Upgrade to CPAN-1.88_62
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Wed Nov  8 17:31:20 CET 2006 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 if test ! -c /dev/null ; then
69         cat >&4 <<EOF
70 ***
71 *** I'm sorry, but /dev/null appears to be a file rather than a device.
72 *** Please consult your operating sytem's notes for making a device
73 *** in /dev.
74 *** Cannot continue, aborting.
75 ***
76 EOF
77         exit 1
78 fi
79
80 : compute my invocation name
81 me=$0
82 case "$0" in
83 */*)
84         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
85         test "$me" || me=$0
86         ;;
87 esac
88
89 : Proper separator for the PATH environment variable
90 p_=:
91 : On OS/2 this directory should exist if this is not floppy only system :-]
92 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
93     if test -n "$OS2_SHELL"; then
94                 p_=\;
95                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
96                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
97                 is_os2=yes
98         elif test -n "$DJGPP"; then
99                 case "X${MACHTYPE:-nonesuchmach}" in
100                 *cygwin) ;;
101                 *) p_=\; ;;
102                 esac
103         fi
104 fi
105
106 : Proper PATH setting
107 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
108 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
109 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
110 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
111 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
112 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
113 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
114 paths="$paths /sbin /usr/sbin /usr/libexec"
115 paths="$paths /system/gnu_library/bin"
116
117 for p in $paths
118 do
119         case "$p_$PATH$p_" in
120         *$p_$p$p_*) ;;
121         *) test -d $p && PATH=$PATH$p_$p ;;
122         esac
123 done
124
125 PATH=.$p_$PATH
126 export PATH
127
128 : shall we be using ksh?
129 inksh=''
130 needksh=''
131 avoidksh=''
132 newsh=/bin/ksh
133 changesh=''
134 if (PATH=.; alias -x) >/dev/null 2>&1; then
135                 inksh=true
136 fi
137 if test -f /hp-ux -a -f /bin/ksh; then
138         needksh='to avoid sh bug in "here document" expansion'
139 fi
140 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
141         if test X`/usr/bin/uname -v` = X4; then
142                 avoidksh="to avoid AIX 4's /bin/sh"
143                 newsh=/usr/bin/bsh
144         fi
145 fi
146 if test -f /osf_boot -a -f /usr/sbin/setld; then
147         if test X`/usr/bin/uname -s` = XOSF1; then
148                 avoidksh="to avoid Digital UNIX' ksh"
149                 newsh=/bin/sh
150                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
151         fi
152 fi
153 case "$inksh/$needksh" in
154 /[a-z]*)
155                 ENV=''
156                 changesh=true
157                 reason="$needksh"
158         ;;
159 esac
160 case "$inksh/$avoidksh" in
161 true/[a-z]*)
162         changesh=true
163         reason="$avoidksh"
164         ;;
165 esac
166 case "$inksh/$needksh-$avoidksh-" in
167 true/--)
168                 cat <<EOM
169 (I see you are using the Korn shell.  Some ksh's blow up on $me,
170 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
171 EOM
172         ;;
173 esac
174 case "$changesh" in
175 true)
176         export newsh
177         echo "(Feeding myself to $newsh $reason.)"
178         case "$0" in
179         Configure|*/Configure) exec $newsh $0 "$@";;
180         *) exec $newsh Configure "$@";;
181         esac
182         ;;
183 esac
184
185 : if needed set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *)              CDPATH='' ;;
192         esac
193         ;;
194 esac
195 : Configure runs within the UU subdirectory
196 test -d UU || mkdir UU
197 cd UU && rm -f ./*
198
199 ccname=''
200 ccversion=''
201 ccsymbols=''
202 cppccsymbols=''
203 cppsymbols=''
204 from=''
205 run=''
206 targetarch=''
207 to=''
208 usecrosscompile=''
209 mistrustnm=''
210 perllibs=''
211 dynamic_ext=''
212 extensions=''
213 known_extensions=''
214 nonxs_ext=''
215 static_ext=''
216 useopcode=''
217 useposix=''
218 extras=''
219 d_bsd=''
220 d_eunice=''
221 d_xenix=''
222 eunicefix=''
223 Mcc=''
224 ar=''
225 awk=''
226 bash=''
227 bison=''
228 byacc=''
229 cat=''
230 chgrp=''
231 chmod=''
232 chown=''
233 comm=''
234 compress=''
235 cp=''
236 cpio=''
237 cpp=''
238 csh=''
239 date=''
240 echo=''
241 egrep=''
242 emacs=''
243 expr=''
244 find=''
245 flex=''
246 gmake=''
247 grep=''
248 gzip=''
249 inews=''
250 ksh=''
251 less=''
252 line=''
253 lint=''
254 ln=''
255 lp=''
256 lpr=''
257 ls=''
258 mail=''
259 mailx=''
260 make=''
261 mkdir=''
262 more=''
263 mv=''
264 nm=''
265 nroff=''
266 perl=''
267 pg=''
268 pmake=''
269 pr=''
270 rm=''
271 rmail=''
272 sed=''
273 sendmail=''
274 shar=''
275 sleep=''
276 smail=''
277 sort=''
278 submit=''
279 tail=''
280 tar=''
281 tbl=''
282 tee=''
283 test=''
284 touch=''
285 tr=''
286 troff=''
287 uname=''
288 uniq=''
289 uuname=''
290 vi=''
291 zcat=''
292 zip=''
293 full_ar=''
294 full_sed=''
295 libswanted=''
296 hint=''
297 myuname=''
298 osname=''
299 osvers=''
300 Author=''
301 Date=''
302 Header=''
303 Id=''
304 Locker=''
305 Log=''
306 RCSfile=''
307 Revision=''
308 Source=''
309 State=''
310 _a=''
311 _exe=''
312 _o=''
313 archobjs=''
314 exe_ext=''
315 firstmakefile=''
316 lib_ext=''
317 obj_ext=''
318 path_sep=''
319 afs=''
320 afsroot=''
321 alignbytes=''
322 ansi2knr=''
323 archlib=''
324 archlibexp=''
325 d_archlib=''
326 installarchlib=''
327 archname=''
328 myarchname=''
329 d_atolf=''
330 d_atoll=''
331 baserev=''
332 bin=''
333 binexp=''
334 initialinstalllocation=''
335 installbin=''
336 userelocatableinc=''
337 byteorder=''
338 cc=''
339 ccflags=''
340 cppflags=''
341 ldflags=''
342 lkflags=''
343 locincpth=''
344 optimize=''
345 cf_email=''
346 cf_by=''
347 cf_time=''
348 charsize=''
349 contains=''
350 cpp_stuff=''
351 cpplast=''
352 cppminus=''
353 cpprun=''
354 cppstdin=''
355 d__fwalk=''
356 d_access=''
357 d_accessx=''
358 d_aintl=''
359 d_alarm=''
360 asctime_r_proto=''
361 d_asctime_r=''
362 d_attribute_format=''
363 d_attribute_malloc=''
364 d_attribute_nonnull=''
365 d_attribute_noreturn=''
366 d_attribute_pure=''
367 d_attribute_unused=''
368 d_attribute_warn_unused_result=''
369 d_bcmp=''
370 d_bcopy=''
371 d_builtin_choose_expr=''
372 d_builtin_expect=''
373 d_bzero=''
374 d_c99_variadic_macros=''
375 d_casti32=''
376 castflags=''
377 d_castneg=''
378 d_chown=''
379 d_chroot=''
380 d_chsize=''
381 d_class=''
382 d_clearenv=''
383 d_closedir=''
384 d_void_closedir=''
385 d_cmsghdr_s=''
386 d_const=''
387 d_copysignl=''
388 d_cplusplus=''
389 cryptlib=''
390 d_crypt=''
391 crypt_r_proto=''
392 d_crypt_r=''
393 d_csh=''
394 full_csh=''
395 d_ctermid=''
396 ctermid_r_proto=''
397 d_ctermid_r=''
398 ctime_r_proto=''
399 d_ctime_r=''
400 d_cuserid=''
401 d_dbl_dig=''
402 d_dbminitproto=''
403 d_difftime=''
404 d_dir_dd_fd=''
405 d_dirfd=''
406 d_dlerror=''
407 d_dlopen=''
408 d_dlsymun=''
409 d_dosuid=''
410 d_suidsafe=''
411 d_drand48_r=''
412 drand48_r_proto=''
413 d_drand48proto=''
414 d_dup2=''
415 d_eaccess=''
416 d_endgrent=''
417 d_endgrent_r=''
418 endgrent_r_proto=''
419 d_endhent=''
420 d_endhostent_r=''
421 endhostent_r_proto=''
422 d_endnent=''
423 d_endnetent_r=''
424 endnetent_r_proto=''
425 d_endpent=''
426 d_endprotoent_r=''
427 endprotoent_r_proto=''
428 d_endpwent=''
429 d_endpwent_r=''
430 endpwent_r_proto=''
431 d_endsent=''
432 d_endservent_r=''
433 endservent_r_proto=''
434 d_faststdio=''
435 d_fchdir=''
436 d_fchmod=''
437 d_fchown=''
438 d_fcntl=''
439 d_fcntl_can_lock=''
440 d_fd_macros=''
441 d_fd_set=''
442 d_fds_bits=''
443 d_fgetpos=''
444 d_finite=''
445 d_finitel=''
446 d_flexfnam=''
447 d_flock=''
448 d_flockproto=''
449 d_fork=''
450 d_fp_class=''
451 d_fpclass=''
452 d_fpclassify=''
453 d_fpclassl=''
454 d_fpos64_t=''
455 d_frexpl=''
456 d_fs_data_s=''
457 d_fseeko=''
458 d_fsetpos=''
459 d_fstatfs=''
460 d_fsync=''
461 d_ftello=''
462 d_ftime=''
463 d_gettimeod=''
464 d_futimes=''
465 d_Gconvert=''
466 d_getcwd=''
467 d_getespwnam=''
468 d_getfsstat=''
469 d_getgrent=''
470 d_getgrent_r=''
471 getgrent_r_proto=''
472 d_getgrgid_r=''
473 getgrgid_r_proto=''
474 d_getgrnam_r=''
475 getgrnam_r_proto=''
476 d_getgrps=''
477 d_gethbyaddr=''
478 d_gethbyname=''
479 d_gethent=''
480 aphostname=''
481 d_gethname=''
482 d_phostname=''
483 d_uname=''
484 d_gethostbyaddr_r=''
485 gethostbyaddr_r_proto=''
486 d_gethostbyname_r=''
487 gethostbyname_r_proto=''
488 d_gethostent_r=''
489 gethostent_r_proto=''
490 d_gethostprotos=''
491 d_getitimer=''
492 d_getlogin=''
493 d_getlogin_r=''
494 getlogin_r_proto=''
495 d_getmnt=''
496 d_getmntent=''
497 d_getnbyaddr=''
498 d_getnbyname=''
499 d_getnent=''
500 d_getnetbyaddr_r=''
501 getnetbyaddr_r_proto=''
502 d_getnetbyname_r=''
503 getnetbyname_r_proto=''
504 d_getnetent_r=''
505 getnetent_r_proto=''
506 d_getnetprotos=''
507 d_getpagsz=''
508 d_getpent=''
509 d_getpgid=''
510 d_getpgrp2=''
511 d_bsdgetpgrp=''
512 d_getpgrp=''
513 d_getppid=''
514 d_getprior=''
515 d_getpbyname=''
516 d_getpbynumber=''
517 d_getprotobyname_r=''
518 getprotobyname_r_proto=''
519 d_getprotobynumber_r=''
520 getprotobynumber_r_proto=''
521 d_getprotoent_r=''
522 getprotoent_r_proto=''
523 d_getprotoprotos=''
524 d_getprpwnam=''
525 d_getpwent=''
526 d_getpwent_r=''
527 getpwent_r_proto=''
528 d_getpwnam_r=''
529 getpwnam_r_proto=''
530 d_getpwuid_r=''
531 getpwuid_r_proto=''
532 d_getsent=''
533 d_getservbyname_r=''
534 getservbyname_r_proto=''
535 d_getservbyport_r=''
536 getservbyport_r_proto=''
537 d_getservent_r=''
538 getservent_r_proto=''
539 d_getservprotos=''
540 d_getspnam=''
541 d_getspnam_r=''
542 getspnam_r_proto=''
543 d_getsbyname=''
544 d_getsbyport=''
545 d_gmtime_r=''
546 gmtime_r_proto=''
547 d_gnulibc=''
548 gnulibc_version=''
549 d_hasmntopt=''
550 d_htonl=''
551 d_ilogbl=''
552 d_inetaton=''
553 d_int64_t=''
554 d_isascii=''
555 d_isfinite=''
556 d_isinf=''
557 d_isnan=''
558 d_isnanl=''
559 d_killpg=''
560 d_lchown=''
561 d_ldbl_dig=''
562 d_libm_lib_version=''
563 d_link=''
564 d_localtime_r=''
565 d_localtime_r_needs_tzset=''
566 localtime_r_proto=''
567 d_locconv=''
568 d_lockf=''
569 d_longdbl=''
570 longdblsize=''
571 d_longlong=''
572 longlongsize=''
573 d_lseekproto=''
574 d_lstat=''
575 d_madvise=''
576 d_malloc_good_size=''
577 d_malloc_size=''
578 d_mblen=''
579 d_mbstowcs=''
580 d_mbtowc=''
581 d_memchr=''
582 d_memcmp=''
583 d_memcpy=''
584 d_memmove=''
585 d_memset=''
586 d_mkdir=''
587 d_mkdtemp=''
588 d_mkfifo=''
589 d_mkstemp=''
590 d_mkstemps=''
591 d_mktime=''
592 d_mmap=''
593 mmaptype=''
594 d_modfl=''
595 d_modfl_pow32_bug=''
596 d_modflproto=''
597 d_mprotect=''
598 d_msg=''
599 d_msgctl=''
600 d_msgget=''
601 d_msghdr_s=''
602 d_msgrcv=''
603 d_msgsnd=''
604 d_msync=''
605 d_munmap=''
606 d_nice=''
607 d_nl_langinfo=''
608 d_off64_t=''
609 d_open3=''
610 d_fpathconf=''
611 d_pathconf=''
612 d_pause=''
613 d_pipe=''
614 d_poll=''
615 d_portable=''
616 d_procselfexe=''
617 procselfexe=''
618 d_old_pthread_create_joinable=''
619 old_pthread_create_joinable=''
620 d_pthread_atfork=''
621 d_pthread_attr_setscope=''
622 d_pthread_yield=''
623 d_sched_yield=''
624 sched_yield=''
625 d_qgcvt=''
626 d_random_r=''
627 random_r_proto=''
628 d_readdir64_r=''
629 readdir64_r_proto=''
630 d_readdir=''
631 d_rewinddir=''
632 d_seekdir=''
633 d_telldir=''
634 d_readdir_r=''
635 readdir_r_proto=''
636 d_readlink=''
637 d_readv=''
638 d_recvmsg=''
639 d_rename=''
640 d_rmdir=''
641 d_safebcpy=''
642 d_safemcpy=''
643 d_sanemcmp=''
644 d_sbrkproto=''
645 d_scalbnl=''
646 d_select=''
647 d_sem=''
648 d_semctl=''
649 d_semget=''
650 d_semop=''
651 d_sendmsg=''
652 d_setegid=''
653 d_seteuid=''
654 d_setgrent=''
655 d_setgrent_r=''
656 setgrent_r_proto=''
657 d_setgrps=''
658 d_sethent=''
659 d_sethostent_r=''
660 sethostent_r_proto=''
661 d_setitimer=''
662 d_setlinebuf=''
663 d_setlocale=''
664 d_setlocale_r=''
665 setlocale_r_proto=''
666 d_setnent=''
667 d_setnetent_r=''
668 setnetent_r_proto=''
669 d_setpent=''
670 d_setpgid=''
671 d_setpgrp2=''
672 d_bsdsetpgrp=''
673 d_setpgrp=''
674 d_setprior=''
675 d_setproctitle=''
676 d_setprotoent_r=''
677 setprotoent_r_proto=''
678 d_setpwent=''
679 d_setpwent_r=''
680 setpwent_r_proto=''
681 d_setregid=''
682 d_setresgid=''
683 d_setresuid=''
684 d_setreuid=''
685 d_setrgid=''
686 d_setruid=''
687 d_setsent=''
688 d_setservent_r=''
689 setservent_r_proto=''
690 d_setsid=''
691 d_setvbuf=''
692 d_sfio=''
693 usesfio=''
694 d_shm=''
695 d_shmat=''
696 d_shmatprototype=''
697 shmattype=''
698 d_shmctl=''
699 d_shmdt=''
700 d_shmget=''
701 d_sigaction=''
702 d_sigprocmask=''
703 d_sigsetjmp=''
704 usesitecustomize=''
705 d_snprintf=''
706 d_vsnprintf=''
707 d_sockatmark=''
708 d_sockatmarkproto=''
709 d_msg_ctrunc=''
710 d_msg_dontroute=''
711 d_msg_oob=''
712 d_msg_peek=''
713 d_msg_proxy=''
714 d_oldsock=''
715 d_scm_rights=''
716 d_socket=''
717 d_sockpair=''
718 sockethdr=''
719 socketlib=''
720 d_socklen_t=''
721 d_socks5_init=''
722 d_sprintf_returns_strlen=''
723 d_sqrtl=''
724 d_srand48_r=''
725 srand48_r_proto=''
726 d_srandom_r=''
727 srandom_r_proto=''
728 d_sresgproto=''
729 d_sresuproto=''
730 d_statblks=''
731 d_statfs_f_flags=''
732 d_statfs_s=''
733 d_fstatvfs=''
734 d_statvfs=''
735 d_stdio_cnt_lval=''
736 d_stdio_ptr_lval=''
737 d_stdio_ptr_lval_nochange_cnt=''
738 d_stdio_ptr_lval_sets_cnt=''
739 d_stdiobase=''
740 d_stdstdio=''
741 stdio_base=''
742 stdio_bufsiz=''
743 stdio_cnt=''
744 stdio_filbuf=''
745 stdio_ptr=''
746 d_index=''
747 d_strchr=''
748 d_strcoll=''
749 d_strctcpy=''
750 d_strerrm=''
751 d_strerror=''
752 d_sysernlst=''
753 d_syserrlst=''
754 d_strerror_r=''
755 strerror_r_proto=''
756 d_strftime=''
757 d_strlcat=''
758 d_strlcpy=''
759 d_strtod=''
760 d_strtol=''
761 d_strtold=''
762 d_strtoll=''
763 d_strtoq=''
764 d_strtoul=''
765 d_strtoull=''
766 d_strtouq=''
767 d_strxfrm=''
768 d_symlink=''
769 d_syscall=''
770 d_syscallproto=''
771 d_sysconf=''
772 d_system=''
773 d_tcgetpgrp=''
774 d_tcsetpgrp=''
775 d_telldirproto=''
776 d_time=''
777 timetype=''
778 clocktype=''
779 d_times=''
780 d_tmpnam_r=''
781 tmpnam_r_proto=''
782 d_truncate=''
783 d_ttyname_r=''
784 ttyname_r_proto=''
785 d_tzname=''
786 d_u32align=''
787 d_ualarm=''
788 d_umask=''
789 d_semctl_semid_ds=''
790 d_semctl_semun=''
791 d_union_semun=''
792 d_unordered=''
793 d_unsetenv=''
794 d_usleep=''
795 d_usleepproto=''
796 d_ustat=''
797 d_vfork=''
798 usevfork=''
799 d_voidsig=''
800 signal_t=''
801 d_volatile=''
802 d_charvspr=''
803 d_vprintf=''
804 d_wait4=''
805 d_waitpid=''
806 d_wcstombs=''
807 d_wctomb=''
808 d_writev=''
809 dlext=''
810 cccdlflags=''
811 ccdlflags=''
812 dlsrc=''
813 ld=''
814 lddlflags=''
815 usedl=''
816 doublesize=''
817 ebcdic=''
818 fflushNULL=''
819 fflushall=''
820 fpossize=''
821 fpostype=''
822 gccansipedantic=''
823 gccosandvers=''
824 gccversion=''
825 gidformat=''
826 gidsign=''
827 gidsize=''
828 gidtype=''
829 groupstype=''
830 h_fcntl=''
831 h_sysfile=''
832 html1dir=''
833 html1direxp=''
834 installhtml1dir=''
835 html3dir=''
836 html3direxp=''
837 installhtml3dir=''
838 i_arpainet=''
839 i_crypt=''
840 db_hashtype=''
841 db_prefixtype=''
842 db_version_major=''
843 db_version_minor=''
844 db_version_patch=''
845 i_db=''
846 i_dbm=''
847 i_rpcsvcdbm=''
848 d_dirnamlen=''
849 direntrytype=''
850 i_dirent=''
851 i_dld=''
852 i_dlfcn=''
853 i_fcntl=''
854 i_float=''
855 i_fp=''
856 i_fp_class=''
857 i_gdbm=''
858 d_grpasswd=''
859 i_grp=''
860 i_ieeefp=''
861 i_inttypes=''
862 i_langinfo=''
863 i_libutil=''
864 i_limits=''
865 i_locale=''
866 i_machcthr=''
867 i_malloc=''
868 i_math=''
869 i_memory=''
870 i_mntent=''
871 i_ndbm=''
872 i_netdb=''
873 i_neterrno=''
874 i_netinettcp=''
875 i_niin=''
876 i_sysin=''
877 i_poll=''
878 i_prot=''
879 i_pthread=''
880 d_pwage=''
881 d_pwchange=''
882 d_pwclass=''
883 d_pwcomment=''
884 d_pwexpire=''
885 d_pwgecos=''
886 d_pwpasswd=''
887 d_pwquota=''
888 i_pwd=''
889 i_sfio=''
890 i_shadow=''
891 i_socks=''
892 i_stddef=''
893 i_stdlib=''
894 i_string=''
895 strings=''
896 i_sunmath=''
897 i_sysaccess=''
898 i_sysdir=''
899 i_sysfile=''
900 d_voidtty=''
901 i_bsdioctl=''
902 i_sysfilio=''
903 i_sysioctl=''
904 i_syssockio=''
905 i_syslog=''
906 i_sysmman=''
907 i_sysmode=''
908 i_sysmount=''
909 i_sysndir=''
910 i_sysparam=''
911 i_sysresrc=''
912 i_syssecrt=''
913 i_sysselct=''
914 i_sysstat=''
915 i_sysstatfs=''
916 i_sysstatvfs=''
917 i_systimes=''
918 i_systypes=''
919 i_sysuio=''
920 i_sysun=''
921 i_sysutsname=''
922 i_sysvfs=''
923 i_syswait=''
924 i_sgtty=''
925 i_termio=''
926 i_termios=''
927 d_tm_tm_gmtoff=''
928 d_tm_tm_zone=''
929 i_systime=''
930 i_systimek=''
931 i_time=''
932 timeincl=''
933 i_unistd=''
934 i_ustat=''
935 i_utime=''
936 i_values=''
937 i_stdarg=''
938 i_varargs=''
939 i_varhdr=''
940 i_vfork=''
941 d_inc_version_list=''
942 inc_version_list=''
943 inc_version_list_init=''
944 installprefix=''
945 installprefixexp=''
946 installstyle=''
947 installusrbinperl=''
948 intsize=''
949 longsize=''
950 shortsize=''
951 issymlink=''
952 libc=''
953 ldlibpthname=''
954 libperl=''
955 shrpenv=''
956 useshrplib=''
957 glibpth=''
958 libpth=''
959 loclibpth=''
960 plibpth=''
961 xlibpth=''
962 ignore_versioned_solibs=''
963 libs=''
964 libsdirs=''
965 libsfiles=''
966 libsfound=''
967 libspath=''
968 lns=''
969 d_PRIEUldbl=''
970 d_PRIFUldbl=''
971 d_PRIGUldbl=''
972 d_PRIeldbl=''
973 d_PRIfldbl=''
974 d_PRIgldbl=''
975 d_SCNfldbl=''
976 sPRIEUldbl=''
977 sPRIFUldbl=''
978 sPRIGUldbl=''
979 sPRIeldbl=''
980 sPRIfldbl=''
981 sPRIgldbl=''
982 sSCNfldbl=''
983 lseeksize=''
984 lseektype=''
985 mad=''
986 madlyh=''
987 madlyobj=''
988 madlysrc=''
989 make_set_make=''
990 d_mymalloc=''
991 freetype=''
992 mallocobj=''
993 mallocsrc=''
994 malloctype=''
995 usemallocwrap=''
996 usemymalloc=''
997 installman1dir=''
998 man1dir=''
999 man1direxp=''
1000 man1ext=''
1001 installman3dir=''
1002 man3dir=''
1003 man3direxp=''
1004 man3ext=''
1005 modetype=''
1006 multiarch=''
1007 mydomain=''
1008 myhostname=''
1009 phostname=''
1010 c=''
1011 n=''
1012 d_eofnblk=''
1013 eagain=''
1014 o_nonblock=''
1015 rd_nodata=''
1016 need_va_copy=''
1017 netdb_hlen_type=''
1018 netdb_host_type=''
1019 netdb_name_type=''
1020 netdb_net_type=''
1021 groupcat=''
1022 hostcat=''
1023 passcat=''
1024 orderlib=''
1025 ranlib=''
1026 d_perl_otherlibdirs=''
1027 otherlibdirs=''
1028 package=''
1029 spackage=''
1030 pager=''
1031 api_revision=''
1032 api_subversion=''
1033 api_version=''
1034 api_versionstring=''
1035 patchlevel=''
1036 perl_patchlevel=''
1037 revision=''
1038 subversion=''
1039 version=''
1040 version_patchlevel_string=''
1041 perl5=''
1042 perladmin=''
1043 perlpath=''
1044 d_nv_preserves_uv=''
1045 d_nv_zero_is_allbits_zero=''
1046 i16size=''
1047 i16type=''
1048 i32size=''
1049 i32type=''
1050 i64size=''
1051 i64type=''
1052 i8size=''
1053 i8type=''
1054 ivsize=''
1055 ivtype=''
1056 nv_preserves_uv_bits=''
1057 nvsize=''
1058 nvtype=''
1059 u16size=''
1060 u16type=''
1061 u32size=''
1062 u32type=''
1063 u64size=''
1064 u64type=''
1065 u8size=''
1066 u8type=''
1067 uvsize=''
1068 uvtype=''
1069 ivdformat=''
1070 nvEUformat=''
1071 nvFUformat=''
1072 nvGUformat=''
1073 nveformat=''
1074 nvfformat=''
1075 nvgformat=''
1076 uvXUformat=''
1077 uvoformat=''
1078 uvuformat=''
1079 uvxformat=''
1080 pidtype=''
1081 prefix=''
1082 prefixexp=''
1083 installprivlib=''
1084 privlib=''
1085 privlibexp=''
1086 prototype=''
1087 ptrsize=''
1088 d_PRIXU64=''
1089 d_PRId64=''
1090 d_PRIi64=''
1091 d_PRIo64=''
1092 d_PRIu64=''
1093 d_PRIx64=''
1094 sPRIXU64=''
1095 sPRId64=''
1096 sPRIi64=''
1097 sPRIo64=''
1098 sPRIu64=''
1099 sPRIx64=''
1100 d_quad=''
1101 quadkind=''
1102 quadtype=''
1103 uquadtype=''
1104 drand01=''
1105 randbits=''
1106 randfunc=''
1107 randseedtype=''
1108 seedfunc=''
1109 installscript=''
1110 scriptdir=''
1111 scriptdirexp=''
1112 selectminbits=''
1113 selecttype=''
1114 sh=''
1115 sig_count=''
1116 sig_name=''
1117 sig_name_init=''
1118 sig_num=''
1119 sig_num_init=''
1120 sig_size=''
1121 d_sitearch=''
1122 installsitearch=''
1123 sitearch=''
1124 sitearchexp=''
1125 installsitebin=''
1126 sitebin=''
1127 sitebinexp=''
1128 installsitehtml1dir=''
1129 sitehtml1dir=''
1130 sitehtml1direxp=''
1131 installsitehtml3dir=''
1132 sitehtml3dir=''
1133 sitehtml3direxp=''
1134 installsitelib=''
1135 sitelib=''
1136 sitelib_stem=''
1137 sitelibexp=''
1138 installsiteman1dir=''
1139 siteman1dir=''
1140 siteman1direxp=''
1141 installsiteman3dir=''
1142 siteman3dir=''
1143 siteman3direxp=''
1144 siteprefix=''
1145 siteprefixexp=''
1146 installsitescript=''
1147 sitescript=''
1148 sitescriptexp=''
1149 sizesize=''
1150 sizetype=''
1151 so=''
1152 socksizetype=''
1153 sharpbang=''
1154 shsharp=''
1155 spitshell=''
1156 src=''
1157 ssizetype=''
1158 startperl=''
1159 startsh=''
1160 stdchar=''
1161 d_stdio_stream_array=''
1162 stdio_stream_array=''
1163 sysman=''
1164 trnl=''
1165 uidformat=''
1166 uidsign=''
1167 uidsize=''
1168 uidtype=''
1169 archname64=''
1170 use64bitall=''
1171 use64bitint=''
1172 usefaststdio=''
1173 ccflags_uselargefiles=''
1174 ldflags_uselargefiles=''
1175 libswanted_uselargefiles=''
1176 uselargefiles=''
1177 uselongdouble=''
1178 usemorebits=''
1179 usemultiplicity=''
1180 nm_opt=''
1181 nm_so_opt=''
1182 runnm=''
1183 usenm=''
1184 useperlio=''
1185 usesocks=''
1186 d_oldpthreads=''
1187 use5005threads=''
1188 useithreads=''
1189 usereentrant=''
1190 usethreads=''
1191 incpath=''
1192 mips_type=''
1193 usrinc=''
1194 d_vendorarch=''
1195 installvendorarch=''
1196 vendorarch=''
1197 vendorarchexp=''
1198 d_vendorbin=''
1199 installvendorbin=''
1200 vendorbin=''
1201 vendorbinexp=''
1202 installvendorhtml1dir=''
1203 vendorhtml1dir=''
1204 vendorhtml1direxp=''
1205 installvendorhtml3dir=''
1206 vendorhtml3dir=''
1207 vendorhtml3direxp=''
1208 d_vendorlib=''
1209 installvendorlib=''
1210 vendorlib=''
1211 vendorlib_stem=''
1212 vendorlibexp=''
1213 installvendorman1dir=''
1214 vendorman1dir=''
1215 vendorman1direxp=''
1216 installvendorman3dir=''
1217 vendorman3dir=''
1218 vendorman3direxp=''
1219 usevendorprefix=''
1220 vendorprefix=''
1221 vendorprefixexp=''
1222 d_vendorscript=''
1223 installvendorscript=''
1224 vendorscript=''
1225 vendorscriptexp=''
1226 versiononly=''
1227 defvoidused=''
1228 voidflags=''
1229 yacc=''
1230 yaccflags=''
1231 CONFIG=''
1232
1233 define='define'
1234 undef='undef'
1235 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1236 rmlist=''
1237
1238 : We must find out about Eunice early
1239 eunicefix=':'
1240 if test -f /etc/unixtovms; then
1241         eunicefix=/etc/unixtovms
1242 fi
1243 if test -f /etc/unixtovms.exe; then
1244         eunicefix=/etc/unixtovms.exe
1245 fi
1246
1247 : Set executable suffix now -- needed before hints available
1248 if test -f "/libs/version.library"; then
1249 : Amiga OS
1250     _exe=""
1251 elif test -f "/system/gnu_library/bin/ar.pm"; then
1252 : Stratus VOS
1253     _exe=".pm"
1254 elif test -n "$DJGPP"; then
1255 : DOS DJGPP
1256     _exe=".exe"
1257 elif test -d c:/. -o -n "$is_os2" ; then
1258 : OS/2 or cygwin
1259     _exe=".exe"
1260 fi
1261
1262 i_whoami=''
1263 ccname=''
1264 ccversion=''
1265 perllibs=''
1266 : set useposix=false in your hint file to disable the POSIX extension.
1267 useposix=true
1268 : set useopcode=false in your hint file to disable the Opcode extension.
1269 useopcode=true
1270 : Trailing extension.  Override this in a hint file, if needed.
1271 : Extra object files, if any, needed on this platform.
1272 archobjs=''
1273 archname=''
1274 : Possible local include directories to search.
1275 : Set locincpth to "" in a hint file to defeat local include searches.
1276 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1277 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1278 :
1279 : no include file wanted by default
1280 inclwanted=''
1281
1282 : Enable -DEBUGGING and -DDEBUGGING from the command line
1283 EBUGGING=''
1284 DEBUGGING=old
1285
1286 groupstype=''
1287 libnames=''
1288 : change the next line if compiling for Xenix/286 on Xenix/386
1289 xlibpth='/usr/lib/386 /lib/386'
1290 : Possible local library directories to search.
1291 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1292 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1293
1294 : general looking path for locating libraries
1295 glibpth="/lib /usr/lib $xlibpth"
1296 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1297 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1298 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1299
1300 : Private path used by Configure to find libraries.  Its value
1301 : is prepended to libpth. This variable takes care of special
1302 : machines, like the mips.  Usually, it should be empty.
1303 plibpth=''
1304
1305 : default library list
1306 libswanted=''
1307 : some systems want to use only the non-versioned libso:s
1308 ignore_versioned_solibs=''
1309 siteman1dir=''
1310 siteman3dir=''
1311 sitescript=''
1312 archname64=''
1313 ccflags_uselargefiles=''
1314 ldflags_uselargefiles=''
1315 libswanted_uselargefiles=''
1316 : set usemultiplicity on the Configure command line to enable multiplicity.
1317 : set usesocks on the Configure command line to enable socks.
1318 : set usethreads on the Configure command line to enable threads.
1319 usereentrant='undef'
1320 : full support for void wanted by default
1321 defvoidused=15
1322
1323 : List of libraries we want.
1324 : If anyone needs extra -lxxx, put those in a hint file.
1325 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1326 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1327 : We probably want to search /usr/shlib before most other libraries.
1328 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1329 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1330 glibpth="/usr/shlib $glibpth"
1331 : Do not use vfork unless overridden by a hint file.
1332 usevfork=false
1333
1334 : Find the basic shell for Bourne shell scripts
1335 case "$sh" in
1336 '')
1337         case "$SYSTYPE" in
1338         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1339         *) xxx='/bin/sh';;
1340         esac
1341         if test -f "$xxx"; then
1342                 sh="$xxx"
1343         else
1344                 : Build up a list and do a single loop so we can 'break' out.
1345                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1346                 for xxx in sh bash ksh pdksh ash; do
1347                         for p in $pth; do
1348                                 try="$try ${p}/${xxx}"
1349                         done
1350                 done
1351                 for xxx in $try; do
1352                         if test -f "$xxx"; then
1353                                 sh="$xxx";
1354                                 break
1355                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1356                                 sh="$xxx";
1357                                 break
1358                         elif test -f "$xxx.exe"; then
1359                                 sh="$xxx";
1360                                 break
1361                         fi
1362                 done
1363         fi
1364         ;;
1365 esac
1366
1367 case "$sh" in
1368 '')     cat >&2 <<EOM
1369 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1370
1371 Usually it's in /bin/sh.  How did you even get this far?
1372 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1373 we'll try to straighten this all out.
1374 EOM
1375         exit 1
1376         ;;
1377 esac
1378
1379 : see if sh knows # comments
1380 if `$sh -c '#' >/dev/null 2>&1`; then
1381         shsharp=true
1382         spitshell=cat
1383         xcat=/bin/cat
1384         test -f $xcat$_exe || xcat=/usr/bin/cat
1385         if test ! -f $xcat$_exe; then
1386                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1387                         if test -f $p/cat$_exe; then
1388                                 xcat=$p/cat
1389                                 break
1390                         fi
1391                 done
1392                 if test ! -f $xcat$_exe; then
1393                         echo "Can't find cat anywhere!"
1394                         exit 1
1395                 fi
1396         fi
1397         echo "#!$xcat" >sharp
1398         $eunicefix sharp
1399         chmod +x sharp
1400         ./sharp > today
1401         if test -s today; then
1402                 sharpbang='#!'
1403         else
1404                 echo "#! $xcat" > sharp
1405                 $eunicefix sharp
1406                 chmod +x sharp
1407                 ./sharp > today
1408                 if test -s today; then
1409                         sharpbang='#! '
1410                 else
1411                         sharpbang=': use '
1412                 fi
1413         fi
1414 else
1415         echo " "
1416         echo "Your $sh doesn't grok # comments--I will strip them later on."
1417         shsharp=false
1418         cd ..
1419         echo "exec grep -v '^[  ]*#'" >spitshell
1420         chmod +x spitshell
1421         $eunicefix spitshell
1422         spitshell=`pwd`/spitshell
1423         cd UU
1424         echo "I presume that if # doesn't work, #! won't work either!"
1425         sharpbang=': use '
1426 fi
1427 rm -f sharp today
1428
1429 : figure out how to guarantee sh startup
1430 case "$startsh" in
1431 '') startsh=${sharpbang}${sh} ;;
1432 *)
1433 esac
1434 cat >sharp <<EOSS
1435 $startsh
1436 set abc
1437 test "$?abc" != 1
1438 EOSS
1439
1440 chmod +x sharp
1441 $eunicefix sharp
1442 if ./sharp; then
1443         : echo "Yup, it does."
1444 else
1445         echo "Hmm... '$startsh' does not guarantee sh startup..."
1446         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1447 fi
1448 rm -f sharp
1449
1450
1451 : Save command line options in file UU/cmdline.opt for later use in
1452 : generating config.sh.
1453 cat > cmdline.opt <<EOSH
1454 # Configure command line arguments.
1455 config_arg0='$0'
1456 config_args='$*'
1457 config_argc=$#
1458 EOSH
1459 argn=1
1460 args_exp=''
1461 args_sep=''
1462 for arg in "$@"; do
1463         cat >>cmdline.opt <<EOSH
1464 config_arg$argn='$arg'
1465 EOSH
1466         # Extreme backslashitis: replace each ' by '"'"'
1467         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1468 $arg
1469 EOC
1470         arg_exp=`cat cmdl.opt`
1471         args_exp="$args_exp$args_sep'$arg_exp'"
1472         argn=`expr $argn + 1`
1473         args_sep=' '
1474 done
1475 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1476 # used by ./hints/os2.sh
1477 rm -f cmdl.opt
1478
1479 : produce awk script to parse command line options
1480 cat >options.awk <<'EOF'
1481 BEGIN {
1482         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1483
1484         len = length(optstr);
1485         for (i = 1; i <= len; i++) {
1486                 c = substr(optstr, i, 1);
1487                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1488                 if (a == ":") {
1489                         arg[c] = 1;
1490                         i++;
1491                 }
1492                 opt[c] = 1;
1493         }
1494 }
1495 {
1496         expect = 0;
1497         str = $0;
1498         if (substr(str, 1, 1) != "-") {
1499                 printf("'%s'\n", str);
1500                 next;
1501         }
1502         len = length($0);
1503         for (i = 2; i <= len; i++) {
1504                 c = substr(str, i, 1);
1505                 if (!opt[c]) {
1506                         printf("-%s\n", substr(str, i));
1507                         next;
1508                 }
1509                 printf("-%s\n", c);
1510                 if (arg[c]) {
1511                         if (i < len)
1512                                 printf("'%s'\n", substr(str, i + 1));
1513                         else
1514                                 expect = 1;
1515                         next;
1516                 }
1517         }
1518 }
1519 END {
1520         if (expect)
1521                 print "?";
1522 }
1523 EOF
1524
1525 : process the command line options
1526 set X `for arg in "$@"; do echo "X$arg"; done |
1527         sed -e s/X// | awk -f options.awk`
1528 eval "set $*"
1529 shift
1530 rm -f options.awk
1531
1532 : set up default values
1533 fastread=''
1534 reuseval=false
1535 config_sh=''
1536 alldone=''
1537 error=''
1538 silent=''
1539 extractsh=''
1540 override=''
1541 knowitall=''
1542 rm -f optdef.sh posthint.sh
1543 cat >optdef.sh <<EOS
1544 $startsh
1545 EOS
1546
1547
1548 : option parsing
1549 while test $# -gt 0; do
1550         case "$1" in
1551         -d) shift; fastread=yes;;
1552         -e) shift; alldone=cont;;
1553         -f)
1554                 shift
1555                 cd ..
1556                 if test -r "$1"; then
1557                         config_sh="$1"
1558                 else
1559                         echo "$me: cannot read config file $1." >&2
1560                         error=true
1561                 fi
1562                 cd UU
1563                 shift;;
1564         -h) shift; error=true;;
1565         -r) shift; reuseval=true;;
1566         -s) shift; silent=true; realsilent=true;;
1567         -E) shift; alldone=exit;;
1568         -K) shift; knowitall=true;;
1569         -O) shift; override=true;;
1570         -S) shift; silent=true; extractsh=true;;
1571         -D)
1572                 shift
1573                 case "$1" in
1574                 *=)
1575                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1576                         echo "$me: ignoring -D $1" >&2
1577                         ;;
1578                 *=*) echo "$1" | \
1579                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1580                 *) echo "$1='define'" >> optdef.sh;;
1581                 esac
1582                 shift
1583                 ;;
1584         -U)
1585                 shift
1586                 case "$1" in
1587                 *=) echo "$1" >> optdef.sh;;
1588                 *=*)
1589                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1590                         echo "$me: ignoring -U $1" >&2
1591                         ;;
1592                 *) echo "$1='undef'" >> optdef.sh;;
1593                 esac
1594                 shift
1595                 ;;
1596         -A)
1597             shift
1598             xxx=''
1599             yyy="$1"
1600             zzz=''
1601             uuu=undef
1602             case "$yyy" in
1603             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1604                  case "$zzz" in
1605                  *:*) zzz='' ;;
1606                  *)   xxx=append
1607                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1608                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1609                  esac
1610                  ;;
1611             esac
1612             case "$xxx" in
1613             '')  case "$yyy" in
1614                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1615                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1616                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1617                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1618                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1619                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1620                  esac
1621                  ;;       
1622             esac
1623             case "$xxx" in
1624             append)
1625                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1626             clear)
1627                 echo "$yyy=''"                  >> posthint.sh ;;
1628             define)
1629                 case "$zzz" in
1630                 '') zzz=define ;;
1631                 esac
1632                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1633             eval)
1634                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1635             prepend)
1636                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1637             undef)
1638                 case "$zzz" in
1639                 '') zzz="$uuu" ;;
1640                 esac
1641                 echo "$yyy=$zzz"                >> posthint.sh ;;
1642             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1643             esac
1644             shift
1645             ;;
1646         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1647             exit 0;;
1648         --) break;;
1649         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1650         *) break;;
1651         esac
1652 done
1653
1654 case "$error" in
1655 true)
1656         cat >&2 <<EOM
1657 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1658                  [-U symbol] [-U symbol=] [-A command:symbol...]
1659   -d : use defaults for all answers.
1660   -e : go on without questioning past the production of config.sh.
1661   -f : specify an alternate default configuration file.
1662   -h : print this help message and exit (with an error status).
1663   -r : reuse C symbols value if possible (skips costly nm extraction).
1664   -s : silent mode, only echoes questions and essential information.
1665   -D : define symbol to have some value:
1666          -D symbol         symbol gets the value 'define'
1667          -D symbol=value   symbol gets the value 'value'
1668   -E : stop at the end of questions, after having produced config.sh.
1669   -K : do not use unless you know what you are doing.
1670   -O : let -D and -U override definitions from loaded configuration file.
1671   -S : perform variable substitutions on all .SH files (can mix with -f)
1672   -U : undefine symbol:
1673          -U symbol    symbol gets the value 'undef'
1674          -U symbol=   symbol gets completely empty
1675   -A : manipulate symbol after the platform specific hints have been applied:
1676          -A symbol=value                append " "value to symbol
1677          -A append:symbol=value         append value to symbol
1678          -A define:symbol=value         define symbol to have value
1679          -A clear:symbol                define symbol to be ''
1680          -A define:symbol               define symbol to be 'define'
1681          -A eval:symbol=value           define symbol to be eval of value
1682          -A prepend:symbol=value        prepend value to symbol
1683          -A undef:symbol                define symbol to be 'undef'
1684          -A undef:symbol=               define symbol to be ''
1685   -V : print version number and exit (with a zero status).
1686 EOM
1687         exit 1
1688         ;;
1689 esac
1690
1691 : Sanity checks
1692 case "$fastread$alldone" in
1693 yescont|yesexit) ;;
1694 *)
1695         case "$extractsh" in
1696         true) ;;
1697         *)
1698                 if test ! -t 0; then
1699                         echo "Say 'sh Configure', not 'sh <Configure'"
1700                         exit 1
1701                 fi
1702                 ;;
1703         esac
1704         ;;
1705 esac
1706
1707 exec 4>&1
1708 case "$silent" in
1709 true) exec 1>/dev/null;;
1710 esac
1711
1712 : run the defines and the undefines, if any, but leave the file out there...
1713 touch optdef.sh
1714 . ./optdef.sh
1715 : create the posthint manipulation script and leave the file out there...
1716 touch posthint.sh
1717
1718 : set package name
1719 package=perl5
1720 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1721 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1722 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1723 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1724 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1725 esac
1726
1727 : Some greps do not return status, grrr.
1728 echo "grimblepritz" >grimble
1729 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1730         contains=contains
1731 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1732         contains=grep
1733 else
1734         contains=contains
1735 fi
1736 rm -f grimble
1737 : the following should work in any shell
1738 case "$contains" in
1739 contains*)
1740         echo " "
1741         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1742         cat >contains <<'EOSS'
1743 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1744 EOSS
1745 chmod +x contains
1746 esac
1747
1748 : Find the path to the source tree
1749 case "$src" in
1750 '') case "$0" in
1751     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1752          case "$src" in
1753          /*)    ;;
1754          .)     ;;
1755          *)     src=`cd ../$src && pwd` ;;
1756          esac
1757          ;;
1758     *)   src='.';;
1759     esac;;
1760 esac
1761 case "$src" in
1762 '')     src=/
1763         rsrc=/
1764         ;;
1765 /*) rsrc="$src";;
1766 *) rsrc="../$src";;
1767 esac
1768 if test -f $rsrc/Configure && \
1769         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1770 then
1771    : found it, so we are ok.
1772 else
1773         rsrc=''
1774         for src in . .. ../.. ../../.. ../../../..; do
1775                 if test -f ../$src/Configure && \
1776                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1777                 then
1778                         rsrc=../$src
1779                         break
1780                 fi
1781         done
1782 fi
1783 case "$rsrc" in
1784 '')
1785         cat <<EOM >&4
1786
1787 Sorry, I can't seem to locate the source dir for $package.  Please start
1788 Configure with an explicit path -- i.e. /some/path/Configure.
1789
1790 EOM
1791         exit 1
1792         ;;
1793 ../.)   rsrc='..';;
1794 *)
1795         echo " "
1796         echo "Sources for $package found in \"$src\"." >&4
1797         ;;
1798 esac
1799
1800 : script used to extract .SH files with variable substitutions
1801 cat >extract <<'EOS'
1802 PERL_CONFIG_SH=true
1803 echo "Doing variable substitutions on .SH files..."
1804 if test -f MANIFEST; then
1805         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1806 else
1807         echo "(Looking for .SH files under the source directory.)"
1808         set x `(cd "$src"; find . -name "*.SH" -print)`
1809 fi
1810 shift
1811 case $# in
1812 0) set x `(cd "$src"; echo *.SH)`; shift;;
1813 esac
1814 if test ! -f "$src/$1"; then
1815         shift
1816 fi
1817 mkdir_p='
1818 name=$1;
1819 create="";
1820 while test $name; do
1821         if test ! -d "$name"; then
1822                 create="$name $create";
1823                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1824                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1825         else
1826                 name="";
1827         fi;
1828 done;
1829 for file in $create; do
1830         mkdir $file;
1831 done
1832 '
1833 for file in $*; do
1834         case "$src" in
1835         ".")
1836                 case "$file" in
1837                 */*)
1838                         dir=`expr X$file : 'X\(.*\)/'`
1839                         file=`expr X$file : 'X.*/\(.*\)'`
1840                         (cd "$dir" && . ./$file)
1841                         ;;
1842                 *)
1843                         . ./$file
1844                         ;;
1845                 esac
1846                 ;;
1847         *)
1848                 case "$file" in
1849                 */*)
1850                         dir=`expr X$file : 'X\(.*\)/'`
1851                         file=`expr X$file : 'X.*/\(.*\)'`
1852                         (set x $dir; shift; eval $mkdir_p)
1853                         sh <"$src/$dir/$file"
1854                         ;;
1855                 *)
1856                         sh <"$src/$file"
1857                         ;;
1858                 esac
1859                 ;;
1860         esac
1861 done
1862 if test -f "$src/config_h.SH"; then
1863         if test ! -f config.h; then
1864         : oops, they left it out of MANIFEST, probably, so do it anyway.
1865         . "$src/config_h.SH"
1866         fi
1867 fi
1868 EOS
1869
1870 : extract files and exit if asked to do so
1871 case "$extractsh" in
1872 true)
1873         case "$realsilent" in
1874         true) ;;
1875         *) exec 1>&4;;
1876         esac
1877         case "$config_sh" in
1878         '') config_sh='config.sh';;
1879         esac
1880         echo " "
1881         echo "Fetching answers from $config_sh..."
1882         cd ..
1883         . $config_sh
1884         test "$override" && . ./optdef.sh
1885         echo " "
1886         . UU/extract
1887         rm -rf UU
1888         echo "Extraction done."
1889         exit 0
1890         ;;
1891 esac
1892
1893 : Eunice requires " " instead of "", can you believe it
1894 echo " "
1895 : Here we go...
1896 echo "Beginning of configuration questions for $package."
1897
1898 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1899
1900 : first determine how to suppress newline on echo command
1901 echo " "
1902 echo "Checking echo to see how to suppress newlines..."
1903 (echo "hi there\c" ; echo " ") >.echotmp
1904 if $contains c .echotmp >/dev/null 2>&1 ; then
1905         echo "...using -n."
1906         n='-n'
1907         c=''
1908 else
1909         cat <<'EOM'
1910 ...using \c
1911 EOM
1912         n=''
1913         c='\c'
1914 fi
1915 echo $n "The star should be here-->$c"
1916 echo '*'
1917 rm -f .echotmp
1918
1919 : Now test for existence of everything in MANIFEST
1920 echo " "
1921 if test -f "$rsrc/MANIFEST"; then
1922         echo "First let's make sure your kit is complete.  Checking..." >&4
1923         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1924         rm -f missing
1925         tmppwd=`pwd`
1926         for filelist in x??; do
1927                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1928         done
1929         if test -s missing; then
1930                 cat missing >&4
1931                 cat >&4 <<'EOM'
1932
1933 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1934
1935 You have the option of continuing the configuration process, despite the
1936 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1937 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1938 and contact the author (perlbug@perl.org).
1939
1940 EOM
1941                 echo $n "Continue? [n] $c" >&4
1942                 read ans
1943                 case "$ans" in
1944                 y*)
1945                         echo "Continuing..." >&4
1946                         rm -f missing
1947                         ;;
1948                 *)
1949                         echo "ABORTING..." >&4
1950                         kill $$
1951                         ;;
1952                 esac
1953         else
1954                 echo "Looks good..."
1955         fi
1956 else
1957         echo "There is no MANIFEST file.  I hope your kit is complete !"
1958 fi
1959 rm -f missing x??
1960
1961 echo " "
1962 : Find the appropriate value for a newline for tr
1963 if test -n "$DJGPP"; then
1964        trnl='\012'
1965 fi
1966 if test X"$trnl" = X; then
1967         case "`echo foo|tr '\n' x 2>/dev/null`" in
1968         foox) trnl='\n' ;;
1969         esac
1970 fi
1971 if test X"$trnl" = X; then
1972         case "`echo foo|tr '\012' x 2>/dev/null`" in
1973         foox) trnl='\012' ;;
1974         esac
1975 fi
1976 if test X"$trnl" = X; then
1977        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1978        fooxy) trnl='\n\r' ;;
1979        esac
1980 fi
1981 if test X"$trnl" = X; then
1982         cat <<EOM >&2
1983
1984 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1985
1986 EOM
1987         exit 1
1988 fi
1989
1990 : compute the number of columns on the terminal for proper question formatting
1991 case "$COLUMNS" in
1992 '') COLUMNS='80';;
1993 esac
1994
1995 : set up the echo used in my read
1996 myecho="case \"\$xxxm\" in
1997 '') echo $n \"\$rp $c\" >&4;;
1998 *) case \"\$rp\" in
1999         '') echo $n \"[\$xxxm] $c\";;
2000         *)
2001                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2002                         echo \"\$rp\" >&4
2003                         echo $n \"[\$xxxm] $c\" >&4
2004                 else
2005                         echo $n \"\$rp [\$xxxm] $c\" >&4
2006                 fi
2007                 ;;
2008         esac;;
2009 esac"
2010
2011 : now set up to do reads with possible shell escape and default assignment
2012 cat <<EOSC >myread
2013 $startsh
2014 xxxm=\$dflt
2015 $myecho
2016 ans='!'
2017 case "\$fastread" in
2018 yes) case "\$dflt" in
2019         '') ;;
2020         *) ans='';
2021                 case "\$silent-\$rp" in
2022                 true-) ;;
2023                 *) echo " " >&4;;
2024                 esac;;
2025         esac;;
2026 *) case "\$silent" in
2027         true) case "\$rp" in
2028                 '') ans='';;
2029                 esac;;
2030         esac;;
2031 esac
2032 while expr "X\$ans" : "X!" >/dev/null; do
2033         read answ
2034         set x \$xxxm
2035         shift
2036         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2037         case  "\$answ" in
2038         "!")
2039                 sh 1>&4
2040                 echo " "
2041                 $myecho
2042                 ;;
2043         !*)
2044                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2045                 shift
2046                 sh 1>&4 -c "\$*"
2047                 echo " "
2048                 $myecho
2049                 ;;
2050         "\$ans")
2051                 case "\$ans" in
2052                 \\&*)
2053                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2054                         shift
2055                         case "\$1" in
2056                         -d)
2057                                 fastread=yes
2058                                 echo "(OK, I'll run with -d after this question.)" >&4
2059                                 ;;
2060                         -*)
2061                                 echo "*** Sorry, \$1 not supported yet." >&4
2062                                 ;;
2063                         esac
2064                         $myecho
2065                         ans=!
2066                         ;;
2067                 esac;;
2068         *)
2069                 case "\$aok" in
2070                 y)
2071                         echo "*** Substitution done -- please confirm."
2072                         xxxm="\$ans"
2073                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2074                         xxxm="\$ans"
2075                         ans=!
2076                         ;;
2077                 *)
2078                         echo "*** Error -- try again."
2079                         ans=!
2080                         ;;
2081                 esac
2082                 $myecho
2083                 ;;
2084         esac
2085         case "\$ans\$xxxm\$nostick" in
2086         '')
2087                 ans=!
2088                 $myecho
2089                 ;;
2090         esac
2091 done
2092 case "\$ans" in
2093 '') ans="\$xxxm";;
2094 esac
2095 EOSC
2096
2097 : create .config dir to save info across Configure sessions
2098 test -d ../.config || mkdir ../.config
2099 cat >../.config/README <<EOF
2100 This directory created by Configure to save information that should
2101 persist across sessions for $package.
2102
2103 You may safely delete it if you wish.
2104 EOF
2105
2106 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2107 case "$usedevel" in
2108 $define|true|[yY]*) ;;
2109 *) case "$xversion" in
2110    *[13579])
2111         cat >&4 <<EOH
2112 *** WHOA THERE!!! ***
2113
2114     This is an UNSTABLE DEVELOPMENT release.
2115     The version of this $package distribution is $xversion, that is, odd,
2116     (as opposed to even) and that signifies a development release.
2117     If you want a maintenance release, you want an even-numbered version.
2118
2119     Do ***NOT*** install this into production use.
2120     Data corruption and crashes are possible.
2121
2122     It is most seriously suggested that you do not continue any further
2123     unless you want to help in developing and debugging Perl.
2124
2125     If you *still* want to build perl, you can answer 'y' now,
2126     or pass -Dusedevel to Configure.
2127
2128 EOH
2129         rp='Do you really want to continue?'
2130         dflt='n'
2131         . ./myread
2132         case "$ans" in
2133         [yY]) echo >&4 "Okay, continuing."
2134               usedevel="$define" ;;
2135         *) echo >&4 "Okay, bye."
2136            exit 1
2137            ;;
2138         esac
2139         ;;
2140     esac
2141     ;;
2142 esac
2143 case "$usedevel" in
2144 $define|true|[yY]*)
2145         case "$versiononly" in
2146         '') versiononly="$define" ;;
2147         esac
2148         case "$installusrbinperl" in
2149         '') installusrbinperl="$undef" ;;
2150         esac
2151         ;;
2152 esac
2153
2154 : general instructions
2155 needman=true
2156 firsttime=true
2157 user=`(logname) 2>/dev/null`
2158 case "$user" in
2159 '') user=`whoami 2>&1`;;
2160 esac
2161 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2162         firsttime=false
2163         echo " "
2164         rp='Would you like to see the instructions?'
2165         dflt=n
2166         . ./myread
2167         case "$ans" in
2168         [yY]*) ;;
2169         *) needman=false;;
2170         esac
2171 fi
2172 if $needman; then
2173         cat <<EOH
2174
2175 This installation shell script will examine your system and ask you questions
2176 to determine how the perl5 package should be installed. If you get
2177 stuck on a question, you may use a ! shell escape to start a subshell or
2178 execute a command.  Many of the questions will have default answers in square
2179 brackets; typing carriage return will give you the default.
2180
2181 On some of the questions which ask for file or directory names you are allowed
2182 to use the ~name construct to specify the login directory belonging to "name",
2183 even if you don't have a shell which knows about that.  Questions where this is
2184 allowed will be marked "(~name ok)".
2185
2186 EOH
2187         rp=''
2188         dflt='Type carriage return to continue'
2189         . ./myread
2190         cat <<'EOH'
2191
2192 The prompter used in this script allows you to use shell variables and
2193 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2194 in the default answer, as if the default line was a set of arguments given to a
2195 script shell.  This means you may also use $* to repeat the whole default line,
2196 so you do not have to re-type everything to add something to the default.
2197
2198 Everytime there is a substitution, you will have to confirm.  If there is an
2199 error (e.g. an unmatched backtick), the default answer will remain unchanged
2200 and you will be prompted again.
2201
2202 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2203 the questions and use the computed defaults (or the previous answers if there
2204 was already a config.sh file). Type 'Configure -h' for a list of options.
2205 You may also start interactively and then answer '& -d' at any prompt to turn
2206 on the non-interactive behaviour for the remainder of the execution.
2207
2208 EOH
2209         . ./myread
2210         cat <<EOH
2211
2212 Much effort has been expended to ensure that this shell script will run on any
2213 Unix system.  If despite that it blows up on yours, your best bet is to edit
2214 Configure and run it again.  If you can't run Configure for some reason,
2215 you'll have to generate a config.sh file by hand.  Whatever problems you
2216 have, let me (perlbug@perl.org) know how I blew it.
2217
2218 This installation script affects things in two ways:
2219
2220 1) it may do direct variable substitutions on some of the files included
2221    in this kit.
2222 2) it builds a config.h file for inclusion in C programs.  You may edit
2223    any of these files as the need arises after running this script.
2224
2225 If you make a mistake on a question, there is no easy way to back up to it
2226 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2227 files.  Configure will offer to let you do this before it runs the SH files.
2228
2229 EOH
2230         dflt='Type carriage return to continue'
2231         . ./myread
2232         case "$firsttime" in
2233         true) echo $user >>../.config/instruct;;
2234         esac
2235 fi
2236
2237 : find out where common programs are
2238 echo " "
2239 echo "Locating common programs..." >&4
2240 cat <<EOSC >loc
2241 $startsh
2242 case \$# in
2243 0) exit 1;;
2244 esac
2245 thing=\$1
2246 shift
2247 dflt=\$1
2248 shift
2249 for dir in \$*; do
2250         case "\$thing" in
2251         .)
2252         if test -d \$dir/\$thing; then
2253                 echo \$dir
2254                 exit 0
2255         fi
2256         ;;
2257         *)
2258         for thisthing in \$dir/\$thing; do
2259                 : just loop through to pick last item
2260         done
2261         if test -f \$thisthing; then
2262                 echo \$thisthing
2263                 exit 0
2264         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2265                 echo \$thisthing
2266                 exit 0
2267         elif test -f \$dir/\$thing.exe; then
2268                 if test -n "$DJGPP"; then
2269                         echo \$dir/\$thing.exe
2270                 elif test "$eunicefix" != ":"; then
2271                         : on Eunice apparently
2272                         echo \$dir/\$thing
2273                         exit 0
2274                 fi
2275                 exit 0
2276         fi
2277         ;;
2278         esac
2279 done
2280 echo \$dflt
2281 exit 1
2282 EOSC
2283 chmod +x loc
2284 $eunicefix loc
2285 loclist="
2286 awk
2287 cat
2288 chmod
2289 comm
2290 cp
2291 echo
2292 expr
2293 grep
2294 ls
2295 mkdir
2296 rm
2297 sed
2298 sort
2299 touch
2300 tr
2301 uniq
2302 "
2303 trylist="
2304 Mcc
2305 ar
2306 bison
2307 byacc
2308 cpp
2309 csh
2310 date
2311 egrep
2312 gmake
2313 gzip
2314 less
2315 ln
2316 make
2317 more
2318 nm
2319 nroff
2320 pg
2321 test
2322 uname
2323 zip
2324 "
2325 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2326 pth="$pth /lib /usr/lib"
2327 for file in $loclist; do
2328         eval xxx=\$$file
2329         case "$xxx" in
2330         /*|?:[\\/]*)
2331                 if test -f "$xxx"; then
2332                         : ok
2333                 else
2334                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2335                         xxx=`./loc $file $file $pth`
2336                 fi
2337                 ;;
2338         '') xxx=`./loc $file $file $pth`;;
2339         *) xxx=`./loc $xxx $xxx $pth`;;
2340         esac
2341         eval $file=$xxx$_exe
2342         eval _$file=$xxx
2343         case "$xxx" in
2344         /*)
2345                 echo $file is in $xxx.
2346                 ;;
2347         ?:[\\/]*)
2348                 echo $file is in $xxx.
2349                 ;;
2350         *)
2351                 echo "I don't know where '$file' is, and my life depends on it." >&4
2352                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2353                 exit 1
2354                 ;;
2355         esac
2356 done
2357 echo " "
2358 echo "Don't worry if any of the following aren't found..."
2359 say=offhand
2360 for file in $trylist; do
2361         eval xxx=\$$file
2362         case "$xxx" in
2363         /*|?:[\\/]*)
2364                 if test -f "$xxx"; then
2365                         : ok
2366                 else
2367                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2368                         xxx=`./loc $file $file $pth`
2369                 fi
2370                 ;;
2371         '') xxx=`./loc $file $file $pth`;;
2372         *) xxx=`./loc $xxx $xxx $pth`;;
2373         esac
2374         eval $file=$xxx$_exe
2375         eval _$file=$xxx
2376         case "$xxx" in
2377         /*)
2378                 echo $file is in $xxx.
2379                 ;;
2380         ?:[\\/]*)
2381                 echo $file is in $xxx.
2382                 ;;
2383         *)
2384                 echo "I don't see $file out there, $say."
2385                 say=either
2386                 ;;
2387         esac
2388 done
2389 case "$egrep" in
2390 egrep)
2391         echo "Substituting grep for egrep."
2392         egrep=$grep
2393         _egrep=$grep
2394         ;;
2395 esac
2396 case "$ln" in
2397 ln)
2398         echo "Substituting cp for ln."
2399         ln=$cp
2400         _ln=$cp
2401         ;;
2402 esac
2403 case "$make" in
2404 make)   
2405         case "$gmake" in
2406         gmake)
2407         echo "I can't find make or gmake, and my life depends on it." >&4
2408         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2409         exit 1
2410         ;;
2411         esac
2412         ;;
2413 esac    
2414 case "$gmake" in
2415 gmake)  ;;
2416 *)      # We can't have osname yet.
2417         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2418                 # Assume that gmake, if found, is definitely GNU make
2419                 # and prefer it over the system make.
2420                 echo "Substituting gmake for make."
2421                 make=$gmake
2422                 _make=$gmake
2423         fi
2424         ;;
2425 esac
2426 case "$test" in
2427 test)
2428         echo "Hopefully test is built into your sh."
2429         ;;
2430 *)
2431         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2432                 echo "Using the test built into your sh."
2433                 test=test
2434                 _test=test
2435         fi
2436         ;;
2437 esac
2438 case "$echo" in
2439 echo)
2440         echo "Hopefully echo is built into your sh."
2441         ;;
2442 '') ;;
2443 *)
2444         echo " "
2445 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2446         $echo $n "hi there$c" >foo1
2447         echo $n "hi there$c" >foo2
2448         if cmp foo1 foo2 >/dev/null 2>&1; then
2449                 echo "They are compatible.  In fact, they may be identical."
2450         else
2451                 case "$n" in
2452                 '-n') n='' c='\c';;
2453                 *) n='-n' c='';;
2454                 esac
2455                 cat <<FOO
2456 They are not compatible!  You are probably running ksh on a non-USG system.
2457 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2458 have echo built in and we may have to run some Bourne shell scripts.  That
2459 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2460
2461 FOO
2462                 $echo $n "The star should be here-->$c"
2463                 $echo "*"
2464         fi
2465         $rm -f foo1 foo2
2466         ;;
2467 esac
2468
2469 cat <<EOS >trygcc
2470 $startsh
2471 EOS
2472 cat <<'EOSC' >>trygcc
2473 case "$cc" in
2474 '') ;;
2475 *)  $rm -f try try.*
2476     $cat >try.c <<EOM
2477 int main(int argc, char *argv[]) {
2478   return 0;
2479 }
2480 EOM
2481     if $cc -o try $ccflags $ldflags try.c; then
2482        :
2483     else
2484         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2485         despair=yes
2486         trygcc=yes
2487         case "$cc" in
2488         *gcc*) trygcc=no ;;
2489         esac
2490         case "`$cc -v -c try.c 2>&1`" in
2491         *gcc*) trygcc=no ;;
2492         esac
2493         if $test X"$trygcc" = Xyes; then
2494             if gcc -o try -c try.c; then
2495                 echo " "
2496                 echo "You seem to have a working gcc, though." >&4
2497                 rp="Would you like to use it?"
2498                 dflt=y
2499                 if $test -f myread; then
2500                     . ./myread
2501                 else
2502                     if $test -f UU/myread; then
2503                         . ./UU/myread
2504                     else
2505                         echo "Cannot find myread, sorry.  Aborting." >&2
2506                         exit 1
2507                     fi
2508                 fi  
2509                 case "$ans" in
2510                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2511                        if $test -f usethreads.cbu; then
2512                            $cat >&4 <<EOM 
2513
2514 *** However, any setting of the C compiler flags (e.g. for thread support)
2515 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2516 *** (together with e.g. -Dusethreads).
2517
2518 EOM
2519                        fi;;
2520                 esac
2521             fi
2522         fi
2523     fi
2524     $rm -f try try.*
2525     ;;
2526 esac
2527 EOSC
2528
2529 cat <<EOS >checkcc
2530 $startsh
2531 EOS
2532 cat <<'EOSC' >>checkcc
2533 case "$cc" in        
2534 '') ;;
2535 *)  $rm -f try try.*              
2536     $cat >try.c <<EOM
2537 int main(int argc, char *argv[]) {
2538   return 0;
2539 }
2540 EOM
2541     if $cc -o try $ccflags $ldflags try.c; then
2542        :
2543     else
2544         if $test X"$despair" = Xyes; then
2545            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2546         fi
2547         $cat >&4 <<EOM         
2548 You need to find a working C compiler.
2549 Either (purchase and) install the C compiler supplied by your OS vendor,
2550 or for a free C compiler try http://gcc.gnu.org/
2551 I cannot continue any further, aborting.
2552 EOM
2553         exit 1
2554     fi
2555     $rm -f try try.*
2556     ;;
2557 esac
2558 EOSC
2559
2560 : determine whether symbolic links are supported
2561 echo " "
2562 $touch blurfl
2563 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2564         echo "Symbolic links are supported." >&4
2565         lns="$ln -s"
2566 else
2567         echo "Symbolic links are NOT supported." >&4
2568         lns="$ln"
2569 fi
2570 $rm -f blurfl sym
2571
2572 : determine whether symbolic links are supported
2573 echo " "
2574 case "$lns" in
2575 *"ln"*" -s")
2576         echo "Checking how to test for symbolic links..." >&4
2577         $lns blurfl sym
2578         if $test "X$issymlink" = X; then
2579                 case "$newsh" in
2580                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2581                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2582                 esac
2583                 if test $? = 0; then
2584                         issymlink="test -h"
2585                 else
2586                         echo "Your builtin 'test -h' may be broken." >&4
2587                         case "$test" in
2588                         /*)     ;;
2589                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2590                                 for p in $pth
2591                                 do
2592                                         if test -f "$p/$test"; then
2593                                                 test="$p/$test"
2594                                                 break
2595                                         fi
2596                                 done
2597                                 ;;
2598                         esac
2599                         case "$test" in
2600                         /*)
2601                                 echo "Trying external '$test -h'." >&4
2602                                 issymlink="$test -h"
2603                                 if $test ! -h sym >/dev/null 2>&1; then
2604                                         echo "External '$test -h' is broken, too." >&4
2605                                         issymlink=''
2606                                 fi
2607                                 ;;
2608                         *)      issymlink='' ;;
2609                         esac
2610                 fi              
2611         fi
2612         if $test "X$issymlink" = X; then
2613                 if $test -L sym 2>/dev/null; then
2614                         issymlink="$test -L"
2615                         echo "The builtin '$test -L' worked." >&4
2616                 fi
2617         fi
2618         if $test "X$issymlink" != X; then
2619                 echo "You can test for symbolic links with '$issymlink'." >&4
2620         else
2621                 echo "I do not know how you can test for symbolic links." >&4
2622         fi
2623         $rm -f blurfl sym
2624         ;;
2625 *)      echo "No symbolic links, so not testing for their testing..." >&4
2626         ;;
2627 esac
2628 echo " "
2629
2630
2631 case "$mksymlinks" in
2632 $define|true|[yY]*)
2633         case "$src" in
2634         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2635                 exit 1
2636                 ;;
2637         *)      case "$lns:$issymlink" in
2638                 *"ln"*" -s:"*"test -"?)
2639                         echo "Creating the symbolic links..." >&4
2640                         echo "(First creating the subdirectories...)" >&4
2641                         cd ..
2642                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2643                                 read directory
2644                                 test -z "$directory" && break
2645                                 mkdir -p $directory
2646                         done
2647                         # Sanity check 1.
2648                         if test ! -d t/base; then
2649                                 echo "Failed to create the subdirectories.  Aborting." >&4
2650                                 exit 1
2651                         fi
2652                         echo "(Then creating the symlinks...)" >&4
2653                         awk '{print $1}' $src/MANIFEST | while true; do
2654                                 read filename
2655                                 test -z "$filename" && break
2656                                 if test -f $filename; then
2657                                         if $issymlink $filename; then
2658                                                 rm -f $filename
2659                                         fi
2660                                 fi
2661                                 if test -f $filename; then
2662                                         echo "$filename already exists, not symlinking."
2663                                 else
2664                                         ln -s $src/$filename $filename
2665                                 fi
2666                         done
2667                         # Sanity check 2.
2668                         if test ! -f t/base/lex.t; then
2669                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2670                                 exit 1
2671                         fi
2672                         cd UU
2673                         ;;
2674                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2675                         ;;
2676                 esac
2677                 ;;
2678         esac
2679         ;;
2680 esac
2681
2682
2683 case "$usecrosscompile" in
2684 $define|true|[yY]*)
2685         $echo "Cross-compiling..."
2686         croak=''
2687         case "$cc" in
2688         *-*-gcc) # A cross-compiling gcc, probably.
2689             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2690             ar=$targetarch-ar
2691             # leave out ld, choosing it is more complex
2692             nm=$targetarch-nm
2693             ranlib=$targetarch-ranlib
2694             $echo 'extern int foo;' > try.c
2695             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2696             shift
2697             if $test $# -gt 0; then
2698                 incpth="$incpth $*"
2699                 incpth="`$echo $incpth|$sed 's/^ //'`"
2700                 echo "Guessing incpth '$incpth'." >&4
2701                 for i in $*; do
2702                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2703                     if $test -d $j; then
2704                         libpth="$libpth $j"
2705                     fi
2706                 done   
2707                 libpth="`$echo $libpth|$sed 's/^ //'`"
2708                 echo "Guessing libpth '$libpth'." >&4
2709             fi
2710             $rm -f try.c
2711             ;;
2712         esac
2713         case "$targetarch" in
2714         '') echo "Targetarch not defined." >&4; croak=y ;;
2715         *)  echo "Using targetarch $targetarch." >&4 ;;
2716         esac
2717         case "$incpth" in
2718         '') echo "Incpth not defined." >&4; croak=y ;;
2719         *)  echo "Using incpth '$incpth'." >&4 ;;
2720         esac
2721         case "$libpth" in
2722         '') echo "Libpth not defined." >&4; croak=y ;;
2723         *)  echo "Using libpth '$libpth'." >&4 ;;
2724         esac
2725         case "$usrinc" in
2726         '') for i in $incpth; do
2727                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2728                     usrinc=$i
2729                     echo "Guessing usrinc $usrinc." >&4
2730                     break
2731                 fi
2732             done
2733             case "$usrinc" in
2734             '') echo "Usrinc not defined." >&4; croak=y ;;
2735             esac
2736             ;;
2737         *)  echo "Using usrinc $usrinc." >&4 ;;
2738         esac
2739         case "$targethost" in
2740         '') echo "Targethost not defined." >&4; croak=y ;;
2741         *)  echo "Using targethost $targethost." >&4
2742         esac
2743         locincpth=' '
2744         loclibpth=' '
2745         case "$croak" in
2746         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2747         esac
2748         case "$src" in
2749         /*) run=$src/Cross/run
2750             targetmkdir=$src/Cross/mkdir
2751             to=$src/Cross/to
2752             from=$src/Cross/from
2753             ;;
2754         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2755             run=$pwd/Cross/run
2756             targetmkdir=$pwd/Cross/mkdir
2757             to=$pwd/Cross/to
2758             from=$pwd/Cross/from
2759             ;;
2760         esac
2761         case "$targetrun" in
2762         '') targetrun=ssh ;;
2763         esac
2764         case "$targetto" in
2765         '') targetto=scp ;;
2766         esac
2767         case "$targetfrom" in
2768         '') targetfrom=scp ;;
2769         esac
2770         run=$run-$targetrun
2771         to=$to-$targetto
2772         from=$from-$targetfrom
2773         case "$targetdir" in
2774         '')  targetdir=/tmp
2775              echo "Guessing targetdir $targetdir." >&4
2776              ;;
2777         esac
2778         case "$targetuser" in
2779         '')  targetuser=root
2780              echo "Guessing targetuser $targetuser." >&4
2781              ;;
2782         esac
2783         case "$targetfrom" in
2784         scp)    q=-q ;;
2785         *)      q='' ;;
2786         esac
2787         case "$targetrun" in
2788         ssh|rsh)
2789             cat >$run <<EOF
2790 #!/bin/sh
2791 case "\$1" in
2792 -cwd)
2793   shift
2794   cwd=\$1
2795   shift
2796   ;;
2797 esac
2798 case "\$cwd" in
2799 '') cwd=$targetdir ;;
2800 esac
2801 exe=\$1
2802 shift
2803 if $test ! -f \$exe.xok; then
2804   $to \$exe
2805   $touch \$exe.xok
2806 fi
2807 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2808 EOF
2809             ;;
2810         *)  echo "Unknown targetrun '$targetrun'" >&4
2811             exit 1
2812             ;;
2813         esac
2814         case "$targetmkdir" in
2815         */Cross/mkdir)
2816             cat >$targetmkdir <<EOF
2817 #!/bin/sh
2818 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2819 EOF
2820             $chmod a+rx $targetmkdir
2821             ;;
2822         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2823             exit 1
2824             ;;
2825         esac
2826         case "$targetto" in
2827         scp|rcp)
2828             cat >$to <<EOF
2829 #!/bin/sh
2830 for f in \$@
2831 do
2832   case "\$f" in
2833   /*)
2834     $targetmkdir \`dirname \$f\`
2835     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2836     ;;
2837   *)
2838     $targetmkdir $targetdir/\`dirname \$f\`
2839     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2840     ;;
2841   esac
2842 done
2843 exit 0
2844 EOF
2845             ;;
2846         cp) cat >$to <<EOF
2847 #!/bin/sh
2848 for f in \$@
2849 do
2850   case "\$f" in
2851   /*)
2852     $mkdir -p $targetdir/\`dirname \$f\`
2853     $cp \$f $targetdir/\$f || exit 1
2854     ;;
2855   *)
2856     $targetmkdir $targetdir/\`dirname \$f\`
2857     $cp \$f $targetdir/\$f || exit 1
2858     ;;
2859   esac
2860 done
2861 exit 0
2862 EOF
2863             ;;
2864         *)  echo "Unknown targetto '$targetto'" >&4
2865             exit 1
2866             ;;
2867         esac
2868         case "$targetfrom" in
2869         scp|rcp)
2870           cat >$from <<EOF
2871 #!/bin/sh
2872 for f in \$@
2873 do
2874   $rm -f \$f
2875   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2876 done
2877 exit 0
2878 EOF
2879             ;;
2880         cp) cat >$from <<EOF
2881 #!/bin/sh
2882 for f in \$@
2883 do
2884   $rm -f \$f
2885   cp $targetdir/\$f . || exit 1
2886 done
2887 exit 0
2888 EOF
2889             ;;
2890         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2891             exit 1
2892             ;;
2893         esac
2894         if $test ! -f $run; then
2895             echo "Target 'run' script '$run' not found." >&4
2896         else
2897             $chmod a+rx $run
2898         fi
2899         if $test ! -f $to; then
2900             echo "Target 'to' script '$to' not found." >&4
2901         else
2902             $chmod a+rx $to
2903         fi
2904         if $test ! -f $from; then
2905             echo "Target 'from' script '$from' not found." >&4
2906         else
2907             $chmod a+rx $from
2908         fi
2909         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2910             exit 1
2911         fi
2912         cat >&4 <<EOF
2913 Using '$run' for remote execution,
2914 and '$from' and '$to'
2915 for remote file transfer.
2916 EOF
2917         ;;
2918 *)      run=''
2919         to=:
2920         from=:
2921         usecrosscompile='undef'
2922         targetarch=''
2923         ;;
2924 esac
2925
2926 : see whether [:lower:] and [:upper:] are supported character classes
2927 echo " "
2928 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2929 ABYZ)
2930         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2931         up='[:upper:]'
2932         low='[:lower:]'
2933         ;;
2934 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2935         # (0xd9 and 0xe2), therefore that is a nice testing point.
2936         if test "X$up" = X -o "X$low" = X; then
2937             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2938             rs) up='[A-Z]'
2939                 low='[a-z]'
2940                 ;;
2941             esac
2942         fi
2943         if test "X$up" = X -o "X$low" = X; then
2944             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2945             rs) up='A-Z'
2946                 low='a-z'
2947                 ;;
2948             esac
2949         fi
2950         if test "X$up" = X -o "X$low" = X; then
2951             case "`echo RS | od -x 2>/dev/null`" in
2952             *D9E2*|*d9e2*)
2953                 echo "Hey, this might be EBCDIC." >&4
2954                 if test "X$up" = X -o "X$low" = X; then
2955                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2956                     rs) up='[A-IJ-RS-Z]'
2957                         low='[a-ij-rs-z]'
2958                         ;;
2959                     esac
2960                 fi
2961                 if test "X$up" = X -o "X$low" = X; then
2962                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2963                     rs) up='A-IJ-RS-Z'
2964                         low='a-ij-rs-z'
2965                         ;;
2966                     esac
2967                 fi
2968                 ;;
2969             esac
2970         fi
2971 esac
2972 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2973 rs)
2974     echo "Using $up and $low to convert case." >&4
2975     ;;
2976 *)
2977     echo "I don't know how to translate letters from upper to lower case." >&4
2978     echo "Your tr is not acting any way I know of." >&4
2979     exit 1
2980     ;;
2981 esac
2982 : set up the translation script tr, must be called with ./tr of course
2983 cat >tr <<EOSC
2984 $startsh
2985 case "\$1\$2" in
2986 '[A-Z][a-z]') exec $tr '$up' '$low';;
2987 '[a-z][A-Z]') exec $tr '$low' '$up';;
2988 esac
2989 exec $tr "\$@"
2990 EOSC
2991 chmod +x tr
2992 $eunicefix tr
2993
2994 : Try to determine whether config.sh was made on this system
2995 case "$config_sh" in
2996 '')
2997 myuname=`$uname -a 2>/dev/null`
2998 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2999 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3000 # because the A-Z/a-z are not consecutive.
3001 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3002         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3003 newmyuname="$myuname"
3004 dflt=n
3005 case "$knowitall" in
3006 '')
3007         if test -f ../config.sh; then
3008                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3009                         eval "`grep myuname= ../config.sh`"
3010                 fi
3011                 if test "X$myuname" = "X$newmyuname"; then
3012                         dflt=y
3013                 fi
3014         fi
3015         ;;
3016 *) dflt=y;;
3017 esac
3018
3019 : Get old answers from old config file if Configure was run on the
3020 : same system, otherwise use the hints.
3021 hint=default
3022 cd ..
3023 if test -f config.sh; then
3024         echo " "
3025         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3026         . UU/myread
3027         case "$ans" in
3028         n*|N*) echo "OK, I'll ignore it."
3029                 mv config.sh config.sh.old
3030                 myuname="$newmyuname"
3031                 ;;
3032         *)  echo "Fetching default answers from your old config.sh file..." >&4
3033                 tmp_n="$n"
3034                 tmp_c="$c"
3035                 tmp_sh="$sh"
3036                 . ./config.sh
3037                 cp config.sh UU
3038                 n="$tmp_n"
3039                 c="$tmp_c"
3040                 : Older versions did not always set $sh.  Catch re-use of such
3041                 : an old config.sh.
3042                 case "$sh" in
3043                 '') sh="$tmp_sh" ;;
3044                 esac
3045                 hint=previous
3046                 ;;
3047         esac
3048 fi
3049 . ./UU/checkcc
3050 if test ! -f config.sh; then
3051         $cat <<EOM
3052
3053 First time through, eh?  I have some defaults handy for some systems
3054 that need some extra help getting the Configure answers right:
3055
3056 EOM
3057         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3058         dflt=''
3059         : Half the following guesses are probably wrong... If you have better
3060         : tests or hints, please send them to perlbug@perl.org
3061         : The metaconfig authors would also appreciate a copy...
3062         $test -f /irix && osname=irix
3063         $test -f /xenix && osname=sco_xenix
3064         $test -f /dynix && osname=dynix
3065         $test -f /dnix && osname=dnix
3066         $test -f /lynx.os && osname=lynxos
3067         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3068         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3069         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3070         $test -f /bin/mips && /bin/mips && osname=mips
3071         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3072                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3073         $test -d /usr/apollo/bin && osname=apollo
3074         $test -f /etc/saf/_sactab && osname=svr4
3075         $test -d /usr/include/minix && osname=minix
3076         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3077         if $test -d /MachTen -o -d /MachTen_Folder; then
3078                 osname=machten
3079                 if $test -x /sbin/version; then
3080                         osvers=`/sbin/version | $awk '{print $2}' |
3081                         $sed -e 's/[A-Za-z]$//'`
3082                 elif $test -x /usr/etc/version; then
3083                         osvers=`/usr/etc/version | $awk '{print $2}' |
3084                         $sed -e 's/[A-Za-z]$//'`
3085                 else
3086                         osvers="$2.$3"
3087                 fi
3088         fi
3089
3090         $test -f /sys/posix.dll &&
3091                 $test -f /usr/bin/what &&
3092                 set X `/usr/bin/what /sys/posix.dll` &&
3093                 $test "$3" = UWIN &&
3094                 osname=uwin &&
3095                 osvers="$5"
3096
3097         if $test -f $uname; then
3098                 set X $myuname
3099                 shift
3100
3101                 case "$5" in
3102                 fps*) osname=fps ;;
3103                 mips*)
3104                         case "$4" in
3105                         umips) osname=umips ;;
3106                         *) osname=mips ;;
3107                         esac;;
3108                 [23]100) osname=mips ;;
3109                 next*) osname=next ;;
3110                 i386*)
3111                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3112                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3113                                 osname='sco'
3114                                 osvers=$tmp
3115                         elif $test -f /etc/kconfig; then
3116                                 osname=isc
3117                                 if test "$lns" = "$ln -s"; then
3118                                         osvers=4
3119                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3120                                         osvers=3
3121                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3122                                         osvers=2
3123                                 fi
3124                         fi
3125                         tmp=''
3126                         ;;
3127                 pc*)
3128                         if test -n "$DJGPP"; then
3129                                 osname=dos
3130                                 osvers=djgpp
3131                         fi
3132                         ;;
3133                 esac
3134
3135                 case "$1" in
3136                 aix) osname=aix
3137                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3138                         case "$tmp" in
3139                         # oslevel can fail with:
3140                         # oslevel: Unable to acquire lock.
3141                         *not\ found) osvers="$4"."$3" ;;
3142                         '<3240'|'<>3240') osvers=3.2.0 ;;
3143                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3144                         '=3250'|'>3250') osvers=3.2.5 ;;
3145                         *) osvers=$tmp;;
3146                         esac
3147                         ;;
3148                 bsd386) osname=bsd386
3149                         osvers=`$uname -r`
3150                         ;;
3151                 cygwin*) osname=cygwin
3152                         osvers="$3"
3153                         ;;
3154                 *dc.osx) osname=dcosx
3155                         osvers="$3"
3156                         ;;
3157                 dnix) osname=dnix
3158                         osvers="$3"
3159                         ;;
3160                 domainos) osname=apollo
3161                         osvers="$3"
3162                         ;;
3163                 dgux)   osname=dgux
3164                         osvers="$3"
3165                         ;;
3166                 dragonfly) osname=dragonfly
3167                         osvers="$3"
3168                         ;;
3169                 dynixptx*) osname=dynixptx
3170                         osvers=`echo "$4"|sed 's/^v//'`
3171                         ;;
3172                 freebsd) osname=freebsd
3173                         osvers="$3" ;;
3174                 genix)  osname=genix ;;
3175                 gnu)    osname=gnu
3176                         osvers="$3" ;;
3177                 hp*)    osname=hpux
3178                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3179                         ;;
3180                 irix*)  osname=irix
3181                         case "$3" in
3182                         4*) osvers=4 ;;
3183                         5*) osvers=5 ;;
3184                         *)      osvers="$3" ;;
3185                         esac
3186                         ;;
3187                 linux)  osname=linux
3188                         case "$3" in
3189                         *)      osvers="$3" ;;
3190                         esac
3191                         ;;
3192                 MiNT)   osname=mint
3193                         ;;
3194                 netbsd*) osname=netbsd
3195                         osvers="$3"
3196                         ;;
3197                 news-os) osvers="$3"
3198                         case "$3" in
3199                         4*) osname=newsos4 ;;
3200                         *) osname=newsos ;;
3201                         esac
3202                         ;;
3203                 next*) osname=next ;;
3204                 nonstop-ux) osname=nonstopux ;;
3205                 openbsd) osname=openbsd
3206                         osvers="$3"
3207                         ;;
3208                 os2)    osname=os2
3209                         osvers="$4"
3210                         ;;
3211                 POSIX-BC | posix-bc ) osname=posix-bc
3212                         osvers="$3"
3213                         ;;
3214                 powerux | power_ux | powermax_os | powermaxos | \
3215                 powerunix | power_unix) osname=powerux
3216                         osvers="$3"
3217                         ;;
3218                 qnx) osname=qnx
3219                         osvers="$4"
3220                         ;;
3221                 solaris) osname=solaris
3222                         case "$3" in
3223                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3224                         *)      osvers="$3" ;;
3225                         esac
3226                         ;;
3227                 sunos) osname=sunos
3228                         case "$3" in
3229                         5*) osname=solaris
3230                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3231                         *)      osvers="$3" ;;
3232                         esac
3233                         ;;
3234                 titanos) osname=titanos
3235                         case "$3" in
3236                         1*) osvers=1 ;;
3237                         2*) osvers=2 ;;
3238                         3*) osvers=3 ;;
3239                         4*) osvers=4 ;;
3240                         *)      osvers="$3" ;;
3241                         esac
3242                         ;;
3243                 ultrix) osname=ultrix
3244                         osvers="$3"
3245                         ;;
3246                 osf1|mls+)      case "$5" in
3247                                 alpha)
3248                                         osname=dec_osf
3249                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3250                                         case "$osvers" in
3251                                         [1-9].[0-9]*) ;;
3252                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3253                                         esac
3254                                         ;;
3255                         hp*)    osname=hp_osf1  ;;
3256                         mips)   osname=mips_osf1 ;;
3257                         esac
3258                         ;;
3259                 # UnixWare 7.1.2 is known as Open UNIX 8
3260                 openunix|unixware) osname=svr5
3261                         osvers="$4"
3262                         ;;
3263                 uts)    osname=uts
3264                         osvers="$3"
3265                         ;;
3266                 vos) osvers="$3"
3267                         ;;
3268                 $2) case "$osname" in
3269                         *isc*) ;;
3270                         *freebsd*) ;;
3271                         svr*)
3272                                 : svr4.x or possibly later
3273                                 case "svr$3" in
3274                                 ${osname}*)
3275                                         osname=svr$3
3276                                         osvers=$4
3277                                         ;;
3278                                 esac
3279                                 case "$osname" in
3280                                 svr4.0)
3281                                         : Check for ESIX
3282                                         if test -f /stand/boot ; then
3283                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3284                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3285                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3286                                                         if test -n "$isesix"; then
3287                                                                 osname=esix4
3288                                                         fi
3289                                                 fi
3290                                         fi
3291                                         ;;
3292                                 esac
3293                                 ;;
3294                         *)      if test -f /etc/systemid; then
3295                                         osname=sco
3296                                         set `echo $3 | $sed 's/\./ /g'` $4
3297                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3298                                                 osvers=$1.$2.$3
3299                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3300                                                 osvers=$1.$2
3301                                         elif $test -f $src/hints/sco_$1.sh; then
3302                                                 osvers=$1
3303                                         fi
3304                                 else
3305                                         case "$osname" in
3306                                         '') : Still unknown.  Probably a generic Sys V.
3307                                                 osname="sysv"
3308                                                 osvers="$3"
3309                                                 ;;
3310                                         esac
3311                                 fi
3312                                 ;;
3313                         esac
3314                         ;;
3315                 *)      case "$osname" in
3316                         '') : Still unknown.  Probably a generic BSD.
3317                                 osname="$1"
3318                                 osvers="$3"
3319                                 ;;
3320                         esac
3321                         ;;
3322                 esac
3323         else
3324                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3325                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3326                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3327                                 osname=news_os
3328                         fi
3329                         $rm -f UU/kernel.what
3330                 elif test -d c:/. -o -n "$is_os2" ; then
3331                         set X $myuname
3332                         osname=os2
3333                         osvers="$5"
3334                 fi
3335         fi
3336
3337         case "$targetarch" in
3338         '') ;;
3339         *)  hostarch=$osname
3340             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3341             osvers=''
3342             ;;
3343         esac
3344
3345         : Now look for a hint file osname_osvers, unless one has been
3346         : specified already.
3347         case "$hintfile" in
3348         ''|' ')
3349                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3350                 : Also try without trailing minor version numbers.
3351                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3352                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3353                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3354                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3355                 case "$file" in
3356                 '') dflt=none ;;
3357                 *)  case "$osvers" in
3358                         '') dflt=$file
3359                                 ;;
3360                         *)  if $test -f $src/hints/$file.sh ; then
3361                                         dflt=$file
3362                                 elif $test -f $src/hints/$xfile.sh ; then
3363                                         dflt=$xfile
3364                                 elif $test -f $src/hints/$xxfile.sh ; then
3365                                         dflt=$xxfile
3366                                 elif $test -f $src/hints/$xxxfile.sh ; then
3367                                         dflt=$xxxfile
3368                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3369                                         dflt=$xxxxfile
3370                                 elif $test -f "$src/hints/${osname}.sh" ; then
3371                                         dflt="${osname}"
3372                                 else
3373                                         dflt=none
3374                                 fi
3375                                 ;;
3376                         esac
3377                         ;;
3378                 esac
3379                 if $test -f Policy.sh ; then
3380                         case "$dflt" in
3381                         *Policy*) ;;
3382                         none) dflt="Policy" ;;
3383                         *) dflt="Policy $dflt" ;;
3384                         esac
3385                 fi
3386                 ;;
3387         *)
3388                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3389                 ;;
3390         esac
3391
3392         if $test -f Policy.sh ; then
3393                 $cat <<EOM
3394
3395 There's also a Policy hint file available, which should make the
3396 site-specific (policy) questions easier to answer.
3397 EOM
3398
3399         fi
3400
3401         $cat <<EOM
3402
3403 You may give one or more space-separated answers, or "none" if appropriate.
3404 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3405 previous run of Configure, you may specify it as well as or instead of
3406 OS-specific hints.  If hints are provided for your OS, you should use them:
3407 although Perl can probably be built without hints on many platforms, using
3408 hints often improve performance and may enable features that Configure can't
3409 set up on its own. If there are no hints that match your OS, specify "none";
3410 DO NOT give a wrong version or a wrong OS.
3411
3412 EOM
3413
3414         rp="Which of these apply, if any?"
3415         . UU/myread
3416         tans=$ans
3417         for file in $tans; do
3418                 if $test X$file = XPolicy -a -f Policy.sh; then
3419                         . Policy.sh
3420                         $cat Policy.sh >> UU/config.sh
3421                 elif $test -f $src/hints/$file.sh; then
3422                         . $src/hints/$file.sh
3423                         $cat $src/hints/$file.sh >> UU/config.sh
3424                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3425                         : nothing
3426                 else
3427                         : Give one chance to correct a possible typo.
3428                         echo "$file.sh does not exist"
3429                         dflt=$file
3430                         rp="hint to use instead?"
3431                         . UU/myread
3432                         for file in $ans; do
3433                                 if $test -f "$src/hints/$file.sh"; then
3434                                         . $src/hints/$file.sh
3435                                         $cat $src/hints/$file.sh >> UU/config.sh
3436                                 elif $test X$ans = X -o X$ans = Xnone ; then
3437                                         : nothing
3438                                 else
3439                                         echo "$file.sh does not exist -- ignored."
3440                                 fi
3441                         done
3442                 fi
3443         done
3444
3445         hint=recommended
3446         : Remember our hint file for later.
3447         if $test -f "$src/hints/$file.sh" ; then
3448                 hintfile="$file"
3449         else
3450                 hintfile=''
3451         fi
3452 fi
3453 cd UU
3454 ;;
3455 *)
3456         echo " "
3457         echo "Fetching default answers from $config_sh..." >&4
3458         tmp_n="$n"
3459         tmp_c="$c"
3460         cd ..
3461         cp $config_sh config.sh 2>/dev/null
3462         chmod +w config.sh
3463         . ./config.sh
3464         cd UU
3465         cp ../config.sh .
3466         n="$tmp_n"
3467         c="$tmp_c"
3468         hint=previous
3469         ;;
3470 esac
3471 test "$override" && . ./optdef.sh
3472
3473 : Restore computed paths
3474 for file in $loclist $trylist; do
3475         eval $file="\$_$file"
3476 done
3477
3478 cat << EOM
3479
3480 Configure uses the operating system name and version to set some defaults.
3481 The default value is probably right if the name rings a bell. Otherwise,
3482 since spelling matters for me, either accept the default or answer "none"
3483 to leave it blank.
3484
3485 EOM
3486 case "$osname" in
3487         ''|' ')
3488                 case "$hintfile" in
3489                 ''|' '|none) dflt=none ;;
3490                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3491                 esac
3492                 ;;
3493         *) dflt="$osname" ;;
3494 esac
3495 rp="Operating system name?"
3496 . ./myread
3497 case "$ans" in
3498 none)  osname='' ;;
3499 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3500 esac
3501 echo " "
3502 case "$osvers" in
3503         ''|' ')
3504                 case "$hintfile" in
3505                 ''|' '|none) dflt=none ;;
3506                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3507                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3508                         case "$dflt" in
3509                         ''|' ') dflt=none ;;
3510                         esac
3511                         ;;
3512                 esac
3513                 ;;
3514         *) dflt="$osvers" ;;
3515 esac
3516 rp="Operating system version?"
3517 . ./myread
3518 case "$ans" in
3519 none)  osvers='' ;;
3520 *) osvers="$ans" ;;
3521 esac
3522
3523
3524 . ./posthint.sh
3525
3526 : who configured the system
3527 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3528 case "$cf_by" in
3529 "")
3530         cf_by=`(logname) 2>/dev/null`
3531         case "$cf_by" in
3532         "")
3533                 cf_by=`(whoami) 2>/dev/null`
3534                 case "$cf_by" in
3535                 "") cf_by=unknown ;;
3536                 esac ;;
3537         esac ;;
3538 esac
3539
3540 : decide how portable to be.  Allow command line overrides.
3541 case "$d_portable" in
3542 "$undef") ;;
3543 *)      d_portable="$define" ;;
3544 esac
3545
3546 : set up shell script to do ~ expansion
3547 cat >filexp <<EOSS
3548 $startsh
3549 : expand filename
3550 case "\$1" in
3551  ~/*|~)
3552         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3553         ;;
3554  ~*)
3555         if $test -f /bin/csh; then
3556                 /bin/csh -f -c "glob \$1"
3557                 failed=\$?
3558                 echo ""
3559                 exit \$failed
3560         else
3561                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3562                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3563                 if $test ! -d "\$dir"; then
3564                         me=\`basename \$0\`
3565                         echo "\$me: can't locate home directory for: \$name" >&2
3566                         exit 1
3567                 fi
3568                 case "\$1" in
3569                 */*)
3570                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3571                         ;;
3572                 *)
3573                         echo \$dir
3574                         ;;
3575                 esac
3576         fi
3577         ;;
3578 *)
3579         echo \$1
3580         ;;
3581 esac
3582 EOSS
3583 chmod +x filexp
3584 $eunicefix filexp
3585
3586 : now set up to get a file name
3587 cat <<EOS >getfile
3588 $startsh
3589 EOS
3590 cat <<'EOSC' >>getfile
3591 tilde=''
3592 fullpath=''
3593 already=''
3594 skip=''
3595 none_ok=''
3596 exp_file=''
3597 nopath_ok=''
3598 orig_rp="$rp"
3599 orig_dflt="$dflt"
3600 case "$gfpth" in
3601 '') gfpth='.' ;;
3602 esac
3603
3604 case "$fn" in
3605 *\(*)
3606         : getfile will accept an answer from the comma-separated list
3607         : enclosed in parentheses even if it does not meet other criteria.
3608         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3609         fn=`echo $fn | sed 's/(.*)//'`
3610         ;;
3611 esac
3612
3613 case "$fn" in
3614 *:*)
3615         loc_file=`expr $fn : '.*:\(.*\)'`
3616         fn=`expr $fn : '\(.*\):.*'`
3617         ;;
3618 esac
3619
3620 case "$fn" in
3621 *~*) tilde=true;;
3622 esac
3623 case "$fn" in
3624 */*) fullpath=true;;
3625 esac
3626 case "$fn" in
3627 *+*) skip=true;;
3628 esac
3629 case "$fn" in
3630 *n*) none_ok=true;;
3631 esac
3632 case "$fn" in
3633 *e*) exp_file=true;;
3634 esac
3635 case "$fn" in
3636 *p*) nopath_ok=true;;
3637 esac
3638
3639 case "$fn" in
3640 *f*) type='File';;
3641 *d*) type='Directory';;
3642 *l*) type='Locate';;
3643 esac
3644
3645 what="$type"
3646 case "$what" in
3647 Locate) what='File';;
3648 esac
3649
3650 case "$exp_file" in
3651 '')
3652         case "$d_portable" in
3653         "$define") ;;
3654         *) exp_file=true;;
3655         esac
3656         ;;
3657 esac
3658
3659 cd ..
3660 while test "$type"; do
3661         redo=''
3662         rp="$orig_rp"
3663         dflt="$orig_dflt"
3664         case "$tilde" in
3665         true) rp="$rp (~name ok)";;
3666         esac
3667         . UU/myread
3668         if test -f UU/getfile.ok && \
3669                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3670         then
3671                 value="$ans"
3672                 ansexp="$ans"
3673                 break
3674         fi
3675         case "$ans" in
3676         none)
3677                 value=''
3678                 ansexp=''
3679                 case "$none_ok" in
3680                 true) type='';;
3681                 esac
3682                 ;;
3683         *)
3684                 case "$tilde" in
3685                 '') value="$ans"
3686                         ansexp="$ans";;
3687                 *)
3688                         value=`UU/filexp $ans`
3689                         case $? in
3690                         0)
3691                                 if test "$ans" != "$value"; then
3692                                         echo "(That expands to $value on this system.)"
3693                                 fi
3694                                 ;;
3695                         *) value="$ans";;
3696                         esac
3697                         ansexp="$value"
3698                         case "$exp_file" in
3699                         '') value="$ans";;
3700                         esac
3701                         ;;
3702                 esac
3703                 case "$fullpath" in
3704                 true)
3705                         case "$ansexp" in
3706                         /*) value="$ansexp" ;;
3707                         [a-zA-Z]:/*) value="$ansexp" ;;
3708                         *)
3709                                 redo=true
3710                                 case "$already" in
3711                                 true)
3712                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3713                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3714                                         ;;
3715                                 *)
3716                                 echo "Please give a full path name, starting with slash." >&4
3717                                         case "$tilde" in
3718                                         true)
3719                                 echo "Note that using ~name is ok provided it expands well." >&4
3720                                                 already=true
3721                                                 ;;
3722                                         esac
3723                                 esac
3724                                 ;;
3725                         esac
3726                         ;;
3727                 esac
3728                 case "$redo" in
3729                 '')
3730                         case "$type" in
3731                         File)
3732                                 for fp in $gfpth; do
3733                                         if test "X$fp" = X.; then
3734                                             pf="$ansexp"
3735                                         else    
3736                                             pf="$fp/$ansexp"
3737                                         fi
3738                                         if test -f "$pf"; then
3739                                                 type=''
3740                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3741                                         then
3742                                                 echo "($value is not a plain file, but that's ok.)"
3743                                                 type=''
3744                                         fi
3745                                         if test X"$type" = X; then
3746                                             value="$pf"
3747                                             break
3748                                         fi
3749                                 done
3750                                 ;;
3751                         Directory)
3752                                 for fp in $gfpth; do
3753                                         if test "X$fp" = X.; then
3754                                             dir="$ans"
3755                                             direxp="$ansexp"
3756                                         else    
3757                                             dir="$fp/$ansexp"
3758                                             direxp="$fp/$ansexp"
3759                                         fi
3760                                         if test -d "$direxp"; then
3761                                                 type=''
3762                                                 value="$dir"
3763                                                 break
3764                                         fi
3765                                 done
3766                                 ;;
3767                         Locate)
3768                                 if test -d "$ansexp"; then
3769                                         echo "(Looking for $loc_file in directory $value.)"
3770                                         value="$value/$loc_file"
3771                                         ansexp="$ansexp/$loc_file"
3772                                 fi
3773                                 if test -f "$ansexp"; then
3774                                         type=''
3775                                 fi
3776                                 case "$nopath_ok" in
3777                                 true)   case "$value" in
3778                                         */*) ;;
3779                                         *)      echo "Assuming $value will be in people's path."
3780                                                 type=''
3781                                                 ;;
3782                                         esac
3783                                         ;;
3784                                 esac
3785                                 ;;
3786                         esac
3787
3788                         case "$skip" in
3789                         true) type='';
3790                         esac
3791
3792                         case "$type" in
3793                         '') ;;
3794                         *)
3795                                 if test "$fastread" = yes; then
3796                                         dflt=y
3797                                 else
3798                                         dflt=n
3799                                 fi
3800                                 rp="$what $value doesn't exist.  Use that name anyway?"
3801                                 . UU/myread
3802                                 dflt=''
3803                                 case "$ans" in
3804                                 y*) type='';;
3805                                 *) echo " ";;
3806                                 esac
3807                                 ;;
3808                         esac
3809                         ;;
3810                 esac
3811                 ;;
3812         esac
3813 done
3814 cd UU
3815 ans="$value"
3816 rp="$orig_rp"
3817 dflt="$orig_dflt"
3818 rm -f getfile.ok
3819 test "X$gfpthkeep" != Xy && gfpth=""
3820 EOSC
3821
3822 : determine root of directory hierarchy where package will be installed.
3823 case "$prefix" in
3824 '')
3825         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3826         ;;
3827 *?/)
3828         dflt=`echo "$prefix" | sed 's/.$//'`
3829         ;;
3830 *)
3831         dflt="$prefix"
3832         ;;
3833 esac
3834 $cat <<EOM
3835
3836 By default, $package will be installed in $dflt/bin, manual pages
3837 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3838 installation directories. Typically this is something like /usr/local.
3839 If you wish to have binaries under /usr/bin but other parts of the
3840 installation under /usr/local, that's ok: you will be prompted
3841 separately for each of the installation directories, the prefix being
3842 only used to set the defaults.
3843
3844 EOM
3845 fn=d~
3846 rp='Installation prefix to use?'
3847 . ./getfile
3848 oldprefix=''
3849 case "$prefix" in
3850 '') ;;
3851 *)
3852         case "$ans" in
3853         "$prefix") ;;
3854         *) oldprefix="$prefix";;
3855         esac
3856         ;;
3857 esac
3858 prefix="$ans"
3859 prefixexp="$ansexp"
3860
3861 case "$afsroot" in
3862 '')     afsroot=/afs ;;
3863 *)      afsroot=$afsroot ;;
3864 esac
3865
3866 : is AFS running?
3867 echo " "
3868 case "$afs" in
3869 $define|true)   afs=true ;;
3870 $undef|false)   afs=false ;;
3871 *)      if test -d $afsroot; then
3872                 afs=true
3873         else
3874                 afs=false
3875         fi
3876         ;;
3877 esac
3878 if $afs; then
3879         echo "AFS may be running... I'll be extra cautious then..." >&4
3880 else
3881         echo "AFS does not seem to be running..." >&4
3882 fi
3883
3884 : determine installation prefix for where package is to be installed.
3885 if $afs; then 
3886 $cat <<EOM
3887
3888 Since you are running AFS, I need to distinguish the directory in which
3889 files will reside from the directory in which they are installed (and from
3890 which they are presumably copied to the former directory by occult means).
3891
3892 EOM
3893         case "$installprefix" in
3894         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3895         *) dflt="$installprefix";;
3896         esac
3897 else
3898 $cat <<EOM
3899
3900 In some special cases, particularly when building $package for distribution,
3901 it is convenient to distinguish the directory in which files should be
3902 installed from the directory ($prefix) in which they will
3903 eventually reside.  For most users, these two directories are the same.
3904
3905 EOM
3906         case "$installprefix" in
3907         '') dflt=$prefix ;;
3908         *) dflt=$installprefix;;
3909         esac
3910 fi
3911 fn=d~
3912 rp='What installation prefix should I use for installing files?'
3913 . ./getfile
3914 installprefix="$ans"
3915 installprefixexp="$ansexp"
3916
3917 : Perform the prefixexp/installprefixexp correction if necessary
3918 cat <<EOS >installprefix
3919 $startsh
3920 EOS
3921 cat <<'EOSC' >>installprefix
3922 : Change installation prefix, if necessary.
3923 if $test X"$prefix" != X"$installprefix"; then
3924     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3925 else
3926     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3927 fi
3928 EOSC
3929 chmod +x installprefix
3930 $eunicefix installprefix
3931
3932 : Set variables such as privlib and privlibexp from the output of ./getfile
3933 : performing the prefixexp/installprefixexp correction if necessary.
3934 cat <<EOS >setprefixvar
3935 $startsh
3936 EOS
3937 cat <<'EOSC' >>setprefixvar
3938 eval "${prefixvar}=\"\$ans\""
3939 eval "${prefixvar}exp=\"\$ansexp\""
3940 . ./installprefix
3941 EOSC
3942 chmod +x setprefixvar
3943 $eunicefix setprefixvar
3944
3945 : set up the script used to warn in case of inconsistency
3946 cat <<EOS >whoa
3947 $startsh
3948 EOS
3949 cat <<'EOSC' >>whoa
3950 dflt=y
3951 echo " "
3952 echo "*** WHOA THERE!!! ***" >&4
3953 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3954 rp="    Keep the $hint value?"
3955 . ./myread
3956 case "$ans" in
3957 y) td=$was; tu=$was;;
3958 esac
3959 EOSC
3960
3961 : function used to set $1 to $val
3962 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3963 case "$val$was" in
3964 $define$undef) . ./whoa; eval "$var=\$td";;
3965 $undef$define) . ./whoa; eval "$var=\$tu";;
3966 *) eval "$var=$val";;
3967 esac'
3968
3969 case "$usesocks" in
3970 $define|true|[yY]*)     dflt='y';;
3971 *) dflt='n';;
3972 esac
3973 cat <<EOM
3974
3975 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3976 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3977 to use the PerlIO abstraction layer, this will be implicitly selected.
3978
3979 If this doesn't make any sense to you, just accept the default '$dflt'.
3980 EOM
3981 rp='Build Perl for SOCKS?'
3982 . ./myread
3983 case "$ans" in
3984 y|Y)    val="$define" ;;     
3985 *)      val="$undef" ;;
3986 esac
3987 set usesocks
3988 eval $setvar
3989
3990 case "$usesocks" in
3991 $define|true|[yY]*) useperlio="$define";;
3992 esac
3993
3994 case "$useperlio" in
3995 $define|true|[yY]*|'')  dflt='y';;
3996 *) dflt='n';;
3997 esac
3998 cat <<EOM
3999
4000 Previous version of $package used the standard IO mechanisms as
4001 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4002 alternate IO mechanisms via the PerlIO abstraction layer, but the
4003 stdio mechanism is still available if needed.  The abstraction layer
4004 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4005 Using PerlIO with sfio may cause problems with some extension modules.
4006
4007 If this doesn't make any sense to you, just accept the default '$dflt'.
4008 EOM
4009 rp='Use the PerlIO abstraction layer?'
4010 . ./myread
4011 case "$ans" in
4012 y|Y) 
4013         val="$define"
4014         ;;
4015 *)      
4016         echo "Ok, doing things the stdio way."
4017         val="$undef"
4018         ;;
4019 esac
4020 set useperlio
4021 eval $setvar 
4022
4023 case "$usesocks" in
4024 $define|true|[yY]*)
4025         case "$useperlio" in
4026         $define|true|[yY]*) ;;
4027         *)      cat >&4 <<EOM
4028
4029 You are using the SOCKS proxy protocol library which means that you
4030 should also use the PerlIO layer.  You may be headed for trouble.
4031
4032 EOM
4033                 ;;
4034         esac
4035         ;;
4036 esac
4037
4038         
4039 case "$usethreads" in
4040 $define|true|[yY]*)     dflt='y';;
4041 *)     # Catch case where user specified ithreads or 5005threads but
4042        # forgot -Dusethreads (A.D. 4/2002)
4043        case "$useithreads$use5005threads" in
4044        *$define*)      
4045                 case "$useperlio" in
4046                 "$define")      dflt='y' ;;
4047                 *)              dflt='n' ;;
4048                 esac
4049                 ;;
4050        *)       dflt='n';;
4051        esac
4052        ;;
4053 esac
4054 cat <<EOM
4055
4056 Perl can be built to take advantage of threads on some systems.
4057 To do so, Configure can be run with -Dusethreads.
4058
4059 Note that Perl built with threading support runs slightly slower
4060 and uses more memory than plain Perl. The current implementation
4061 is believed to be stable, but it is fairly new, and so should be
4062 treated with caution.
4063
4064 If this doesn't make any sense to you, just accept the default '$dflt'.
4065 EOM
4066 rp='Build a threading Perl?'
4067 . ./myread
4068 case "$ans" in
4069 y|Y)    val="$define" ;;
4070 *)      val="$undef" ;;
4071 esac
4072 set usethreads
4073 eval $setvar
4074
4075 case "$usethreads" in
4076 $define)
4077         $cat <<EOM
4078
4079 Since release 5.6, Perl has had two different threading implementations,
4080 the newer interpreter-based version (ithreads) with one interpreter per
4081 thread, and the older 5.005 version (5005threads).
4082 The 5005threads version is effectively unmaintained and will probably be
4083 removed in Perl 5.10, so there should be no need to build a Perl using it
4084 unless needed for backwards compatibility with some existing 5.005threads
4085 code.
4086
4087 EOM
4088         : Default to ithreads unless overridden on command line or with
4089         : old config.sh
4090         dflt='y'
4091         case "$use5005threads" in
4092                 $define|true|[yY]*) dflt='n';;
4093         esac
4094         case "$useithreads" in
4095                 $undef|false|[nN]*) dflt='n';;
4096         esac
4097         rp='Use the newer interpreter-based ithreads?'
4098         . ./myread
4099         case "$ans" in
4100         y|Y)    val="$define" ;;
4101         *)      val="$undef" ;;
4102         esac
4103         set useithreads
4104         eval $setvar
4105         : Now set use5005threads to the opposite value.
4106         case "$useithreads" in
4107         $define) val="$undef" ;;
4108         *) val="$define" ;;
4109         esac
4110         set use5005threads
4111         eval $setvar
4112         ;;
4113 *)
4114         useithreads="$undef"
4115         use5005threads="$undef"
4116         ;;
4117 esac
4118
4119 case "$useithreads$use5005threads" in
4120 "$define$define")
4121         $cat >&4 <<EOM
4122
4123 You cannot have both the ithreads and the 5.005 threads enabled
4124 at the same time.  Disabling the 5.005 threads since they are
4125 much less stable than the ithreads.
4126
4127 EOM
4128         use5005threads="$undef"
4129         ;;
4130 esac
4131
4132 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4133         cat >&4 <<EOF
4134 ***
4135 *** To build with ithreads you must also use the PerlIO layer.
4136 *** Cannot continue, aborting.
4137 ***
4138 EOF
4139         exit 1
4140 fi
4141
4142 case "$d_oldpthreads" in
4143 '')     : Configure tests would be welcome here.  For now, assume undef.
4144         val="$undef" ;;
4145 *)      val="$d_oldpthreads" ;;
4146 esac
4147 set d_oldpthreads
4148 eval $setvar
4149
4150
4151 : Look for a hint-file generated 'call-back-unit'.  If the
4152 : user has specified that a threading perl is to be built,
4153 : we may need to set or change some other defaults.
4154 if $test -f usethreads.cbu; then
4155     echo "Your platform has some specific hints regarding threaded builds, using them..."
4156     . ./usethreads.cbu
4157 else
4158     case "$usethreads" in
4159         "$define"|true|[yY]*)
4160                 $cat <<EOM
4161 (Your platform does not have any specific hints for threaded builds.
4162  Assuming POSIX threads, then.)
4163 EOM
4164         ;;
4165     esac
4166 fi
4167
4168 cat <<EOM
4169
4170 Perl can be built so that multiple Perl interpreters can coexist
4171 within the same Perl executable.
4172 EOM
4173
4174 case "$useithreads" in
4175 $define)
4176         cat <<EOM
4177 This multiple interpreter support is required for interpreter-based threads.
4178 EOM
4179         val="$define"
4180         ;;
4181 *)      case "$usemultiplicity" in
4182         $define|true|[yY]*)     dflt='y';;
4183         *) dflt='n';;
4184         esac
4185         echo " "
4186         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4187         rp='Build Perl for multiplicity?'
4188         . ./myread
4189         case "$ans" in
4190         y|Y)    val="$define" ;;
4191         *)      val="$undef" ;;
4192         esac
4193         ;;
4194 esac
4195 set usemultiplicity
4196 eval $setvar
4197
4198
4199 case "$usemorebits" in
4200 "$define"|true|[yY]*)
4201         use64bitint="$define"
4202         uselongdouble="$define"
4203         usemorebits="$define"
4204         ;;
4205 *)      usemorebits="$undef"
4206         ;;
4207 esac
4208
4209 : make some quick guesses about what we are up against
4210 echo " "
4211 $echo $n "Hmm...  $c"
4212 echo exit 1 >bsd
4213 echo exit 1 >usg
4214 echo exit 1 >v7
4215 echo exit 1 >osf1
4216 echo exit 1 >eunice
4217 echo exit 1 >xenix
4218 echo exit 1 >venix
4219 echo exit 1 >os2
4220 d_bsd="$undef"
4221 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4222 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4223 then
4224         echo "Looks kind of like an OSF/1 system, but we'll see..."
4225         echo exit 0 >osf1
4226 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4227         xxx=`./loc addbib blurfl $pth`
4228         if $test -f $xxx; then
4229         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4230                 echo exit 0 >bsd
4231                 echo exit 0 >usg
4232         else
4233                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4234                         echo "Looks kind of like an extended USG system, but we'll see..."
4235                 else
4236                         echo "Looks kind of like a USG system, but we'll see..."
4237                 fi
4238                 echo exit 0 >usg
4239         fi
4240 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4241         echo "Looks kind of like a BSD system, but we'll see..."
4242         d_bsd="$define"
4243         echo exit 0 >bsd
4244 else
4245         echo "Looks kind of like a Version 7 system, but we'll see..."
4246         echo exit 0 >v7
4247 fi
4248 case "$eunicefix" in
4249 *unixtovms*)
4250         $cat <<'EOI'
4251 There is, however, a strange, musty smell in the air that reminds me of
4252 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4253 EOI
4254         echo exit 0 >eunice
4255         d_eunice="$define"
4256 : it so happens the Eunice I know will not run shell scripts in Unix format
4257         ;;
4258 *)
4259         echo " "
4260         echo "Congratulations.  You aren't running Eunice."
4261         d_eunice="$undef"
4262         ;;
4263 esac
4264 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4265 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4266 : semicolon as a patch separator
4267 case "$p_" in
4268 :) ;;
4269 *)
4270         $cat <<'EOI'
4271 I have the feeling something is not exactly right, however...don't tell me...
4272 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4273 (Or you may be running DOS with DJGPP.)
4274 EOI
4275         echo exit 0 >os2
4276         ;;
4277 esac
4278 if test -f /xenix; then
4279         echo "Actually, this looks more like a XENIX system..."
4280         echo exit 0 >xenix
4281         d_xenix="$define"
4282 else
4283         echo " "
4284         echo "It's not Xenix..."
4285         d_xenix="$undef"
4286 fi
4287 chmod +x xenix
4288 $eunicefix xenix
4289 if test -f /venix; then
4290         echo "Actually, this looks more like a VENIX system..."
4291         echo exit 0 >venix
4292 else
4293         echo " "
4294         if ./xenix; then
4295                 : null
4296         else
4297                 echo "Nor is it Venix..."
4298         fi
4299 fi
4300 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4301 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4302 $rm -f foo
4303
4304 case "$cc" in
4305 '') dflt=cc;;
4306 *) dflt="$cc";;
4307 esac
4308 rp="Use which C compiler?"
4309 . ./myread
4310 cc="$ans"
4311
4312 : See if they have not cc but they do have gcc
4313 . ./trygcc
4314 : Look for a hint-file generated 'call-back-unit'.  Now that the
4315 : user has specified the compiler, we may need to set or change some
4316 : other defaults.
4317 if $test -f cc.cbu; then
4318     . ./cc.cbu
4319 fi
4320 . ./checkcc
4321
4322 echo " "
4323 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4324 $cat >try.c <<EOM
4325 #include <stdio.h>
4326 int main() {
4327 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4328 #ifdef __VERSION__
4329         printf("%s\n", __VERSION__);
4330 #else
4331         printf("%s\n", "1");
4332 #endif
4333 #endif
4334         return(0);
4335 }
4336 EOM
4337 if $cc -o try $ccflags $ldflags try.c; then
4338         gccversion=`$run ./try`
4339         case "$gccversion" in
4340         '') echo "You are not using GNU cc." ;;
4341         *)  echo "You are using GNU cc $gccversion."
4342             ccname=gcc
4343             ;;
4344         esac
4345 else
4346         echo " "
4347         echo "*** WHOA THERE!!! ***" >&4
4348         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4349         case "$knowitall" in
4350         '')
4351         echo "    You'd better start hunting for one and let me know about it." >&4
4352                 exit 1
4353                 ;;
4354         esac
4355 fi
4356 $rm -f try try.*
4357 case "$gccversion" in
4358 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4359 esac
4360 case "$gccversion" in
4361 '') gccosandvers='' ;;
4362 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4363    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4364    gccshortvers=''
4365    case "$gccosandvers" in
4366    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4367    $osname$osvers) ;; # looking good
4368    $osname*) cat <<EOM >&4
4369
4370 *** WHOA THERE!!! ***
4371
4372     Your gcc has not been compiled for the exact release of
4373     your operating system ($gccosandvers versus $osname$osvers).
4374
4375     In general it is a good idea to keep gcc synchronized with
4376     the operating system because otherwise serious problems
4377     may ensue when trying to compile software, like Perl.
4378
4379     I'm trying to be optimistic here, though, and will continue.
4380     If later during the configuration and build icky compilation
4381     problems appear (headerfile conflicts being the most common
4382     manifestation), I suggest reinstalling the gcc to match
4383     your operating system release.
4384
4385 EOM
4386       ;;
4387    *) gccosandvers='' ;; # failed to parse, better be silent
4388    esac
4389    ;;
4390 esac
4391 case "$ccname" in
4392 '') ccname="$cc" ;;
4393 esac
4394
4395 # gcc 3.* complain about adding -Idirectories that they already know about,
4396 # so we will take those off from locincpth.
4397 case "$gccversion" in
4398 3*)
4399     echo "main(){}">try.c
4400     for incdir in $locincpth; do
4401        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4402              grep '^c[cp]p*[01]: warning: changing search order '`
4403        if test "X$warn" != X; then
4404            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4405        fi
4406     done
4407     $rm -f try try.*
4408 esac
4409
4410 : What should the include directory be ?
4411 echo " "
4412 $echo $n "Hmm...  $c"
4413 dflt='/usr/include'
4414 incpath=''
4415 mips_type=''
4416 if $test -f /bin/mips && /bin/mips; then
4417         echo "Looks like a MIPS system..."
4418         $cat >usr.c <<'EOCP'
4419 #ifdef SYSTYPE_BSD43
4420 /bsd43
4421 #endif
4422 EOCP
4423         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4424                 dflt='/bsd43/usr/include'
4425                 incpath='/bsd43'
4426                 mips_type='BSD 4.3'
4427         else
4428                 mips_type='System V'
4429         fi
4430         $rm -f usr.c usr.out
4431         echo "and you're compiling with the $mips_type compiler and libraries."
4432         xxx_prompt=y
4433         echo "exit 0" >mips
4434 else
4435         echo "Doesn't look like a MIPS system."
4436         xxx_prompt=n
4437         echo "exit 1" >mips
4438 fi
4439 chmod +x mips
4440 $eunicefix mips
4441 case "$usrinc" in
4442 '') ;;
4443 *) dflt="$usrinc";;
4444 esac
4445 case "$xxx_prompt" in
4446 y)      fn=d/
4447         echo " "
4448         rp='Where are the include files you want to use?'
4449         . ./getfile
4450         usrinc="$ans"
4451         ;;
4452 *)      usrinc="$dflt"
4453         ;;
4454 esac
4455
4456 : see how we invoke the C preprocessor
4457 echo " "
4458 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4459 cat <<'EOT' >testcpp.c
4460 #define ABC abc
4461 #define XYZ xyz
4462 ABC.XYZ
4463 EOT
4464 cd ..
4465 if test ! -f cppstdin; then
4466         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4467                 # AIX cc -E doesn't show the absolute headerfile
4468                 # locations but we'll cheat by using the -M flag.
4469                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4470         else
4471                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4472         fi
4473 else
4474         echo "Keeping your $hint cppstdin wrapper."
4475 fi
4476 chmod 755 cppstdin
4477 wrapper=`pwd`/cppstdin
4478 ok='false'
4479 cd UU
4480
4481 if $test "X$cppstdin" != "X" && \
4482         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4483         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4484 then
4485         echo "You used to use $cppstdin $cppminus so we'll use that again."
4486         case "$cpprun" in
4487         '') echo "But let's see if we can live without a wrapper..." ;;
4488         *)
4489                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4490                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4491                 then
4492                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4493                         ok='true'
4494                 else
4495                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4496                 fi
4497                 ;;
4498         esac
4499 else
4500         case "$cppstdin" in
4501         '') ;;
4502         *)
4503                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4504                 ;;
4505         esac
4506 fi
4507
4508 if $ok; then
4509         : nothing
4510 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4511         $cc -E <testcpp.c >testcpp.out 2>&1; \
4512         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4513         echo "Yup, it does."
4514         x_cpp="$cc -E"
4515         x_minus='';
4516 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4517         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4518         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4519         echo "Yup, it does."
4520         x_cpp="$cc -E"
4521         x_minus='-';
4522 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4523         $cc -P <testcpp.c >testcpp.out 2>&1; \
4524         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4525         echo "Yipee, that works!"
4526         x_cpp="$cc -P"
4527         x_minus='';
4528 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4529         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4530         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4531         echo "At long last!"
4532         x_cpp="$cc -P"
4533         x_minus='-';
4534 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4535         $cpp <testcpp.c >testcpp.out 2>&1; \
4536         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4537         echo "It works!"
4538         x_cpp="$cpp"
4539         x_minus='';
4540 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4541         $cpp - <testcpp.c >testcpp.out 2>&1; \
4542         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4543         echo "Hooray, it works!  I was beginning to wonder."
4544         x_cpp="$cpp"
4545         x_minus='-';
4546 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4547         $wrapper <testcpp.c >testcpp.out 2>&1; \
4548         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4549         x_cpp="$wrapper"
4550         x_minus=''
4551         echo "Eureka!"
4552 else
4553         dflt=''
4554         rp="No dice.  I can't find a C preprocessor.  Name one:"
4555         . ./myread
4556         x_cpp="$ans"
4557         x_minus=''
4558         $x_cpp <testcpp.c >testcpp.out 2>&1
4559         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4560                 echo "OK, that will do." >&4
4561         else
4562 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4563                 exit 1
4564         fi
4565 fi
4566
4567 case "$ok" in
4568 false)
4569         cppstdin="$x_cpp"
4570         cppminus="$x_minus"
4571         cpprun="$x_cpp"
4572         cpplast="$x_minus"
4573         set X $x_cpp
4574         shift
4575         case "$1" in
4576         "$cpp")
4577                 echo "Perhaps can we force $cc -E using a wrapper..."
4578                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4579                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4580                 then
4581                         echo "Yup, we can."
4582                         cppstdin="$wrapper"
4583                         cppminus='';
4584                 else
4585                         echo "Nope, we'll have to live without it..."
4586                 fi
4587                 ;;
4588         esac
4589         case "$cpprun" in
4590         "$wrapper")
4591                 cpprun=''
4592                 cpplast=''
4593                 ;;
4594         esac
4595         ;;
4596 esac
4597
4598 case "$cppstdin" in
4599 "$wrapper"|'cppstdin') ;;
4600 *) $rm -f $wrapper;;
4601 esac
4602 $rm -f testcpp.c testcpp.out
4603
4604 : Set private lib path
4605 case "$plibpth" in
4606 '') if ./mips; then
4607                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4608         fi;;
4609 esac
4610 case "$libpth" in
4611 ' ') dlist='';;
4612 '') dlist="$loclibpth $plibpth $glibpth";;
4613 *) dlist="$libpth";;
4614 esac
4615
4616 : Now check and see which directories actually exist, avoiding duplicates
4617 libpth=''
4618 for xxx in $dlist
4619 do
4620     if $test -d $xxx; then
4621                 case " $libpth " in
4622                 *" $xxx "*) ;;
4623                 *) libpth="$libpth $xxx";;
4624                 esac
4625     fi
4626 done
4627 $cat <<'EOM'
4628
4629 Some systems have incompatible or broken versions of libraries.  Among
4630 the directories listed in the question below, please remove any you
4631 know not to be holding relevant libraries, and add any that are needed.
4632 Say "none" for none.
4633
4634 EOM
4635 case "$libpth" in
4636 '') dflt='none';;
4637 *)
4638         set X $libpth
4639         shift
4640         dflt=${1+"$@"}
4641         ;;
4642 esac
4643 rp="Directories to use for library searches?"
4644 . ./myread
4645 case "$ans" in
4646 none) libpth=' ';;
4647 *) libpth="$ans";;
4648 esac
4649
4650 : compute shared library extension
4651 case "$so" in
4652 '')
4653         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4654                 dflt='sl'
4655         else
4656                 dflt='so'
4657         fi
4658         ;;
4659 *) dflt="$so";;
4660 esac
4661 $cat <<EOM
4662
4663 On some systems, shared libraries may be available.  Answer 'none' if
4664 you want to suppress searching of shared libraries for the remainder
4665 of this configuration.
4666
4667 EOM
4668 rp='What is the file extension used for shared libraries?'
4669 . ./myread
4670 so="$ans"
4671
4672 : Define several unixisms.
4673 : Hints files or command line option can be used to override them.
4674 : The convoluted testing is in case hints files set either the old
4675 : or the new name.
4676 case "$_exe" in
4677 '')     case "$exe_ext" in
4678         '')     ;;
4679         *)      _exe="$exe_ext" ;;
4680         esac
4681         ;;
4682 esac
4683 case "$_a" in
4684 '')     case "$lib_ext" in
4685     '') _a='.a';;
4686         *)      _a="$lib_ext" ;;
4687         esac
4688         ;;
4689 esac
4690 case "$_o" in
4691 '') case "$obj_ext" in
4692         '')     _o='.o';;
4693         *)      _o="$obj_ext";;
4694         esac
4695         ;;
4696 esac
4697 case "$p_" in
4698 '') case "$path_sep" in
4699         '')     p_=':';;
4700         *)      p_="$path_sep";;
4701         esac
4702         ;;
4703 esac
4704 exe_ext=$_exe
4705 lib_ext=$_a
4706 obj_ext=$_o
4707 path_sep=$p_
4708
4709 : Which makefile gets called first.  This is used by make depend.
4710 case "$firstmakefile" in
4711 '') firstmakefile='makefile';;
4712 esac
4713
4714 case "$ccflags" in
4715 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4716 esac
4717
4718 case "$uselongdouble" in
4719 $define|true|[yY]*)     dflt='y';;
4720 *) dflt='n';;
4721 esac
4722 cat <<EOM
4723
4724 Perl can be built to take advantage of long doubles which
4725 (if available) may give more accuracy and range for floating point numbers.
4726
4727 If this doesn't make any sense to you, just accept the default '$dflt'.
4728 EOM
4729 rp='Try to use long doubles if available?'
4730 . ./myread
4731 case "$ans" in
4732 y|Y)    val="$define"   ;;
4733 *)      val="$undef"    ;;
4734 esac
4735 set uselongdouble
4736 eval $setvar
4737
4738 case "$uselongdouble" in
4739 true|[yY]*) uselongdouble="$define" ;;
4740 esac
4741
4742 : Look for a hint-file generated 'call-back-unit'.  If the
4743 : user has specified that long doubles should be used,
4744 : we may need to set or change some other defaults.
4745 if $test -f uselongdouble.cbu; then
4746     echo "Your platform has some specific hints regarding long doubles, using them..."
4747     . ./uselongdouble.cbu
4748 else
4749     case "$uselongdouble" in
4750         $define)
4751                 $cat <<EOM
4752 (Your platform does not have any specific hints for long doubles.)
4753 EOM
4754         ;;
4755     esac
4756 fi
4757
4758 : Looking for optional libraries
4759 echo " "
4760 echo "Checking for optional libraries..." >&4
4761 case "$libs" in
4762 ' '|'') dflt='';;
4763 *) dflt="$libs";;
4764 esac
4765 case "$libswanted" in
4766 '') libswanted='c_s';;
4767 esac
4768 case "$usesocks" in
4769 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4770 esac
4771 libsfound=''
4772 libsfiles=''
4773 libsdirs=''
4774 libspath=''
4775 for thisdir in $libpth $xlibpth; do
4776   test -d $thisdir && libspath="$libspath $thisdir"
4777 done
4778 for thislib in $libswanted; do
4779         for thisdir in $libspath; do
4780             xxx=''
4781             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4782                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4783                 $test -f "$xxx" && eval $libscheck
4784                 $test -f "$xxx" && libstyle=shared
4785             fi
4786             if test ! -f "$xxx"; then
4787                 xxx=$thisdir/lib$thislib.$so
4788                 $test -f "$xxx" && eval $libscheck
4789                 $test -f "$xxx" && libstyle=shared
4790             fi  
4791             if test ! -f "$xxx"; then
4792                 xxx=$thisdir/lib$thislib$_a
4793                 $test -f "$xxx" && eval $libscheck
4794                 $test -f "$xxx" && libstyle=static
4795             fi
4796             if test ! -f "$xxx"; then
4797                 xxx=$thisdir/$thislib$_a
4798                 $test -f "$xxx" && eval $libscheck
4799                 $test -f "$xxx" && libstyle=static
4800             fi
4801             if test ! -f "$xxx"; then
4802                 xxx=$thisdir/lib${thislib}_s$_a
4803                 $test -f "$xxx" && eval $libscheck
4804                 $test -f "$xxx" && libstyle=static
4805                 $test -f "$xxx" && thislib=${thislib}_s
4806             fi
4807             if test ! -f "$xxx"; then
4808                 xxx=$thisdir/Slib$thislib$_a
4809                 $test -f "$xxx" && eval $libscheck
4810                 $test -f "$xxx" && libstyle=static
4811             fi
4812             if $test -f "$xxx"; then
4813                 case "$libstyle" in
4814                 shared) echo "Found -l$thislib (shared)." ;;
4815                 static) echo "Found -l$thislib." ;;
4816                 *)      echo "Found -l$thislib ($libstyle)." ;;
4817                 esac
4818                 case " $dflt " in
4819                 *"-l$thislib "*);;
4820                 *) dflt="$dflt -l$thislib"
4821                    libsfound="$libsfound $xxx"
4822                    yyy=`basename $xxx`
4823                    libsfiles="$libsfiles $yyy"
4824                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4825                    case " $libsdirs " in
4826                    *" $yyy "*) ;;
4827                    *) libsdirs="$libsdirs $yyy" ;;
4828                    esac
4829                    ;;
4830                 esac
4831                 break
4832             fi  
4833         done
4834         if $test ! -f "$xxx"; then
4835             echo "No -l$thislib."
4836         fi
4837 done
4838 set X $dflt
4839 shift
4840 dflt="$*"
4841 case "$libs" in
4842 '') dflt="$dflt";;
4843 *) dflt="$libs";;
4844 esac
4845 case "$dflt" in
4846 ' '|'') dflt='none';;
4847 esac
4848
4849 $cat <<EOM
4850
4851 In order to compile $package on your machine, a number of libraries
4852 are usually needed.  Include any other special libraries here as well.
4853 Say "none" for none.  The default list is almost always right.
4854 EOM
4855
4856 echo " "
4857 rp="What libraries to use?"
4858 . ./myread
4859 case "$ans" in
4860 none) libs=' ';;
4861 *) libs="$ans";;
4862 esac
4863
4864 : determine optimization, if desired, or use for debug flag also
4865 case "$optimize" in
4866 ' '|$undef) dflt='none';;
4867 '') dflt='-O';;
4868 *) dflt="$optimize";;
4869 esac
4870 $cat <<EOH
4871
4872 By default, $package compiles with the -O flag to use the optimizer.
4873 Alternately, you might want to use the symbolic debugger, which uses
4874 the -g flag (on traditional Unix systems).  Either flag can be
4875 specified here.  To use neither flag, specify the word "none".
4876
4877 EOH
4878 rp="What optimizer/debugger flag should be used?"
4879 . ./myread
4880 optimize="$ans"
4881 case "$optimize" in
4882 'none') optimize=" ";;
4883 esac
4884
4885 : Check what DEBUGGING is required from the command line
4886 : -DEBUGGING      or -DDEBUGGING or
4887 : -DEBUGGING=both                       = -g + -DDEBUGGING
4888 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4889 : -DEBUGGING=none or -UDEBUGGING        =
4890 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4891 case "$EBUGGING" in
4892 '')     ;;
4893 *)      DEBUGGING=$EBUGGING ;;
4894 esac
4895
4896 case "$DEBUGGING" in
4897 -g|$define)
4898     case "$optimize" in
4899         *-g*) ;;
4900         *)    optimize="$optimize -g" ;;
4901     esac ;;
4902 none|$undef)
4903     case "$optimize" in
4904         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
4905                 shift
4906                 optimize="$*"
4907                 ;;
4908     esac ;;
4909 esac
4910
4911 dflt=''
4912 case "$DEBUGGING" in
4913 both|$define) dflt='-DDEBUGGING'
4914 esac
4915
4916 : We will not override a previous value, but we might want to
4917 : augment a hint file
4918 case "$hint" in
4919 default|recommended)
4920         case "$gccversion" in
4921         1*) dflt="$dflt -fpcc-struct-return" ;;
4922         esac
4923         case "$optimize:$DEBUGGING" in
4924         *-g*:old) dflt="$dflt -DDEBUGGING";;
4925         esac
4926         case "$gccversion" in
4927         2*) if test -d /etc/conf/kconfig.d &&
4928                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4929                 then
4930                         # Interactive Systems (ISC) POSIX mode.
4931                         dflt="$dflt -posix"
4932                 fi
4933                 ;;
4934         esac
4935         case "$gccversion" in
4936         1*) ;;
4937         2.[0-8]*) ;;
4938         ?*)     echo " "
4939                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4940                 echo 'int main(void) { return 0; }' > gcctest.c
4941                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4942                         echo "Yes, it does." 2>&1
4943                         case "$ccflags" in
4944                         *strict-aliasing*)
4945                                 echo "Leaving current flags $ccflags alone." 2>&1
4946                                 ;;
4947                         *) dflt="$dflt -fno-strict-aliasing" ;;
4948                         esac
4949                 else
4950                         echo "Nope, it doesn't, but that's ok." 2>&1
4951                 fi
4952                 ;;
4953         esac
4954         # For gcc, adding -pipe speeds up compilations for some, but apparently
4955         # some assemblers can't read from stdin.  (It also slows down compilations
4956         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4957         case "$gccversion" in
4958         ?*)     echo " "
4959                 echo "Checking if your compiler accepts -pipe" 2>&1
4960                 echo 'int main(void) { return 0; }' > gcctest.c
4961                 if $cc -pipe -o gcctest gcctest.c; then
4962                         echo "Yes, it does." 2>&1
4963                         case "$ccflags" in
4964                         *-pipe*)
4965                                 echo "Leaving current flags $ccflags alone." 2>&1
4966                                 ;;
4967                         *) dflt="$dflt -pipe" ;;
4968                         esac
4969                 else
4970                         echo "Nope, it doesn't, but that's ok." 2>&1
4971                 fi
4972                 ;;
4973         esac
4974         ;;
4975 esac
4976
4977 case "$mips_type" in
4978 *BSD*|'') inclwanted="$locincpth $usrinc";;
4979 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4980 esac
4981 for thisincl in $inclwanted; do
4982         if $test -d $thisincl; then
4983                 if $test x$thisincl != x$usrinc; then
4984                         case "$dflt" in
4985                         *" -I$thisincl "*);;
4986                         *) dflt="$dflt -I$thisincl ";;
4987                         esac
4988                 fi
4989         fi
4990 done
4991
4992 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4993         xxx=true;
4994 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4995         xxx=true;
4996 else
4997         xxx=false;
4998 fi;
4999 if $xxx; then
5000         case "$dflt" in
5001         *$2*);;
5002         *) dflt="$dflt -D$2";;
5003         esac;
5004 fi'
5005
5006 set signal.h LANGUAGE_C; eval $inctest
5007
5008 case "$usesocks" in
5009 $define)
5010         ccflags="$ccflags -DSOCKS"
5011         ;;
5012 esac
5013
5014 case "$hint" in
5015 default|recommended) dflt="$ccflags $dflt" ;;
5016 *) dflt="$ccflags";;
5017 esac
5018
5019 case "$dflt" in
5020 ''|' ') dflt=none;;
5021 esac
5022
5023 $cat <<EOH
5024
5025 Your C compiler may want other flags.  For this question you should include
5026 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5027 but you should NOT include libraries or ld flags like -lwhatever.  If you
5028 want $package to honor its debug switch, you should include -DDEBUGGING here.
5029 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5030
5031 To use no flags, specify the word "none".
5032
5033 EOH
5034 set X $dflt
5035 shift
5036 dflt=${1+"$@"}
5037 rp="Any additional cc flags?"
5038 . ./myread
5039 case "$ans" in
5040 none) ccflags='';;
5041 *) ccflags="$ans";;
5042 esac
5043
5044 : the following weeds options from ccflags that are of no interest to cpp
5045 case "$cppflags" in
5046 '') cppflags="$ccflags" ;;
5047 *)  cppflags="$cppflags $ccflags" ;;
5048 esac
5049 case "$gccversion" in
5050 1*) cppflags="$cppflags -D__GNUC__"
5051 esac
5052 case "$mips_type" in
5053 '');;
5054 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5055 esac
5056 case "$cppflags" in
5057 '');;
5058 *)
5059         echo " "
5060         echo "Let me guess what the preprocessor flags are..." >&4
5061         set X $cppflags
5062         shift
5063         cppflags=''
5064         $cat >cpp.c <<'EOM'
5065 #define BLURFL foo
5066
5067 BLURFL xx LFRULB
5068 EOM
5069         previous=''
5070         for flag in $*
5071         do
5072                 case "$flag" in
5073                 -*) ftry="$flag";;
5074                 *) ftry="$previous $flag";;
5075                 esac
5076                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5077                         >cpp1.out 2>/dev/null && \
5078                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5079                         >cpp2.out 2>/dev/null && \
5080                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5081                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5082                 then
5083                         cppflags="$cppflags $ftry"
5084                         previous=''
5085                 else
5086                         previous="$flag"
5087                 fi
5088         done
5089         set X $cppflags
5090         shift
5091         cppflags=${1+"$@"}
5092         case "$cppflags" in
5093         *-*)  echo "They appear to be: $cppflags";;
5094         esac
5095         $rm -f cpp.c cpp?.out
5096         ;;
5097 esac
5098
5099 : flags used in final linking phase
5100 case "$ldflags" in
5101 '') if ./venix; then
5102                 dflt='-i -z'
5103         else
5104                 dflt=''
5105         fi
5106         case "$ccflags" in
5107         *-posix*) dflt="$dflt -posix" ;;
5108         esac
5109         ;;
5110 *) dflt="$ldflags";;
5111 esac
5112
5113 : Try to guess additional flags to pick up local libraries.
5114 for thislibdir in $libpth; do
5115         case " $loclibpth " in
5116         *" $thislibdir "*)
5117                 case "$dflt " in
5118                 *"-L$thislibdir "*) ;;
5119                 *)  dflt="$dflt -L$thislibdir" ;;
5120                 esac
5121                 ;;
5122         esac
5123 done
5124
5125 case "$dflt" in
5126 '') dflt='none' ;;
5127 esac
5128
5129 $cat <<EOH
5130
5131 Your C linker may need flags.  For this question you should
5132 include -L/whatever and any other flags used by the C linker, but you
5133 should NOT include libraries like -lwhatever.
5134
5135 Make sure you include the appropriate -L/path flags if your C linker
5136 does not normally search all of the directories you specified above,
5137 namely
5138         $libpth
5139 To use no flags, specify the word "none".
5140
5141 EOH
5142
5143 rp="Any additional ld flags (NOT including libraries)?"
5144 . ./myread
5145 case "$ans" in
5146 none) ldflags='';;
5147 *) ldflags="$ans";;
5148 esac
5149 rmlist="$rmlist pdp11"
5150
5151 : coherency check
5152 echo " "
5153 echo "Checking your choice of C compiler and flags for coherency..." >&4
5154 $cat > try.c <<'EOF'
5155 #include <stdio.h>
5156 int main() { printf("Ok\n"); return(0); }
5157 EOF
5158 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5159 shift
5160 $cat >try.msg <<'EOM'
5161 I've tried to compile and run the following simple program:
5162
5163 EOM
5164 $cat try.c >> try.msg
5165
5166 $cat >> try.msg <<EOM
5167
5168 I used the command:
5169
5170         $*
5171         $run ./try
5172
5173 and I got the following output:
5174
5175 EOM
5176 dflt=y
5177 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5178         if $sh -c "$run ./try" >>try.msg 2>&1; then
5179                 xxx=`$run ./try`
5180                 case "$xxx" in
5181                 "Ok") dflt=n ;;
5182                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5183                         case " $libs " in
5184                         *" -lsfio "*)
5185                                 cat >> try.msg <<'EOQS'
5186 If $libs contains -lsfio, and sfio is mis-configured, then it
5187 sometimes (apparently) runs and exits with a 0 status, but with no
5188 output!  It may have to do with sfio's use of _exit vs. exit.
5189
5190 EOQS
5191                                 rp="You have a big problem.  Shall I abort Configure"
5192                                 dflt=y
5193                                 ;;
5194                         esac
5195                         ;;
5196                 esac
5197         else
5198                 echo "The program compiled OK, but exited with status $?." >>try.msg
5199                 rp="You have a problem.  Shall I abort Configure"
5200                 dflt=y
5201         fi
5202 else
5203         echo "I can't compile the test program." >>try.msg
5204         rp="You have a BIG problem.  Shall I abort Configure"
5205         dflt=y
5206 fi
5207 case "$dflt" in
5208 y)
5209         $cat try.msg >&4
5210         case "$knowitall" in
5211         '')
5212                 echo "(The supplied flags or libraries might be incorrect.)"
5213                 ;;
5214         *) dflt=n;;
5215         esac
5216         echo " "
5217         . ./myread
5218         case "$ans" in
5219         n*|N*) ;;
5220         *)      echo "Ok.  Stopping Configure." >&4
5221                 exit 1
5222                 ;;
5223         esac
5224         ;;
5225 n) echo "OK, that should do.";;
5226 esac
5227 $rm -f try try.* core
5228
5229 : define a shorthand compile call
5230 compile='
5231 mc_file=$1;
5232 shift;
5233 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5234 : define a shorthand compile call for compilations that should be ok.
5235 compile_ok='
5236 mc_file=$1;
5237 shift;
5238 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5239
5240 : determine filename position in cpp output
5241 echo " "
5242 echo "Computing filename position in cpp output for #include directives..." >&4
5243 case "$osname" in
5244 vos) testaccess=-e ;;
5245 *)   testaccess=-r ;;
5246 esac
5247 echo '#include <stdio.h>' > foo.c
5248 $cat >fieldn <<EOF
5249 $startsh
5250 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5251 $grep '^[       ]*#.*stdio\.h' | \
5252 while read cline; do
5253         pos=1
5254         set \$cline
5255         while $test \$# -gt 0; do
5256                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5257                         echo "\$pos"
5258                         exit 0
5259                 fi
5260                 shift
5261                 pos=\`expr \$pos + 1\`
5262         done
5263 done
5264 EOF
5265 chmod +x fieldn
5266 fieldn=`./fieldn`
5267 $rm -f foo.c fieldn
5268 case $fieldn in
5269 '') pos='???';;
5270 1) pos=first;;
5271 2) pos=second;;
5272 3) pos=third;;
5273 *) pos="${fieldn}th";;
5274 esac
5275 echo "Your cpp writes the filename in the $pos field of the line."
5276
5277 case "$osname" in
5278 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5279 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5280 *)   cppfilter='' ;;
5281 esac
5282 : locate header file
5283 $cat >findhdr <<EOF
5284 $startsh
5285 wanted=\$1
5286 name=''
5287 for usrincdir in $usrinc
5288 do
5289         if test -f \$usrincdir/\$wanted; then
5290                 echo "\$usrincdir/\$wanted"
5291                 exit 0
5292         fi
5293 done
5294 awkprg='{ print \$$fieldn }'
5295 echo "#include <\$wanted>" > foo\$\$.c
5296 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5297 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5298 while read cline; do
5299         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5300         case "\$name" in
5301         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5302         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5303         *) exit 2;;
5304         esac;
5305 done;
5306 #
5307 # status = 0: grep returned 0 lines, case statement not executed
5308 # status = 1: headerfile found
5309 # status = 2: while loop executed, no headerfile found
5310 #
5311 status=\$?
5312 $rm -f foo\$\$.c;
5313 if test \$status -eq 1; then
5314         exit 0;
5315 fi
5316 exit 1
5317 EOF
5318 chmod +x findhdr
5319
5320 : define an alternate in-header-list? function
5321 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5322 cont=true; xxf="echo \"<\$1> found.\" >&4";
5323 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5324 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5325 esac;
5326 case $# in 4) instead=instead;; *) instead="at last";; esac;
5327 while $test "$cont"; do
5328         xxx=`./findhdr $1`
5329         var=$2; eval "was=\$$2";
5330         if $test "$xxx" && $test -r "$xxx";
5331         then eval $xxf;
5332         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5333                 cont="";
5334         else eval $xxnf;
5335         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5336         set $yyy; shift; shift; yyy=$@;
5337         case $# in 0) cont="";;
5338         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5339                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5340         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5341                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5342         esac;
5343 done;
5344 while $test "$yyy";
5345 do set $yyy; var=$2; eval "was=\$$2";
5346         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5347         set $yyy; shift; shift; yyy=$@;
5348 done'
5349
5350 : see if stdlib is available
5351 set stdlib.h i_stdlib
5352 eval $inhdr
5353
5354 : check for lengths of integral types
5355 echo " "
5356 case "$intsize" in
5357 '')
5358         echo "Checking to see how big your integers are..." >&4
5359         $cat >try.c <<EOCP
5360 #include <stdio.h>
5361 #$i_stdlib I_STDLIB
5362 #ifdef I_STDLIB
5363 #include <stdlib.h>
5364 #endif
5365 int main()
5366 {
5367         printf("intsize=%d;\n", (int)sizeof(int));
5368         printf("longsize=%d;\n", (int)sizeof(long));
5369         printf("shortsize=%d;\n", (int)sizeof(short));
5370         exit(0);
5371 }
5372 EOCP
5373         set try
5374         if eval $compile_ok && $run ./try > /dev/null; then
5375                 eval `$run ./try`
5376                 echo "Your integers are $intsize bytes long."
5377                 echo "Your long integers are $longsize bytes long."
5378                 echo "Your short integers are $shortsize bytes long."
5379         else
5380                 $cat >&4 <<EOM
5381 !
5382 Help! I can't compile and run the intsize test program: please enlighten me!
5383 (This is probably a misconfiguration in your system or libraries, and
5384 you really ought to fix it.  Still, I'll try anyway.)
5385 !
5386 EOM
5387                 dflt=4
5388                 rp="What is the size of an integer (in bytes)?"
5389                 . ./myread
5390                 intsize="$ans"
5391                 dflt=$intsize
5392                 rp="What is the size of a long integer (in bytes)?"
5393                 . ./myread
5394                 longsize="$ans"
5395                 dflt=2
5396                 rp="What is the size of a short integer (in bytes)?"
5397                 . ./myread
5398                 shortsize="$ans"
5399         fi
5400         ;;
5401 esac
5402 $rm -f try try.*
5403
5404 : check for long long
5405 echo " "
5406 echo "Checking to see if you have long long..." >&4
5407 echo 'int main() { long long x = 7; return 0; }' > try.c
5408 set try
5409 if eval $compile; then
5410         val="$define"
5411         echo "You have long long."
5412 else
5413         val="$undef"
5414         echo "You do not have long long."
5415 fi
5416 $rm try.*
5417 set d_longlong
5418 eval $setvar
5419
5420 : check for length of long long
5421 case "${d_longlong}${longlongsize}" in
5422 $define)
5423         echo " "
5424         echo "Checking to see how big your long longs are..." >&4
5425         $cat >try.c <<'EOCP'
5426 #include <stdio.h>
5427 int main()
5428 {
5429     printf("%d\n", (int)sizeof(long long));
5430     return(0);
5431 }
5432 EOCP
5433         set try
5434         if eval $compile_ok; then
5435                 longlongsize=`$run ./try`
5436                 echo "Your long longs are $longlongsize bytes long."
5437         else
5438                 dflt='8'
5439                 echo " "
5440                 echo "(I can't seem to compile the test program.  Guessing...)"
5441                 rp="What is the size of a long long (in bytes)?"
5442                 . ./myread
5443                 longlongsize="$ans"
5444         fi
5445         if $test "X$longsize" = "X$longlongsize"; then
5446                 echo "(That isn't any different from an ordinary long.)"
5447         fi      
5448         ;;
5449 esac
5450 $rm -f try.* try
5451
5452 : see if inttypes.h is available
5453 : we want a real compile instead of Inhdr because some systems
5454 : have an inttypes.h which includes non-existent headers
5455 echo " "
5456 $cat >try.c <<EOCP
5457 #include <inttypes.h>
5458 int main() {
5459         static int32_t foo32 = 0x12345678;
5460 }
5461 EOCP
5462 set try
5463 if eval $compile; then
5464         echo "<inttypes.h> found." >&4
5465         val="$define"
5466 else
5467         echo "<inttypes.h> NOT found." >&4
5468         val="$undef"
5469 fi
5470 $rm -f try.c try
5471 set i_inttypes
5472 eval $setvar
5473
5474 : check for int64_t
5475 echo " "
5476 echo "Checking to see if you have int64_t..." >&4
5477 $cat >try.c <<EOCP
5478 #include <sys/types.h>
5479 #$i_inttypes I_INTTYPES
5480 #ifdef I_INTTYPES
5481 #include <inttypes.h>
5482 #endif
5483 int main() { int64_t x = 7; }
5484 EOCP
5485 set try
5486 if eval $compile; then
5487         val="$define"
5488         echo "You have int64_t."
5489 else
5490         val="$undef"
5491         echo "You do not have int64_t."
5492 fi
5493 $rm -f try try.*
5494 set d_int64_t
5495 eval $setvar
5496
5497
5498 echo " "
5499 echo "Checking which 64-bit integer type we could use..." >&4
5500
5501 case "$intsize" in
5502 8) val=int
5503    set quadtype
5504    eval $setvar
5505    val='"unsigned int"'
5506    set uquadtype
5507    eval $setvar
5508    quadkind=1
5509    ;;
5510 *) case "$longsize" in
5511    8) val=long
5512       set quadtype
5513       eval $setvar
5514       val='"unsigned long"'
5515       set uquadtype
5516       eval $setvar
5517       quadkind=2
5518       ;;
5519    *) case "$d_longlong:$longlongsize" in
5520       define:8)
5521         val='"long long"'
5522         set quadtype
5523         eval $setvar
5524         val='"unsigned long long"'
5525         set uquadtype
5526         eval $setvar
5527         quadkind=3
5528         ;;
5529       *) case "$d_int64_t" in
5530          define)
5531            val=int64_t
5532            set quadtype
5533            eval $setvar
5534            val=uint64_t
5535            set uquadtype
5536            eval $setvar
5537            quadkind=4
5538            ;;
5539          esac
5540          ;;
5541       esac
5542       ;;
5543    esac
5544    ;;
5545 esac
5546
5547 case "$quadtype" in
5548 '')     echo "Alas, no 64-bit integer types in sight." >&4
5549         d_quad="$undef"
5550         ;;
5551 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5552         d_quad="$define"
5553         ;;
5554 esac
5555
5556
5557 case "$uselonglong" in
5558 "$define"|true|[yY]*)
5559         cat <<EOM >&4
5560
5561 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5562 EOM
5563         use64bitint="$define"
5564         ;;
5565 esac                          
5566 case "$use64bits" in
5567 "$define"|true|[yY]*)
5568         cat <<EOM >&4
5569
5570 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5571 EOM
5572         use64bitint="$define"
5573         ;;
5574 esac                          
5575 case "$use64bitints" in
5576 "$define"|true|[yY]*)
5577         cat <<EOM >&4
5578
5579 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5580 EOM
5581         use64bitint="$define"
5582         ;;
5583 esac                          
5584 case "$use64bitsint" in
5585 "$define"|true|[yY]*)
5586         cat <<EOM >&4
5587
5588 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5589 EOM
5590         use64bitint="$define"
5591         ;;
5592 esac                          
5593 case "$uselonglongs" in
5594 "$define"|true|[yY]*)
5595         cat <<EOM >&4
5596
5597 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5598 EOM
5599         use64bitint="$define"
5600         ;;
5601 esac                          
5602 case "$use64bitsall" in
5603 "$define"|true|[yY]*)
5604         cat <<EOM >&4
5605
5606 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5607 EOM
5608         use64bitall="$define"
5609         ;;
5610 esac                          
5611
5612 case "$ccflags" in
5613 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5614 esac
5615 case "$use64bitall" in
5616 "$define"|true|[yY]*) use64bitint="$define" ;;
5617 esac
5618
5619 case "$longsize" in
5620 8) cat <<EOM
5621
5622 You have natively 64-bit long integers.
5623 EOM
5624    val="$define"
5625    ;;
5626 *) case "$use64bitint" in
5627    "$define"|true|[yY]*) dflt='y';;
5628    *) dflt='n';;
5629    esac
5630    case "$d_quad" in
5631    "$define") ;;
5632    *) dflt='n' ;;
5633    esac
5634    cat <<EOM
5635
5636 Perl can be built to take advantage of 64-bit integer types
5637 on some systems.  To do so, Configure can be run with -Duse64bitint.
5638 Choosing this option will most probably introduce binary incompatibilities.
5639
5640 If this doesn't make any sense to you, just accept the default '$dflt'.
5641 (The default has been chosen based on your configuration.)
5642 EOM
5643    rp='Try to use 64-bit integers, if available?'
5644    . ./myread
5645    case "$ans" in
5646    [yY]*) val="$define" ;;
5647    *)     val="$undef"  ;;
5648    esac
5649    ;;
5650 esac
5651 set use64bitint
5652 eval $setvar
5653
5654 case "$use64bitall" in
5655 "$define"|true|[yY]*) dflt='y' ;;
5656 *) case "$longsize" in
5657    8) dflt='y' ;;
5658    *) dflt='n' ;;
5659    esac
5660    ;;
5661 esac    
5662 cat <<EOM
5663
5664 You may also choose to try maximal 64-bitness.  It means using as much
5665 64-bitness as possible on the platform.  This in turn means even more
5666 binary incompatibilities.  On the other hand, your platform may not
5667 have any more 64-bitness available than what you already have chosen.
5668
5669 If this doesn't make any sense to you, just accept the default '$dflt'.
5670 (The default has been chosen based on your configuration.)
5671 EOM
5672 rp='Try to use maximal 64-bit support, if available?'
5673 . ./myread
5674 case "$ans" in
5675 [yY]*) val="$define" ;;
5676 *)     val="$undef"  ;;
5677 esac
5678 set use64bitall
5679 eval $setvar
5680 case "$use64bitall" in
5681 "$define")
5682         case "$use64bitint" in
5683         "$undef")
5684                 cat <<EOM
5685
5686 Since you have chosen a maximally 64-bit build, I'm also turning on
5687 the use of 64-bit integers.
5688 EOM
5689                 use64bitint="$define" ;;
5690         esac
5691         ;;
5692 esac
5693
5694 : Look for a hint-file generated 'call-back-unit'.  If the
5695 : user has specified that a 64-bit perl is to be built,
5696 : we may need to set or change some other defaults.
5697 if $test -f use64bitint.cbu; then
5698         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5699         . ./use64bitint.cbu
5700 fi
5701 case "$use64bitint" in
5702 "$define"|true|[yY]*)
5703         case "$longsize" in
5704         4) case "$archname64" in
5705            '') archname64=64int ;;
5706            esac
5707            ;;
5708         esac
5709         ;;
5710 esac
5711
5712 : Look for a hint-file generated 'call-back-unit'.  If the
5713 : user has specified that a maximally 64-bit perl is to be built,
5714 : we may need to set or change some other defaults.
5715 if $test -f use64bitall.cbu; then
5716         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5717         . ./use64bitall.cbu
5718 fi
5719 case "$use64bitall" in
5720 "$define"|true|[yY]*)
5721         case "$longsize" in
5722         4) case "$archname64" in
5723            ''|64int) archname64=64all ;;
5724            esac
5725            ;;
5726         esac
5727         ;;
5728 esac
5729
5730 case "$d_quad:$use64bitint" in
5731 $undef:$define)
5732         cat >&4 <<EOF
5733
5734 *** You have chosen to use 64-bit integers,
5735 *** but none can be found.
5736 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5737 *** Cannot continue, aborting.
5738
5739 EOF
5740         exit 1
5741         ;;
5742 esac
5743
5744 : check for length of double
5745 echo " "
5746 case "$doublesize" in
5747 '')
5748         echo "Checking to see how big your double precision numbers are..." >&4
5749         $cat >try.c <<EOCP
5750 #include <stdio.h>
5751 #$i_stdlib I_STDLIB
5752 #ifdef I_STDLIB
5753 #include <stdlib.h>
5754 #endif
5755 int main()
5756 {
5757     printf("%d\n", (int)sizeof(double));
5758     exit(0);
5759 }
5760 EOCP
5761         set try
5762         if eval $compile_ok; then
5763                 doublesize=`$run ./try`
5764                 echo "Your double is $doublesize bytes long."
5765         else
5766                 dflt='8'
5767                 echo "(I can't seem to compile the test program.  Guessing...)"
5768                 rp="What is the size of a double precision number (in bytes)?"
5769                 . ./myread
5770                 doublesize="$ans"
5771         fi
5772         ;;
5773 esac
5774 $rm -f try.c try
5775
5776 : check for long doubles
5777 echo " "
5778 echo "Checking to see if you have long double..." >&4
5779 echo 'int main() { long double x = 7.0; }' > try.c
5780 set try
5781 if eval $compile; then
5782         val="$define"
5783         echo "You have long double."
5784 else
5785         val="$undef"
5786         echo "You do not have long double."
5787 fi
5788 $rm try.*
5789 set d_longdbl
5790 eval $setvar
5791
5792 : check for length of long double
5793 case "${d_longdbl}${longdblsize}" in
5794 $define)
5795         echo " "
5796         echo "Checking to see how big your long doubles are..." >&4
5797         $cat >try.c <<'EOCP'
5798 #include <stdio.h>
5799 int main()
5800 {
5801         printf("%d\n", sizeof(long double));
5802 }
5803 EOCP
5804         set try
5805         set try
5806         if eval $compile; then
5807                 longdblsize=`$run ./try`
5808                 echo "Your long doubles are $longdblsize bytes long."
5809         else
5810                 dflt='8'
5811                 echo " "
5812                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5813                 rp="What is the size of a long double (in bytes)?"
5814                 . ./myread
5815                 longdblsize="$ans"
5816         fi
5817         if $test "X$doublesize" = "X$longdblsize"; then
5818                 echo "That isn't any different from an ordinary double."
5819                 echo "I'll keep your setting anyway, but you may see some"
5820                 echo "harmless compilation warnings."
5821         fi      
5822         ;;
5823 esac
5824 $rm -f try.* try
5825
5826 : determine the architecture name
5827 echo " "
5828 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5829         tarch=`arch`"-$osname"
5830 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5831         if uname -m > tmparch 2>&1 ; then
5832                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5833                         -e 's/$/'"-$osname/" tmparch`
5834         else
5835                 tarch="$osname"
5836         fi
5837         $rm -f tmparch
5838 else
5839         tarch="$osname"
5840 fi
5841 case "$myarchname" in
5842 ''|"$tarch") ;;
5843 *)
5844         echo "(Your architecture name used to be $myarchname.)"
5845         archname=''
5846         ;;
5847 esac
5848 case "$targetarch" in
5849 '') ;;
5850 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5851 esac
5852 myarchname="$tarch"
5853 case "$archname" in
5854 '') dflt="$tarch";;
5855 *) dflt="$archname";;
5856 esac
5857 rp='What is your architecture name'
5858 . ./myread
5859 archname="$ans"
5860 case "$usethreads" in
5861 $define)
5862         echo "Threads selected." >&4
5863         case "$archname" in
5864         *-thread*) echo "...and architecture name already has -thread." >&4
5865                 ;;
5866         *)      archname="$archname-thread"
5867                 echo "...setting architecture name to $archname." >&4
5868                 ;;
5869         esac
5870         ;;
5871 esac
5872 case "$usemultiplicity" in
5873 $define)
5874         echo "Multiplicity selected." >&4
5875         case "$archname" in
5876         *-multi*) echo "...and architecture name already has -multi." >&4
5877                 ;;
5878         *)      archname="$archname-multi"
5879                 echo "...setting architecture name to $archname." >&4
5880                 ;;
5881         esac
5882         ;;
5883 esac
5884 case "$use64bitint$use64bitall" in
5885 *"$define"*)
5886         case "$archname64" in
5887         '')
5888                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5889                 ;;
5890         *)
5891                 case "$use64bitint" in
5892                 "$define") echo "64 bit integers selected." >&4 ;;
5893                 esac
5894                 case "$use64bitall" in
5895                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5896                 esac
5897                 case "$archname" in
5898                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5899                         ;;
5900                 *)      archname="$archname-$archname64"
5901                         echo "...setting architecture name to $archname." >&4
5902                         ;;
5903                 esac
5904                 ;;
5905         esac
5906 esac
5907 case "$uselongdouble" in
5908 $define)
5909         echo "Long doubles selected." >&4
5910         case "$longdblsize" in
5911         $doublesize)
5912                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5913                 ;;
5914         *)
5915                 case "$archname" in
5916                 *-ld*) echo "...and architecture name already has -ld." >&4
5917                         ;;
5918                 *)      archname="$archname-ld"
5919                         echo "...setting architecture name to $archname." >&4
5920                         ;;
5921                 esac
5922                 ;;
5923         esac
5924         ;;
5925 esac
5926 case "$useperlio" in
5927 $define)
5928         echo "Perlio selected." >&4
5929         ;;
5930 *)
5931         echo "Perlio not selected, using stdio." >&4
5932         case "$archname" in
5933         *-stdio*) echo "...and architecture name already has -stdio." >&4
5934                 ;;
5935         *)      archname="$archname-stdio"
5936                 echo "...setting architecture name to $archname." >&4
5937                 ;;
5938         esac
5939         ;;
5940 esac
5941 if $test -f archname.cbu; then
5942         echo "Your platform has some specific hints for architecture name, using them..."
5943         . ./archname.cbu
5944 fi
5945
5946 : set the prefixit variable, to compute a suitable default value
5947 prefixit='case "$3" in
5948 ""|none)
5949         case "$oldprefix" in
5950         "") eval "$1=\"\$$2\"";;
5951         *)
5952                 case "$3" in
5953                 "") eval "$1=";;
5954                 none)
5955                         eval "tp=\"\$$2\"";
5956                         case "$tp" in
5957                         ""|" ") eval "$1=\"\$$2\"";;
5958                         *) eval "$1=";;
5959                         esac;;
5960                 esac;;
5961         esac;;
5962 *)
5963         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5964         case "$tp" in
5965         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5966         /*-$oldprefix/*|\~*-$oldprefix/*)
5967                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5968         *) eval "$1=\"\$$2\"";;
5969         esac;;
5970 esac'
5971
5972 : get the patchlevel
5973 echo " "
5974 echo "Getting the current patchlevel..." >&4
5975 if $test -r $rsrc/patchlevel.h;then
5976         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5977         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5978         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5979         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5980         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5981         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5982         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5983 else
5984         revision=0
5985         patchlevel=0
5986         subversion=0
5987         api_revision=0
5988         api_version=0
5989         api_subversion=0
5990         perl_patchlevel=0
5991         $echo "(You do not have patchlevel.h.  Eek.)"
5992 fi
5993 if $test -r $rsrc/.patch ; then
5994         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5995                 perl_patchlevel=`cat $rsrc/.patch`
5996         fi
5997 fi
5998 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5999 version_patchlevel_string="version $patchlevel subversion $subversion"
6000 case "$perl_patchlevel" in
6001 0|'') ;;
6002 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6003 esac
6004
6005 $echo "(You have $package $version_patchlevel_string.)"
6006
6007 case "$osname" in
6008 dos|vms)
6009         : XXX Should be a Configure test for double-dots in filenames.
6010         version=`echo $revision $patchlevel $subversion | \
6011                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6012         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6013                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6014         ;;
6015 *)
6016         version=`echo $revision $patchlevel $subversion | \
6017                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6018         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6019                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6020         ;;
6021 esac
6022 : Special case the 5.005_xx maintenance series, which used 5.005
6023 : without any subversion label as a subdirectory in $sitelib
6024 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6025         api_versionstring='5.005'
6026 fi
6027
6028 : determine installation style
6029 : For now, try to deduce it from prefix unless it is already set.
6030 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6031 case "$installstyle" in
6032 '')     case "$prefix" in
6033                 *perl*) dflt='lib';;
6034                 *) dflt='lib/perl5' ;;
6035         esac
6036         ;;
6037 *)      dflt="$installstyle" ;;
6038 esac
6039 : Probably not worth prompting for this since we prompt for all
6040 : the directories individually, and the prompt would be too long and
6041 : confusing anyway.
6042 installstyle=$dflt
6043
6044 : determine where public executables go
6045 echo " "
6046 set dflt bin bin
6047 eval $prefixit
6048 fn=d~
6049 rp='Pathname where the public executables will reside?'
6050 . ./getfile
6051 if $test "X$ansexp" != "X$binexp"; then
6052         installbin=''
6053 fi
6054 prefixvar=bin
6055 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6056 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6057 :     this via initialinstalllocation
6058 . ./setprefixvar
6059
6060 case "$userelocatableinc" in
6061 $define|true|[yY]*)     dflt='y' ;;
6062 *)                      dflt='n' ;;
6063 esac
6064 cat <<EOM
6065
6066 Would you like to build Perl so that the installation is relocatable, so that
6067 library paths in @INC are determined relative to the path of the perl binary?
6068 This is not advised for system Perl installs, or if you need to run setid
6069 scripts or scripts under taint mode.
6070
6071 If this doesn't make any sense to you, just accept the default '$dflt'.
6072 EOM
6073 rp='Use relocatable @INC?'
6074 . ./myread
6075 case "$ans" in
6076 y|Y)    val="$define" ;;
6077 *)      val="$undef"  ;;
6078 esac
6079 set userelocatableinc
6080 eval $setvar
6081
6082 initialinstalllocation="$binexp"
6083 : Default prefix is now "up one level from where the binaries are"
6084 case "$userelocatableinc" in
6085 $define|true|[yY]*)
6086     bin=".../"
6087     binexp=".../"
6088     prefix=".../.."
6089     prefixexp=".../.."
6090     installprefixexp=".../.."
6091     ;;
6092 esac
6093
6094 : determine where private library files go
6095 : Usual default is /usr/local/lib/perl5/$version.
6096 : Also allow things like /opt/perl/lib/$version, since
6097 : /opt/perl/lib/perl5... would be redundant.
6098 : The default "style" setting is made in installstyle.U
6099 case "$installstyle" in
6100 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6101 *)       set dflt privlib lib/$version ;;
6102 esac
6103 eval $prefixit
6104 $cat <<EOM
6105
6106 There are some auxiliary files for $package that need to be put into a
6107 private library directory that is accessible by everyone.
6108
6109 EOM
6110 fn=$binexp
6111 fn=d~+
6112 rp='Pathname where the private library files will reside?'
6113 . ./getfile
6114 prefixvar=privlib
6115 . ./setprefixvar
6116
6117 : set the prefixup variable, to restore leading tilda escape
6118 prefixup='case "$prefixexp" in
6119 "$prefix") ;;
6120 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6121 esac'
6122
6123 : determine where public architecture dependent libraries go
6124 set archlib archlib
6125 eval $prefixit
6126 : privlib default is /usr/local/lib/$package/$version
6127 : archlib default is /usr/local/lib/$package/$version/$archname
6128 : privlib may have an optional trailing /share.
6129 tdflt=`echo $privlib | $sed 's,/share$,,'`
6130 tdflt=$tdflt/$archname
6131 case "$archlib" in
6132 '')     dflt=$tdflt
6133         ;;
6134 *)      dflt="$archlib"
6135     ;;
6136 esac
6137 $cat <<EOM
6138
6139 $spackage contains architecture-dependent library files.  If you are
6140 sharing libraries in a heterogeneous environment, you might store
6141 these files in a separate location.  Otherwise, you can just include
6142 them with the rest of the public library files.
6143
6144 EOM
6145 fn=$binexp
6146 fn=d+~
6147 rp='Where do you want to put the public architecture-dependent libraries?'
6148 . ./getfile
6149 prefixvar=archlib
6150 . ./setprefixvar
6151 if $test X"$archlib" = X"$privlib"; then
6152         d_archlib="$undef"
6153 else
6154         d_archlib="$define"
6155 fi
6156
6157 : see if setuid scripts can be secure
6158 $cat <<EOM
6159
6160 Some kernels have a bug that prevents setuid #! scripts from being
6161 secure.  Some sites have disabled setuid #! scripts because of this.
6162
6163 First let's decide if your kernel supports secure setuid #! scripts.
6164 (If setuid #! scripts would be secure but have been disabled anyway,
6165 don't say that they are secure if asked.)
6166
6167 EOM
6168
6169 val="$undef"
6170 if $test -d /dev/fd; then
6171         echo "#!$ls" >reflect
6172         chmod +x,u+s reflect
6173         ./reflect >flect 2>&1
6174         if $contains "/dev/fd" flect >/dev/null; then
6175                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6176                 val="$define"
6177         else
6178                 $cat <<EOM
6179 If you are not sure if they are secure, I can check but I'll need a
6180 username and password different from the one you are using right now.
6181 If you don't have such a username or don't want me to test, simply
6182 enter 'none'.
6183
6184 EOM
6185                 rp='Other username to test security of setuid scripts with?'
6186                 dflt='none'
6187                 . ./myread
6188                 case "$ans" in
6189                 n|none)
6190                         case "$d_suidsafe" in
6191                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6192                                 dflt=n;;
6193                         "$undef")
6194                                 echo "Well, the $hint value is *not* secure." >&4
6195                                 dflt=n;;
6196                         *)      echo "Well, the $hint value *is* secure." >&4
6197                                 dflt=y;;
6198                         esac
6199                         ;;
6200                 *)
6201                         $rm -f reflect flect
6202                         echo "#!$ls" >reflect
6203                         chmod +x,u+s reflect
6204                         echo >flect
6205                         chmod a+w flect
6206                         echo '"su" will (probably) prompt you for '"$ans's password."
6207                         su $ans -c './reflect >flect'
6208                         if $contains "/dev/fd" flect >/dev/null; then
6209                                 echo "Okay, it looks like setuid scripts are secure." >&4
6210                                 dflt=y
6211                         else
6212                                 echo "I don't think setuid scripts are secure." >&4
6213                                 dflt=n
6214                         fi
6215                         ;;
6216                 esac
6217                 rp='Does your kernel have *secure* setuid scripts?'
6218                 . ./myread
6219                 case "$ans" in
6220                 [yY]*)  val="$define";;
6221                 *)      val="$undef";;
6222                 esac
6223         fi
6224 else
6225         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6226         echo "(That's for file descriptors, not floppy disks.)"
6227         val="$undef"
6228 fi
6229 set d_suidsafe
6230 eval $setvar
6231
6232 $rm -f reflect flect
6233
6234 : now see if they want to do setuid emulation
6235 echo " "
6236 val="$undef"
6237 case "$d_suidsafe" in
6238 "$define")
6239         val="$undef"
6240         echo "No need to emulate SUID scripts since they are secure here." >&4
6241         ;;
6242 *)
6243         $cat <<EOM
6244 Some systems have disabled setuid scripts, especially systems where
6245 setuid scripts cannot be secure.  On systems where setuid scripts have
6246 been disabled, the setuid/setgid bits on scripts are currently
6247 useless.  It is possible for $package to detect those bits and emulate
6248 setuid/setgid in a secure fashion.  This emulation will only work if
6249 setuid scripts have been disabled in your kernel.
6250
6251 EOM
6252         case "$d_dosuid" in
6253         "$define") dflt=y ;;
6254         *) dflt=n ;;
6255         esac
6256         rp="Do you want to do setuid/setgid emulation?"
6257         . ./myread
6258         case "$ans" in
6259         [yY]*)  val="$define";;
6260         *)      val="$undef";;
6261         esac
6262         ;;
6263 esac
6264 set d_dosuid
6265 eval $setvar
6266
6267 : Find perl5.005 or later.
6268 echo "Looking for a previously installed perl5.005 or later... "
6269 case "$perl5" in
6270 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6271                 : Check if this perl is recent and can load a simple module
6272                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6273                         perl5=$tdir/perl
6274                         break;
6275                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6276                         perl5=$tdir/perl5
6277                         break;
6278                 fi
6279         done
6280         ;;
6281 *)      perl5="$perl5"
6282         ;;
6283 esac
6284 case "$perl5" in
6285 '')     echo "None found.  That's ok.";;
6286 *)      echo "Using $perl5." ;;
6287 esac
6288
6289 $cat <<EOM
6290
6291 After $package is installed, you may wish to install various
6292 add-on modules and utilities.  Typically, these add-ons will
6293 be installed under $prefix with the rest
6294 of this package.  However, you may wish to install such add-ons
6295 elsewhere under a different prefix.
6296
6297 If you do not wish to put everything under a single prefix, that's
6298 ok.  You will be prompted for the individual locations; this siteprefix
6299 is only used to suggest the defaults.
6300
6301 The default should be fine for most people.
6302
6303 EOM
6304 fn=d~+
6305 rp='Installation prefix to use for add-on modules and utilities?'
6306 : XXX Here might be another good place for an installstyle setting.
6307 case "$siteprefix" in
6308 '') dflt=$prefix ;;
6309 *)  dflt=$siteprefix ;;
6310 esac
6311 . ./getfile
6312 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6313 oldsiteprefix=''
6314 case "$siteprefix" in
6315 '') ;;
6316 *)      case "$ans" in
6317         "$prefix") ;;
6318         *) oldsiteprefix="$prefix";;
6319         esac
6320         ;;
6321 esac
6322 siteprefix="$ans"
6323 siteprefixexp="$ansexp"
6324
6325 : determine where site specific libraries go.
6326 : Usual default is /usr/local/lib/perl5/site_perl/$version
6327 : The default "style" setting is made in installstyle.U
6328 : XXX No longer works with Prefixit stuff.
6329 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6330 case "$sitelib" in
6331 '') case "$installstyle" in
6332         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6333         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6334         esac
6335         ;;
6336 *)      dflt="$sitelib"
6337         ;;
6338 esac
6339 $cat <<EOM
6340
6341 The installation process will create a directory for
6342 site-specific extensions and modules.  Most users find it convenient
6343 to place all site-specific files in this directory rather than in the
6344 main distribution directory.
6345
6346 EOM
6347 fn=d~+
6348 rp='Pathname for the site-specific library files?'
6349 . ./getfile
6350 prefixvar=sitelib
6351 . ./setprefixvar
6352 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6353
6354 : Determine list of previous versions to include in @INC
6355 $cat > getverlist <<EOPL
6356 #!$perl5 -w
6357 use File::Basename;
6358 \$api_versionstring = "$api_versionstring";
6359 \$version = "$version";
6360 \$stem = "$sitelib_stem";
6361 \$archname = "$archname";
6362 EOPL
6363         $cat >> getverlist <<'EOPL'
6364 # The list found is store twice for each entry: the original name, and
6365 # the binary broken down version as pack "sss", so sorting is easy and
6366 # unambiguous. This will work for all versions that have a maximum of
6367 # three digit groups, separate by '.'s or '_'s. Names are extended with
6368 # ".0.0" to ensure at least three elements for the pack.
6369 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6370
6371 # Can't have leading @ because metaconfig interprets it as a command!
6372 ;@inc_version_list=();
6373 # XXX Redo to do opendir/readdir?
6374 if (-d $stem) {
6375     chdir($stem);
6376     ;@candidates = map {
6377         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6378 }
6379 else {
6380     ;@candidates = ();
6381 }
6382
6383 ($pversion, $aversion, $vsn5005) = map {
6384     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6385 foreach $d (@candidates) {
6386     if ($d->[1] lt $pversion) {
6387         if ($d->[1] ge $aversion) {
6388             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6389         }
6390         elsif ($d->[1] ge $vsn5005) {
6391             unshift(@inc_version_list, grep { -d } $d->[0]);
6392         }
6393     }
6394     else {
6395         # Skip newer version.  I.e. don't look in
6396         # 5.7.0 if we're installing 5.6.1.
6397     }
6398 }
6399
6400 if (@inc_version_list) {
6401     print join(' ', @inc_version_list);
6402 }
6403 else {
6404     # Blank space to preserve value for next Configure run.
6405     print " ";
6406 }
6407 EOPL
6408 chmod +x getverlist
6409 case "$inc_version_list" in
6410 '')     if test -x "$perl5$exe_ext"; then
6411                 dflt=`$perl5 getverlist`
6412         else
6413                 dflt='none'
6414         fi
6415         ;;
6416 $undef) dflt='none' ;;
6417 *)  eval dflt=\"$inc_version_list\" ;;
6418 esac
6419 case "$dflt" in
6420 ''|' ') dflt=none ;;
6421 esac
6422 case "$dflt" in
6423 5.005) dflt=none ;;
6424 esac
6425 $cat <<EOM
6426
6427 In order to ease the process of upgrading, this version of perl
6428 can be configured to use modules built and installed with earlier
6429 versions of perl that were installed under $prefix.  Specify here
6430 the list of earlier versions that this version of perl should check.
6431 If Configure detected no earlier versions of perl installed under
6432 $prefix, then the list will be empty.  Answer 'none' to tell perl
6433 to not search earlier versions.
6434
6435 The default should almost always be sensible, so if you're not sure,
6436 just accept the default.
6437 EOM
6438
6439 rp='List of earlier versions to include in @INC?'
6440 . ./myread
6441 case "$ans" in
6442 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6443 *) inc_version_list="$ans" ;;
6444 esac
6445 case "$inc_version_list" in
6446 ''|' ')
6447         inc_version_list_init='0'
6448         d_inc_version_list="$undef"
6449         ;;
6450 *)      inc_version_list_init=`echo $inc_version_list |
6451                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6452         d_inc_version_list="$define"
6453         ;;
6454 esac
6455 $rm -f getverlist
6456
6457 : see if this is a malloc.h system
6458 : we want a real compile instead of Inhdr because some systems have a
6459 : malloc.h that just gives a compile error saying to use stdlib.h instead
6460 echo " "
6461 $cat >try.c <<EOCP
6462 #include <stdlib.h>
6463 #include <malloc.h>
6464 int main () { return 0; }
6465 EOCP
6466 set try
6467 if eval $compile; then
6468     echo "<malloc.h> found." >&4
6469     val="$define"
6470 else
6471     echo "<malloc.h> NOT found." >&4
6472     val="$undef"
6473 fi
6474 $rm -f try.c try
6475 set i_malloc
6476 eval $setvar
6477
6478 : check for void type
6479 echo " "
6480 echo "Checking to see how well your C compiler groks the void type..." >&4
6481 case "$voidflags" in
6482 '')
6483         $cat >try.c <<EOCP
6484 #$i_stdlib I_STDLIB
6485 #ifdef I_STDLIB
6486 #include <stdlib.h>
6487 #endif
6488 #if TRY & 1
6489 void sub() {
6490 #else
6491 sub() {
6492 #endif
6493         extern void moo();      /* function returning void */
6494         void (*goo)();          /* ptr to func returning void */
6495 #if TRY & 8
6496         void *hue;              /* generic ptr */
6497 #endif
6498 #if TRY & 2
6499         void (*foo[10])();
6500 #endif
6501
6502 #if TRY & 4
6503         if(goo == moo) {
6504                 exit(0);
6505         }
6506 #endif
6507         exit(0);
6508 }
6509 int main() { sub(); }
6510 EOCP
6511         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6512                 voidflags=$defvoidused
6513         echo "Good.  It appears to support void to the level $package wants.">&4
6514                 if $contains warning .out >/dev/null 2>&1; then
6515                         echo "However, you might get some warnings that look like this:"
6516                         $cat .out
6517                 fi
6518         else
6519 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6520                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6521                         echo "It supports 1..."
6522                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6523                                 echo "It also supports 2..."
6524                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6525                                         voidflags=7
6526                                         echo "And it supports 4 but not 8 definitely."
6527                                 else
6528                                         echo "It doesn't support 4..."
6529                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6530                                                 voidflags=11
6531                                                 echo "But it supports 8."
6532                                         else
6533                                                 voidflags=3
6534                                                 echo "Neither does it support 8."
6535                                         fi
6536                                 fi
6537                         else
6538                                 echo "It does not support 2..."
6539                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6540                                         voidflags=13
6541                                         echo "But it supports 4 and 8."
6542                                 else
6543                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6544                                                 voidflags=5
6545                                                 echo "And it supports 4 but has not heard about 8."
6546                                         else
6547                                                 echo "However it supports 8 but not 4."
6548                                         fi
6549                                 fi
6550                         fi
6551                 else
6552                         echo "There is no support at all for void."
6553                         voidflags=0
6554                 fi
6555         fi
6556 esac
6557 case "$voidflags" in
6558 "$defvoidused") ;;
6559 *)      $cat >&4 <<'EOM'
6560   Support flag bits are:
6561     1: basic void declarations.
6562     2: arrays of pointers to functions returning void.
6563     4: operations between pointers to and addresses of void functions.
6564     8: generic void pointers.
6565 EOM
6566         dflt="$voidflags";
6567         rp="Your void support flags add up to what?"
6568         . ./myread
6569         voidflags="$ans"
6570         ;;
6571 esac
6572 $rm -f try.* .out
6573
6574 : check for length of pointer
6575 echo " "
6576 case "$ptrsize" in
6577 '')
6578         echo "Checking to see how big your pointers are..." >&4
6579         if test "$voidflags" -gt 7; then
6580                 echo '#define VOID_PTR char *' > try.c
6581         else
6582                 echo '#define VOID_PTR void *' > try.c
6583         fi
6584         $cat >>try.c <<EOCP
6585 #include <stdio.h>
6586 #$i_stdlib I_STDLIB
6587 #ifdef I_STDLIB
6588 #include <stdlib.h>
6589 #endif
6590 int main()
6591 {
6592     printf("%d\n", (int)sizeof(VOID_PTR));
6593     exit(0);
6594 }
6595 EOCP
6596         set try
6597         if eval $compile_ok; then
6598                 ptrsize=`$run ./try`
6599                 echo "Your pointers are $ptrsize bytes long."
6600         else
6601                 dflt='4'
6602                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6603                 rp="What is the size of a pointer (in bytes)?"
6604                 . ./myread
6605                 ptrsize="$ans"
6606         fi
6607         ;;
6608 esac
6609 $rm -f try.c try
6610 case "$use64bitall" in
6611 "$define"|true|[yY]*)
6612         case "$ptrsize" in
6613         4)      cat <<EOM >&4
6614
6615 *** You have chosen a maximally 64-bit build,
6616 *** but your pointers are only 4 bytes wide.
6617 *** Please rerun Configure without -Duse64bitall.
6618 EOM
6619                 case "$d_quad" in
6620                 define)
6621                         cat <<EOM >&4
6622 *** Since you have quads, you could possibly try with -Duse64bitint.
6623 EOM
6624                         ;;
6625                 esac
6626                 cat <<EOM >&4
6627 *** Cannot continue, aborting.
6628
6629 EOM
6630
6631                 exit 1
6632                 ;;
6633         esac
6634         ;;
6635 esac
6636
6637
6638 : determine whether to use malloc wrapping
6639 echo " "
6640 case "$usemallocwrap" in
6641 [yY]*|true|$define)     dflt='y' ;;
6642 [nN]*|false|$undef)     dflt='n' ;;
6643 *)      case "$usedevel" in
6644         [yY]*|true|$define)     dflt='y' ;;
6645         *) dflt='n' ;;
6646         esac
6647         ;;
6648 esac
6649 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6650 . ./myread
6651 usemallocwrap="$ans"
6652 case "$ans" in
6653 y*|true)
6654         usemallocwrap="$define" ;;
6655 *)
6656         usemallocwrap="$undef" ;;
6657 esac
6658
6659 : determine which malloc to compile in
6660 echo " "
6661 case "$usemymalloc" in
6662 [yY]*|true|$define)     dflt='y' ;;
6663 [nN]*|false|$undef)     dflt='n' ;;
6664 *)      case "$ptrsize" in
6665         4) dflt='y' ;;
6666         *) dflt='n' ;;
6667         esac
6668         ;;
6669 esac
6670 rp="Do you wish to attempt to use the malloc that comes with $package?"
6671 . ./myread
6672 usemymalloc="$ans"
6673 case "$ans" in
6674 y*|true)
6675         usemymalloc='y'
6676         mallocsrc='malloc.c'
6677         mallocobj="malloc$_o"
6678         d_mymalloc="$define"
6679         case "$libs" in
6680         *-lmalloc*)
6681                 : Remove malloc from list of libraries to use
6682                 echo "Removing unneeded -lmalloc from library list" >&4
6683                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6684                 shift
6685                 libs="$*"
6686                 echo "libs = $libs" >&4
6687                 ;;
6688         esac
6689         ;;
6690 *)
6691         usemymalloc='n'
6692         mallocsrc=''
6693         mallocobj=''
6694         d_mymalloc="$undef"
6695         ;;
6696 esac
6697
6698 : compute the return types of malloc and free
6699 echo " "
6700 $cat >malloc.c <<END
6701 #$i_malloc I_MALLOC
6702 #$i_stdlib I_STDLIB
6703 #include <stdio.h>
6704 #include <sys/types.h>
6705 #ifdef I_MALLOC
6706 #include <malloc.h>
6707 #endif
6708 #ifdef I_STDLIB
6709 #include <stdlib.h>
6710 #endif
6711 #ifdef TRY_MALLOC
6712 void *malloc();
6713 #endif
6714 #ifdef TRY_FREE
6715 void free();
6716 #endif
6717 END
6718 case "$malloctype" in
6719 '')
6720         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6721                 malloctype='void *'
6722         else
6723                 malloctype='char *'
6724         fi
6725         ;;
6726 esac
6727 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6728
6729 case "$freetype" in
6730 '')
6731         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6732                 freetype='void'
6733         else
6734                 freetype='int'
6735         fi
6736         ;;
6737 esac
6738 echo "Your system uses $freetype free(), it would seem." >&4
6739 $rm -f malloc.[co]
6740 : determine where site specific architecture-dependent libraries go.
6741 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6742 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6743 : sitelib may have an optional trailing /share.
6744 case "$sitearch" in
6745 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6746         dflt="$dflt/$archname"
6747         ;;
6748 *)      dflt="$sitearch"
6749         ;;
6750 esac
6751 set sitearch sitearch none
6752 eval $prefixit
6753 $cat <<EOM
6754
6755 The installation process will also create a directory for
6756 architecture-dependent site-specific extensions and modules.
6757
6758 EOM
6759 fn=d~+
6760 rp='Pathname for the site-specific architecture-dependent library files?'
6761 . ./getfile
6762 prefixvar=sitearch
6763 . ./setprefixvar
6764 if $test X"$sitearch" = X"$sitelib"; then
6765         d_sitearch="$undef"
6766 else
6767         d_sitearch="$define"
6768 fi
6769
6770 $cat <<EOM
6771
6772 The installation process will also create a directory for
6773 vendor-supplied add-ons.  Vendors who supply perl with their system
6774 may find it convenient to place all vendor-supplied files in this
6775 directory rather than in the main distribution directory.  This will
6776 ease upgrades between binary-compatible maintenance versions of perl.
6777
6778 Of course you may also use these directories in whatever way you see
6779 fit.  For example, you might use them to access modules shared over a
6780 company-wide network.
6781
6782 The default answer should be fine for most people.
6783 This causes further questions about vendor add-ons to be skipped
6784 and no vendor-specific directories will be configured for perl.
6785
6786 EOM
6787 rp='Do you want to configure vendor-specific add-on directories?'
6788 case "$usevendorprefix" in
6789 define|true|[yY]*) dflt=y ;;
6790 *)      : User may have set vendorprefix directly on Configure command line.
6791         case "$vendorprefix" in
6792         ''|' ') dflt=n ;;
6793         *)      dflt=y ;;
6794         esac
6795         ;;
6796 esac
6797 . ./myread
6798 case "$ans" in
6799 [yY]*)  fn=d~+
6800         rp='Installation prefix to use for vendor-supplied add-ons?'
6801         case "$vendorprefix" in
6802         '') dflt='' ;;
6803         *)  dflt=$vendorprefix ;;
6804         esac
6805         . ./getfile
6806         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6807         oldvendorprefix=''
6808         case "$vendorprefix" in
6809         '') ;;
6810         *)      case "$ans" in
6811                 "$prefix") ;;
6812                 *) oldvendorprefix="$prefix";;
6813                 esac
6814                 ;;
6815         esac
6816         usevendorprefix="$define"
6817         vendorprefix="$ans"
6818         vendorprefixexp="$ansexp"
6819         ;;
6820 *)      usevendorprefix="$undef"
6821         vendorprefix=''
6822         vendorprefixexp=''
6823         ;;
6824 esac
6825
6826 case "$vendorprefix" in
6827 '')     d_vendorlib="$undef"
6828         vendorlib=''
6829         vendorlibexp=''
6830         ;;
6831 *)      d_vendorlib="$define"
6832         : determine where vendor-supplied modules go.
6833         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6834         case "$vendorlib" in
6835         '')
6836                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6837                 case "$installstyle" in
6838                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6839                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6840                 esac
6841                 ;;
6842         *)      dflt="$vendorlib"
6843                 ;;
6844         esac
6845         fn=d~+
6846         rp='Pathname for the vendor-supplied library files?'
6847         . ./getfile
6848         vendorlib="$ans"
6849         vendorlibexp="$ansexp"
6850         ;;
6851 esac
6852 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6853 prefixvar=vendorlib
6854 . ./installprefix
6855
6856 case "$vendorprefix" in
6857 '')     d_vendorarch="$undef"
6858         vendorarch=''
6859         vendorarchexp=''
6860         ;;
6861 *)      d_vendorarch="$define"
6862         : determine where vendor-supplied architecture-dependent libraries go.
6863         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6864         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6865         : vendorlib may have an optional trailing /share.
6866         case "$vendorarch" in
6867         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6868                 dflt="$dflt/$archname"
6869                 ;;
6870         *)      dflt="$vendorarch" ;;
6871         esac
6872         fn=d~+
6873         rp='Pathname for vendor-supplied architecture-dependent files?'
6874         . ./getfile
6875         vendorarch="$ans"
6876         vendorarchexp="$ansexp"
6877         ;;
6878 esac
6879 prefixvar=vendorarch
6880 . ./installprefix
6881
6882 : Final catch-all directories to search
6883 $cat <<EOM
6884
6885 Lastly, you can have perl look in other directories for extensions and
6886 modules in addition to those already specified.
6887 These directories will be searched after 
6888         $sitearch 
6889         $sitelib 
6890 EOM
6891 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6892 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6893 echo ' '
6894 case "$otherlibdirs" in
6895 ''|' ') dflt='none' ;;
6896 *)      dflt="$otherlibdirs" ;;
6897 esac
6898 $cat <<EOM
6899 Enter a colon-separated set of extra paths to include in perl's @INC
6900 search path, or enter 'none' for no extra paths.
6901
6902 EOM
6903
6904 rp='Colon-separated list of additional directories for perl to search?'
6905 . ./myread
6906 case "$ans" in
6907 ' '|''|none)    otherlibdirs=' ' ;;     
6908 *)      otherlibdirs="$ans" ;;
6909 esac
6910 case "$otherlibdirs" in
6911 ' ') val=$undef ;;
6912 *)      val=$define ;;
6913 esac
6914 set d_perl_otherlibdirs
6915 eval $setvar
6916
6917 : Cruising for prototypes
6918 echo " "
6919 echo "Checking out function prototypes..." >&4
6920 $cat >prototype.c <<EOCP
6921 #$i_stdlib I_STDLIB
6922 #ifdef I_STDLIB
6923 #include <stdlib.h>
6924 #endif
6925 int main(int argc, char *argv[]) {
6926         exit(0);}
6927 EOCP
6928 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6929         echo "Your C compiler appears to support function prototypes."
6930         val="$define"
6931 else
6932         echo "Your C compiler doesn't seem to understand function prototypes."
6933         val="$undef"
6934 fi
6935 set prototype
6936 eval $setvar
6937 $rm -f prototype*
6938
6939 case "$prototype" in
6940 "$define") ;;
6941 *)      ansi2knr='ansi2knr'
6942         echo " "
6943         cat <<EOM >&4
6944
6945 $me:  FATAL ERROR:
6946 This version of $package can only be compiled by a compiler that 
6947 understands function prototypes.  Unfortunately, your C compiler 
6948         $cc $ccflags
6949 doesn't seem to understand them.  Sorry about that.
6950
6951 If GNU cc is available for your system, perhaps you could try that instead.  
6952
6953 Eventually, we hope to support building Perl with pre-ANSI compilers.
6954 If you would like to help in that effort, please contact <perlbug@perl.org>.
6955
6956 Aborting Configure now.
6957 EOM
6958         exit 2
6959         ;;
6960 esac
6961
6962 echo " "
6963 case "$extras" in
6964 '') dflt='n';;
6965 *) dflt='y';;
6966 esac
6967 cat <<EOM
6968 Perl can be built with extra modules or bundles of modules which
6969 will be fetched from the CPAN and installed alongside Perl.
6970
6971 Notice that you will need access to the CPAN; either via the Internet,
6972 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6973 be asked later to configure the CPAN.pm module which will in turn do
6974 the installation of the rest of the extra modules or bundles.)
6975
6976 Notice also that if the modules require any external software such as
6977 libraries and headers (the libz library and the zlib.h header for the
6978 Compress::Zlib module, for example) you MUST have any such software
6979 already installed, this configuration process will NOT install such
6980 things for you.
6981
6982 If this doesn't make any sense to you, just accept the default '$dflt'.
6983 EOM
6984 rp='Install any extra modules (y or n)?'
6985 . ./myread
6986 case "$ans" in
6987 y|Y)
6988         cat <<EOM
6989
6990 Please list any extra modules or bundles to be installed from CPAN,
6991 with spaces between the names.  The names can be in any format the
6992 'install' command of CPAN.pm will understand.  (Answer 'none',
6993 without the quotes, to install no extra modules or bundles.)
6994 EOM
6995         rp='Extras?'
6996         dflt="$extras"
6997         . ./myread
6998         extras="$ans"
6999 esac
7000 case "$extras" in
7001 ''|'none')
7002         val=''
7003         $rm -f ../extras.lst
7004         ;;
7005 *)      echo "(Saving the list of extras for later...)"
7006         echo "$extras" > ../extras.lst
7007         val="'$extras'"
7008         ;;
7009 esac
7010 set extras
7011 eval $setvar
7012 echo " "
7013
7014 : determine where html pages for programs go
7015 set html1dir html1dir none
7016 eval $prefixit
7017 $cat <<EOM
7018
7019 If you wish to install html files for programs in $spackage, indicate
7020 the appropriate directory here.  To skip installing html files,
7021 answer "none".
7022 EOM
7023 case "$html1dir" in
7024 ''|none|$undef|' ') dflt=none ;;
7025 *) dflt=$html1dir ;;
7026 esac
7027 fn=dn+~
7028 rp="Directory for the main $spackage html pages?"
7029 . ./getfile
7030 prefixvar=html1dir
7031 . ./setprefixvar
7032 : Use ' ' for none so value is preserved next time through Configure
7033 $test X"$html1dir" = "X" && html1dir=' '
7034
7035 : determine where html pages for libraries and modules go
7036 set html3dir html3dir none
7037 eval $prefixit
7038 $cat <<EOM
7039
7040 If you wish to install html files for modules associated with $spackage,
7041 indicate the appropriate directory here.  To skip installing html files,
7042 answer "none".
7043 EOM
7044 : There is no obvious default.  If they have specified html1dir, then
7045 : try to key off that, possibly changing .../html1 into .../html3.
7046 case "$html3dir" in
7047 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7048 *) dflt=$html3dir ;;
7049 esac
7050 fn=dn+~
7051 rp="Directory for the $spackage module html pages?"
7052 . ./getfile
7053 prefixvar=html3dir
7054 . ./setprefixvar
7055 : Use ' ' for none so value is preserved next time through Configure
7056 $test X"$html3dir" = "X" && html3dir=' '
7057
7058 : determine whether to install perl also as /usr/bin/perl
7059
7060 echo " "
7061 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7062         $cat <<EOM
7063 Many scripts expect perl to be installed as /usr/bin/perl.
7064
7065 If you want to, I can install the perl you are about to compile
7066 as /usr/bin/perl (in addition to $bin/perl).
7067 EOM
7068         if test -f /usr/bin/perl; then
7069             $cat <<EOM
7070
7071 However, please note that because you already have a /usr/bin/perl,
7072 overwriting that with a new Perl would very probably cause problems.
7073 Therefore I'm assuming you don't want to do that (unless you insist).
7074
7075 EOM
7076             case "$installusrbinperl" in
7077             "$define"|[yY]*)    dflt='y';;
7078             *)                  dflt='n';;
7079             esac
7080         else
7081             $cat <<EOM
7082
7083 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7084
7085 EOM
7086             case "$installusrbinperl" in
7087             "$undef"|[nN]*)     dflt='n';;
7088             *)                  dflt='y';;
7089             esac
7090         fi
7091         rp="Do you want to install perl as /usr/bin/perl?"
7092         . ./myread
7093         case "$ans" in
7094         [yY]*)  val="$define";;
7095         *)      val="$undef" ;;
7096         esac
7097 else
7098         val="$undef"
7099 fi
7100 set installusrbinperl
7101 eval $setvar
7102
7103 echo " "
7104 echo "Checking for GNU C Library..." >&4
7105 cat >try.c <<'EOCP'
7106 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7107    alone are insufficient to distinguish different versions, such as
7108    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7109    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7110 */
7111 #include <stdio.h>
7112 int main(void)
7113 {
7114 #ifdef __GLIBC__
7115 #   ifdef __GLIBC_MINOR__
7116 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7117 #           include <gnu/libc-version.h>
7118             printf("%s\n",  gnu_get_libc_version());
7119 #       else
7120             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7121 #       endif
7122 #   else
7123         printf("%d\n",  __GLIBC__);
7124 #   endif
7125     return 0;
7126 #else
7127     return 1;
7128 #endif
7129 }
7130 EOCP
7131 set try
7132 if eval $compile_ok && $run ./try > glibc.ver; then
7133         val="$define"
7134         gnulibc_version=`$cat glibc.ver`
7135         echo "You are using the GNU C Library version $gnulibc_version"
7136 else
7137         val="$undef"
7138         gnulibc_version=''
7139         echo "You are not using the GNU C Library"
7140 fi
7141 $rm -f try try.* glibc.ver
7142 set d_gnulibc
7143 eval $setvar
7144
7145 : see if nm is to be used to determine whether a symbol is defined or not
7146 case "$usenm" in
7147 '')
7148         dflt=''
7149         case "$d_gnulibc" in
7150         "$define")
7151                 echo " "
7152                 echo "nm probably won't work on the GNU C Library." >&4
7153                 dflt=n
7154                 ;;
7155         esac
7156         case "$dflt" in
7157         '') 
7158                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7159                         echo " "
7160                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7161                         echo "'nm' won't be sufficient on this sytem." >&4
7162                         dflt=n
7163                 fi
7164                 ;;
7165         esac
7166         case "$dflt" in
7167         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7168                 if $test $dflt -gt 20; then
7169                         dflt=y
7170                 else
7171                         dflt=n
7172                 fi
7173                 ;;
7174         esac
7175         ;;
7176 *)
7177         case "$usenm" in
7178         true|$define) dflt=y;;
7179         *) dflt=n;;
7180         esac
7181         ;;
7182 esac
7183 $cat <<EOM
7184
7185 I can use $nm to extract the symbols from your C libraries. This
7186 is a time consuming task which may generate huge output on the disk (up
7187 to 3 megabytes) but that should make the symbols extraction faster. The
7188 alternative is to skip the 'nm' extraction part and to compile a small
7189 test program instead to determine whether each symbol is present. If
7190 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7191 this may be the best solution.
7192
7193 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7194
7195 EOM
7196 rp="Shall I use $nm to extract C symbols from the libraries?"
7197 . ./myread
7198 case "$ans" in
7199 [Nn]*) usenm=false;;
7200 *) usenm=true;;
7201 esac
7202
7203 runnm=$usenm
7204 case "$reuseval" in
7205 true) runnm=false;;
7206 esac
7207
7208 : nm options which may be necessary
7209 case "$nm_opt" in
7210 '') if $test -f /mach_boot; then
7211                 nm_opt=''       # Mach
7212         elif $test -d /usr/ccs/lib; then
7213                 nm_opt='-p'     # Solaris (and SunOS?)
7214         elif $test -f /dgux; then
7215                 nm_opt='-p'     # DG-UX
7216         elif $test -f /lib64/rld; then
7217                 nm_opt='-p'     # 64-bit Irix
7218         else
7219                 nm_opt=''
7220         fi;;
7221 esac
7222
7223 : nm options which may be necessary for shared libraries but illegal
7224 : for archive libraries.  Thank you, Linux.
7225 case "$nm_so_opt" in
7226 '')     case "$myuname" in
7227         *linux*|gnu*)
7228                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7229                         nm_so_opt='--dynamic'
7230                 fi
7231                 ;;
7232         esac
7233         ;;
7234 esac
7235
7236 case "$runnm" in
7237 true)
7238 : get list of predefined functions in a handy place
7239 echo " "
7240 case "$libc" in
7241 '') libc=unknown
7242         case "$libs" in
7243         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7244         esac
7245         ;;
7246 esac
7247 case "$libs" in
7248 '') ;;
7249 *)  for thislib in $libs; do
7250         case "$thislib" in
7251         -lc|-lc_s)
7252                 : Handle C library specially below.
7253                 ;;
7254         -l*)
7255                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7256                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7257                         :
7258                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7259                         :
7260                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7261                         :
7262                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7263                         :
7264                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7265                         :
7266                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7267                         :
7268                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7269                         :
7270                 else
7271                         try=''
7272                 fi
7273                 libnames="$libnames $try"
7274                 ;;
7275         *) libnames="$libnames $thislib" ;;
7276         esac
7277         done
7278         ;;
7279 esac
7280 xxx=normal
7281 case "$libc" in
7282 unknown)
7283         set /lib/libc.$so
7284         for xxx in $libpth; do
7285                 $test -r $1 || set $xxx/libc.$so
7286                 : The messy sed command sorts on library version numbers.
7287                 $test -r $1 || \
7288                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7289                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7290                                 h
7291                                 s/[0-9][0-9]*/0000&/g
7292                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7293                                 G
7294                                 s/\n/ /' | \
7295                          $sort | $sed -e 's/^.* //'`
7296                 eval set \$$#
7297         done
7298         $test -r $1 || set /usr/ccs/lib/libc.$so
7299         $test -r $1 || set /lib/libsys_s$_a
7300         ;;
7301 *)
7302         set blurfl
7303         ;;
7304 esac
7305 if $test -r "$1"; then
7306         echo "Your (shared) C library seems to be in $1."
7307         libc="$1"
7308 elif $test -r /lib/libc && $test -r /lib/clib; then
7309         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7310         xxx=apollo
7311         libc='/lib/clib /lib/libc'
7312         if $test -r /lib/syslib; then
7313                 echo "(Your math library is in /lib/syslib.)"
7314                 libc="$libc /lib/syslib"
7315         fi
7316 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7317         echo "Your C library seems to be in $libc, as you said before."
7318 elif $test -r $incpath/usr/lib/libc$_a; then
7319         libc=$incpath/usr/lib/libc$_a;
7320         echo "Your C library seems to be in $libc.  That's fine."
7321 elif $test -r /lib/libc$_a; then
7322         libc=/lib/libc$_a;
7323         echo "Your C library seems to be in $libc.  You're normal."
7324 else
7325         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7326                 :
7327         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7328                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7329         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7330                 :
7331         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7332                 :
7333         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7334                 :
7335         else
7336                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7337         fi
7338         if $test -r "$tans"; then
7339                 echo "Your C library seems to be in $tans, of all places."
7340                 libc=$tans
7341         else
7342                 libc='blurfl'
7343         fi
7344 fi
7345 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7346         dflt="$libc"
7347         cat <<EOM
7348
7349 If the guess above is wrong (which it might be if you're using a strange
7350 compiler, or your machine supports multiple models), you can override it here.
7351
7352 EOM
7353 else
7354         dflt=''
7355         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7356         cat >&4 <<EOM
7357 I can't seem to find your C library.  I've looked in the following places:
7358
7359 EOM
7360         $sed 's/^/      /' libpath
7361         cat <<EOM
7362
7363 None of these seems to contain your C library. I need to get its name...
7364
7365 EOM
7366 fi
7367 fn=f
7368 rp='Where is your C library?'
7369 . ./getfile
7370 libc="$ans"
7371
7372 echo " "
7373 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7374 set X `cat libnames`
7375 shift
7376 xxx=files
7377 case $# in 1) xxx=file; esac
7378 echo "Extracting names from the following $xxx for later perusal:" >&4
7379 echo " "
7380 $sed 's/^/      /' libnames >&4
7381 echo " "
7382 $echo $n "This may take a while...$c" >&4
7383
7384 for file in $*; do
7385         case $file in
7386         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7387         *) $nm $nm_opt $file 2>/dev/null;;
7388         esac
7389 done >libc.tmp
7390
7391 $echo $n ".$c"
7392 $grep fprintf libc.tmp > libc.ptf
7393 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7394 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7395 xxx='[ADTSIW]'
7396 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7397         eval $xscan;\
7398         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7399                 eval $xrun
7400 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7401         eval $xscan;\
7402         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7403                 eval $xrun
7404 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7405         eval $xscan;\
7406         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7407                 eval $xrun
7408 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7409         eval $xscan;\
7410         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7411                 eval $xrun
7412 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7413         eval $xscan;\
7414         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7415                 eval $xrun
7416 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7417         eval $xscan;\
7418         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7419                 eval $xrun
7420 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7421                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7422         eval $xscan;\
7423         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7424                 eval $xrun
7425 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7426         eval $xscan;\
7427         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7428                 eval $xrun
7429 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7430         eval $xscan;\
7431         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7432                 eval $xrun
7433 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7434         eval $xscan;\
7435         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7436                 eval $xrun
7437 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7438         eval $xscan;\
7439         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7440                 eval $xrun
7441 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7442         eval $xscan;\
7443         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7444                 eval $xrun
7445 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7446         eval $xscan;\
7447         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7448                 eval $xrun
7449 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7450         eval $xscan;\
7451         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7452                 eval $xrun
7453 else
7454         $nm -p $* 2>/dev/null >libc.tmp
7455         $grep fprintf libc.tmp > libc.ptf
7456         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7457                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7458         then
7459                 nm_opt='-p'
7460                 eval $xrun
7461         else
7462                 echo " "
7463                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7464                 com=''
7465                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7466                         for thisname in $libnames $libc; do
7467                                 $ar t $thisname >>libc.tmp
7468                         done
7469                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7470                         echo "Ok." >&4
7471                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7472                         # Repeat libc to extract forwarders to DLL entries too
7473                         for thisname in $libnames $libc; do
7474                                 $ar tv $thisname >>libc.tmp
7475                                 # Revision 50 of EMX has bug in $ar.
7476                                 # it will not extract forwarders to DLL entries
7477                                 # Use emximp which will extract exactly them.
7478                                 emximp -o tmp.imp $thisname \
7479                                     2>/dev/null && \
7480                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7481                                     < tmp.imp >>libc.tmp
7482                                 $rm tmp.imp
7483                         done
7484                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7485                         echo "Ok." >&4
7486                 else
7487                         echo "$ar didn't seem to work right." >&4
7488                         echo "Maybe this is a Cray...trying bld instead..." >&4
7489                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7490                         then
7491                                 for thisname in $libnames; do
7492                                         bld t $libnames | \
7493                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7494                                         $ar t $thisname >>libc.tmp
7495                                 done
7496                                 echo "Ok." >&4
7497                         else
7498                                 echo "That didn't work either.  Giving up." >&4
7499                                 exit 1
7500                         fi
7501                 fi
7502         fi
7503 fi
7504 nm_extract="$com"
7505 case "$PASE" in
7506 define)
7507     echo " "
7508     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7509     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7510     ;;
7511 *)  if $test -f /lib/syscalls.exp; then
7512         echo " "
7513         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7514         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7515     fi
7516     ;;
7517 esac
7518 ;;
7519 esac
7520 $rm -f libnames libpath
7521
7522 : see if dld is available
7523 set dld.h i_dld
7524 eval $inhdr
7525
7526 : is a C symbol defined?
7527 csym='tlook=$1;
7528 case "$3" in
7529 -v) tf=libc.tmp; tdc="";;
7530 -a) tf=libc.tmp; tdc="[]";;
7531 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7532 esac;
7533 tx=yes;
7534 case "$reuseval-$4" in
7535 true-) ;;
7536 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7537 esac;
7538 case "$tx" in
7539 yes)
7540         tval=false;
7541         if $test "$runnm" = true; then
7542                 if $contains $tlook $tf >/dev/null 2>&1; then
7543                         tval=true;
7544                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7545                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7546                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7547                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7548                         $rm -f try$_exe try.c core core.* try.core;
7549                 fi;
7550         else
7551                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7552                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7553                 $rm -f try$_exe try.c;
7554         fi;
7555         ;;
7556 *)
7557         case "$tval" in
7558         $define) tval=true;;
7559         *) tval=false;;
7560         esac;
7561         ;;
7562 esac;
7563 eval "$2=$tval"'
7564
7565 : define an is-in-libc? function
7566 inlibc='echo " "; td=$define; tu=$undef;
7567 sym=$1; var=$2; eval "was=\$$2";
7568 tx=yes;
7569 case "$reuseval$was" in
7570 true) ;;
7571 true*) tx=no;;
7572 esac;
7573 case "$tx" in
7574 yes)
7575         set $sym tres -f;
7576         eval $csym;
7577         case "$tres" in
7578         true)
7579                 echo "$sym() found." >&4;
7580                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7581         *)
7582                 echo "$sym() NOT found." >&4;
7583                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7584         esac;;
7585 *)
7586         case "$was" in
7587         $define) echo "$sym() found." >&4;;
7588         *) echo "$sym() NOT found." >&4;;
7589         esac;;
7590 esac'
7591
7592
7593 echo " "
7594 echo "Checking for C++..." >&4
7595 cat >try.c <<'EOCP'
7596 #include <stdio.h>
7597 int main(void)
7598 {
7599 #ifdef __cplusplus
7600     printf("define\n");
7601 #else
7602     printf("undef\n");
7603 #endif
7604     return 0;
7605 }
7606 EOCP
7607 set try
7608 if eval $compile_ok && $run ./try >cplusplus$$; then
7609         val=`$cat cplusplus$$`
7610         echo "You are using a C++ compiler."
7611 else
7612         val="$undef"
7613         echo "You are not using a C++ compiler."
7614 fi
7615 $rm -f try try.* cplusplus$$
7616 set d_cplusplus
7617 eval $setvar
7618
7619 : see if dlopen exists
7620 xxx_runnm="$runnm"
7621 xxx_ccflags="$ccflags"
7622 runnm=false
7623 : with g++ one needs -shared to get is-in-libc to work for dlopen
7624 case "$gccversion" in
7625 '')     ;;
7626 *)      case "$d_cplusplus" in
7627         "$define") ccflags="$ccflags -shared" ;;
7628         esac
7629         ;;
7630 esac
7631 set dlopen d_dlopen
7632 eval $inlibc
7633 runnm="$xxx_runnm"
7634 ccflags="$xxx_ccflags"
7635
7636 : see if this is a unistd.h system
7637 set unistd.h i_unistd
7638 eval $inhdr
7639
7640 : determine which dynamic loading, if any, to compile in
7641 echo " "
7642 dldir="ext/DynaLoader"
7643 case "$usedl" in
7644 $define|y|true)
7645         dflt='y'
7646         usedl="$define"
7647         ;;
7648 $undef|n|false)
7649         dflt='n'
7650         usedl="$undef"
7651         ;;
7652 *) 
7653         dflt='n'
7654         case "$d_dlopen" in
7655             $define) dflt='y' ;;
7656         esac
7657         case "$i_dld" in
7658             $define) dflt='y' ;;
7659         esac
7660         : Does a dl_xxx.xs file exist for this operating system
7661         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7662         ;;
7663 esac
7664 rp="Do you wish to use dynamic loading?"
7665 . ./myread
7666 usedl="$ans"
7667 case "$ans" in
7668 y*) usedl="$define"
7669         case "$dlsrc" in
7670         '')
7671                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7672                         dflt="$dldir/dl_${osname}.xs"
7673                 elif $test "$d_dlopen" = "$define" ; then
7674                         dflt="$dldir/dl_dlopen.xs"
7675                 elif $test "$i_dld" = "$define" ; then
7676                         dflt="$dldir/dl_dld.xs"
7677                 else
7678                         dflt=''
7679                 fi
7680                 ;;
7681         *)      dflt="$dldir/$dlsrc"
7682                 ;;
7683         esac
7684     echo "The following dynamic loading files are available:"
7685         : Can not go over to $dldir because getfile has path hard-coded in.
7686         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7687         rp="Source file to use for dynamic loading"
7688         fn="fne"
7689         gfpth="$src"
7690         . ./getfile
7691         usedl="$define"
7692         : emulate basename
7693         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7694
7695         $cat << EOM
7696
7697 Some systems may require passing special flags to $cc -c to
7698 compile modules that will be used to create a shared library.
7699 To use no flags, say "none".
7700
7701 EOM
7702     case "$cccdlflags" in
7703     '') case "$gccversion" in
7704                 '') case "$osname" in
7705                         hpux)   dflt='+z' ;;
7706                         next)   dflt='none' ;;
7707                         irix*)  dflt='-KPIC' ;;
7708                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7709                         sunos)  dflt='-pic' ;;
7710                         *)      dflt='none' ;;
7711                     esac
7712                         ;;
7713                 *)  case "$osname" in
7714                         darwin) dflt='none' ;;
7715                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7716                         *)      dflt='-fpic' ;;
7717                     esac ;;
7718             esac ;;
7719         ' ') dflt='none' ;;
7720     *)  dflt="$cccdlflags" ;;
7721     esac
7722     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7723     . ./myread
7724     case "$ans" in
7725     none) cccdlflags=' ' ;;
7726     *) cccdlflags="$ans" ;;
7727     esac
7728
7729     cat << EOM
7730
7731 Some systems use ld to create libraries that can be dynamically loaded,
7732 while other systems (such as those using ELF) use $cc.
7733
7734 EOM
7735         case "$ld" in
7736         '')     $cat >try.c <<EOM
7737 /* Test for whether ELF binaries are produced */
7738 #include <fcntl.h>
7739 #$i_stdlib I_STDLIB
7740 #ifdef I_STDLIB
7741 #include <stdlib.h>
7742 #endif
7743 #$i_unistd I_UNISTD
7744 #ifdef I_UNISTD
7745 #include <unistd.h>
7746 #endif
7747 int main() {
7748         char b[4];
7749         int i = open("a.out",O_RDONLY);
7750         if(i == -1) 
7751                 exit(1); /* fail */
7752         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7753                 exit(0); /* succeed (yes, it's ELF) */
7754         else
7755                 exit(1); /* fail */
7756 }
7757 EOM
7758                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7759                         cat <<EOM
7760 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7761 EOM
7762                         dflt="$cc"
7763                 else
7764                         echo "I'll use ld to build dynamic libraries."
7765                         dflt='ld'
7766                 fi
7767                 rm -f try.c a.out
7768                 ;;
7769         *)      dflt="$ld"
7770                 ;;
7771         esac
7772
7773     rp="What command should be used to create dynamic libraries?"
7774     . ./myread
7775         ld="$ans"
7776
7777     cat << EOM
7778
7779 Some systems may require passing special flags to $ld to create a
7780 library that can be dynamically loaded.  If your ld flags include
7781 -L/other/path options to locate libraries outside your loader's normal
7782 search path, you may need to specify those -L options here as well.  To
7783 use no flags, say "none".
7784
7785 EOM
7786     case "$lddlflags" in
7787     '') case "$osname" in
7788                         beos) dflt='-nostart' ;;
7789                         hpux) dflt='-b';
7790                               case "$gccversion" in
7791                               '') dflt="$dflt +vnocompatwarnings" ;;
7792                               esac
7793                               ;;        
7794                         linux|irix*|gnu*)       dflt='-shared' ;;
7795                         next)  dflt='none' ;;
7796                         solaris) dflt='-G' ;;
7797                         sunos) dflt='-assert nodefinitions' ;;
7798                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7799                 *)     dflt='none' ;;
7800                         esac
7801                         ;;
7802     *) dflt="$lddlflags" ;;
7803     esac
7804
7805         : Try to guess additional flags to pick up local libraries.
7806         : Be careful not to append to a plain 'none'
7807         case "$dflt" in
7808         none) dflt='' ;;
7809         esac
7810         for thisflag in $ldflags; do
7811                 case "$thisflag" in
7812                 -L*|-R*|-Wl,-R*)
7813                         case " $dflt " in
7814                         *" $thisflag "*) ;;
7815                         *) dflt="$dflt $thisflag" ;;
7816                         esac
7817                         ;;
7818                 esac
7819         done
7820
7821         case "$dflt" in
7822         ''|' ') dflt='none' ;;
7823         esac
7824
7825     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7826     . ./myread
7827     case "$ans" in
7828     none) lddlflags=' ' ;;
7829     *) lddlflags="$ans" ;;
7830     esac
7831
7832         cat <<EOM
7833
7834 Some systems may require passing special flags to $cc to indicate that
7835 the resulting executable will use dynamic linking.  To use no flags,
7836 say "none".
7837
7838 EOM
7839     case "$ccdlflags" in
7840     '') case "$osname" in
7841             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7842             next|sunos) dflt='none' ;;
7843             *)          dflt='none' ;;
7844             esac ;;
7845     ' ')  dflt='none' ;;
7846     *)  dflt="$ccdlflags" ;;
7847     esac
7848     rp="Any special flags to pass to $cc to use dynamic linking?"
7849     . ./myread
7850     case "$ans" in
7851     none) ccdlflags=' ' ;;
7852     *) ccdlflags="$ans" ;;
7853     esac
7854     ;;
7855 *)  usedl="$undef"
7856         ld='ld'
7857     dlsrc='dl_none.xs'
7858     lddlflags=''
7859     ccdlflags=''
7860     ;;
7861 esac
7862
7863 also=''
7864 case "$usedl" in
7865 $undef)
7866         # No dynamic loading being used, so don't bother even to prompt.
7867         useshrplib='false'
7868         ;;
7869 *)      case "$useshrplib" in
7870         '')     case "$osname" in
7871                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7872                         dflt=y
7873                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7874                         ;;
7875                 next*)
7876                         case "$osvers" in
7877                         4*)     dflt=y
7878                                 also='Building a shared libperl is needed for MAB support.'
7879                                 ;;
7880                         *)      dflt=n
7881                                 ;;
7882                         esac
7883                         ;;
7884                 *)      dflt=n
7885                         ;;
7886                 esac
7887                 ;;
7888         $define|true|[Yy]*)
7889                 dflt=y
7890                 ;;
7891         *)      dflt=n
7892                 ;;
7893         esac
7894         $cat << EOM
7895
7896 The perl executable is normally obtained by linking perlmain.c with
7897 libperl${_a}, any static extensions (usually just DynaLoader), and
7898 any other libraries needed on this system (such as -lm, etc.).  Since
7899 your system supports dynamic loading, it is probably possible to build
7900 a shared libperl.$so.  If you will have more than one executable linked
7901 to libperl.$so, this will significantly reduce the size of each
7902 executable, but it may have a noticeable effect on performance.  The
7903 default is probably sensible for your system.
7904 $also
7905
7906 EOM
7907         rp="Build a shared libperl.$so (y/n)"
7908         . ./myread
7909         case "$ans" in
7910         true|$define|[Yy]*)
7911                 useshrplib='true'  ;;
7912         *)      useshrplib='false' ;;
7913         esac
7914         ;;
7915 esac
7916
7917 case "$useshrplib" in
7918 true)
7919         case "$libperl" in
7920         '')
7921                 # Figure out a good name for libperl.so.  Since it gets stored in
7922                 # a version-specific architecture-dependent library, the version
7923                 # number isn't really that important, except for making cc/ld happy.
7924                 #
7925                 # A name such as libperl.so.3.1
7926                 majmin="libperl.$so.$patchlevel.$subversion"
7927                 # A name such as libperl.so.301
7928                 majonly=`echo $patchlevel $subversion |
7929                         $awk '{printf "%d%02d", $1, $2}'`
7930                 majonly=libperl.$so.$majonly
7931                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7932                 # rely on figuring it out from the naming of libc.
7933                 case "${osname}${osvers}" in
7934                 next4*)
7935                         dflt=libperl.5.$so
7936                         # XXX How handle the --version stuff for MAB?
7937                         ;;
7938                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7939                         dflt=libperl.$so
7940                         ;;
7941                 cygwin*) # ld links against an importlib
7942                         dflt=libperl$lib_ext
7943                         ;;
7944                 *)      # Try to guess based on whether libc has major.minor.
7945                         case "$libc" in
7946                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7947                         *libc.$so.[0-9]*) dflt=$majonly ;;
7948                         *)      dflt=libperl.$so ;;
7949                         esac
7950                         ;;
7951                 esac
7952                 ;;
7953         *)      dflt=$libperl
7954                 ;;
7955         esac
7956         cat << EOM
7957
7958 I need to select a good name for the shared libperl.  If your system uses
7959 library names with major and minor numbers, then you might want something
7960 like $majmin.  Alternatively, if your system uses a single version
7961 number for shared libraries, then you might want to use $majonly.
7962 Or, your system might be quite happy with a simple libperl.$so.
7963
7964 Since the shared libperl will get installed into a version-specific
7965 architecture-dependent directory, the version number of the shared perl
7966 library probably isn't important, so the default should be o.k.
7967
7968 EOM
7969         rp='What name do you want to give to the shared libperl?'
7970         . ./myread
7971         libperl=$ans
7972         echo "Ok, I'll use $libperl"
7973         ;;
7974 *)
7975         libperl="libperl${_a}"
7976         ;;
7977 esac
7978
7979 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7980 case "$shrpdir" in
7981 '') ;;
7982 *)      $cat >&4 <<EOM
7983 WARNING:  Use of the shrpdir variable for the installation location of
7984 the shared $libperl is not supported.  It was never documented and
7985 will not work in this version.  Let me (perlbug@perl.org)
7986 know of any problems this may cause.
7987
7988 EOM
7989         case "$shrpdir" in
7990         "$archlibexp/CORE")
7991                 $cat >&4 <<EOM
7992 But your current setting of $shrpdir is
7993 the default anyway, so it's harmless.
7994 EOM
7995                 ;;
7996         *)
7997                 $cat >&4 <<EOM
7998 Further, your current attempted setting of $shrpdir
7999 conflicts with the value of $archlibexp/CORE
8000 that installperl will use.
8001 EOM
8002                 ;;
8003         esac
8004         ;;
8005 esac
8006
8007 # How will the perl executable find the installed shared $libperl?
8008 # Add $xxx to ccdlflags.
8009 # If we can't figure out a command-line option, use $shrpenv to
8010 # set env LD_RUN_PATH.  The main perl makefile uses this.
8011 shrpdir=$archlibexp/CORE
8012 xxx=''
8013 tmp_shrpenv=''
8014 if "$useshrplib"; then
8015     case "$osname" in 
8016         aix)
8017                 # We'll set it in Makefile.SH...
8018                 ;;
8019         solaris)
8020                 xxx="-R $shrpdir"
8021                 ;;
8022         freebsd|netbsd|openbsd|interix|dragonfly)
8023                 xxx="-Wl,-R$shrpdir"
8024                 ;;
8025         bsdos|linux|irix*|dec_osf|gnu*)
8026                 xxx="-Wl,-rpath,$shrpdir"
8027                 ;;
8028         next)
8029                 # next doesn't like the default...
8030                 ;;
8031         beos)
8032                 # beos doesn't like the default, either.
8033                 ;;
8034         hpux*)
8035                 # hpux doesn't like the default, either.
8036                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8037                 ;;
8038         *)
8039                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8040                 ;;
8041         esac
8042         case "$xxx" in
8043         '') ;;
8044         *)      
8045                 # Only add $xxx if it isn't already in ccdlflags.
8046                 case " $ccdlflags " in
8047                 *" $xxx "*)     ;;
8048                 *)      ccdlflags="$ccdlflags $xxx"
8049                         cat <<EOM >&4
8050
8051 Adding $xxx to the flags
8052 passed to $ld so that the perl executable will find the 
8053 installed shared $libperl.
8054
8055 EOM
8056                         ;;
8057                 esac
8058                 ;;
8059         esac
8060 fi
8061 # Fix ccdlflags in AIX for building external extensions.
8062 # (For building Perl itself bare -bE:perl.exp is needed,
8063 #  Makefile.SH takes care of this.)
8064 case "$osname" in
8065 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8066 esac
8067 # Respect a hint or command-line value.
8068 case "$shrpenv" in
8069 '') shrpenv="$tmp_shrpenv" ;;
8070 esac
8071 case "$ldlibpthname" in
8072 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8073 none)   ldlibpthname='' ;;
8074 esac
8075
8076 : determine where manual pages are on this system
8077 echo " "
8078 case "$sysman" in
8079 '') 
8080         syspath='/usr/share/man/man1 /usr/man/man1'
8081         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8082         syspath="$syspath /usr/man/u_man/man1"
8083         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8084         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8085         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8086         sysman=`./loc . /usr/man/man1 $syspath`
8087         ;;
8088 esac
8089 if $test -d "$sysman"; then
8090         echo "System manual is in $sysman." >&4
8091 else
8092         echo "Could not find manual pages in source form." >&4
8093 fi
8094
8095 : determine where manual pages go
8096 set man1dir man1dir none
8097 eval $prefixit
8098 $cat <<EOM
8099
8100 $spackage has manual pages available in source form.
8101 EOM
8102 case "$nroff" in
8103 nroff)
8104         echo "However, you don't have nroff, so they're probably useless to you."
8105         case "$man1dir" in
8106         '') man1dir="none";;
8107         esac;;
8108 esac
8109 echo "If you don't want the manual sources installed, answer 'none'."
8110 case "$man1dir" in
8111 ' ') dflt=none
8112         ;;
8113 '')
8114         lookpath="$prefixexp/share/man/man1"
8115         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8116         lookpath="$lookpath $prefixexp/man/p_man/man1"
8117         lookpath="$lookpath $prefixexp/man/u_man/man1"
8118         lookpath="$lookpath $prefixexp/man/man.1"
8119         case "$sysman" in
8120         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8121         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8122         esac
8123         set dflt
8124         eval $prefixup
8125         ;;
8126 *)  dflt="$man1dir"
8127         ;;
8128 esac
8129 echo " "
8130 fn=dn+~
8131 rp="Where do the main $spackage manual pages (source) go?"
8132 . ./getfile
8133 if $test "X$man1direxp" != "X$ansexp"; then
8134         installman1dir=''
8135 fi
8136 prefixvar=man1dir
8137 . ./setprefixvar
8138
8139 case "$man1dir" in
8140 '')     man1dir=' '
8141         installman1dir='';;
8142 esac
8143
8144 : What suffix to use on installed man pages
8145
8146 case "$man1dir" in
8147 ' ')
8148         man1ext='0'
8149         ;;
8150 *)
8151         rp="What suffix should be used for the main $spackage man pages?"
8152         case "$man1ext" in
8153         '')     case "$man1dir" in
8154                 *1)  dflt=1 ;;
8155                 *1p) dflt=1p ;;
8156                 *1pm) dflt=1pm ;;
8157                 *l) dflt=l;;
8158                 *n) dflt=n;;
8159                 *o) dflt=o;;
8160                 *p) dflt=p;;
8161                 *C) dflt=C;;
8162                 *L) dflt=L;;
8163                 *L1) dflt=L1;;
8164                 *) dflt=1;;
8165                 esac
8166                 ;;
8167         *)      dflt="$man1ext";;
8168         esac
8169         . ./myread
8170         man1ext="$ans"
8171         ;;
8172 esac
8173
8174 : see if we can have long filenames
8175 echo " "
8176 first=123456789abcdef
8177 $rm -f $first
8178 if (echo hi >$first) 2>/dev/null; then
8179         if $test -f 123456789abcde; then
8180                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8181                 val="$undef"
8182         else
8183                 echo 'You can have filenames longer than 14 characters.'>&4
8184                 val="$define"
8185         fi
8186 else
8187         $cat <<'EOM'
8188 You can't have filenames longer than 14 chars.
8189 You can't even think about them!
8190 EOM
8191         val="$undef"
8192 fi 
8193 set d_flexfnam
8194 eval $setvar
8195 $rm -rf 123456789abcde*
8196
8197 : determine where library module manual pages go
8198 set man3dir man3dir none
8199 eval $prefixit
8200 $cat <<EOM
8201
8202 $spackage has manual pages for many of the library modules.
8203 EOM
8204
8205 case "$nroff" in
8206 nroff)
8207         $cat <<'EOM'
8208 However, you don't have nroff, so they're probably useless to you.
8209 EOM
8210         case "$man3dir" in
8211         '') man3dir="none";;
8212         esac;;
8213 esac
8214
8215 case "$d_flexfnam" in
8216 undef)
8217         $cat <<'EOM'
8218 However, your system can't handle the long file names like File::Basename.3.
8219 EOM
8220         case "$man3dir" in
8221         '') man3dir="none";;
8222         esac;;
8223 esac
8224
8225 echo "If you don't want the manual sources installed, answer 'none'."
8226 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8227 case "$man3dir" in
8228 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8229         if $test -d "$privlib/man/man3"; then
8230                 cat <<EOM >&4
8231
8232 WARNING:  Previous versions of perl installed man3 pages into
8233 $privlib/man/man3.  This version will suggest a
8234 new default of $dflt.
8235 EOM
8236                 tdflt=$dflt
8237                 dflt='n'
8238                 rp='Do you wish to preserve the old behavior?(y/n)'
8239                 . ./myread
8240                 case "$ans" in
8241                 y*) dflt="$privlib/man/man3" ;;
8242                 *)  dflt=$tdflt ;;
8243                 esac
8244     fi
8245         ;;
8246 *)      dflt="$man3dir" ;;
8247 esac
8248 case "$dflt" in
8249 ' ') dflt=none ;;
8250 esac
8251 echo " "
8252 fn=dn+~
8253 rp="Where do the $package library man pages (source) go?"
8254 . ./getfile
8255 prefixvar=man3dir
8256 . ./setprefixvar
8257
8258 case "$man3dir" in
8259 '')     man3dir=' '
8260         installman3dir='';;
8261 esac
8262
8263 : What suffix to use on installed man pages
8264 case "$man3dir" in
8265 ' ')
8266         man3ext='0'
8267         ;;
8268 *)
8269         rp="What suffix should be used for the $package library man pages?"
8270         case "$man3ext" in
8271         '')     case "$man3dir" in
8272                 *3)  dflt=3 ;;
8273                 *3p) dflt=3p ;;
8274                 *3pm) dflt=3pm ;;
8275                 *l) dflt=l;;
8276                 *n) dflt=n;;
8277                 *o) dflt=o;;
8278                 *p) dflt=p;;
8279                 *C) dflt=C;;
8280                 *L) dflt=L;;
8281                 *L3) dflt=L3;;
8282                 *) dflt=3;;
8283                 esac
8284                 ;;
8285         *)      dflt="$man3ext";;
8286         esac
8287         . ./myread
8288         man3ext="$ans"
8289         ;;
8290 esac
8291
8292 : see if we have to deal with yellow pages, now NIS.
8293 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8294         if $test -f /usr/etc/nibindd; then
8295                 echo " "
8296                 echo "I'm fairly confident you're on a NeXT."
8297                 echo " "
8298                 rp='Do you get the hosts file via NetInfo?'
8299                 dflt=y
8300                 case "$hostcat" in
8301                 nidump*) ;;
8302                 '') ;;
8303                 *) dflt=n;;
8304                 esac
8305                 . ./myread
8306                 case "$ans" in
8307                 y*) hostcat='nidump hosts .';;
8308                 *)      case "$hostcat" in
8309                         nidump*) hostcat='';;
8310                         esac
8311                         ;;
8312                 esac
8313         fi
8314         case "$hostcat" in
8315         nidump*) ;;
8316         *)
8317                 case "$hostcat" in
8318                 *ypcat*) dflt=y;;
8319                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8320                                 dflt=y
8321                         else
8322                                 dflt=n
8323                         fi;;
8324                 *) dflt=n;;
8325                 esac
8326                 echo " "
8327                 rp='Are you getting the hosts file via yellow pages?'
8328                 . ./myread
8329                 case "$ans" in
8330                 y*) hostcat='ypcat hosts';;
8331                 *) hostcat='cat /etc/hosts';;
8332                 esac
8333                 ;;
8334         esac
8335 fi
8336 case "$hostcat" in
8337 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8338 esac
8339 case "$groupcat" in
8340 '') test -f /etc/group && groupcat='cat /etc/group';;
8341 esac
8342 case "$passcat" in
8343 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8344 esac
8345
8346 : now get the host name
8347 echo " "
8348 echo "Figuring out host name..." >&4
8349 case "$myhostname" in
8350 '') cont=true
8351         echo 'Maybe "hostname" will work...'
8352         if tans=`sh -c hostname 2>&1` ; then
8353                 myhostname=$tans
8354                 phostname=hostname
8355                 cont=''
8356         fi
8357         ;;
8358 *) cont='';;
8359 esac
8360 if $test "$cont"; then
8361         if ./xenix; then
8362                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8363                 if tans=`cat /etc/systemid 2>&1` ; then
8364                         myhostname=$tans
8365                         phostname='cat /etc/systemid'
8366                         echo "Whadyaknow.  Xenix always was a bit strange..."
8367                         cont=''
8368                 fi
8369         elif $test -r /etc/systemid; then
8370                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8371         fi
8372 fi
8373 if $test "$cont"; then
8374         echo 'No, maybe "uuname -l" will work...'
8375         if tans=`sh -c 'uuname -l' 2>&1` ; then
8376                 myhostname=$tans
8377                 phostname='uuname -l'
8378         else
8379                 echo 'Strange.  Maybe "uname -n" will work...'
8380                 if tans=`sh -c 'uname -n' 2>&1` ; then
8381                         myhostname=$tans
8382                         phostname='uname -n'
8383                 else
8384                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8385                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8386                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8387                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8388                         else
8389                                 case "$myhostname" in
8390                                 '') echo "Does this machine have an identity crisis or something?"
8391                                         phostname='';;
8392                                 *)
8393                                         echo "Well, you said $myhostname before..."
8394                                         phostname='echo $myhostname';;
8395                                 esac
8396                         fi
8397                 fi
8398         fi
8399 fi
8400 case "$myhostname" in
8401 '') myhostname=noname ;;
8402 esac
8403 : you do not want to know about this
8404 set $myhostname
8405 myhostname=$1
8406
8407 : verify guess
8408 if $test "$myhostname" ; then
8409         dflt=y
8410         rp='Your host name appears to be "'$myhostname'".'" Right?"
8411         . ./myread
8412         case "$ans" in
8413         y*) ;;
8414         *) myhostname='';;
8415         esac
8416 fi
8417
8418 : bad guess or no guess
8419 while $test "X$myhostname" = X ; do
8420         dflt=''
8421         rp="Please type the (one word) name of your host:"
8422         . ./myread
8423         myhostname="$ans"
8424 done
8425
8426 : translate upper to lower if necessary
8427 case "$myhostname" in
8428 *[A-Z]*)
8429         echo "(Normalizing case in your host name)"
8430         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8431         ;;
8432 esac
8433
8434 case "$myhostname" in
8435 *.*)
8436         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8437         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8438         echo "(Trimming domain name from host name--host name is now $myhostname)"
8439         ;;
8440 *) case "$mydomain" in
8441         '')
8442                 {
8443                         test "X$hostcat" = "Xypcat hosts" &&
8444                         ypmatch "$myhostname" hosts 2>/dev/null |\
8445                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8446                         $test -s hosts
8447                 } || {
8448                         test "X$hostcat" != "X" &&
8449                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8450                                         /[       ]$myhostname[  . ]/p" > hosts
8451                 }
8452                 tmp_re="[       . ]"
8453                 if $test -f hosts; then
8454                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8455                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8456                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8457                                 hosts | $sort | $uniq | \
8458                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8459                         case `$echo X$dflt` in
8460                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8461                                 dflt=.
8462                                 ;;
8463                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8464                                 ;;
8465                         esac
8466                 else
8467                         echo "(I cannot locate a hosts database anywhere)"
8468                         dflt=.
8469                 fi
8470                 case "$dflt" in
8471                 .)
8472                         tans=`./loc resolv.conf X /etc /usr/etc`
8473                         if $test -f "$tans"; then
8474                                 echo "(Attempting domain name extraction from $tans)"
8475                                 dflt=.`$sed -n -e 's/   / /g' \
8476                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8477                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8478                                 case "$dflt" in
8479                                 .) dflt=.`$sed -n -e 's/        / /g' \
8480                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8481                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8482                                         ;;
8483                                 esac
8484                         fi
8485                         ;;
8486                 esac
8487                 case "$dflt" in
8488                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8489                         dflt=.`sh -c domainname 2>/dev/null`
8490                         case "$dflt" in
8491                         '') dflt='.';;
8492                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8493                         esac
8494                         ;;
8495                 esac
8496                 case "$dflt$osname" in
8497                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8498                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8499                         ;;
8500                 esac
8501                 case "$dflt" in
8502                 .) echo "(Lost all hope -- silly guess then)"
8503                         dflt='.nonet'
8504                         ;;
8505                 esac
8506                 $rm -f hosts
8507                 ;;
8508         *) dflt="$mydomain";;
8509         esac;;
8510 esac
8511 echo " "
8512 rp="What is your domain name?"
8513 . ./myread
8514 tans="$ans"
8515 case "$ans" in
8516 '') ;;
8517 .*) ;;
8518 *) tans=".$tans";;
8519 esac
8520 mydomain="$tans"
8521
8522 : translate upper to lower if necessary
8523 case "$mydomain" in
8524 *[A-Z]*)
8525         echo "(Normalizing case in your domain name)"
8526         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8527         ;;
8528 esac
8529
8530 : a little sanity check here
8531 case "$phostname" in
8532 '') ;;
8533 *)
8534         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8535         $myhostname$mydomain|$myhostname) ;;
8536         *)
8537                 case "$phostname" in
8538                 sed*)
8539                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8540                         ;;
8541                 *)
8542                         echo "(That doesn't agree with your $phostname command, by the way.)"
8543                         ;;
8544                 esac
8545         ;;
8546         esac
8547         ;;
8548 esac
8549
8550 $cat <<EOM
8551
8552 I need to get your e-mail address in Internet format if possible, i.e.
8553 something like user@host.domain. Please answer accurately since I have
8554 no easy means to double check it. The default value provided below
8555 is most probably close to reality but may not be valid from outside
8556 your organization...
8557
8558 EOM
8559 cont=x
8560 while test "$cont"; do
8561         case "$cf_email" in
8562         '') dflt="$cf_by@$myhostname$mydomain";;
8563         *) dflt="$cf_email";;
8564         esac
8565         rp='What is your e-mail address?'
8566         . ./myread
8567         cf_email="$ans"
8568         case "$cf_email" in
8569         *@*.*) cont='' ;;
8570         *)
8571                 rp='Address does not look like an Internet one.  Use it anyway?'
8572                 case "$fastread" in
8573                 yes) dflt=y ;;
8574                 *) dflt=n ;;
8575                 esac
8576                 . ./myread
8577                 case "$ans" in
8578                 y*) cont='' ;;
8579                 *) echo " " ;;
8580                 esac
8581                 ;;
8582         esac
8583 done
8584
8585 $cat <<EOM
8586
8587 If you or somebody else will be maintaining perl at your site, please
8588 fill in the correct e-mail address here so that they may be contacted
8589 if necessary. Currently, the "perlbug" program included with perl
8590 will send mail to this address in addition to perlbug@perl.org. You may
8591 enter "none" for no administrator.
8592
8593 EOM
8594 case "$perladmin" in
8595 '') dflt="$cf_email";;
8596 *) dflt="$perladmin";;
8597 esac
8598 rp='Perl administrator e-mail address'
8599 . ./myread
8600 perladmin="$ans"
8601
8602 : determine whether to only install version-specific parts.
8603 echo " "
8604 $cat <<EOM
8605 Do you want to install only the version-specific parts of the perl
8606 distribution?  Usually you do *not* want to do this.
8607 EOM
8608 case "$versiononly" in
8609 "$define"|[Yy]*|true) dflt='y' ;;
8610 *) dflt='n';
8611 esac
8612 rp="Do you want to install only the version-specific parts of perl?"
8613 . ./myread
8614 case "$ans" in
8615 [yY]*)  val="$define";;
8616 *)      val="$undef" ;;
8617 esac
8618 set versiononly
8619 eval $setvar
8620
8621 case "$versiononly" in
8622 "$define") inc_version_list=''
8623            inc_version_list_init=0
8624            ;;
8625 esac
8626
8627 : figure out how to guarantee perl startup
8628 : XXX Note that this currently takes advantage of the bug that binexp ignores
8629 :     the Configure -Dinstallprefix setting, which in turn means that under
8630 :     relocatable @INC, initialinstalllocation is what binexp started as.
8631 case "$startperl" in
8632 '')
8633         case "$sharpbang" in
8634         *!)
8635                 $cat <<EOH
8636
8637 I can use the #! construct to start perl on your system. This will
8638 make startup of perl scripts faster, but may cause problems if you
8639 want to share those scripts and perl is not in a standard place
8640 ($initialinstalllocation/perl) on all your platforms. The alternative
8641 is to force a shell by starting the script with a single ':' character.
8642
8643 EOH
8644                 case "$versiononly" in
8645                 "$define")      dflt="$initialinstalllocation/perl$version";;
8646                 *)              dflt="$initialinstalllocation/perl";;
8647                 esac
8648                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8649                 . ./myread
8650                 case "$ans" in
8651                 none)   startperl=": # use perl";;
8652                 *)      startperl="#!$ans"
8653                         if $test 30 -lt `echo "$ans" | wc -c`; then
8654                                 $cat >&4 <<EOM
8655
8656 WARNING:  Some systems limit the #! command to 32 characters.
8657 If you experience difficulty running Perl scripts with #!, try
8658 installing Perl in a directory with a shorter pathname.
8659
8660 EOM
8661                         fi ;;
8662                 esac
8663                 ;;
8664         *) startperl=": # use perl"
8665                 ;;
8666         esac
8667         ;;
8668 esac
8669 echo "I'll use $startperl to start perl scripts."
8670
8671 : figure best path for perl in scripts
8672 case "$perlpath" in
8673 '')
8674         case "$versiononly" in
8675         "$define")      perlpath="$initialinstalllocation/perl$version";;
8676         *)              perlpath="$initialinstalllocation/perl";;
8677         esac
8678         case "$startperl" in
8679         *!*) ;;
8680         *)
8681                 $cat <<EOH
8682
8683 I will use the "eval 'exec'" idiom to start Perl on your system.
8684 I can use the full path of your Perl binary for this purpose, but
8685 doing so may cause problems if you want to share those scripts and
8686 Perl is not always in a standard place ($initialinstalllocation/perl).
8687
8688 EOH
8689                 dflt="$initialinstalllocation/perl"
8690                 rp="What path shall I use in \"eval 'exec'\"?"
8691                 . ./myread
8692                 perlpath="$ans"
8693                 ;;
8694         esac
8695         ;;
8696 esac
8697 case "$startperl" in
8698 *!*)    ;;
8699 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8700 esac
8701
8702 : determine where public executable scripts go
8703 set scriptdir scriptdir
8704 eval $prefixit
8705 case "$scriptdir" in
8706 '')
8707         dflt="$bin"
8708         : guess some guesses
8709         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8710         $test -d /usr/share/bin     && dflt=/usr/share/bin
8711         $test -d /usr/local/script  && dflt=/usr/local/script
8712         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8713         $test -d $prefixexp/script  && dflt=$prefixexp/script
8714         set dflt
8715         eval $prefixup
8716         ;;
8717 *)  dflt="$scriptdir"
8718         ;;
8719 esac
8720 $cat <<EOM
8721
8722 Some installations have a separate directory just for executable scripts so
8723 that they can mount it across multiple architectures but keep the scripts in
8724 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8725 Or you might just lump your scripts in with all your other executables.
8726
8727 EOM
8728 fn=d~
8729 rp='Where do you keep publicly executable scripts?'
8730 . ./getfile
8731 if $test "X$ansexp" != "X$scriptdirexp"; then
8732         installscript=''
8733 fi
8734 installscriptdir=''
8735 prefixvar=scriptdir
8736 . ./setprefixvar
8737 : A little fix up for an irregularly named variable.
8738 installscript="$installscriptdir"
8739
8740 : determine where add-on public executables go
8741 case "$sitebin" in
8742 '')     dflt=$siteprefix/bin ;;
8743 *)      dflt=$sitebin ;;
8744 esac
8745 fn=d~
8746 rp='Pathname where the add-on public executables should be installed?'
8747 . ./getfile
8748 prefixvar=sitebin
8749 . ./setprefixvar
8750
8751 : determine where add-on html pages go
8752 : There is no standard location, so try to copy the previously-selected
8753 : directory structure for the core html pages.
8754 case "$sitehtml1dir" in
8755 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8756 *)     dflt=$sitehtml1dir ;;
8757 esac
8758 case "$dflt" in
8759 ''|' ') dflt=none ;;
8760 esac
8761 fn=dn+~
8762 rp='Pathname where the site-specific html pages should be installed?'
8763 . ./getfile
8764 prefixvar=sitehtml1dir
8765 . ./setprefixvar
8766
8767 : determine where add-on library html pages go
8768 : There is no standard location, so try to copy the previously-selected
8769 : directory structure for the core html pages.
8770 case "$sitehtml3dir" in
8771 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8772 *)     dflt=$sitehtml3dir ;;
8773 esac
8774 case "$dflt" in
8775 ''|' ') dflt=none ;;
8776 esac
8777 fn=dn+~
8778 rp='Pathname where the site-specific library html pages should be installed?'
8779 . ./getfile
8780 prefixvar=sitehtml3dir
8781 . ./setprefixvar
8782
8783 : determine where add-on manual pages go
8784 case "$siteman1dir" in
8785 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8786 *)      dflt=$siteman1dir ;;
8787 esac
8788 case "$dflt" in
8789 ''|' ') dflt=none ;;
8790 esac
8791 fn=dn+~
8792 rp='Pathname where the site-specific manual pages should be installed?'
8793 . ./getfile
8794 prefixvar=siteman1dir
8795 . ./setprefixvar
8796
8797 : determine where add-on library man pages go
8798 case "$siteman3dir" in
8799 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8800 *)      dflt=$siteman3dir ;;
8801 esac
8802 case "$dflt" in
8803 ''|' ') dflt=none ;;
8804 esac
8805 fn=dn+~
8806 rp='Pathname where the site-specific library manual pages should be installed?'
8807 . ./getfile
8808 prefixvar=siteman3dir
8809 . ./setprefixvar
8810
8811 : determine where add-on public executable scripts go
8812 case "$sitescript" in
8813 '')     dflt=$siteprefix/script
8814         $test -d $dflt || dflt=$sitebin ;;
8815 *)  dflt="$sitescript" ;;
8816 esac
8817 fn=d~+
8818 rp='Pathname where add-on public executable scripts should be installed?'
8819 . ./getfile
8820 prefixvar=sitescript
8821 . ./setprefixvar
8822
8823 case "$usefaststdio" in
8824 $define|true|[yY]*|'')
8825         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8826         case "$xversion" in
8827         [68])   dflt='y' ;;
8828         *)      dflt='n' ;;
8829         esac
8830         ;;
8831 *) dflt='n';;
8832 esac
8833 cat <<EOM
8834
8835 Perl can be built to use 'fast stdio', which means using the stdio
8836 library but also directly manipulating the stdio buffers to enable
8837 faster I/O.  Using stdio is better for backward compatibility (especially
8838 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8839 interface has been preferred instead of stdio.
8840
8841 If this doesn't make any sense to you, just accept the default '$dflt'.
8842 EOM
8843 rp='Use the "fast stdio" if available?'
8844 . ./myread
8845 case "$ans" in
8846 y|Y)    val="$define" ;;     
8847 *)      val="$undef" ;;
8848 esac
8849 set usefaststdio
8850 eval $setvar
8851
8852
8853 : define an is-a-typedef? function
8854 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8855 case "$inclist" in
8856 "") inclist="sys/types.h";;
8857 esac;
8858 eval "varval=\$$var";
8859 case "$varval" in
8860 "")
8861         $rm -f temp.c;
8862         for inc in $inclist; do
8863                 echo "#include <$inc>" >>temp.c;
8864         done;
8865         echo "#ifdef $type" >> temp.c;
8866         echo "printf(\"We have $type\");" >> temp.c;
8867         echo "#endif" >> temp.c;
8868         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8869         if $contains $type temp.E >/dev/null 2>&1; then
8870                 eval "$var=\$type";
8871         else
8872                 eval "$var=\$def";
8873         fi;
8874         $rm -f temp.?;;
8875 *) eval "$var=\$varval";;
8876 esac'
8877
8878 : define an is-a-typedef? function that prompts if the type is not available.
8879 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8880 case "$inclist" in
8881 "") inclist="sys/types.h";;
8882 esac;
8883 eval "varval=\$$var";
8884 case "$varval" in
8885 "")
8886         $rm -f temp.c;
8887         for inc in $inclist; do
8888                 echo "#include <$inc>" >>temp.c;
8889         done;
8890         echo "#ifdef $type" >> temp.c;
8891         echo "printf(\"We have $type\");" >> temp.c;
8892         echo "#endif" >> temp.c;
8893         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8894         echo " " ;
8895         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8896         if $contains $type temp.E >/dev/null 2>&1; then
8897                 echo "$type found." >&4;
8898                 eval "$var=\$type";
8899         else
8900                 echo "$type NOT found." >&4;
8901                 dflt="$def";
8902                 . ./myread ;
8903                 eval "$var=\$ans";
8904         fi;
8905         $rm -f temp.?;;
8906 *) eval "$var=\$varval";;
8907 esac'
8908
8909 : see what type lseek is declared as in the kernel
8910 rp="What is the type used for lseek's offset on this system?"
8911 set off_t lseektype long stdio.h sys/types.h
8912 eval $typedef_ask
8913
8914 echo " "
8915 echo "Checking to see how big your file offsets are..." >&4
8916 $cat >try.c <<EOCP
8917 #include <sys/types.h>
8918 #include <stdio.h>
8919 int main()
8920 {
8921     printf("%d\n", (int)sizeof($lseektype));
8922     return(0); 
8923 }
8924 EOCP
8925 set try
8926 if eval $compile_ok; then
8927         lseeksize=`$run ./try`
8928         echo "Your file offsets are $lseeksize bytes long."
8929 else
8930         dflt=$longsize
8931         echo " "
8932         echo "(I can't seem to compile the test program.  Guessing...)"
8933         rp="What is the size of your file offsets (in bytes)?"
8934         . ./myread
8935         lseeksize="$ans"
8936 fi
8937 $rm -f try.c try
8938
8939 : see what type file positions are declared as in the library
8940 rp="What is the type for file position used by fsetpos()?"
8941 set fpos_t fpostype long stdio.h sys/types.h
8942 eval $typedef_ask
8943
8944 echo " "
8945 case "$fpostype" in
8946 *_t) zzz="$fpostype"    ;;
8947 *)   zzz="fpos_t"       ;;
8948 esac
8949 echo "Checking the size of $zzz..." >&4 
8950 cat > try.c <<EOCP
8951 #include <sys/types.h>
8952 #include <stdio.h>
8953 #$i_stdlib I_STDLIB
8954 #ifdef I_STDLIB
8955 #include <stdlib.h>
8956 #endif
8957 int main() {
8958     printf("%d\n", (int)sizeof($fpostype));
8959     exit(0);
8960 }
8961 EOCP
8962 set try
8963 if eval $compile_ok; then
8964         yyy=`$run ./try`
8965         case "$yyy" in
8966         '')     fpossize=4
8967                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8968                 ;;
8969         *)      fpossize=$yyy
8970                 echo "Your $zzz is $fpossize bytes long."
8971                 ;;
8972         esac
8973 else
8974         dflt="$longsize"
8975         echo " " >&4
8976         echo "(I can't compile the test program.  Guessing...)" >&4
8977         rp="What is the size of your file positions (in bytes)?"
8978         . ./myread
8979         fpossize="$ans"
8980 fi
8981
8982 # Backward compatibility (uselfs is deprecated).
8983 case "$uselfs" in
8984 "$define"|true|[yY]*)
8985         cat <<EOM >&4
8986
8987 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8988 EOM
8989         uselargefiles="$define"
8990         ;;
8991 esac                          
8992
8993 case "$lseeksize:$fpossize" in
8994 8:8) cat <<EOM
8995
8996 You can have files larger than 2 gigabytes.
8997 EOM
8998    val="$define" ;;
8999 *)    case "$uselargefiles" in
9000    "$undef"|false|[nN]*) dflt='n' ;;
9001    *)   dflt='y' ;;
9002    esac
9003    cat <<EOM
9004
9005 Perl can be built to understand large files (files larger than 2 gigabytes)
9006 on some systems.  To do so, Configure can be run with -Duselargefiles.
9007
9008 If this doesn't make any sense to you, just accept the default '$dflt'.
9009 EOM
9010    rp='Try to understand large files, if available?'
9011    . ./myread
9012    case "$ans" in
9013    y|Y)         val="$define" ;;
9014    *)           val="$undef"  ;;
9015    esac
9016    ;;
9017 esac
9018 set uselargefiles
9019 eval $setvar
9020 : Look for a hint-file generated 'call-back-unit'.  If the
9021 : user has specified that a large files perl is to be built,
9022 : we may need to set or change some other defaults.
9023 if $test -f uselargefiles.cbu; then
9024         echo "Your platform has some specific hints regarding large file builds, using them..."
9025         . ./uselargefiles.cbu
9026 fi
9027 case "$uselargefiles" in
9028 "$define")
9029         if $test -f uselargefiles.cbu; then
9030                 echo " "
9031                 echo "Rechecking to see how big your file offsets are..." >&4
9032                 $cat >try.c <<EOCP
9033 #include <sys/types.h>
9034 #include <stdio.h>
9035 int main()
9036 {
9037     printf("%d\n", (int)sizeof($lseektype));
9038     return(0); 
9039 }
9040 EOCP
9041                 set try
9042                 if eval $compile_ok; then
9043                         lseeksize=`$run ./try`
9044                         $echo "Your file offsets are now $lseeksize bytes long."
9045                 else
9046                         dflt="$lseeksize"
9047                         echo " "
9048                         echo "(I can't seem to compile the test program.  Guessing...)"
9049                         rp="What is the size of your file offsets (in bytes)?"
9050                         . ./myread
9051                         lseeksize="$ans"
9052                 fi
9053                 case "$fpostype" in
9054                 *_t) zzz="$fpostype"    ;;
9055                 *)   zzz="fpos_t"       ;;
9056                 esac
9057                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9058                 $cat > try.c <<EOCP
9059 #include <sys/types.h>
9060 #include <stdio.h>
9061 #$i_stdlib I_STDLIB
9062 #ifdef I_STDLIB
9063 #include <stdlib.h>
9064 #endif
9065 int main() {
9066     printf("%d\n", (int)sizeof($fpostype));
9067     return(0);
9068 }
9069 EOCP
9070                 set try
9071                 if eval $compile_ok; then
9072                         yyy=`$run ./try`
9073                         dflt="$lseeksize"
9074                         case "$yyy" in
9075                         '')     echo " "
9076                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9077                                 ;;
9078                         *)      fpossize=$yyy
9079                                 echo " $fpossize bytes." >&4
9080                                 ;;
9081                         esac
9082                 else
9083                         dflt="$fpossize"
9084                         echo " "
9085                         echo "(I can't compile the test program.  Guessing...)" >&4
9086                         rp="What is the size of your file positions (in bytes)?"
9087                         . ./myread
9088                         fpossize="$ans"
9089                 fi
9090                 $rm -f try.c try
9091         fi
9092         ;;
9093 esac
9094
9095 case "$vendorprefix" in
9096 '')     d_vendorbin="$undef"
9097         vendorbin=''
9098         vendorbinexp=''
9099         ;;
9100 *)      d_vendorbin="$define"
9101         : determine where vendor-supplied executables go.
9102         case "$vendorbin" in
9103         '') dflt=$vendorprefix/bin ;;
9104         *)      dflt="$vendorbin" ;;
9105         esac
9106         fn=d~+
9107         rp='Pathname for the vendor-supplied executables directory?'
9108         . ./getfile
9109         vendorbin="$ans"
9110         vendorbinexp="$ansexp"
9111         ;;
9112 esac
9113 prefixvar=vendorbin
9114 . ./installprefix
9115
9116 case "$vendorprefix" in
9117 '')     vendorhtml1dir=''
9118         vendorhtml1direxp=''
9119         ;;
9120 *)      : determine where vendor-supplied html pages go.
9121         : There is no standard location, so try to copy the previously-selected
9122         : directory structure for the core html pages.
9123         : XXX Better default suggestions would be welcome.
9124         case "$vendorhtml1dir" in
9125         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9126         *)      dflt=$vendorhtml1dir ;;
9127         esac
9128         case "$dflt" in
9129         ''|' ') dflt=none ;;
9130         esac
9131         fn=dn+~
9132         rp='Pathname for the vendor-supplied html pages?'
9133         . ./getfile
9134         vendorhtml1dir="$ans"
9135         vendorhtml1direxp="$ansexp"
9136         ;;
9137 esac
9138 : Use ' ' for none so value is preserved next time through Configure
9139 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9140 prefixvar=vendorhtml1dir
9141 . ./installprefix
9142
9143 case "$vendorprefix" in
9144 '')     vendorhtml3dir=''
9145         vendorhtml3direxp=''
9146         ;;
9147 *)      : determine where vendor-supplied module html pages go.
9148         : There is no standard location, so try to copy the previously-selected
9149         : directory structure for the core html pages.
9150         : XXX Better default suggestions would be welcome.
9151         case "$vendorhtml3dir" in
9152         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9153         *)      dflt=$vendorhtml3dir ;;
9154         esac
9155         case "$dflt" in
9156         ''|' ') dflt=none ;;
9157         esac
9158         fn=dn+~
9159         rp='Pathname for the vendor-supplied html pages?'
9160         . ./getfile
9161         vendorhtml3dir="$ans"
9162         vendorhtml3direxp="$ansexp"
9163         ;;
9164 esac
9165 : Use ' ' for none so value is preserved next time through Configure
9166 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9167 prefixvar=vendorhtml3dir
9168 . ./installprefix
9169
9170 case "$vendorprefix" in
9171 '')     vendorman1dir=''
9172         vendorman1direxp=''
9173         ;;
9174 *)      : determine where vendor-supplied manual pages go.
9175         case "$vendorman1dir" in
9176         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9177         *)      dflt=$vendorman1dir ;;
9178         esac
9179         case "$dflt" in
9180         ''|' ') dflt=none ;;
9181         esac
9182         fn=nd~+
9183         rp='Pathname for the vendor-supplied manual section 1 pages?'
9184         . ./getfile
9185         vendorman1dir="$ans"
9186         vendorman1direxp="$ansexp"
9187         ;;
9188 esac
9189 : Use ' ' for none so value is preserved next time through Configure
9190 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9191 prefixvar=vendorman1dir
9192 . ./installprefix
9193
9194 case "$vendorprefix" in
9195 '')     vendorman3dir=''
9196         vendorman3direxp=''
9197         ;;
9198 *)      : determine where vendor-supplied module manual pages go.
9199         case "$vendorman3dir" in
9200         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9201         *)      dflt=$vendorman3dir ;;
9202         esac
9203         case "$dflt" in
9204         ''|' ') dflt=none ;;
9205         esac
9206         fn=nd~+
9207         rp='Pathname for the vendor-supplied manual section 3 pages?'
9208         . ./getfile
9209         vendorman3dir="$ans"
9210         vendorman3direxp="$ansexp"
9211         ;;
9212 esac
9213 : Use ' ' for none so value is preserved next time through Configure
9214 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9215 prefixvar=vendorman3dir
9216 . ./installprefix
9217
9218 case "$vendorprefix" in
9219 '')     d_vendorscript="$undef"
9220         vendorscript=''
9221         vendorscriptexp=''
9222         ;;
9223 *)      d_vendorscript="$define"
9224         : determine where vendor-supplied scripts go.
9225         case "$vendorscript" in
9226         '')     dflt=$vendorprefix/script
9227                 $test -d $dflt || dflt=$vendorbin ;;
9228         *)  dflt="$vendorscript" ;;
9229         esac
9230         $cat <<EOM
9231
9232 The installation process will create a directory for
9233 vendor-supplied scripts.
9234
9235 EOM
9236         fn=d~+
9237         rp='Pathname for the vendor-supplied scripts directory?'
9238         . ./getfile
9239         vendorscript="$ans"
9240         vendorscriptexp="$ansexp"
9241         ;;
9242 esac
9243 prefixvar=vendorscript
9244 . ./installprefix
9245
9246 : see if qgcvt exists
9247 set qgcvt d_qgcvt
9248 eval $inlibc
9249
9250 echo " "
9251
9252 if $test X"$d_longdbl" = X"$define"; then
9253
9254 echo "Checking how to print long doubles..." >&4
9255
9256 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9257         $cat >try.c <<'EOCP'
9258 #include <sys/types.h>
9259 #include <stdio.h>
9260 int main() {
9261   double d = 123.456;
9262   printf("%.3f\n", d);
9263 }
9264 EOCP
9265         set try
9266         if eval $compile; then
9267                 yyy=`$run ./try`
9268                 case "$yyy" in
9269                 123.456)
9270                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9271                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9272                         echo "We will use %f."
9273                         ;;
9274                 esac
9275         fi
9276 fi
9277
9278 if $test X"$sPRIfldbl" = X; then
9279         $cat >try.c <<'EOCP'
9280 #include <sys/types.h>
9281 #include <stdio.h>
9282 int main() {
9283   long double d = 123.456;
9284   printf("%.3Lf\n", d);
9285 }
9286 EOCP
9287         set try
9288         if eval $compile; then
9289                 yyy=`$run ./try`
9290                 case "$yyy" in
9291                 123.456)
9292                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9293                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9294                         echo "We will use %Lf."
9295                         ;;
9296                 esac
9297         fi
9298 fi
9299
9300 if $test X"$sPRIfldbl" = X; then
9301         $cat >try.c <<'EOCP'
9302 #include <sys/types.h>
9303 #include <stdio.h>
9304 int main() {
9305   long double d = 123.456;
9306   printf("%.3llf\n", d);
9307 }
9308 EOCP
9309         set try
9310         if eval $compile; then
9311                 yyy=`$run ./try`
9312                 case "$yyy" in
9313                 123.456)
9314                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9315                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9316                         echo "We will use %llf."
9317                         ;;
9318                 esac
9319         fi
9320 fi
9321
9322 if $test X"$sPRIfldbl" = X; then
9323         $cat >try.c <<'EOCP'
9324 #include <sys/types.h>
9325 #include <stdio.h>
9326 int main() {
9327   long double d = 123.456;
9328   printf("%.3lf\n", d);
9329 }
9330 EOCP
9331         set try
9332         if eval $compile; then
9333                 yyy=`$run ./try`
9334                 case "$yyy" in
9335                 123.456)
9336                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9337                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9338                         echo "We will use %lf."
9339                         ;;
9340                 esac
9341         fi
9342 fi
9343
9344 if $test X"$sPRIfldbl" = X; then
9345         echo "Cannot figure out how to print long doubles." >&4
9346 else
9347         sSCNfldbl=$sPRIfldbl    # expect consistency
9348 fi
9349
9350 $rm -f try try.*
9351
9352 fi # d_longdbl
9353
9354 case "$sPRIfldbl" in
9355 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9356         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9357         d_SCNfldbl="$undef";
9358         ;;
9359 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9360         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9361         d_SCNfldbl="$define";
9362         ;;
9363 esac
9364
9365 : Check how to convert floats to strings.
9366
9367 if test "X$d_Gconvert" = X; then
9368
9369 echo " "
9370 echo "Checking for an efficient way to convert floats to strings."
9371 echo " " > try.c
9372 case "$uselongdouble" in
9373 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9374 esac
9375 case "$d_longdbl" in
9376 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9377 esac
9378 case "$d_PRIgldbl" in
9379 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9380 esac
9381 $cat >>try.c <<EOP
9382 #ifdef TRY_gconvert
9383 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9384 char *myname = "gconvert";
9385 #endif
9386 #ifdef TRY_gcvt
9387 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9388 char *myname = "gcvt";
9389 #endif
9390 #ifdef TRY_qgcvt
9391 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9392 char *myname = "qgcvt";
9393 #define DOUBLETYPE long double
9394 #endif
9395 #ifdef TRY_sprintf
9396 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9397 #ifdef HAS_PRIgldbl
9398 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9399 #else
9400 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9401 #endif
9402 #else
9403 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9404 #endif
9405 char *myname = "sprintf";
9406 #endif
9407
9408 #ifndef DOUBLETYPE
9409 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9410 #define DOUBLETYPE long double
9411 #else
9412 #define DOUBLETYPE double
9413 #endif
9414 #endif
9415
9416 #include <stdio.h>
9417
9418 #define I_STDLIB $i_stdlib
9419 #ifdef I_STDLIB
9420 #include <stdlib.h>
9421 #endif
9422
9423 int
9424 checkit(expect, got)
9425 char *expect;
9426 char *got;
9427 {
9428     if (strcmp(expect, got)) {
9429                 printf("%s oddity:  Expected %s, got %s\n",
9430                         myname, expect, got);
9431                 exit(1);
9432         }
9433 }
9434
9435 int main()
9436
9437         char buf[64]; 
9438         buf[63] = '\0';
9439
9440         /* This must be 1st test on (which?) platform */
9441         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9442         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9443         checkit("0.1", buf);
9444
9445         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9446         checkit("0.01", buf);
9447
9448         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9449         checkit("0.001", buf);
9450
9451         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9452         checkit("0.0001", buf);
9453
9454         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9455         if (strlen(buf) > 5)
9456             checkit("9e-005", buf); /* for Microsoft ?? */
9457         else
9458             checkit("9e-05", buf);
9459
9460         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9461         checkit("1", buf);
9462
9463         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9464         checkit("1.1", buf);
9465
9466         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9467         checkit("1.01", buf);
9468
9469         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9470         checkit("1.001", buf);
9471
9472         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9473         checkit("1.0001", buf);
9474
9475         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9476         checkit("1.00001", buf);
9477
9478         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9479         checkit("1.000001", buf);
9480
9481         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9482         checkit("0", buf);
9483
9484         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9485         checkit("-1", buf);
9486
9487         /* Some Linux gcvt's give 1.e+5 here. */
9488         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9489         checkit("100000", buf);
9490         
9491         /* Some Linux gcvt's give -1.e+5 here. */
9492         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9493         checkit("-100000", buf);
9494
9495         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9496         checkit("123.456", buf);
9497
9498         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9499         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9500         /* 34 should be enough to scare even long double
9501          * places into using the e notation. */
9502         if (strlen(buf) > 5)
9503             checkit("1e+034", buf); /* for Microsoft */
9504         else
9505             checkit("1e+34", buf);
9506
9507         /* For Perl, if you add additional tests here, also add them to
9508          * t/base/num.t for benefit of platforms not using Configure or
9509          * overriding d_Gconvert */
9510
9511         exit(0);
9512 }
9513 EOP
9514 : first add preferred functions to our list
9515 xxx_list=""
9516 for xxx_convert in $gconvert_preference; do
9517     case $xxx_convert in
9518     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9519     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9520     esac 
9521 done
9522 : then add any others
9523 for xxx_convert in gconvert gcvt sprintf; do
9524     case "$xxx_list" in
9525     *$xxx_convert*) ;;
9526     *) xxx_list="$xxx_list $xxx_convert" ;;
9527     esac 
9528 done
9529
9530 case "$d_longdbl$uselongdouble" in
9531 "$define$define")
9532     : again, add prefered functions to our list first
9533     xxx_ld_list=""
9534     for xxx_convert in $gconvert_ld_preference; do
9535         case $xxx_convert in
9536         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9537         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9538         esac
9539     done
9540     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9541     for xxx_convert in qgcvt sprintf $xxx_list; do
9542         case "$xxx_ld_list" in
9543         $xxx_convert*|*" $xxx_convert"*) ;;
9544         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9545         esac
9546     done
9547     : if sprintf cannot do long doubles, move it to the end
9548     if test "$d_PRIgldbl" != "$define"; then
9549         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9550     fi
9551     : if no qgcvt, remove it
9552     if test "$d_qgcvt" != "$define"; then
9553         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9554     fi
9555     : use the ld_list
9556     xxx_list="$xxx_ld_list"
9557     ;;
9558 esac
9559
9560 for xxx_convert in $xxx_list; do
9561         echo "Trying $xxx_convert..."
9562         $rm -f try try$_o
9563         set try -DTRY_$xxx_convert
9564         if eval $compile; then
9565                 echo "$xxx_convert() found." >&4
9566                 if $run ./try; then
9567                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9568                         break;
9569                 else
9570                         echo "...But $xxx_convert didn't work as I expected."
9571                         xxx_convert=''
9572                 fi
9573         else
9574                 echo "$xxx_convert NOT found." >&4
9575         fi
9576 done
9577
9578 if test X$xxx_convert = X; then
9579     echo "*** WHOA THERE!!! ***" >&4
9580     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9581     xxx_convert=sprintf
9582 fi
9583
9584 case "$xxx_convert" in
9585 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9586 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9587 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9588 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9589    "$define$define$define")
9590       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9591    "$define$define$undef")
9592       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9593    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9594    esac
9595    ;;  
9596 esac
9597
9598 fi
9599
9600 : see if _fwalk exists
9601 set fwalk d__fwalk
9602 eval $inlibc
9603
9604 : Initialize h_fcntl
9605 h_fcntl=false
9606
9607 : Initialize h_sysfile
9608 h_sysfile=false
9609
9610 : access call always available on UNIX
9611 set access d_access
9612 eval $inlibc
9613
9614 : locate the flags for 'access()'
9615 case "$d_access" in
9616 "$define")
9617         echo " "
9618         $cat >access.c <<EOCP
9619 #include <sys/types.h>
9620 #ifdef I_FCNTL
9621 #include <fcntl.h>
9622 #endif
9623 #ifdef I_SYS_FILE
9624 #include <sys/file.h>
9625 #endif
9626 #ifdef I_UNISTD
9627 #include <unistd.h>
9628 #endif
9629 #$i_stdlib I_STDLIB
9630 #ifdef I_STDLIB
9631 #include <stdlib.h>
9632 #endif
9633 int main() {
9634         exit(R_OK);
9635 }
9636 EOCP
9637         : check sys/file.h first, no particular reason here
9638         if $test `./findhdr sys/file.h` && \
9639                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9640                 h_sysfile=true;
9641                 echo "<sys/file.h> defines the *_OK access constants." >&4
9642         elif $test `./findhdr fcntl.h` && \
9643                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9644                 h_fcntl=true;
9645                 echo "<fcntl.h> defines the *_OK access constants." >&4
9646         elif $test `./findhdr unistd.h` && \
9647                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9648                 echo "<unistd.h> defines the *_OK access constants." >&4
9649         else
9650                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9651         fi
9652         ;;
9653 esac
9654 $rm -f access*
9655
9656 : see if accessx exists
9657 set accessx d_accessx
9658 eval $inlibc
9659
9660 : see if aintl exists
9661 set aintl d_aintl
9662 eval $inlibc
9663
9664 : see if alarm exists
9665 set alarm d_alarm
9666 eval $inlibc
9667
9668 : see if POSIX threads are available
9669 set pthread.h i_pthread
9670 eval $inhdr
9671
9672 : define a fucntion to check prototypes
9673 $cat > protochk <<EOSH
9674 $startsh
9675 cc="$cc"
9676 optimize="$optimize"
9677 ccflags="$ccflags"
9678 prototype="$prototype"
9679 define="$define"
9680 rm=$rm
9681 usethreads=$usethreads
9682 i_pthread=$i_pthread
9683 pthread_h_first=$pthread_h_first
9684 EOSH
9685
9686 $cat >> protochk <<'EOSH'
9687
9688 $rm -f try.c
9689 foo="$1"
9690 shift
9691 while test $# -ge 2; do
9692         case "$1" in
9693                 $define) echo "#include <$2>" >> try.c ;;
9694                 literal) echo "$2" >> try.c ;;
9695         esac
9696     # Extra magic for the benefit of systems that need pthread.h
9697     # to be included early to correctly detect threadsafe functions.
9698     # Such functions must guarantee themselves, though, that the usethreads
9699     # and i_pthread have been defined, before calling protochk.
9700     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9701         echo "#include <pthread.h>" >> try.c
9702         pthread_h_done=yes
9703     fi
9704     shift 2
9705 done
9706 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9707 cat >> try.c <<'EOCP'
9708 #ifdef CAN_PROTOTYPE
9709 #define _(args) args
9710 #else
9711 #define _(args) ()
9712 #endif
9713 EOCP
9714 echo "$foo" >> try.c
9715 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9716 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9717 status=$?
9718 $rm -f try.[co]
9719 exit $status
9720 EOSH
9721 chmod +x protochk
9722 $eunicefix protochk
9723
9724 hasproto='varname=$1; func=$2; shift; shift;
9725 while $test $# -ge 2; do
9726         case "$1" in
9727         $define) echo "#include <$2>";;
9728         esac ;
9729     shift 2;
9730 done > try.c;
9731 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9732 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9733         echo "$func() prototype found.";
9734         val="$define";
9735 else
9736         echo "$func() prototype NOT found.";
9737         val="$undef";
9738 fi;
9739 set $varname;
9740 eval $setvar;
9741 $rm -f try.c tryout.c'
9742
9743 : see if sys/types.h has to be included
9744 set sys/types.h i_systypes
9745 eval $inhdr
9746
9747 : see if sys/select.h has to be included
9748 set sys/select.h i_sysselct
9749 eval $inhdr
9750
9751 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9752 while $test $# -ge 2; do
9753         case "$1" in
9754         $define) echo "#include <$2>";;
9755         esac ;
9756     shift 2;
9757 done > try.c;
9758 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9759 set try;
9760 if eval $compile; then
9761         val="$define";
9762 else
9763         val="$undef";
9764 fi;
9765 set $varname;
9766 eval $setvar;
9767 $rm -f try.c try.o'
9768
9769 : see if we should include time.h, sys/time.h, or both
9770 echo " "
9771 if test "X$timeincl" = X; then
9772         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9773         $echo $n "I'm now running the test program...$c"
9774         $cat >try.c <<EOCP
9775 #include <sys/types.h>
9776 #ifdef I_TIME
9777 #include <time.h>
9778 #endif
9779 #ifdef I_SYSTIME
9780 #ifdef SYSTIMEKERNEL
9781 #define KERNEL
9782 #endif
9783 #include <sys/time.h>
9784 #endif
9785 #ifdef I_SYSSELECT
9786 #include <sys/select.h>
9787 #endif
9788 #$i_stdlib I_STDLIB
9789 #ifdef I_STDLIB
9790 #include <stdlib.h>
9791 #endif
9792 int main()
9793 {
9794         struct tm foo;
9795 #ifdef S_TIMEVAL
9796         struct timeval bar;
9797 #endif
9798 #ifdef S_TIMEZONE
9799         struct timezone tzp;
9800 #endif
9801         if (foo.tm_sec == foo.tm_sec)
9802                 exit(0);
9803 #ifdef S_TIMEVAL
9804         if (bar.tv_sec == bar.tv_sec)
9805                 exit(0);
9806 #endif
9807         exit(1);
9808 }
9809 EOCP
9810         flags=''
9811         for s_timezone in '-DS_TIMEZONE' ''; do
9812         sysselect=''
9813         for s_timeval in '-DS_TIMEVAL' ''; do
9814         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9815         for i_time in '' '-DI_TIME'; do
9816         for i_systime in '-DI_SYSTIME' ''; do
9817                 case "$flags" in
9818                 '') $echo $n ".$c"
9819                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9820                         if eval $compile; then
9821                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9822                                 shift
9823                                 flags="$*"
9824                                 echo " "
9825                                 $echo $n "Succeeded with $flags$c"
9826                         fi
9827                         ;;
9828                 esac
9829         done
9830         done
9831         done
9832         done
9833         done
9834         timeincl=''
9835         echo " "
9836         case "$flags" in
9837         *SYSTIMEKERNEL*) i_systimek="$define"
9838                 timeincl=`./findhdr sys/time.h`
9839                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9840         *) i_systimek="$undef";;
9841         esac
9842         case "$flags" in
9843         *I_TIME*) i_time="$define"
9844                 timeincl=`./findhdr time.h`" $timeincl"
9845                 echo "We'll include <time.h>." >&4;;
9846         *) i_time="$undef";;
9847         esac
9848         case "$flags" in
9849         *I_SYSTIME*) i_systime="$define"
9850                 timeincl=`./findhdr sys/time.h`" $timeincl"
9851                 echo "We'll include <sys/time.h>." >&4;;
9852         *) i_systime="$undef";;
9853         esac
9854         $rm -f try.c try
9855 fi
9856 : see if struct tm knows about tm_zone
9857 case "$i_systime$i_time" in
9858 *$define*) 
9859         echo " "
9860         echo "Checking to see if your struct tm has tm_zone field..." >&4
9861         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9862         eval $hasfield
9863         ;;
9864 *)      val="$undef"
9865         set d_tm_tm_zone
9866         eval $setvar
9867         ;;
9868 esac
9869 case "$d_tm_tm_zone" in
9870 "$define")      echo "Yes, it does."   ;;
9871 *)              echo "No, it doesn't." ;;
9872 esac
9873 : see if struct tm knows about tm_gmtoff
9874 case "$i_systime$i_time" in
9875 *$define*) 
9876         echo " "
9877         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9878         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9879         eval $hasfield
9880         ;;
9881 *)      val="$undef"
9882         set d_tm_tm_gmtoff
9883         eval $setvar
9884         ;;
9885 esac
9886 case "$d_tm_tm_gmtoff" in
9887 "$define")      echo "Yes, it does."   ;;
9888 *)              echo "No, it doesn't." ;;
9889 esac
9890
9891 : see if asctime_r exists
9892 set asctime_r d_asctime_r
9893 eval $inlibc
9894 case "$d_asctime_r" in
9895 "$define")
9896         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9897         case "$d_asctime_r_proto:$usethreads" in
9898         ":define")      d_asctime_r_proto=define
9899                 set d_asctime_r_proto asctime_r $hdrs
9900                 eval $hasproto ;;
9901         *)      ;;
9902         esac
9903         case "$d_asctime_r_proto" in
9904         define)
9905         case "$asctime_r_proto" in
9906         ''|0) try='char* asctime_r(const struct tm*, char*);'
9907         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9908         esac
9909         case "$asctime_r_proto" in
9910         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9911         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9912         esac
9913         case "$asctime_r_proto" in
9914         ''|0) try='int asctime_r(const struct tm*, char*);'
9915         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9916         esac
9917         case "$asctime_r_proto" in
9918         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9919         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9920         esac
9921         case "$asctime_r_proto" in
9922         ''|0)   d_asctime_r=undef
9923                 asctime_r_proto=0
9924                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9925         * )     case "$asctime_r_proto" in
9926                 REENTRANT_PROTO*) ;;
9927                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9928                 esac
9929                 echo "Prototype: $try" ;;
9930         esac
9931         ;;
9932         *)      case "$usethreads" in
9933                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9934                 esac
9935                 d_asctime_r=undef
9936                 asctime_r_proto=0
9937                 ;;
9938         esac
9939         ;;
9940 *)      asctime_r_proto=0
9941         ;;
9942 esac
9943
9944 : see if atolf exists
9945 set atolf d_atolf
9946 eval $inlibc
9947
9948 : see if atoll exists
9949 set atoll d_atoll
9950 eval $inlibc
9951
9952 : Look for GCC-style attribute format
9953 case "$d_attribute_format" in
9954 '')
9955 echo " "
9956 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9957 $cat >attrib.c <<'EOCP'
9958 #include <stdio.h>
9959 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9960 EOCP
9961 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9962         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9963                 echo "Your C compiler doesn't support __attribute__((format))."
9964                 val="$undef"
9965         else
9966                 echo "Your C compiler supports __attribute__((format))."
9967                 val="$define"
9968         fi
9969 else
9970         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9971         val="$undef"
9972 fi
9973 ;;
9974 *) val="$d_attribute_format" ;;
9975 esac
9976 set d_attribute_format
9977 eval $setvar
9978 $rm -f attrib*
9979
9980 : Look for GCC-style attribute malloc
9981 case "$d_attribute_malloc" in
9982 '')
9983 echo " "
9984 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9985 $cat >attrib.c <<'EOCP'
9986 #include <stdio.h>
9987 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9988 EOCP
9989 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9990         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9991                 echo "Your C compiler doesn't support __attribute__((malloc))."
9992                 val="$undef"
9993         else
9994                 echo "Your C compiler supports __attribute__((malloc))."
9995                 val="$define"
9996         fi
9997 else
9998         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9999         val="$undef"
10000 fi
10001 ;;
10002 *) val="$d_attribute_malloc" ;;
10003 esac
10004 set d_attribute_malloc
10005 eval $setvar
10006 $rm -f attrib*
10007
10008 : Look for GCC-style attribute nonnull
10009 case "$d_attribute_nonnull" in
10010 '')
10011 echo " "
10012 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10013 $cat >attrib.c <<'EOCP'
10014 #include <stdio.h>
10015 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10016 EOCP
10017 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10018         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10019                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10020                 val="$undef"
10021         else
10022                 echo "Your C compiler supports __attribute__((nonnull))."
10023                 val="$define"
10024         fi
10025 else
10026         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10027         val="$undef"
10028 fi
10029 ;;
10030 *) val="$d_attribute_nonnull" ;;
10031 esac
10032 set d_attribute_nonnull
10033 eval $setvar
10034 $rm -f attrib*
10035
10036 : Look for GCC-style attribute noreturn
10037 case "$d_attribute_noreturn" in
10038 '')
10039 echo " "
10040 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10041 $cat >attrib.c <<'EOCP'
10042 #include <stdio.h>
10043 void fall_over_dead( void ) __attribute__((noreturn));
10044 EOCP
10045 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10046         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10047                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10048                 val="$undef"
10049         else
10050                 echo "Your C compiler supports __attribute__((noreturn))."
10051                 val="$define"
10052         fi
10053 else
10054         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10055         val="$undef"
10056 fi
10057 ;;
10058 *) val="$d_attribute_noreturn" ;;
10059 esac
10060 set d_attribute_noreturn
10061 eval $setvar
10062 $rm -f attrib*
10063
10064 : Look for GCC-style attribute pure
10065 case "$d_attribute_pure" in
10066 '')
10067 echo " "
10068 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10069 $cat >attrib.c <<'EOCP'
10070 #include <stdio.h>
10071 int square( int n ) __attribute__((pure));
10072 EOCP
10073 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10074         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10075                 echo "Your C compiler doesn't support __attribute__((pure))."
10076                 val="$undef"
10077         else
10078                 echo "Your C compiler supports __attribute__((pure))."
10079                 val="$define"
10080         fi
10081 else
10082         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10083         val="$undef"
10084 fi
10085 ;;
10086 *) val="$d_attribute_pure" ;;
10087 esac
10088 set d_attribute_pure
10089 eval $setvar
10090 $rm -f attrib*
10091
10092 : Look for GCC-style attribute unused
10093 case "$d_attribute_unused" in
10094 '')
10095 echo " "
10096 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10097 $cat >attrib.c <<'EOCP'
10098 #include <stdio.h>
10099 int do_something( int dummy __attribute__((unused)), int n );
10100 EOCP
10101 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10102         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10103                 echo "Your C compiler doesn't support __attribute__((unused))."
10104                 val="$undef"
10105         else
10106                 echo "Your C compiler supports __attribute__((unused))."
10107                 val="$define"
10108         fi
10109 else
10110         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10111         val="$undef"
10112 fi
10113 ;;
10114 *) val="$d_attribute_unused" ;;
10115 esac
10116 set d_attribute_unused
10117 eval $setvar
10118 $rm -f attrib*
10119
10120 : Look for GCC-style attribute warn_unused_result
10121 case "$d_attribute_warn_unused_result" in
10122 '')
10123 echo " "
10124 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10125 $cat >attrib.c <<'EOCP'
10126 #include <stdio.h>
10127 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10128 EOCP
10129 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10130         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10131                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10132                 val="$undef"
10133         else
10134                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10135                 val="$define"
10136         fi
10137 else
10138         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10139         val="$undef"
10140 fi
10141 ;;
10142 *) val="$d_attribute_warn_unused_result" ;;
10143 esac
10144 set d_attribute_warn_unused_result
10145 eval $setvar
10146 $rm -f attrib*
10147
10148 : see if bcmp exists
10149 set bcmp d_bcmp
10150 eval $inlibc
10151
10152 : see if bcopy exists
10153 set bcopy d_bcopy
10154 eval $inlibc
10155
10156 : see if getpgrp exists
10157 set getpgrp d_getpgrp
10158 eval $inlibc
10159
10160 case "$d_getpgrp" in
10161 "$define")
10162         echo " "
10163         echo "Checking to see which flavor of getpgrp is in use..."
10164         $cat >try.c <<EOP
10165 #$i_unistd I_UNISTD
10166 #include <sys/types.h>
10167 #ifdef I_UNISTD
10168 #  include <unistd.h>
10169 #endif
10170 #$i_stdlib I_STDLIB
10171 #ifdef I_STDLIB
10172 #include <stdlib.h>
10173 #endif
10174 int main()
10175 {
10176         if (getuid() == 0) {
10177                 printf("(I see you are running Configure as super-user...)\n");
10178                 setuid(1);
10179         }
10180 #ifdef TRY_BSD_PGRP
10181         if (getpgrp(1) == 0)
10182                 exit(0);
10183 #else
10184         if (getpgrp() > 0)
10185                 exit(0);
10186 #endif
10187         exit(1);
10188 }
10189 EOP
10190         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10191                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10192                 val="$define"
10193         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10194                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10195                 val="$undef"
10196         else
10197                 echo "I can't seem to compile and run the test program."
10198                 if ./usg; then
10199                         xxx="a USG one, i.e. you use getpgrp()."
10200                 else
10201                         # SVR4 systems can appear rather BSD-ish.
10202                         case "$i_unistd" in
10203                         $undef)
10204                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10205                                 val="$define"
10206                                 ;;
10207                         $define)
10208                                 xxx="probably a USG one, i.e. you use getpgrp()."
10209                                 val="$undef"
10210                                 ;;
10211                         esac
10212                 fi
10213                 echo "Assuming your getpgrp is $xxx" >&4
10214         fi
10215         ;;
10216 *) val="$undef";;
10217 esac
10218 set d_bsdgetpgrp
10219 eval $setvar
10220 $rm -f try try.*
10221
10222 : see if setpgrp exists
10223 set setpgrp d_setpgrp
10224 eval $inlibc
10225
10226 case "$d_setpgrp" in
10227 "$define")
10228         echo " "
10229         echo "Checking to see which flavor of setpgrp is in use..."
10230         $cat >try.c <<EOP
10231 #$i_unistd I_UNISTD
10232 #include <sys/types.h>
10233 #ifdef I_UNISTD
10234 #  include <unistd.h>
10235 #endif
10236 #$i_stdlib I_STDLIB
10237 #ifdef I_STDLIB
10238 #include <stdlib.h>
10239 #endif
10240 int main()
10241 {
10242         if (getuid() == 0) {
10243                 printf("(I see you are running Configure as super-user...)\n");
10244                 setuid(1);
10245         }
10246 #ifdef TRY_BSD_PGRP
10247         if (-1 == setpgrp(1, 1))
10248                 exit(0);
10249 #else
10250         if (setpgrp() != -1)
10251                 exit(0);
10252 #endif
10253         exit(1);
10254 }
10255 EOP
10256         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10257                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10258                 val="$define"
10259         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10260                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10261                 val="$undef"
10262         else
10263                 echo "(I can't seem to compile and run the test program.)"
10264                 if ./usg; then
10265                         xxx="a USG one, i.e. you use setpgrp()."
10266                 else
10267                         # SVR4 systems can appear rather BSD-ish.
10268                         case "$i_unistd" in
10269                         $undef)
10270                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10271                                 val="$define"
10272                                 ;;
10273                         $define)
10274                                 xxx="probably a USG one, i.e. you use setpgrp()."
10275                                 val="$undef"
10276                                 ;;
10277                         esac
10278                 fi
10279                 echo "Assuming your setpgrp is $xxx" >&4
10280         fi
10281         ;;
10282 *) val="$undef";;
10283 esac
10284 set d_bsdsetpgrp
10285 eval $setvar
10286 $rm -f try try.*
10287 : Look for GCC-style __builtin_choose_expr
10288 case "$d_builtin_choose_expr" in
10289 '')
10290     echo " "
10291     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10292     $cat >try.c <<'EOCP'
10293 #include <assert.h>
10294 #include <stdlib.h>
10295 #include <stdio.h>
10296
10297 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10298
10299 int main(void) {
10300     assert( SYRINX(1) == 2112 );
10301     assert( SYRINX(1) != 5150 );
10302     assert( SYRINX(0) == 5150 );
10303     assert( SYRINX(0) != 2112 );
10304     puts( "All good!" );
10305     exit(0);
10306 }
10307
10308 EOCP
10309     set try
10310     if eval $compile; then
10311         echo "Your C compiler supports __builtin_choose_expr."
10312         val="$define"
10313     else
10314         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10315         val="$undef"
10316     fi
10317 ;;
10318 *) val="$d_builtin_choose_expr" ;;
10319 esac
10320
10321 set d_builtin_choose_expr
10322 eval $setvar
10323 $rm -f try.* try core core.try.*
10324
10325 : Look for GCC-style __builtin_expect
10326 case "$d_builtin_expect" in
10327 '')
10328     echo " "
10329     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10330     $cat >builtin.c <<'EOCP'
10331 int main(void) {
10332     int n = 50;
10333     if ( __builtin_expect(n, 0) ) n = 1;
10334 }
10335 EOCP
10336     set try
10337     if eval $compile; then
10338         echo "Your C compiler supports __builtin_choose_expr."
10339         val="$define"
10340     else
10341         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10342         val="$undef"
10343     fi
10344     ;;
10345 *) val="$d_builtin_expect" ;;
10346 esac
10347
10348 set d_builtin_expect
10349 eval $setvar
10350 $rm -f try.* try core core.try.*
10351
10352 : see if bzero exists
10353 set bzero d_bzero
10354 eval $inlibc
10355
10356 : see if stdarg is available
10357 echo " "
10358 if $test `./findhdr stdarg.h`; then
10359         echo "<stdarg.h> found." >&4
10360         valstd="$define"
10361 else
10362         echo "<stdarg.h> NOT found." >&4
10363         valstd="$undef"
10364 fi
10365
10366 : see if varags is available
10367 echo " "
10368 if $test `./findhdr varargs.h`; then
10369         echo "<varargs.h> found." >&4
10370 else
10371         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10372 fi
10373
10374 : set up the varargs testing programs
10375 $cat > varargs.c <<EOP
10376 #ifdef I_STDARG
10377 #include <stdarg.h>
10378 #endif
10379 #ifdef I_VARARGS
10380 #include <varargs.h>
10381 #endif
10382
10383 #ifdef I_STDARG
10384 int f(char *p, ...)
10385 #else
10386 int f(va_alist)
10387 va_dcl
10388 #endif
10389 {
10390         va_list ap;
10391 #ifndef I_STDARG
10392         char *p;
10393 #endif
10394 #ifdef I_STDARG
10395         va_start(ap,p);
10396 #else
10397         va_start(ap);
10398         p = va_arg(ap, char *);
10399 #endif
10400         va_end(ap);
10401         return 0;
10402 }
10403 EOP
10404 $cat > varargs <<EOP
10405 $startsh
10406 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10407         echo "true"
10408 else
10409         echo "false"
10410 fi
10411 $rm -f varargs$_o
10412 EOP
10413 chmod +x varargs
10414
10415 : now check which varargs header should be included
10416 echo " "
10417 i_varhdr=''
10418 case "$valstd" in
10419 "$define")
10420         if `./varargs I_STDARG`; then
10421                 val='stdarg.h'
10422         elif `./varargs I_VARARGS`; then
10423                 val='varargs.h'
10424         fi
10425         ;;
10426 *)
10427         if `./varargs I_VARARGS`; then
10428                 val='varargs.h'
10429         fi
10430         ;;
10431 esac
10432 case "$val" in
10433 '')
10434 echo "I could not find the definition for va_dcl... You have problems..." >&4
10435         val="$undef"; set i_stdarg; eval $setvar
10436         val="$undef"; set i_varargs; eval $setvar
10437         ;;
10438 *) 
10439         set i_varhdr
10440         eval $setvar
10441         case "$i_varhdr" in
10442         stdarg.h)
10443                 val="$define"; set i_stdarg; eval $setvar
10444                 val="$undef"; set i_varargs; eval $setvar
10445                 ;;
10446         varargs.h)
10447                 val="$undef"; set i_stdarg; eval $setvar
10448                 val="$define"; set i_varargs; eval $setvar
10449                 ;;
10450         esac
10451         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10452 esac
10453 $rm -f varargs*
10454
10455 : see if the Compiler supports C99 variadic macros
10456 case "$i_stdarg$i_stdlib" in
10457     "$define$define")
10458     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10459     $cat >try.c <<EOCP
10460 #include <stdio.h>
10461 #include <stdarg.h>
10462
10463 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10464
10465 int main() {
10466   char buf[20];
10467   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10468   puts(buf);
10469   return 0;
10470 }
10471 EOCP
10472     set try
10473     if eval $compile && $run ./try 2>&1 >/dev/null; then
10474         case "`$run ./try`" in
10475             "123 456 789")
10476             echo "You have C99 variadic macros." >&4
10477             d_c99_variadic_macros="$define"
10478             ;;
10479             *)
10480             echo "You don't have functional C99 variadic macros." >&4
10481             d_c99_variadic_macros="$undef"
10482             ;;
10483         esac
10484     else
10485         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10486         d_c99_variadic_macros="$undef"
10487     fi
10488     $rm -f try.* try core core.try.*
10489     ;;
10490     *)
10491     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10492     d_c99_variadic_macros="$undef"
10493     ;;
10494 esac
10495
10496 : see if signal is declared as pointer to function returning int or void
10497 echo " "
10498 xxx=`./findhdr signal.h`
10499 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10500 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10501         echo "You have int (*signal())() instead of void." >&4
10502         val="$undef"
10503 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10504         echo "You have void (*signal())()." >&4
10505         val="$define"
10506 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10507         echo "You have int (*signal())() instead of void." >&4
10508         val="$undef"
10509 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10510         echo "You have void (*signal())()." >&4
10511         val="$define"
10512 else
10513         case "$d_voidsig" in
10514         '')
10515         echo "I can't determine whether signal handler returns void or int..." >&4
10516                 dflt=void
10517                 rp="What type does your signal handler return?"
10518                 . ./myread
10519                 case "$ans" in
10520                 v*) val="$define";;
10521                 *) val="$undef";;
10522                 esac;;
10523         "$define")
10524                 echo "As you already told me, signal handler returns void." >&4
10525                 val="$define"
10526                 ;;
10527         *)      echo "As you already told me, signal handler returns int." >&4
10528                 val="$undef"
10529                 ;;
10530         esac
10531 fi
10532 set d_voidsig
10533 eval $setvar
10534 case "$d_voidsig" in
10535 "$define") signal_t="void";;
10536 *) signal_t="int";;
10537 esac
10538 $rm -f $$.tmp
10539
10540 : check for ability to cast large floats to 32-bit ints.
10541 echo " "
10542 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10543 if $test "$intsize" -ge 4; then
10544         xxx=int
10545 else
10546         xxx=long
10547 fi
10548 $cat >try.c <<EOCP
10549 #include <stdio.h>
10550 #$i_stdlib I_STDLIB
10551 #ifdef I_STDLIB
10552 #include <stdlib.h>
10553 #endif
10554 #include <sys/types.h>
10555 #include <signal.h>
10556 $signal_t blech(int s) { exit(3); }
10557 int main()
10558 {
10559         $xxx i32;
10560         double f, g;
10561         int result = 0;
10562         char str[16];
10563         signal(SIGFPE, blech);
10564
10565         /* Don't let compiler optimize the test away.  Store the number 
10566            in a writable string for gcc to pass to sscanf under HP/UX.
10567         */
10568         sprintf(str, "2147483647");
10569         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10570         g = 10 * f;
10571         i32  = ($xxx) g;
10572
10573         /* x86 processors will probably give 0x8000 0000, which is a
10574            sign change.  We don't want that.  We want to mimic SPARC
10575            behavior here, which is to preserve the sign and give
10576            back 0x7fff ffff.
10577         */
10578         if (i32 != ($xxx) f)
10579                 result |= 1;
10580         exit(result);
10581 }
10582 EOCP
10583 set try
10584 if eval $compile_ok; then
10585         $run ./try
10586         yyy=$?
10587 else
10588         echo "(I can't seem to compile the test program--assuming it can't)"
10589         yyy=1
10590 fi
10591 case "$yyy" in
10592 0)      val="$define"
10593         echo "Yup, it can."
10594         ;;
10595 *)      val="$undef"
10596         echo "Nope, it can't."
10597         ;;
10598 esac
10599 set d_casti32
10600 eval $setvar
10601 $rm -f try try.*
10602
10603 : check for ability to cast negative floats to unsigned
10604 echo " "
10605 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10606 $cat >try.c <<EOCP
10607 #include <stdio.h>
10608 #$i_stdlib I_STDLIB
10609 #ifdef I_STDLIB
10610 #include <stdlib.h>
10611 #endif
10612 #include <sys/types.h>
10613 #include <signal.h>
10614 $signal_t blech(int s) { exit(7); }
10615 $signal_t blech_in_list(int s) { exit(4); }
10616 unsigned long dummy_long(unsigned long p) { return p; }
10617 unsigned int dummy_int(unsigned int p) { return p; }
10618 unsigned short dummy_short(unsigned short p) { return p; }
10619 int main()
10620 {
10621         double f;
10622         unsigned long along;
10623         unsigned int aint;
10624         unsigned short ashort;
10625         int result = 0;
10626         char str[16];
10627         
10628         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10629            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10630            optimized the whole file away
10631         */
10632         /* Store the number in a writable string for gcc to pass to 
10633            sscanf under HP/UX.
10634         */
10635         sprintf(str, "-123");
10636         sscanf(str, "%lf", &f);  /* f = -123.; */
10637
10638         signal(SIGFPE, blech);
10639         along = (unsigned long)f;
10640         aint = (unsigned int)f;
10641         ashort = (unsigned short)f;
10642         if (along != (unsigned long)-123)
10643                 result |= 1;
10644         if (aint != (unsigned int)-123)
10645                 result |= 1;
10646         if (ashort != (unsigned short)-123)
10647                 result |= 1;
10648         sprintf(str, "1073741824.");
10649         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10650         f = f + f;
10651         along = 0;
10652         along = (unsigned long)f;
10653         if (along != 0x80000000)
10654                 result |= 2;
10655         f -= 1.;
10656         along = 0;
10657         along = (unsigned long)f;
10658         if (along != 0x7fffffff)
10659                 result |= 1;
10660         f += 2.;
10661         along = 0;
10662         along = (unsigned long)f;
10663         if (along != 0x80000001)
10664                 result |= 2;
10665         if (result)
10666                 exit(result);
10667         signal(SIGFPE, blech_in_list);
10668         sprintf(str, "123.");
10669         sscanf(str, "%lf", &f);  /* f = 123.; */
10670         along = dummy_long((unsigned long)f);
10671         aint = dummy_int((unsigned int)f);
10672         ashort = dummy_short((unsigned short)f);
10673         if (along != (unsigned long)123)
10674                 result |= 4;
10675         if (aint != (unsigned int)123)
10676                 result |= 4;
10677         if (ashort != (unsigned short)123)
10678                 result |= 4;
10679         exit(result);
10680
10681 }
10682 EOCP
10683 set try
10684 if eval $compile_ok; then
10685         $run ./try
10686         castflags=$?
10687 else
10688         echo "(I can't seem to compile the test program--assuming it can't)"
10689         castflags=7
10690 fi
10691 case "$castflags" in
10692 0)      val="$define"
10693         echo "Yup, it can."
10694         ;;
10695 *)      val="$undef"
10696         echo "Nope, it can't."
10697         ;;
10698 esac
10699 set d_castneg
10700 eval $setvar
10701 $rm -f try.*
10702
10703 : see if vprintf exists
10704 echo " "
10705 if set vprintf val -f d_vprintf; eval $csym; $val; then
10706         echo 'vprintf() found.' >&4
10707         val="$define"
10708         $cat >try.c <<EOF
10709 #include <varargs.h>
10710 #$i_stdlib I_STDLIB
10711 #ifdef I_STDLIB
10712 #include <stdlib.h>
10713 #endif
10714
10715 int main() { xxx("foo"); }
10716
10717 xxx(va_alist)
10718 va_dcl
10719 {
10720         va_list args;
10721         char buf[10];
10722
10723         va_start(args);
10724         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10725 }
10726 EOF
10727         set try
10728         if eval $compile && $run ./try; then
10729                 echo "Your vsprintf() returns (int)." >&4
10730                 val2="$undef"
10731         else
10732                 echo "Your vsprintf() returns (char*)." >&4
10733                 val2="$define"
10734         fi
10735 else
10736         echo 'vprintf() NOT found.' >&4
10737                 val="$undef"
10738                 val2="$undef"
10739 fi
10740 $rm -f try try.*
10741 set d_vprintf
10742 eval $setvar
10743 val=$val2
10744 set d_charvspr
10745 eval $setvar
10746
10747 : see if chown exists
10748 set chown d_chown
10749 eval $inlibc
10750
10751 : see if chroot exists
10752 set chroot d_chroot
10753 eval $inlibc
10754
10755 : see if chsize exists
10756 set chsize d_chsize
10757 eval $inlibc
10758
10759 : see if class exists
10760 set class d_class
10761 eval $inlibc
10762
10763 : see if clearenv exists
10764 set clearenv d_clearenv
10765 eval $inlibc
10766
10767 hasstruct='varname=$1; struct=$2; shift; shift;
10768 while $test $# -ge 2; do
10769         case "$1" in
10770         $define) echo "#include <$2>";;
10771         esac ;
10772     shift 2;
10773 done > try.c;
10774 echo "int main () { struct $struct foo; }" >> try.c;
10775 set try;
10776 if eval $compile; then
10777         val="$define";
10778 else
10779         val="$undef";
10780 fi;
10781 set $varname;
10782 eval $setvar;
10783 $rm -f try.c try.o'
10784
10785 socketlib=''
10786 sockethdr=''
10787 : see whether socket exists
10788 echo " "
10789 $echo $n "Hmm... $c" >&4
10790 if set socket val -f d_socket; eval $csym; $val; then
10791         echo "Looks like you have Berkeley networking support." >&4
10792         d_socket="$define"
10793         if set setsockopt val -f; eval $csym; $val; then
10794                 d_oldsock="$undef"
10795         else
10796                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10797                 d_oldsock="$define"
10798         fi
10799 else
10800         if $contains socklib libc.list >/dev/null 2>&1; then
10801                 echo "Looks like you have Berkeley networking support." >&4
10802                 d_socket="$define"
10803                 : we will have to assume that it supports the 4.2 BSD interface
10804                 d_oldsock="$undef"
10805         else
10806                 echo "You don't have Berkeley networking in libc$_a..." >&4
10807                 if test "X$d_socket" = "X$define"; then
10808                    echo "...but you seem to believe that you have sockets." >&4
10809                 else
10810                         for net in net socket
10811                         do
10812                                 if test -f /usr/lib/lib$net$_a; then
10813                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10814                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10815                                         if $contains socket libc.list >/dev/null 2>&1; then
10816                                                 d_socket="$define"
10817                                                 socketlib="-l$net"
10818                                                 case "$net" in
10819                                                 net)
10820                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10821                                                         sockethdr="-I/usr/netinclude"
10822                                                         ;;
10823                                                 esac
10824                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10825                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10826                                                         d_oldsock="$undef"
10827                                                 else
10828                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10829                                                         d_oldsock="$define"
10830                                                 fi
10831                                                 break
10832                                         fi
10833                                 fi
10834                         done
10835                         if test "X$d_socket" != "X$define"; then
10836                            echo "or anywhere else I see." >&4
10837                            d_socket="$undef"
10838                            d_oldsock="$undef"
10839                         fi
10840                 fi
10841         fi
10842 fi
10843
10844 : see if socketpair exists
10845 set socketpair d_sockpair
10846 eval $inlibc
10847
10848
10849 echo " "
10850 echo "Checking the availability of certain socket constants..." >&4
10851 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10852         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10853         $cat >try.c <<EOF
10854 #include <sys/types.h>
10855 #include <sys/socket.h>
10856 int main() {
10857     int i = $ENUM;
10858 }
10859 EOF
10860         val="$undef"
10861         set try; if eval $compile; then
10862                 val="$define"
10863         fi
10864         set d_${enum}; eval $setvar
10865         $rm -f try.c try
10866 done
10867
10868 : see if this is a sys/uio.h system
10869 set sys/uio.h i_sysuio
10870 eval $inhdr
10871
10872
10873 echo " "
10874 echo "Checking to see if your system supports struct cmsghdr..." >&4
10875 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10876 eval $hasstruct
10877 case "$d_cmsghdr_s" in
10878 "$define")      echo "Yes, it does."   ;;
10879 *)              echo "No, it doesn't." ;;
10880 esac
10881
10882
10883 : check for const keyword
10884 echo " "
10885 echo 'Checking to see if your C compiler knows about "const"...' >&4
10886 $cat >const.c <<'EOCP'
10887 typedef struct spug { int drokk; } spug;
10888 int main()
10889 {
10890         const char *foo;
10891         const spug y = { 0 };
10892 }
10893 EOCP
10894 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10895         val="$define"
10896         echo "Yup, it does."
10897 else
10898         val="$undef"
10899         echo "Nope, it doesn't."
10900 fi
10901 set d_const
10902 eval $setvar
10903
10904 : see if copysignl exists
10905 set copysignl d_copysignl
10906 eval $inlibc
10907
10908 : see if crypt exists
10909 echo " "
10910 set crypt d_crypt
10911 eval $inlibc
10912 case "$d_crypt" in
10913 $define) cryptlib='' ;;
10914 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10915                 echo 'crypt() found.' >&4
10916                 val="$define"
10917                 cryptlib=''
10918         else
10919                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10920                 if $test -z "$cryptlib"; then
10921                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10922                 else
10923                         cryptlib=-lcrypt
10924                 fi
10925                 if $test -z "$cryptlib"; then
10926                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10927                 else
10928                         cryptlib=-lcrypt
10929                 fi
10930                 if $test -z "$cryptlib"; then
10931                         cryptlib=`./loc libcrypt$_a "" $libpth`
10932                 else
10933                         cryptlib=-lcrypt
10934                 fi
10935                 if $test -z "$cryptlib"; then
10936                         echo 'crypt() NOT found.' >&4
10937                         val="$undef"
10938                 else
10939                         val="$define"
10940                 fi
10941         fi
10942         set d_crypt
10943         eval $setvar
10944         ;;
10945 esac
10946
10947 : see if this is a crypt.h system
10948 set crypt.h i_crypt
10949 eval $inhdr
10950
10951 : see if crypt_r exists
10952 set crypt_r d_crypt_r
10953 eval $inlibc
10954 case "$d_crypt_r" in
10955 "$define")
10956         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10957         case "$d_crypt_r_proto:$usethreads" in
10958         ":define")      d_crypt_r_proto=define
10959                 set d_crypt_r_proto crypt_r $hdrs
10960                 eval $hasproto ;;
10961         *)      ;;
10962         esac
10963         case "$d_crypt_r_proto" in
10964         define)
10965         case "$crypt_r_proto" in
10966         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10967         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10968         esac
10969         case "$crypt_r_proto" in
10970         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10971         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10972         esac
10973         case "$crypt_r_proto" in
10974         ''|0)   d_crypt_r=undef
10975                 crypt_r_proto=0
10976                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10977         * )     case "$crypt_r_proto" in
10978                 REENTRANT_PROTO*) ;;
10979                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10980                 esac
10981                 echo "Prototype: $try" ;;
10982         esac
10983         ;;
10984         *)      case "$usethreads" in
10985                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10986                 esac
10987                 d_crypt_r=undef
10988                 crypt_r_proto=0
10989                 ;;
10990         esac
10991         ;;
10992 *)      crypt_r_proto=0
10993         ;;
10994 esac
10995
10996 : get csh whereabouts
10997 case "$csh" in
10998 'csh') val="$undef" ;;
10999 *) val="$define" ;;
11000 esac
11001 set d_csh
11002 eval $setvar
11003 : Respect a hint or command line value for full_csh.
11004 case "$full_csh" in
11005 '') full_csh=$csh ;;
11006 esac
11007
11008 : see if ctermid exists
11009 set ctermid d_ctermid
11010 eval $inlibc
11011
11012 : see if ctermid_r exists
11013 set ctermid_r d_ctermid_r
11014 eval $inlibc
11015 case "$d_ctermid_r" in
11016 "$define")
11017         hdrs="$i_systypes sys/types.h define stdio.h "
11018         case "$d_ctermid_r_proto:$usethreads" in
11019         ":define")      d_ctermid_r_proto=define
11020                 set d_ctermid_r_proto ctermid_r $hdrs
11021                 eval $hasproto ;;
11022         *)      ;;
11023         esac
11024         case "$d_ctermid_r_proto" in
11025         define)
11026         case "$ctermid_r_proto" in
11027         ''|0) try='char* ctermid_r(char*);'
11028         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11029         esac
11030         case "$ctermid_r_proto" in
11031         ''|0)   d_ctermid_r=undef
11032                 ctermid_r_proto=0
11033                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11034         * )     case "$ctermid_r_proto" in
11035                 REENTRANT_PROTO*) ;;
11036                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11037                 esac
11038                 echo "Prototype: $try" ;;
11039         esac
11040         ;;
11041         *)      case "$usethreads" in
11042                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11043                 esac
11044                 d_ctermid_r=undef
11045                 ctermid_r_proto=0
11046                 ;;
11047         esac
11048         ;;
11049 *)      ctermid_r_proto=0
11050         ;;
11051 esac
11052
11053 : see if ctime_r exists
11054 set ctime_r d_ctime_r
11055 eval $inlibc
11056 case "$d_ctime_r" in
11057 "$define")
11058         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11059         case "$d_ctime_r_proto:$usethreads" in
11060         ":define")      d_ctime_r_proto=define
11061                 set d_ctime_r_proto ctime_r $hdrs
11062                 eval $hasproto ;;
11063         *)      ;;
11064         esac
11065         case "$d_ctime_r_proto" in
11066         define)
11067         case "$ctime_r_proto" in
11068         ''|0) try='char* ctime_r(const time_t*, char*);'
11069         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11070         esac
11071         case "$ctime_r_proto" in
11072         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11073         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11074         esac
11075         case "$ctime_r_proto" in
11076         ''|0) try='int ctime_r(const time_t*, char*);'
11077         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11078         esac
11079         case "$ctime_r_proto" in
11080         ''|0) try='int ctime_r(const time_t*, char*, int);'
11081         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11082         esac
11083         case "$ctime_r_proto" in
11084         ''|0)   d_ctime_r=undef
11085                 ctime_r_proto=0
11086                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11087         * )     case "$ctime_r_proto" in
11088                 REENTRANT_PROTO*) ;;
11089                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11090                 esac
11091                 echo "Prototype: $try" ;;
11092         esac
11093         ;;
11094         *)      case "$usethreads" in
11095                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11096                 esac
11097                 d_ctime_r=undef
11098                 ctime_r_proto=0
11099                 ;;
11100         esac
11101         ;;
11102 *)      ctime_r_proto=0
11103         ;;
11104 esac
11105
11106 : see if cuserid exists
11107 set cuserid d_cuserid
11108 eval $inlibc
11109
11110 : see if this is a limits.h system
11111 set limits.h i_limits
11112 eval $inhdr
11113
11114 : see if this is a float.h system
11115 set float.h i_float
11116 eval $inhdr
11117
11118 : See if number of significant digits in a double precision number is known
11119 echo " "
11120 $cat >dbl_dig.c <<EOM
11121 #$i_limits I_LIMITS
11122 #$i_float I_FLOAT
11123 #ifdef I_LIMITS
11124 #include <limits.h>
11125 #endif
11126 #ifdef I_FLOAT
11127 #include <float.h>
11128 #endif
11129 #ifdef DBL_DIG
11130 printf("Contains DBL_DIG");
11131 #endif
11132 EOM
11133 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11134 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11135         echo "DBL_DIG found." >&4
11136         val="$define"
11137 else
11138         echo "DBL_DIG NOT found." >&4
11139         val="$undef"
11140 fi
11141 $rm -f dbl_dig.?
11142 set d_dbl_dig
11143 eval $setvar
11144
11145 : see if dbm.h is available
11146 : see if dbmclose exists
11147 set dbmclose d_dbmclose
11148 eval $inlibc
11149
11150 case "$d_dbmclose" in
11151 $define)
11152         set dbm.h i_dbm
11153         eval $inhdr
11154         case "$i_dbm" in
11155         $define)
11156                 val="$undef"
11157                 set i_rpcsvcdbm
11158                 eval $setvar
11159                 ;;
11160         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11161                 eval $inhdr
11162                 ;;
11163         esac
11164         ;;
11165 *)      echo "We won't be including <dbm.h>"
11166         val="$undef"
11167         set i_dbm
11168         eval $setvar
11169         val="$undef"
11170         set i_rpcsvcdbm
11171         eval $setvar
11172         ;;
11173 esac
11174
11175 : see if prototype for dbminit is available
11176 echo " "
11177 set d_dbminitproto dbminit $i_dbm dbm.h
11178 eval $hasproto
11179
11180 : see if difftime exists
11181 set difftime d_difftime
11182 eval $inlibc
11183
11184 : see if this is a dirent system
11185 echo " "
11186 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11187         val="$define"
11188         echo "<dirent.h> found." >&4
11189 else
11190         val="$undef"
11191         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11192                 echo "<sys/dir.h> found." >&4
11193                 echo " "
11194         else
11195                 xinc=`./findhdr sys/ndir.h`
11196         fi
11197         echo "<dirent.h> NOT found." >&4
11198 fi
11199 set i_dirent
11200 eval $setvar
11201
11202 : Look for type of directory structure.
11203 echo " "
11204 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11205
11206 case "$direntrytype" in
11207 ''|' ')
11208         case "$i_dirent" in
11209         $define) guess1='struct dirent' ;;
11210         *) guess1='struct direct'  ;;
11211         esac
11212         ;;
11213 *)      guess1="$direntrytype"
11214         ;;
11215 esac
11216
11217 case "$guess1" in
11218 'struct dirent') guess2='struct direct' ;;
11219 *) guess2='struct dirent' ;;
11220 esac
11221                 
11222 if $contains "$guess1" try.c >/dev/null 2>&1; then
11223         direntrytype="$guess1"
11224         echo "Your directory entries are $direntrytype." >&4
11225 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11226         direntrytype="$guess2"
11227         echo "Your directory entries seem to be $direntrytype." >&4
11228 else
11229         echo "I don't recognize your system's directory entries." >&4
11230         rp="What type is used for directory entries on this system?"
11231         dflt="$guess1"
11232         . ./myread
11233         direntrytype="$ans"
11234 fi
11235 $rm -f try.c
11236
11237
11238 : see if the directory entry stores field length
11239 echo " "
11240 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11241 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11242         echo "Good, your directory entry keeps length information in d_namlen." >&4
11243         val="$define"
11244 else
11245         echo "Your directory entry does not know about the d_namlen field." >&4
11246         val="$undef"
11247 fi
11248 set d_dirnamlen
11249 eval $setvar
11250 $rm -f try.c
11251
11252 : Look for DIR.dd_fd
11253 case "$i_dirent" in
11254 "$define")
11255     echo "Checking to see if DIR has a dd_fd member variable" >&4
11256     $cat >try.c <<EOCP
11257 #$i_stdlib I_STDLIB
11258 #ifdef I_STDLIB
11259 #include <stdlib.h>
11260 #endif
11261 #include <dirent.h>
11262
11263 int main() {
11264     DIR dir;
11265     dir.dd_fd = 1;
11266     return 0;
11267 }
11268 EOCP
11269     val=$undef
11270     set try
11271     if eval $compile; then
11272         echo "Yes, it does."
11273         val="$define"
11274     else
11275         echo "No, it does not."
11276         val="$undef"
11277     fi
11278     ;;
11279 *)
11280     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11281     val="$undef"
11282     ;;
11283 esac
11284 set d_dir_dd_fd
11285 eval $setvar
11286 $rm -f try try.*
11287
11288 : see if this is an sysdir system
11289 set sys/dir.h i_sysdir
11290 eval $inhdr
11291
11292 : see if this is an sysndir system
11293 set sys/ndir.h i_sysndir
11294 eval $inhdr
11295
11296 : Look for dirfd
11297 echo " "
11298 $cat >dirfd.c <<EOM
11299 #include <stdio.h>
11300 #$i_stdlib I_STDLIB
11301 #ifdef I_STDLIB
11302 #include <stdlib.h>
11303 #endif
11304 #$i_dirent I_DIRENT             /**/
11305 #$i_sysdir I_SYS_DIR            /**/
11306 #$i_sysndir I_SYS_NDIR          /**/
11307 #$i_systypes I_SYS_TYPES        /**/
11308 #if defined(I_SYS_TYPES)
11309 #include <sys/types.h>
11310 #endif
11311 #if defined(I_DIRENT)
11312 #include <dirent.h>
11313 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11314 #include <sys/dir.h>
11315 #endif
11316 #else
11317 #ifdef I_SYS_NDIR
11318 #include <sys/ndir.h>
11319 #else
11320 #ifdef I_SYS_DIR
11321 #ifdef hp9000s500
11322 #include <ndir.h>       /* may be wrong in the future */
11323 #else
11324 #include <sys/dir.h>
11325 #endif
11326 #endif
11327 #endif
11328 #endif 
11329 int main() {
11330         DIR *dirp = opendir(".");
11331         if (dirfd(dirp) >= 0)
11332                 exit(0);
11333         else
11334                 exit(1);
11335 }
11336 EOM
11337 val=$undef
11338 set dirfd
11339 if eval $compile; then
11340         val="$define"
11341 fi
11342 case "$val" in
11343 $define)        echo "dirfd() found." >&4       ;;
11344 *)              echo "dirfd() NOT found." >&4   ;;
11345 esac
11346 set d_dirfd
11347 eval $setvar
11348 $rm -f dirfd*
11349
11350 : see if dlerror exists
11351 xxx_runnm="$runnm"
11352 runnm=false
11353 set dlerror d_dlerror
11354 eval $inlibc
11355 runnm="$xxx_runnm"
11356
11357 : see if dlfcn is available
11358 set dlfcn.h i_dlfcn
11359 eval $inhdr
11360
11361 case "$usedl" in
11362 $define|y|true)
11363         $cat << EOM
11364
11365 On a few systems, the dynamically loaded modules that perl generates and uses
11366 will need a different extension than shared libs. The default will probably
11367 be appropriate.
11368
11369 EOM
11370         case "$dlext" in
11371         '')     dflt="$so" ;;
11372         *)      dflt="$dlext" ;;
11373         esac
11374         rp='What is the extension of dynamically loaded modules'
11375         . ./myread
11376         dlext="$ans"
11377         ;;
11378 *)
11379         dlext="none"
11380         ;;
11381 esac
11382
11383 : Check if dlsym need a leading underscore
11384 echo " "
11385 val="$undef"
11386
11387 case "$dlsrc" in
11388 dl_dlopen.xs)
11389         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11390         $cat >dyna.c <<'EOM'
11391 fred () { }
11392 EOM
11393
11394 $cat >fred.c<<EOM
11395
11396 #include <stdio.h>
11397 #$i_stdlib I_STDLIB
11398 #ifdef I_STDLIB
11399 #include <stdlib.h>
11400 #endif
11401 #$i_dlfcn I_DLFCN
11402 #ifdef I_DLFCN
11403 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11404 #else
11405 #include <sys/types.h>
11406 #include <nlist.h>
11407 #include <link.h>
11408 #endif
11409
11410 extern int fred() ;
11411
11412 int main()
11413 {
11414     void * handle ;
11415     void * symbol ;
11416 #ifndef RTLD_LAZY
11417     int mode = 1 ;
11418 #else
11419     int mode = RTLD_LAZY ;
11420 #endif
11421     handle = dlopen("./dyna.$dlext", mode) ;
11422     if (handle == NULL) {
11423         printf ("1\n") ;
11424         fflush (stdout) ;
11425         exit(0);
11426     }
11427     symbol = dlsym(handle, "fred") ;
11428     if (symbol == NULL) {
11429         /* try putting a leading underscore */
11430         symbol = dlsym(handle, "_fred") ;
11431         if (symbol == NULL) {
11432             printf ("2\n") ;
11433             fflush (stdout) ;
11434             exit(0);
11435         }
11436         printf ("3\n") ;
11437     }
11438     else
11439         printf ("4\n") ;
11440     fflush (stdout) ;
11441     exit(0);
11442 }
11443 EOM
11444         : Call the object file tmp-dyna.o in case dlext=o.
11445         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11446                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11447                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11448                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11449                 xxx=`$run ./fred`
11450                 case $xxx in
11451                 1)      echo "Test program failed using dlopen." >&4
11452                         echo "Perhaps you should not use dynamic loading." >&4;;
11453                 2)      echo "Test program failed using dlsym." >&4
11454                         echo "Perhaps you should not use dynamic loading." >&4;;
11455                 3)      echo "dlsym needs a leading underscore" >&4
11456                         val="$define" ;;
11457                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11458                 esac
11459         else
11460                 echo "I can't compile and run the test program." >&4
11461                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11462         fi
11463         ;;
11464 esac
11465                 
11466 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11467
11468 set d_dlsymun
11469 eval $setvar
11470
11471 : see if drand48_r exists
11472 set drand48_r d_drand48_r
11473 eval $inlibc
11474 case "$d_drand48_r" in
11475 "$define")
11476         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11477         case "$d_drand48_r_proto:$usethreads" in
11478         ":define")      d_drand48_r_proto=define
11479                 set d_drand48_r_proto drand48_r $hdrs
11480                 eval $hasproto ;;
11481         *)      ;;
11482         esac
11483         case "$d_drand48_r_proto" in
11484         define)
11485         case "$drand48_r_proto" in
11486         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11487         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11488         esac
11489         case "$drand48_r_proto" in
11490         ''|0)   d_drand48_r=undef
11491                 drand48_r_proto=0
11492                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11493         * )     case "$drand48_r_proto" in
11494                 REENTRANT_PROTO*) ;;
11495                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11496                 esac
11497                 echo "Prototype: $try" ;;
11498         esac
11499         ;;
11500         *)      case "$usethreads" in
11501                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11502                 esac
11503                 d_drand48_r=undef
11504                 drand48_r_proto=0
11505                 ;;
11506         esac
11507         ;;
11508 *)      drand48_r_proto=0
11509         ;;
11510 esac
11511
11512 : see if prototype for drand48 is available
11513 echo " "
11514 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11515 eval $hasproto
11516
11517 : see if dup2 exists
11518 set dup2 d_dup2
11519 eval $inlibc
11520
11521 : see if eaccess exists
11522 set eaccess d_eaccess
11523 eval $inlibc
11524
11525 : see if endgrent exists
11526 set endgrent d_endgrent
11527 eval $inlibc
11528
11529 : see if this is an grp system
11530 set grp.h i_grp
11531 eval $inhdr
11532
11533 case "$i_grp" in
11534 $define)
11535         xxx=`./findhdr grp.h`
11536         $cppstdin $cppflags $cppminus < $xxx >$$.h
11537
11538         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11539                 val="$define"
11540         else
11541                 val="$undef"
11542         fi
11543         set d_grpasswd
11544         eval $setvar
11545
11546         $rm -f $$.h
11547         ;;
11548 *)
11549         val="$undef";
11550         set d_grpasswd; eval $setvar
11551         ;;
11552 esac
11553
11554 : see if endgrent_r exists
11555 set endgrent_r d_endgrent_r
11556 eval $inlibc
11557 case "$d_endgrent_r" in
11558 "$define")
11559         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11560         case "$d_endgrent_r_proto:$usethreads" in
11561         ":define")      d_endgrent_r_proto=define
11562                 set d_endgrent_r_proto endgrent_r $hdrs
11563                 eval $hasproto ;;
11564         *)      ;;
11565         esac
11566         case "$d_endgrent_r_proto" in
11567         define)
11568         case "$endgrent_r_proto" in
11569         ''|0) try='int endgrent_r(FILE**);'
11570         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11571         esac
11572         case "$endgrent_r_proto" in
11573         ''|0) try='void endgrent_r(FILE**);'
11574         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11575         esac
11576         case "$endgrent_r_proto" in
11577         ''|0)   d_endgrent_r=undef
11578                 endgrent_r_proto=0
11579                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11580         * )     case "$endgrent_r_proto" in
11581                 REENTRANT_PROTO*) ;;
11582                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11583                 esac
11584                 echo "Prototype: $try" ;;
11585         esac
11586         ;;
11587         *)      case "$usethreads" in
11588                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11589                 esac
11590                 d_endgrent_r=undef
11591                 endgrent_r_proto=0
11592                 ;;
11593         esac
11594         ;;
11595 *)      endgrent_r_proto=0
11596         ;;
11597 esac
11598
11599 : see if endhostent exists
11600 set endhostent d_endhent
11601 eval $inlibc
11602
11603 : see if this is a netdb.h system
11604 set netdb.h i_netdb
11605 eval $inhdr
11606
11607 : see if endhostent_r exists
11608 set endhostent_r d_endhostent_r
11609 eval $inlibc
11610 case "$d_endhostent_r" in
11611 "$define")
11612         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11613         case "$d_endhostent_r_proto:$usethreads" in
11614         ":define")      d_endhostent_r_proto=define
11615                 set d_endhostent_r_proto endhostent_r $hdrs
11616                 eval $hasproto ;;
11617         *)      ;;
11618         esac
11619         case "$d_endhostent_r_proto" in
11620         define)
11621         case "$endhostent_r_proto" in
11622         ''|0) try='int endhostent_r(struct hostent_data*);'
11623         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11624         esac
11625         case "$endhostent_r_proto" in
11626         ''|0) try='void endhostent_r(struct hostent_data*);'
11627         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11628         esac
11629         case "$endhostent_r_proto" in
11630         ''|0)   d_endhostent_r=undef
11631                 endhostent_r_proto=0
11632                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11633         * )     case "$endhostent_r_proto" in
11634                 REENTRANT_PROTO*) ;;
11635                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11636                 esac
11637                 echo "Prototype: $try" ;;
11638         esac
11639         ;;
11640         *)      case "$usethreads" in
11641                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11642                 esac
11643                 d_endhostent_r=undef
11644                 endhostent_r_proto=0
11645                 ;;
11646         esac
11647         ;;
11648 *)      endhostent_r_proto=0
11649         ;;
11650 esac
11651
11652 : see if endnetent exists
11653 set endnetent d_endnent
11654 eval $inlibc
11655
11656 : see if endnetent_r exists
11657 set endnetent_r d_endnetent_r
11658 eval $inlibc
11659 case "$d_endnetent_r" in
11660 "$define")
11661         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11662         case "$d_endnetent_r_proto:$usethreads" in
11663         ":define")      d_endnetent_r_proto=define
11664                 set d_endnetent_r_proto endnetent_r $hdrs
11665                 eval $hasproto ;;
11666         *)      ;;
11667         esac
11668         case "$d_endnetent_r_proto" in
11669         define)
11670         case "$endnetent_r_proto" in
11671         ''|0) try='int endnetent_r(struct netent_data*);'
11672         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11673         esac
11674         case "$endnetent_r_proto" in
11675         ''|0) try='void endnetent_r(struct netent_data*);'
11676         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11677         esac
11678         case "$endnetent_r_proto" in
11679         ''|0)   d_endnetent_r=undef
11680                 endnetent_r_proto=0
11681                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11682         * )     case "$endnetent_r_proto" in
11683                 REENTRANT_PROTO*) ;;
11684                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11685                 esac
11686                 echo "Prototype: $try" ;;
11687         esac
11688         ;;
11689         *)      case "$usethreads" in
11690                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11691                 esac
11692                 d_endnetent_r=undef
11693                 endnetent_r_proto=0
11694                 ;;
11695         esac
11696         ;;
11697 *)      endnetent_r_proto=0
11698         ;;
11699 esac
11700
11701 : see if endprotoent exists
11702 set endprotoent d_endpent
11703 eval $inlibc
11704
11705 : see if endprotoent_r exists
11706 set endprotoent_r d_endprotoent_r
11707 eval $inlibc
11708 case "$d_endprotoent_r" in
11709 "$define")
11710         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11711         case "$d_endprotoent_r_proto:$usethreads" in
11712         ":define")      d_endprotoent_r_proto=define
11713                 set d_endprotoent_r_proto endprotoent_r $hdrs
11714                 eval $hasproto ;;
11715         *)      ;;
11716         esac
11717         case "$d_endprotoent_r_proto" in
11718         define)
11719         case "$endprotoent_r_proto" in
11720         ''|0) try='int endprotoent_r(struct protoent_data*);'
11721         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11722         esac
11723         case "$endprotoent_r_proto" in
11724         ''|0) try='void endprotoent_r(struct protoent_data*);'
11725         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11726         esac
11727         case "$endprotoent_r_proto" in
11728         ''|0)   d_endprotoent_r=undef
11729                 endprotoent_r_proto=0
11730                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11731         * )     case "$endprotoent_r_proto" in
11732                 REENTRANT_PROTO*) ;;
11733                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11734                 esac
11735                 echo "Prototype: $try" ;;
11736         esac
11737         ;;
11738         *)      case "$usethreads" in
11739                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11740                 esac
11741                 d_endprotoent_r=undef
11742                 endprotoent_r_proto=0
11743                 ;;
11744         esac
11745         ;;
11746 *)      endprotoent_r_proto=0
11747         ;;
11748 esac
11749
11750 : see if endpwent exists
11751 set endpwent d_endpwent
11752 eval $inlibc
11753
11754 : see if this is a pwd.h system
11755 set pwd.h i_pwd
11756 eval $inhdr
11757
11758 case "$i_pwd" in
11759 $define)
11760         xxx=`./findhdr pwd.h`
11761         $cppstdin $cppflags $cppminus < $xxx >$$.h
11762
11763         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11764                 val="$define"
11765         else
11766                 val="$undef"
11767         fi
11768         set d_pwquota
11769         eval $setvar
11770
11771         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11772                 val="$define"
11773         else
11774                 val="$undef"
11775         fi
11776         set d_pwage
11777         eval $setvar
11778
11779         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11780                 val="$define"
11781         else
11782                 val="$undef"
11783         fi
11784         set d_pwchange
11785         eval $setvar
11786
11787         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11788                 val="$define"
11789         else
11790                 val="$undef"
11791         fi
11792         set d_pwclass
11793         eval $setvar
11794
11795         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11796                 val="$define"
11797         else
11798                 val="$undef"
11799         fi
11800         set d_pwexpire
11801         eval $setvar
11802
11803         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11804                 val="$define"
11805         else
11806                 val="$undef"
11807         fi
11808         set d_pwcomment
11809         eval $setvar
11810
11811         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11812                 val="$define"
11813         else
11814                 val="$undef"
11815         fi
11816         set d_pwgecos
11817         eval $setvar
11818
11819         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11820                 val="$define"
11821         else
11822                 val="$undef"
11823         fi
11824         set d_pwpasswd
11825         eval $setvar
11826
11827         $rm -f $$.h
11828         ;;
11829 *)
11830         val="$undef"; 
11831         set d_pwquota; eval $setvar
11832         set d_pwage; eval $setvar
11833         set d_pwchange; eval $setvar
11834         set d_pwclass; eval $setvar
11835         set d_pwexpire; eval $setvar
11836         set d_pwcomment; eval $setvar
11837         set d_pwgecos; eval $setvar
11838         set d_pwpasswd; eval $setvar
11839         ;;
11840 esac
11841
11842 : see if endpwent_r exists
11843 set endpwent_r d_endpwent_r
11844 eval $inlibc
11845 case "$d_endpwent_r" in
11846 "$define")
11847         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11848         case "$d_endpwent_r_proto:$usethreads" in
11849         ":define")      d_endpwent_r_proto=define
11850                 set d_endpwent_r_proto endpwent_r $hdrs
11851                 eval $hasproto ;;
11852         *)      ;;
11853         esac
11854         case "$d_endpwent_r_proto" in
11855         define)
11856         case "$endpwent_r_proto" in
11857         ''|0) try='int endpwent_r(FILE**);'
11858         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11859         esac
11860         case "$endpwent_r_proto" in
11861         ''|0) try='void endpwent_r(FILE**);'
11862         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11863         esac
11864         case "$endpwent_r_proto" in
11865         ''|0)   d_endpwent_r=undef
11866                 endpwent_r_proto=0
11867                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11868         * )     case "$endpwent_r_proto" in
11869                 REENTRANT_PROTO*) ;;
11870                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11871                 esac
11872                 echo "Prototype: $try" ;;
11873         esac
11874         ;;
11875         *)      case "$usethreads" in
11876                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11877                 esac
11878                 d_endpwent_r=undef
11879                 endpwent_r_proto=0
11880                 ;;
11881         esac
11882         ;;
11883 *)      endpwent_r_proto=0
11884         ;;
11885 esac
11886
11887 : see if endservent exists
11888 set endservent d_endsent
11889 eval $inlibc
11890
11891 : see if endservent_r exists
11892 set endservent_r d_endservent_r
11893 eval $inlibc
11894 case "$d_endservent_r" in
11895 "$define")
11896         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11897         case "$d_endservent_r_proto:$usethreads" in
11898         ":define")      d_endservent_r_proto=define
11899                 set d_endservent_r_proto endservent_r $hdrs
11900                 eval $hasproto ;;
11901         *)      ;;
11902         esac
11903         case "$d_endservent_r_proto" in
11904         define)
11905         case "$endservent_r_proto" in
11906         ''|0) try='int endservent_r(struct servent_data*);'
11907         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11908         esac
11909         case "$endservent_r_proto" in
11910         ''|0) try='void endservent_r(struct servent_data*);'
11911         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11912         esac
11913         case "$endservent_r_proto" in
11914         ''|0)   d_endservent_r=undef
11915                 endservent_r_proto=0
11916                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11917         * )     case "$endservent_r_proto" in
11918                 REENTRANT_PROTO*) ;;
11919                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11920                 esac
11921                 echo "Prototype: $try" ;;
11922         esac
11923         ;;
11924         *)      case "$usethreads" in
11925                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11926                 esac
11927                 d_endservent_r=undef
11928                 endservent_r_proto=0
11929                 ;;
11930         esac
11931         ;;
11932 *)      endservent_r_proto=0
11933         ;;
11934 esac
11935
11936 : Locate the flags for 'open()'
11937 echo " "
11938 $cat >try.c <<EOCP
11939 #include <sys/types.h>
11940 #ifdef I_FCNTL
11941 #include <fcntl.h>
11942 #endif
11943 #ifdef I_SYS_FILE
11944 #include <sys/file.h>
11945 #endif
11946 #$i_stdlib I_STDLIB
11947 #ifdef I_STDLIB
11948 #include <stdlib.h>
11949 #endif
11950 int main() {
11951         if(O_RDONLY);
11952 #ifdef O_TRUNC
11953         exit(0);
11954 #else
11955         exit(1);
11956 #endif
11957 }
11958 EOCP
11959 : check sys/file.h first to get FREAD on Sun
11960 if $test `./findhdr sys/file.h` && \
11961                 set try -DI_SYS_FILE && eval $compile; then
11962         h_sysfile=true;
11963         echo "<sys/file.h> defines the O_* constants..." >&4
11964         if $run ./try; then
11965                 echo "and you have the 3 argument form of open()." >&4
11966                 val="$define"
11967         else
11968                 echo "but not the 3 argument form of open().  Oh, well." >&4
11969                 val="$undef"
11970         fi
11971 elif $test `./findhdr fcntl.h` && \
11972                 set try -DI_FCNTL && eval $compile; then
11973         h_fcntl=true;
11974         echo "<fcntl.h> defines the O_* constants..." >&4
11975         if $run ./try; then
11976                 echo "and you have the 3 argument form of open()." >&4
11977                 val="$define"
11978         else
11979                 echo "but not the 3 argument form of open().  Oh, well." >&4
11980                 val="$undef"
11981         fi
11982 else
11983         val="$undef"
11984         echo "I can't find the O_* constant definitions!  You got problems." >&4
11985 fi
11986 set d_open3
11987 eval $setvar
11988 $rm -f try try.*
11989
11990 : see which of string.h or strings.h is needed
11991 echo " "
11992 strings=`./findhdr string.h`
11993 if $test "$strings" && $test -r "$strings"; then
11994         echo "Using <string.h> instead of <strings.h>." >&4
11995         val="$define"
11996 else
11997         val="$undef"
11998         strings=`./findhdr strings.h`
11999         if $test "$strings" && $test -r "$strings"; then
12000                 echo "Using <strings.h> instead of <string.h>." >&4
12001         else
12002                 echo "No string header found -- You'll surely have problems." >&4
12003         fi
12004 fi
12005 set i_string
12006 eval $setvar
12007 case "$i_string" in
12008 "$undef") strings=`./findhdr strings.h`;;
12009 *)        strings=`./findhdr string.h`;;
12010 esac
12011
12012 : see if this is a sys/file.h system
12013 val=''
12014 set sys/file.h val
12015 eval $inhdr
12016
12017 : do we need to include sys/file.h ?
12018 case "$val" in
12019 "$define")
12020         echo " "
12021         if $h_sysfile; then
12022                 val="$define"
12023                 echo "We'll be including <sys/file.h>." >&4
12024         else
12025                 val="$undef"
12026                 echo "We won't be including <sys/file.h>." >&4
12027         fi
12028         ;;
12029 *)
12030         h_sysfile=false
12031         ;;
12032 esac
12033 set i_sysfile
12034 eval $setvar
12035
12036 : see if fcntl.h is there
12037 val=''
12038 set fcntl.h val
12039 eval $inhdr
12040
12041 : see if we can include fcntl.h
12042 case "$val" in
12043 "$define")
12044         echo " "
12045         if $h_fcntl; then
12046                 val="$define"
12047                 echo "We'll be including <fcntl.h>." >&4
12048         else
12049                 val="$undef"
12050                 if $h_sysfile; then
12051         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12052                 else
12053                         echo "We won't be including <fcntl.h>." >&4
12054                 fi
12055         fi
12056         ;;
12057 *)
12058         h_fcntl=false
12059         val="$undef"
12060         ;;
12061 esac
12062 set i_fcntl
12063 eval $setvar
12064
12065 : check for non-blocking I/O stuff
12066 case "$h_sysfile" in
12067 true) echo "#include <sys/file.h>" > head.c;;
12068 *)
12069        case "$h_fcntl" in
12070        true) echo "#include <fcntl.h>" > head.c;;
12071        *) echo "#include <sys/fcntl.h>" > head.c;;
12072        esac
12073        ;;
12074 esac
12075 echo " "
12076 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12077 case "$o_nonblock" in
12078 '')
12079         $cat head.c > try.c
12080         $cat >>try.c <<EOCP
12081 #include <stdio.h>
12082 #$i_stdlib I_STDLIB
12083 #ifdef I_STDLIB
12084 #include <stdlib.h>
12085 #endif
12086 #$i_fcntl I_FCNTL
12087 #ifdef I_FCNTL
12088 #include <fcntl.h>
12089 #endif
12090 int main() {
12091 #ifdef O_NONBLOCK
12092         printf("O_NONBLOCK\n");
12093         exit(0);
12094 #endif
12095 #ifdef O_NDELAY
12096         printf("O_NDELAY\n");
12097         exit(0);
12098 #endif
12099 #ifdef FNDELAY
12100         printf("FNDELAY\n");
12101         exit(0);
12102 #endif
12103         exit(0);
12104 }
12105 EOCP
12106         set try
12107         if eval $compile_ok; then
12108                 o_nonblock=`$run ./try`
12109                 case "$o_nonblock" in
12110                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12111                 *) echo "Seems like we can use $o_nonblock.";;
12112                 esac
12113         else
12114                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12115         fi
12116         ;;
12117 *) echo "Using $hint value $o_nonblock.";;
12118 esac
12119 $rm -f try try.* .out core
12120
12121 echo " "
12122 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12123 case "$eagain" in
12124 '')
12125         $cat head.c > try.c
12126         $cat >>try.c <<EOCP
12127 #include <errno.h>
12128 #include <sys/types.h>
12129 #include <signal.h>
12130 #include <stdio.h> 
12131 #$i_stdlib I_STDLIB
12132 #ifdef I_STDLIB
12133 #include <stdlib.h>
12134 #endif
12135 #$i_fcntl I_FCNTL
12136 #ifdef I_FCNTL
12137 #include <fcntl.h>
12138 #endif
12139 #define MY_O_NONBLOCK $o_nonblock
12140 #ifndef errno  /* XXX need better Configure test */
12141 extern int errno;
12142 #endif
12143 #$i_unistd I_UNISTD
12144 #ifdef I_UNISTD
12145 #include <unistd.h>
12146 #endif
12147 #$i_string I_STRING
12148 #ifdef I_STRING
12149 #include <string.h>
12150 #else
12151 #include <strings.h>
12152 #endif
12153 $signal_t blech(int x) { exit(3); }
12154 EOCP
12155         $cat >> try.c <<'EOCP'
12156 int main()
12157 {
12158         int pd[2];
12159         int pu[2];
12160         char buf[1];
12161         char string[100];
12162
12163         pipe(pd);       /* Down: child -> parent */
12164         pipe(pu);       /* Up: parent -> child */
12165         if (0 != fork()) {
12166                 int ret;
12167                 close(pd[1]);   /* Parent reads from pd[0] */
12168                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12169 #ifdef F_SETFL
12170                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12171                         exit(1);
12172 #else
12173                 exit(4);
12174 #endif
12175                 signal(SIGALRM, blech);
12176                 alarm(5);
12177                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12178                         exit(2);
12179                 sprintf(string, "%d\n", ret);
12180                 write(2, string, strlen(string));
12181                 alarm(0);
12182 #ifdef EAGAIN
12183                 if (errno == EAGAIN) {
12184                         printf("EAGAIN\n");
12185                         goto ok;
12186                 }
12187 #endif
12188 #ifdef EWOULDBLOCK
12189                 if (errno == EWOULDBLOCK)
12190                         printf("EWOULDBLOCK\n");
12191 #endif
12192         ok:
12193                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12194                 sleep(2);                               /* Give it time to close our pipe */
12195                 alarm(5);
12196                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12197                 alarm(0);
12198                 sprintf(string, "%d\n", ret);
12199                 write(4, string, strlen(string));
12200                 exit(0);
12201         }
12202
12203         close(pd[0]);                   /* We write to pd[1] */
12204         close(pu[1]);                   /* We read from pu[0] */
12205         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12206         close(pd[1]);                   /* Pipe pd is now fully closed! */
12207         exit(0);                                /* Bye bye, thank you for playing! */
12208 }
12209 EOCP
12210         set try
12211         if eval $compile_ok; then
12212                 echo "$startsh" >mtry
12213                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12214                 chmod +x mtry
12215                 ./mtry >/dev/null 2>&1
12216                 case $? in
12217                 0) eagain=`$cat try.out`;;
12218                 1) echo "Could not perform non-blocking setting!";;
12219                 2) echo "I did a successful read() for something that was not there!";;
12220                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12221                 4) echo "Could not find F_SETFL!";;
12222                 *) echo "Something terribly wrong happened during testing.";;
12223                 esac
12224                 rd_nodata=`$cat try.ret`
12225                 echo "A read() system call with no data present returns $rd_nodata."
12226                 case "$rd_nodata" in
12227                 0|-1) ;;
12228                 *)
12229                         echo "(That's peculiar, fixing that to be -1.)"
12230                         rd_nodata=-1
12231                         ;;
12232                 esac
12233                 case "$eagain" in
12234                 '')
12235                         echo "Forcing errno EAGAIN on read() with no data available."
12236                         eagain=EAGAIN
12237                         ;;
12238                 *)
12239                         echo "Your read() sets errno to $eagain when no data is available."
12240                         ;;
12241                 esac
12242                 status=`$cat try.err`
12243                 case "$status" in
12244                 0) echo "And it correctly returns 0 to signal EOF.";;
12245                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12246                 *) echo "However, your read() returns '$status' on EOF??";;
12247                 esac
12248                 val="$define"
12249                 if test "$status" = "$rd_nodata"; then
12250                         echo "WARNING: you can't distinguish between EOF and no data!"
12251                         val="$undef"
12252                 fi
12253         else
12254                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12255                 eagain=EAGAIN
12256         fi
12257         set d_eofnblk
12258         eval $setvar
12259         ;;
12260 *)
12261         echo "Using $hint value $eagain."
12262         echo "Your read() returns $rd_nodata when no data is present."
12263         case "$d_eofnblk" in
12264         "$define") echo "And you can see EOF because read() returns 0.";;
12265         "$undef") echo "But you can't see EOF status from read() returned value.";;
12266         *)
12267                 echo "(Assuming you can't see EOF status from read anyway.)"
12268                 d_eofnblk=$undef
12269                 ;;
12270         esac
12271         ;;
12272 esac
12273 $rm -f try try.* .out core head.c mtry
12274
12275 : see if _ptr and _cnt from stdio act std
12276 echo " "
12277
12278 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12279         echo "(Looks like you have stdio.h from BSD.)"
12280         case "$stdio_ptr" in
12281         '') stdio_ptr='((fp)->_p)'
12282                 ptr_lval=$define
12283                 ;;
12284         *)      ptr_lval=$d_stdio_ptr_lval;;
12285         esac
12286         case "$stdio_cnt" in
12287         '') stdio_cnt='((fp)->_r)'
12288                 cnt_lval=$define
12289                 ;;
12290         *)      cnt_lval=$d_stdio_cnt_lval;;
12291         esac
12292         case "$stdio_base" in
12293         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12294         esac
12295         case "$stdio_bufsiz" in
12296         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12297         esac
12298 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12299         echo "(Looks like you have stdio.h from Linux.)"
12300         case "$stdio_ptr" in
12301         '') stdio_ptr='((fp)->_IO_read_ptr)'
12302                 ptr_lval=$define
12303                 ;;
12304         *)      ptr_lval=$d_stdio_ptr_lval;;
12305         esac
12306         case "$stdio_cnt" in
12307         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12308                 cnt_lval=$undef
12309                 ;;
12310         *)      cnt_lval=$d_stdio_cnt_lval;;
12311         esac
12312         case "$stdio_base" in
12313         '') stdio_base='((fp)->_IO_read_base)';;
12314         esac
12315         case "$stdio_bufsiz" in
12316         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12317         esac
12318 else
12319         case "$stdio_ptr" in
12320         '') stdio_ptr='((fp)->_ptr)'
12321                 ptr_lval=$define
12322                 ;;
12323         *)      ptr_lval=$d_stdio_ptr_lval;;
12324         esac
12325         case "$stdio_cnt" in
12326         '') stdio_cnt='((fp)->_cnt)'
12327                 cnt_lval=$define
12328                 ;;
12329         *)      cnt_lval=$d_stdio_cnt_lval;;
12330         esac
12331         case "$stdio_base" in
12332         '') stdio_base='((fp)->_base)';;
12333         esac
12334         case "$stdio_bufsiz" in
12335         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12336         esac
12337 fi
12338
12339 : test whether _ptr and _cnt really work
12340 echo "Checking how std your stdio is..." >&4
12341 $cat >try.c <<EOP
12342 #include <stdio.h>
12343 #$i_stdlib I_STDLIB
12344 #ifdef I_STDLIB
12345 #include <stdlib.h>
12346 #endif
12347 #define FILE_ptr(fp)    $stdio_ptr
12348 #define FILE_cnt(fp)    $stdio_cnt
12349 int main() {
12350         FILE *fp = fopen("try.c", "r");
12351         char c = getc(fp);
12352         if (
12353                 18 <= FILE_cnt(fp) &&
12354                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12355         )
12356                 exit(0);
12357         exit(1);
12358 }
12359 EOP
12360 val="$undef"
12361 set try
12362 if eval $compile && $to try.c; then
12363         if $run ./try; then
12364                 echo "Your stdio acts pretty std."
12365                 val="$define"
12366         else
12367                 echo "Your stdio isn't very std."
12368         fi
12369 else
12370         echo "Your stdio doesn't appear very std."
12371 fi
12372 $rm -f try.c try
12373
12374 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12375 # direct buffer manipulation no longer works.  The Configure tests
12376 # should be changed to correctly detect this, but until then,
12377 # the following check should at least let perl compile and run.
12378 # (This quick fix should be updated before 5.8.1.)
12379 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12380 # A. Dougherty, June 3, 2002.
12381 case "$d_gnulibc" in
12382 $define)
12383         case "$gnulibc_version" in
12384         2.[01]*)  ;;
12385         2.2) ;;
12386         2.2.[0-9]) ;;
12387         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12388                 val="$undef"
12389                 ;;
12390         esac
12391         ;;
12392 esac
12393 set d_stdstdio
12394 eval $setvar
12395
12396 : Can _ptr be used as an lvalue?
12397 case "$d_stdstdio$ptr_lval" in
12398 $define$define) val=$define ;;
12399 *) val=$undef ;;
12400 esac
12401 set d_stdio_ptr_lval
12402 eval $setvar
12403
12404 : Can _cnt be used as an lvalue?
12405 case "$d_stdstdio$cnt_lval" in
12406 $define$define) val=$define ;;
12407 *) val=$undef ;;
12408 esac
12409 set d_stdio_cnt_lval
12410 eval $setvar
12411
12412
12413 : test whether setting _ptr sets _cnt as a side effect
12414 d_stdio_ptr_lval_sets_cnt="$undef"
12415 d_stdio_ptr_lval_nochange_cnt="$undef"
12416 case "$d_stdio_ptr_lval$d_stdstdio" in
12417 $define$define)
12418         echo "Checking to see what happens if we set the stdio ptr..." >&4
12419 $cat >try.c <<EOP
12420 #include <stdio.h>
12421 /* Can we scream? */
12422 /* Eat dust sed :-) */
12423 /* In the buffer space, no one can hear you scream. */
12424 #$i_stdlib I_STDLIB
12425 #ifdef I_STDLIB
12426 #include <stdlib.h>
12427 #endif
12428 #define FILE_ptr(fp)    $stdio_ptr
12429 #define FILE_cnt(fp)    $stdio_cnt
12430 #include <sys/types.h>
12431 int main() {
12432         FILE *fp = fopen("try.c", "r");
12433         int c;
12434         char *ptr;
12435         size_t cnt;
12436         if (!fp) {
12437             puts("Fail even to read");
12438             exit(1);
12439         }
12440         c = getc(fp); /* Read away the first # */
12441         if (c == EOF) {
12442             puts("Fail even to read");
12443             exit(1);
12444         }
12445         if (!(
12446                 18 <= FILE_cnt(fp) &&
12447                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12448         )) {
12449                 puts("Fail even to read");
12450                 exit (1);
12451         }
12452         ptr = (char*) FILE_ptr(fp);
12453         cnt = (size_t)FILE_cnt(fp);
12454
12455         FILE_ptr(fp) += 42;
12456
12457         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12458                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12459                 exit (1);
12460         }
12461         if (FILE_cnt(fp) <= 20) {
12462                 printf ("Fail (<20 chars to test)");
12463                 exit (1);
12464         }
12465         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12466                 puts("Fail compare");
12467                 exit (1);
12468         }
12469         if (cnt == FILE_cnt(fp)) {
12470                 puts("Pass_unchanged");
12471                 exit (0);
12472         }       
12473         if (FILE_cnt(fp) == (cnt - 42)) {
12474                 puts("Pass_changed");
12475                 exit (0);
12476         }
12477         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12478         return 1;
12479
12480 }
12481 EOP
12482         set try
12483         if eval $compile && $to try.c; then
12484                 case `$run ./try` in
12485                 Pass_changed)
12486                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12487                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12488                 Pass_unchanged)
12489                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12490                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12491                 Fail*)
12492                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12493                 *)
12494                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12495         esac
12496         else
12497                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12498         fi
12499         $rm -f try.c try
12500         ;;
12501 esac
12502
12503 : see if _base is also standard
12504 val="$undef"
12505 case "$d_stdstdio" in
12506 $define)
12507         $cat >try.c <<EOP
12508 #include <stdio.h>
12509 #$i_stdlib I_STDLIB
12510 #ifdef I_STDLIB
12511 #include <stdlib.h>
12512 #endif
12513 #define FILE_base(fp)   $stdio_base
12514 #define FILE_bufsiz(fp) $stdio_bufsiz
12515 int main() {
12516         FILE *fp = fopen("try.c", "r");
12517         char c = getc(fp);
12518         if (
12519                 19 <= FILE_bufsiz(fp) &&
12520                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12521         )
12522                 exit(0);
12523         exit(1);
12524 }
12525 EOP
12526         set try
12527         if eval $compile && $to try.c; then
12528                 if $run ./try; then
12529                         echo "And its _base field acts std."
12530                         val="$define"
12531                 else
12532                         echo "But its _base field isn't std."
12533                 fi
12534         else
12535                 echo "However, it seems to be lacking the _base field."
12536         fi
12537         $rm -f try.c try
12538         ;;
12539 esac
12540 set d_stdiobase
12541 eval $setvar
12542
12543 : see if fast_stdio exists
12544 val="$undef"
12545 case "$d_stdstdio:$d_stdio_ptr_lval" in
12546 "$define:$define")
12547         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12548         *$define*)
12549                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12550                 val="$define"
12551                 ;;
12552         esac
12553         ;;
12554 esac
12555 set d_faststdio
12556 eval $setvar
12557
12558
12559
12560 : see if fchdir exists
12561 set fchdir d_fchdir
12562 eval $inlibc
12563
12564 : see if fchmod exists
12565 set fchmod d_fchmod
12566 eval $inlibc
12567
12568 : see if fchown exists
12569 set fchown d_fchown
12570 eval $inlibc
12571
12572 : see if this is an fcntl system
12573 set fcntl d_fcntl
12574 eval $inlibc
12575
12576 echo " "
12577 : See if fcntl-based locking works.
12578 $cat >try.c <<EOCP
12579 #$i_stdlib I_STDLIB
12580 #ifdef I_STDLIB
12581 #include <stdlib.h>
12582 #endif
12583 #include <unistd.h>
12584 #include <fcntl.h>
12585 #include <signal.h>
12586 $signal_t blech(int x) { exit(3); }
12587 int main() {
12588 #if defined(F_SETLK) && defined(F_SETLKW)
12589      struct flock flock;
12590      int retval, fd;
12591      fd = open("try.c", O_RDONLY);
12592      flock.l_type = F_RDLCK;
12593      flock.l_whence = SEEK_SET;
12594      flock.l_start = flock.l_len = 0;
12595      signal(SIGALRM, blech);
12596      alarm(10);
12597      retval = fcntl(fd, F_SETLK, &flock);
12598      close(fd);
12599      (retval < 0 ? exit(2) : exit(0));
12600 #else
12601      exit(2);
12602 #endif
12603 }
12604 EOCP
12605 echo "Checking if fcntl-based file locking works... "
12606 case "$d_fcntl" in
12607 "$define")
12608         set try
12609         if eval $compile_ok; then
12610                 if $run ./try; then
12611                         echo "Yes, it seems to work."
12612                         val="$define"
12613                 else
12614                         echo "Nope, it didn't work."
12615                         val="$undef"
12616                         case "$?" in
12617                         3) $cat >&4 <<EOM
12618 ***
12619 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12620 *** This is (almost) impossible.
12621 *** If your NFS lock daemons are not feeling well, something like
12622 *** this may happen, please investigate.  Cannot continue, aborting.
12623 ***
12624 EOM
12625                                 exit 1
12626                                 ;;
12627                         esac
12628                 fi
12629         else
12630                 echo "I'm unable to compile the test program, so I'll assume not."
12631                 val="$undef"
12632         fi
12633         ;;
12634 *) val="$undef";
12635         echo "Nope, since you don't even have fcntl()."
12636         ;;
12637 esac
12638 set d_fcntl_can_lock
12639 eval $setvar
12640 $rm -f try*
12641
12642
12643 : check for fd_set items
12644 $cat <<EOM
12645
12646 Checking to see how well your C compiler handles fd_set and friends ...
12647 EOM
12648 $cat >try.c <<EOCP
12649 #$i_stdlib I_STDLIB
12650 #ifdef I_STDLIB
12651 #include <stdlib.h>
12652 #endif
12653 #$i_systime I_SYS_TIME
12654 #$i_sysselct I_SYS_SELECT
12655 #$d_socket HAS_SOCKET
12656 #include <sys/types.h>
12657 #ifdef HAS_SOCKET
12658 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12659 #endif
12660 #ifdef I_SYS_TIME
12661 #include <sys/time.h>
12662 #endif
12663 #ifdef I_SYS_SELECT
12664 #include <sys/select.h>
12665 #endif
12666 int main() {
12667         fd_set fds;
12668
12669 #ifdef TRYBITS
12670         if(fds.fds_bits);
12671 #endif
12672
12673 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12674         exit(0);
12675 #else
12676         exit(1);
12677 #endif
12678 }
12679 EOCP
12680 set try -DTRYBITS
12681 if eval $compile; then
12682         d_fds_bits="$define"
12683         d_fd_set="$define"
12684         echo "Well, your system knows about the normal fd_set typedef..." >&4
12685         if $run ./try; then
12686                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12687                 d_fd_macros="$define"
12688         else
12689                 $cat >&4 <<'EOM'
12690 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12691 EOM
12692                 d_fd_macros="$undef"
12693         fi
12694 else
12695         $cat <<'EOM'
12696 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12697 EOM
12698         set try
12699         if eval $compile; then
12700                 d_fds_bits="$undef"
12701                 d_fd_set="$define"
12702                 echo "Well, your system has some sort of fd_set available..." >&4
12703                 if $run ./try; then
12704                         echo "and you have the normal fd_set macros." >&4
12705                         d_fd_macros="$define"
12706                 else
12707                         $cat <<'EOM'
12708 but not the normal fd_set macros!  Gross!  More work for me...
12709 EOM
12710                         d_fd_macros="$undef"
12711                 fi
12712         else
12713         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12714                 d_fd_set="$undef"
12715                 d_fds_bits="$undef"
12716                 d_fd_macros="$undef"
12717         fi
12718 fi
12719 $rm -f try try.*
12720
12721 : see if fgetpos exists
12722 set fgetpos d_fgetpos
12723 eval $inlibc
12724
12725 : see if finite exists
12726 set finite d_finite
12727 eval $inlibc
12728
12729 : see if finitel exists
12730 set finitel d_finitel
12731 eval $inlibc
12732
12733 : see if flock exists
12734 set flock d_flock
12735 eval $inlibc
12736
12737 : see if prototype for flock is available
12738 echo " "
12739 set d_flockproto flock $i_sysfile sys/file.h
12740 eval $hasproto
12741
12742 : see if fork exists
12743 set fork d_fork
12744 eval $inlibc
12745
12746 : see if fp_class exists
12747 set fp_class d_fp_class
12748 eval $inlibc
12749
12750 : see if pathconf exists
12751 set pathconf d_pathconf
12752 eval $inlibc
12753
12754 : see if fpathconf exists
12755 set fpathconf d_fpathconf
12756 eval $inlibc
12757
12758 : see if fpclass exists
12759 set fpclass d_fpclass
12760 eval $inlibc
12761
12762 : see if fpclassify exists
12763 set fpclassify d_fpclassify
12764 eval $inlibc
12765
12766 : see if fpclassl exists
12767 set fpclassl d_fpclassl
12768 eval $inlibc
12769
12770
12771 : check for fpos64_t
12772 echo " "
12773 echo "Checking to see if you have fpos64_t..." >&4
12774 $cat >try.c <<EOCP
12775 #include <stdio.h>
12776 int main() { fpos64_t x = 7; }
12777 EOCP
12778 set try
12779 if eval $compile; then
12780         val="$define"
12781         echo "You have fpos64_t."
12782 else
12783         val="$undef"
12784         echo "You do not have fpos64_t."
12785         case "$fpossize" in
12786         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12787         esac
12788 fi
12789 $rm -f try.* try
12790 set d_fpos64_t
12791 eval $setvar
12792
12793 : see if frexpl exists
12794 set frexpl d_frexpl
12795 eval $inlibc
12796
12797 : see if this is a sys/param system
12798 set sys/param.h i_sysparam
12799 eval $inhdr
12800
12801 : see if this is a sys/mount.h system
12802 set sys/mount.h i_sysmount
12803 eval $inhdr
12804
12805
12806 echo " "
12807 echo "Checking to see if your system supports struct fs_data..." >&4
12808 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12809 eval $hasstruct
12810 case "$d_fs_data_s" in
12811 "$define")      echo "Yes, it does."   ;;
12812 *)              echo "No, it doesn't." ;;
12813 esac
12814
12815 : see if fseeko exists
12816 set fseeko d_fseeko
12817 eval $inlibc
12818 case "$longsize" in
12819 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12820 esac
12821
12822 : see if fsetpos exists
12823 set fsetpos d_fsetpos
12824 eval $inlibc
12825
12826
12827 : see if fstatfs exists
12828 set fstatfs d_fstatfs
12829 eval $inlibc
12830
12831
12832 : see if statvfs exists
12833 set statvfs d_statvfs
12834 eval $inlibc
12835
12836 : see if fstatvfs exists
12837 set fstatvfs d_fstatvfs
12838 eval $inlibc
12839
12840
12841 : see if fsync exists
12842 set fsync d_fsync
12843 eval $inlibc
12844
12845 : see if ftello exists
12846 set ftello d_ftello
12847 eval $inlibc
12848 case "$longsize" in
12849 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12850 esac
12851
12852 d_futimes="$undef"
12853 : check for a working futimes
12854 echo " "
12855 echo "Checking for a working futimes()" >&4
12856 $cat >try.c <<EOCP
12857 #include <stdio.h>
12858 #include <sys/time.h>
12859 #include <errno.h>
12860 #include <fcntl.h>
12861
12862 int main ()
12863 {
12864     int fd, rv;
12865     fd = open ("try.c", O_RDWR);
12866     if (-1 == fd) exit (1);
12867     rv = futimes (fd, NULL);
12868     exit (rv == -1 ? errno : 0);
12869 }
12870 EOCP
12871 set try
12872 if eval $compile; then
12873     `$run ./try`
12874     rc=$?
12875     case "$rc" in
12876         0)  echo "Yes, it does" >&4
12877             d_futimes="$define"
12878             ;;
12879         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12880             ;;
12881     esac
12882 else
12883     echo "No, it does not (probably harmless)\n" >&4
12884 fi
12885 $rm -f try.* try core core.try.*
12886
12887 : see if getcwd exists
12888 set getcwd d_getcwd
12889 eval $inlibc
12890
12891 : see if getespwnam exists
12892 set getespwnam d_getespwnam
12893 eval $inlibc
12894
12895
12896 : see if getfsstat exists
12897 set getfsstat d_getfsstat
12898 eval $inlibc
12899
12900 : see if getgrent exists
12901 set getgrent d_getgrent
12902 eval $inlibc
12903
12904 : see if getgrent_r exists
12905 set getgrent_r d_getgrent_r
12906 eval $inlibc
12907 case "$d_getgrent_r" in
12908 "$define")
12909         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12910         case "$d_getgrent_r_proto:$usethreads" in
12911         ":define")      d_getgrent_r_proto=define
12912                 set d_getgrent_r_proto getgrent_r $hdrs
12913                 eval $hasproto ;;
12914         *)      ;;
12915         esac
12916         case "$d_getgrent_r_proto" in
12917         define)
12918         case "$getgrent_r_proto" in
12919         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12920         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12921         esac
12922         case "$getgrent_r_proto" in
12923         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12924         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12925         esac
12926         case "$getgrent_r_proto" in
12927         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12928         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12929         esac
12930         case "$getgrent_r_proto" in
12931         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12932         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12933         esac
12934         case "$getgrent_r_proto" in
12935         ''|0) try='int getgrent_r(struct group*, char*, int);'
12936         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12937         esac
12938         case "$getgrent_r_proto" in
12939         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12940         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12941         esac
12942         case "$getgrent_r_proto" in
12943         ''|0)   d_getgrent_r=undef
12944                 getgrent_r_proto=0
12945                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12946         * )     case "$getgrent_r_proto" in
12947                 REENTRANT_PROTO*) ;;
12948                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12949                 esac
12950                 echo "Prototype: $try" ;;
12951         esac
12952         ;;
12953         *)      case "$usethreads" in
12954                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12955                 esac
12956                 d_getgrent_r=undef
12957                 getgrent_r_proto=0
12958                 ;;
12959         esac
12960         ;;
12961 *)      getgrent_r_proto=0
12962         ;;
12963 esac
12964
12965 : see if getgrgid_r exists
12966 set getgrgid_r d_getgrgid_r
12967 eval $inlibc
12968 case "$d_getgrgid_r" in
12969 "$define")
12970         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12971         case "$d_getgrgid_r_proto:$usethreads" in
12972         ":define")      d_getgrgid_r_proto=define
12973                 set d_getgrgid_r_proto getgrgid_r $hdrs
12974                 eval $hasproto ;;
12975         *)      ;;
12976         esac
12977         case "$d_getgrgid_r_proto" in
12978         define)
12979         case "$getgrgid_r_proto" in
12980         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12981         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12982         esac
12983         case "$getgrgid_r_proto" in
12984         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12985         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12986         esac
12987         case "$getgrgid_r_proto" in
12988         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12989         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12990         esac
12991         case "$getgrgid_r_proto" in
12992         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12993         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12994         esac
12995         case "$getgrgid_r_proto" in
12996         ''|0)   d_getgrgid_r=undef
12997                 getgrgid_r_proto=0
12998                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12999         * )     case "$getgrgid_r_proto" in
13000                 REENTRANT_PROTO*) ;;
13001                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13002                 esac
13003                 echo "Prototype: $try" ;;
13004         esac
13005         ;;
13006         *)      case "$usethreads" in
13007                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13008                 esac
13009                 d_getgrgid_r=undef
13010                 getgrgid_r_proto=0
13011                 ;;
13012         esac
13013         ;;
13014 *)      getgrgid_r_proto=0
13015         ;;
13016 esac
13017
13018 : see if getgrnam_r exists
13019 set getgrnam_r d_getgrnam_r
13020 eval $inlibc
13021 case "$d_getgrnam_r" in
13022 "$define")
13023         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13024         case "$d_getgrnam_r_proto:$usethreads" in
13025         ":define")      d_getgrnam_r_proto=define
13026                 set d_getgrnam_r_proto getgrnam_r $hdrs
13027                 eval $hasproto ;;
13028         *)      ;;
13029         esac
13030         case "$d_getgrnam_r_proto" in
13031         define)
13032         case "$getgrnam_r_proto" in
13033         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13034         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13035         esac
13036         case "$getgrnam_r_proto" in
13037         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13038         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13039         esac
13040         case "$getgrnam_r_proto" in
13041         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13042         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13043         esac
13044         case "$getgrnam_r_proto" in
13045         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13046         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13047         esac
13048         case "$getgrnam_r_proto" in
13049         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13050         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13051         esac
13052         case "$getgrnam_r_proto" in
13053         ''|0)   d_getgrnam_r=undef
13054                 getgrnam_r_proto=0
13055                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13056         * )     case "$getgrnam_r_proto" in
13057                 REENTRANT_PROTO*) ;;
13058                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13059                 esac
13060                 echo "Prototype: $try" ;;
13061         esac
13062         ;;
13063         *)      case "$usethreads" in
13064                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13065                 esac
13066                 d_getgrnam_r=undef
13067                 getgrnam_r_proto=0
13068                 ;;
13069         esac
13070         ;;
13071 *)      getgrnam_r_proto=0
13072         ;;
13073 esac
13074
13075 : see if gethostbyaddr exists
13076 set gethostbyaddr d_gethbyaddr
13077 eval $inlibc
13078
13079 : see if gethostbyname exists
13080 set gethostbyname d_gethbyname
13081 eval $inlibc
13082
13083 : see if gethostent exists
13084 set gethostent d_gethent
13085 eval $inlibc
13086
13087 : see how we will look up host name
13088 echo " "
13089 call=''
13090 if set gethostname val -f d_gethname; eval $csym; $val; then
13091         echo 'gethostname() found.' >&4
13092         d_gethname="$define"
13093         call=gethostname
13094 fi
13095 if set uname val -f d_uname; eval $csym; $val; then
13096         if ./xenix; then
13097                 $cat <<'EOM'
13098 uname() was found, but you're running xenix, and older versions of xenix
13099 have a broken uname(). If you don't really know whether your xenix is old
13100 enough to have a broken system call, use the default answer.
13101
13102 EOM
13103                 dflt=y
13104                 case "$d_uname" in
13105                 "$define") dflt=n;;
13106                 esac
13107                 rp='Is your uname() broken?'
13108                 . ./myread
13109                 case "$ans" in
13110                 n*) d_uname="$define"; call=uname;;
13111                 esac
13112         else
13113                 echo 'uname() found.' >&4
13114                 d_uname="$define"
13115                 case "$call" in
13116                 '') call=uname ;;
13117                 esac
13118         fi
13119 fi
13120 case "$d_gethname" in
13121 '') d_gethname="$undef";;
13122 esac
13123 case "$d_uname" in
13124 '') d_uname="$undef";;
13125 esac
13126 case "$d_uname$d_gethname" in
13127 *define*)
13128         dflt=n
13129         cat <<EOM
13130  
13131 Every now and then someone has a $call() that lies about the hostname
13132 but can't be fixed for political or economic reasons.  If you wish, I can
13133 pretend $call() isn't there and maybe compute hostname at run-time
13134 thanks to the '$phostname' command.
13135
13136 EOM
13137         rp="Shall I ignore $call() from now on?"
13138         . ./myread
13139         case "$ans" in
13140         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13141         esac;;
13142 esac
13143 case "$phostname" in
13144 '') aphostname='';;
13145 *) case "$aphostname" in
13146         /*) ;;
13147         *) set X $phostname
13148                 shift
13149                 file=$1
13150                 shift
13151                 file=`./loc $file $file $pth`
13152                 aphostname=`echo $file $*`
13153                 ;;
13154         esac
13155         ;;
13156 esac
13157 case "$d_uname$d_gethname" in
13158 *define*) ;;
13159 *)
13160         case "$phostname" in
13161         '')
13162                 echo "There will be no way for $package to get your hostname." >&4;;
13163         *)
13164         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13165                 ;;
13166         esac;;
13167 esac
13168 case "$d_phostname" in
13169 '') d_phostname="$undef";;
13170 esac
13171
13172 : see if gethostbyaddr_r exists
13173 set gethostbyaddr_r d_gethostbyaddr_r
13174 eval $inlibc
13175 case "$d_gethostbyaddr_r" in
13176 "$define")
13177         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13178         case "$d_gethostbyaddr_r_proto:$usethreads" in
13179         ":define")      d_gethostbyaddr_r_proto=define
13180                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13181                 eval $hasproto ;;
13182         *)      ;;
13183         esac
13184         case "$d_gethostbyaddr_r_proto" in
13185         define)
13186         case "$gethostbyaddr_r_proto" in
13187         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13188         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13189         esac
13190         case "$gethostbyaddr_r_proto" in
13191         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13192         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13193         esac
13194         case "$gethostbyaddr_r_proto" in
13195         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13196         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13197         esac
13198         case "$gethostbyaddr_r_proto" in
13199         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13200         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13201         esac
13202         case "$gethostbyaddr_r_proto" in
13203         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13204         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13205         esac
13206         case "$gethostbyaddr_r_proto" in
13207         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13208         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13209         esac
13210         case "$gethostbyaddr_r_proto" in
13211         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13212         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13213         esac
13214         case "$gethostbyaddr_r_proto" in
13215         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13216         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13217         esac
13218         case "$gethostbyaddr_r_proto" in
13219         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13220         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13221         esac
13222         case "$gethostbyaddr_r_proto" in
13223         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13224         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13225         esac
13226         case "$gethostbyaddr_r_proto" in
13227         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13228         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13229         esac
13230         case "$gethostbyaddr_r_proto" in
13231         ''|0)   d_gethostbyaddr_r=undef
13232                 gethostbyaddr_r_proto=0
13233                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13234         * )     case "$gethostbyaddr_r_proto" in
13235                 REENTRANT_PROTO*) ;;
13236                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13237                 esac
13238                 echo "Prototype: $try" ;;
13239         esac
13240         ;;
13241         *)      case "$usethreads" in
13242                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13243                 esac
13244                 d_gethostbyaddr_r=undef
13245                 gethostbyaddr_r_proto=0
13246                 ;;
13247         esac
13248         ;;
13249 *)      gethostbyaddr_r_proto=0
13250         ;;
13251 esac
13252
13253 : see if gethostbyname_r exists
13254 set gethostbyname_r d_gethostbyname_r
13255 eval $inlibc
13256 case "$d_gethostbyname_r" in
13257 "$define")
13258         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13259         case "$d_gethostbyname_r_proto:$usethreads" in
13260         ":define")      d_gethostbyname_r_proto=define
13261                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13262                 eval $hasproto ;;
13263         *)      ;;
13264         esac
13265         case "$d_gethostbyname_r_proto" in
13266         define)
13267         case "$gethostbyname_r_proto" in
13268         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13269         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13270         esac
13271         case "$gethostbyname_r_proto" in
13272         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13273         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13274         esac
13275         case "$gethostbyname_r_proto" in
13276         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13277         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13278         esac
13279         case "$gethostbyname_r_proto" in
13280         ''|0)   d_gethostbyname_r=undef
13281                 gethostbyname_r_proto=0
13282                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13283         * )     case "$gethostbyname_r_proto" in
13284                 REENTRANT_PROTO*) ;;
13285                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13286                 esac
13287                 echo "Prototype: $try" ;;
13288         esac
13289         ;;
13290         *)      case "$usethreads" in
13291                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13292                 esac
13293                 d_gethostbyname_r=undef
13294                 gethostbyname_r_proto=0
13295                 ;;
13296         esac
13297         ;;
13298 *)      gethostbyname_r_proto=0
13299         ;;
13300 esac
13301
13302 : see if gethostent_r exists
13303 set gethostent_r d_gethostent_r
13304 eval $inlibc
13305 case "$d_gethostent_r" in
13306 "$define")
13307         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13308         case "$d_gethostent_r_proto:$usethreads" in
13309         ":define")      d_gethostent_r_proto=define
13310                 set d_gethostent_r_proto gethostent_r $hdrs
13311                 eval $hasproto ;;
13312         *)      ;;
13313         esac
13314         case "$d_gethostent_r_proto" in
13315         define)
13316         case "$gethostent_r_proto" in
13317         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13318         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13319         esac
13320         case "$gethostent_r_proto" in
13321         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13322         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13323         esac
13324         case "$gethostent_r_proto" in
13325         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13326         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13327         esac
13328         case "$gethostent_r_proto" in
13329         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13330         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13331         esac
13332         case "$gethostent_r_proto" in
13333         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13334         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13335         esac
13336         case "$gethostent_r_proto" in
13337         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13338         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13339         esac
13340         case "$gethostent_r_proto" in
13341         ''|0)   d_gethostent_r=undef
13342                 gethostent_r_proto=0
13343                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13344         * )     case "$gethostent_r_proto" in
13345                 REENTRANT_PROTO*) ;;
13346                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13347                 esac
13348                 echo "Prototype: $try" ;;
13349         esac
13350         ;;
13351         *)      case "$usethreads" in
13352                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13353                 esac
13354                 d_gethostent_r=undef
13355                 gethostent_r_proto=0
13356                 ;;
13357         esac
13358         ;;
13359 *)      gethostent_r_proto=0
13360         ;;
13361 esac
13362
13363 : see if prototypes for various gethostxxx netdb.h functions are available
13364 echo " "
13365 set d_gethostprotos gethostent $i_netdb netdb.h
13366 eval $hasproto
13367
13368 : see if getitimer exists
13369 set getitimer d_getitimer
13370 eval $inlibc
13371
13372 : see if getlogin exists
13373 set getlogin d_getlogin
13374 eval $inlibc
13375
13376 : see if getlogin_r exists
13377 set getlogin_r d_getlogin_r
13378 eval $inlibc
13379 case "$d_getlogin_r" in
13380 "$define")
13381         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13382         case "$d_getlogin_r_proto:$usethreads" in
13383         ":define")      d_getlogin_r_proto=define
13384                 set d_getlogin_r_proto getlogin_r $hdrs
13385                 eval $hasproto ;;
13386         *)      ;;
13387         esac
13388         case "$d_getlogin_r_proto" in
13389         define)
13390         case "$getlogin_r_proto" in
13391         ''|0) try='int getlogin_r(char*, size_t);'
13392         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13393         esac
13394         case "$getlogin_r_proto" in
13395         ''|0) try='int getlogin_r(char*, int);'
13396         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13397         esac
13398         case "$getlogin_r_proto" in
13399         ''|0) try='char* getlogin_r(char*, size_t);'
13400         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13401         esac
13402         case "$getlogin_r_proto" in
13403         ''|0) try='char* getlogin_r(char*, int);'
13404         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13405         esac
13406         case "$getlogin_r_proto" in
13407         ''|0)   d_getlogin_r=undef
13408                 getlogin_r_proto=0
13409                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13410         * )     case "$getlogin_r_proto" in
13411                 REENTRANT_PROTO*) ;;
13412                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13413                 esac
13414                 echo "Prototype: $try" ;;
13415         esac
13416         ;;
13417         *)      case "$usethreads" in
13418                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13419                 esac
13420                 d_getlogin_r=undef
13421                 getlogin_r_proto=0
13422                 ;;
13423         esac
13424         ;;
13425 *)      getlogin_r_proto=0
13426         ;;
13427 esac
13428
13429 : see if getmnt exists
13430 set getmnt d_getmnt
13431 eval $inlibc
13432
13433 : see if getmntent exists
13434 set getmntent d_getmntent
13435 eval $inlibc
13436
13437 : see if getnetbyaddr exists
13438 set getnetbyaddr d_getnbyaddr
13439 eval $inlibc
13440
13441 : see if getnetbyname exists
13442 set getnetbyname d_getnbyname
13443 eval $inlibc
13444
13445 : see if getnetent exists
13446 set getnetent d_getnent
13447 eval $inlibc
13448
13449 : see if getnetbyaddr_r exists
13450 set getnetbyaddr_r d_getnetbyaddr_r
13451 eval $inlibc
13452 case "$d_getnetbyaddr_r" in
13453 "$define")
13454         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13455         case "$d_getnetbyaddr_r_proto:$usethreads" in
13456         ":define")      d_getnetbyaddr_r_proto=define
13457                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13458                 eval $hasproto ;;
13459         *)      ;;
13460         esac
13461         case "$d_getnetbyaddr_r_proto" in
13462         define)
13463         case "$getnetbyaddr_r_proto" in
13464         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13465         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13466         esac
13467         case "$getnetbyaddr_r_proto" in
13468         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13469         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13470         esac
13471         case "$getnetbyaddr_r_proto" in
13472         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13473         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13474         esac
13475         case "$getnetbyaddr_r_proto" in
13476         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13477         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13478         esac
13479         case "$getnetbyaddr_r_proto" in
13480         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13481         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13482         esac
13483         case "$getnetbyaddr_r_proto" in
13484         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13485         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13486         esac
13487         case "$getnetbyaddr_r_proto" in
13488         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13489         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13490         esac
13491         case "$getnetbyaddr_r_proto" in
13492         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13493         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13494         esac
13495         case "$getnetbyaddr_r_proto" in
13496         ''|0)   d_getnetbyaddr_r=undef
13497                 getnetbyaddr_r_proto=0
13498                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13499         * )     case "$getnetbyaddr_r_proto" in
13500                 REENTRANT_PROTO*) ;;
13501                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13502                 esac
13503                 echo "Prototype: $try" ;;
13504         esac
13505         ;;
13506         *)      case "$usethreads" in
13507                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13508                 esac
13509                 d_getnetbyaddr_r=undef
13510                 getnetbyaddr_r_proto=0
13511                 ;;
13512         esac
13513         ;;
13514 *)      getnetbyaddr_r_proto=0
13515         ;;
13516 esac
13517
13518 : see if getnetbyname_r exists
13519 set getnetbyname_r d_getnetbyname_r
13520 eval $inlibc
13521 case "$d_getnetbyname_r" in
13522 "$define")
13523         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13524         case "$d_getnetbyname_r_proto:$usethreads" in
13525         ":define")      d_getnetbyname_r_proto=define
13526                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13527                 eval $hasproto ;;
13528         *)      ;;
13529         esac
13530         case "$d_getnetbyname_r_proto" in
13531         define)
13532         case "$getnetbyname_r_proto" in
13533         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13534         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13535         esac
13536         case "$getnetbyname_r_proto" in
13537         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13538         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13539         esac
13540         case "$getnetbyname_r_proto" in
13541         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13542         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13543         esac
13544         case "$getnetbyname_r_proto" in
13545         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13546         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13547         esac
13548         case "$getnetbyname_r_proto" in
13549         ''|0)   d_getnetbyname_r=undef
13550                 getnetbyname_r_proto=0
13551                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13552         * )     case "$getnetbyname_r_proto" in
13553                 REENTRANT_PROTO*) ;;
13554                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13555                 esac
13556                 echo "Prototype: $try" ;;
13557         esac
13558         ;;
13559         *)      case "$usethreads" in
13560                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13561                 esac
13562                 d_getnetbyname_r=undef
13563                 getnetbyname_r_proto=0
13564                 ;;
13565         esac
13566         ;;
13567 *)      getnetbyname_r_proto=0
13568         ;;
13569 esac
13570
13571 : see if getnetent_r exists
13572 set getnetent_r d_getnetent_r
13573 eval $inlibc
13574 case "$d_getnetent_r" in
13575 "$define")
13576         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13577         case "$d_getnetent_r_proto:$usethreads" in
13578         ":define")      d_getnetent_r_proto=define
13579                 set d_getnetent_r_proto getnetent_r $hdrs
13580                 eval $hasproto ;;
13581         *)      ;;
13582         esac
13583         case "$d_getnetent_r_proto" in
13584         define)
13585         case "$getnetent_r_proto" in
13586         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13587         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13588         esac
13589         case "$getnetent_r_proto" in
13590         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13591         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13592         esac
13593         case "$getnetent_r_proto" in
13594         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13595         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13596         esac
13597         case "$getnetent_r_proto" in
13598         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13599         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13600         esac
13601         case "$getnetent_r_proto" in
13602         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13603         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13604         esac
13605         case "$getnetent_r_proto" in
13606         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13607         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13608         esac
13609         case "$getnetent_r_proto" in
13610         ''|0)   d_getnetent_r=undef
13611                 getnetent_r_proto=0
13612                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13613         * )     case "$getnetent_r_proto" in
13614                 REENTRANT_PROTO*) ;;
13615                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13616                 esac
13617                 echo "Prototype: $try" ;;
13618         esac
13619         ;;
13620         *)      case "$usethreads" in
13621                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13622                 esac
13623                 d_getnetent_r=undef
13624                 getnetent_r_proto=0
13625                 ;;
13626         esac
13627         ;;
13628 *)      getnetent_r_proto=0
13629         ;;
13630 esac
13631
13632 : see if prototypes for various getnetxxx netdb.h functions are available
13633 echo " "
13634 set d_getnetprotos getnetent $i_netdb netdb.h
13635 eval $hasproto
13636
13637 : see if getpagesize exists
13638 set getpagesize d_getpagsz
13639 eval $inlibc
13640
13641
13642 : see if getprotobyname exists
13643 set getprotobyname d_getpbyname
13644 eval $inlibc
13645
13646 : see if getprotobynumber exists
13647 set getprotobynumber d_getpbynumber
13648 eval $inlibc
13649
13650 : see if getprotoent exists
13651 set getprotoent d_getpent
13652 eval $inlibc
13653
13654 : see if getpgid exists
13655 set getpgid d_getpgid
13656 eval $inlibc
13657
13658 : see if getpgrp2 exists
13659 set getpgrp2 d_getpgrp2
13660 eval $inlibc
13661
13662 : see if getppid exists
13663 set getppid d_getppid
13664 eval $inlibc
13665
13666 : see if getpriority exists
13667 set getpriority d_getprior
13668 eval $inlibc
13669
13670 : see if getprotobyname_r exists
13671 set getprotobyname_r d_getprotobyname_r
13672 eval $inlibc
13673 case "$d_getprotobyname_r" in
13674 "$define")
13675         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13676         case "$d_getprotobyname_r_proto:$usethreads" in
13677         ":define")      d_getprotobyname_r_proto=define
13678                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13679                 eval $hasproto ;;
13680         *)      ;;
13681         esac
13682         case "$d_getprotobyname_r_proto" in
13683         define)
13684         case "$getprotobyname_r_proto" in
13685         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13686         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13687         esac
13688         case "$getprotobyname_r_proto" in
13689         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13690         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13691         esac
13692         case "$getprotobyname_r_proto" in
13693         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13694         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13695         esac
13696         case "$getprotobyname_r_proto" in
13697         ''|0)   d_getprotobyname_r=undef
13698                 getprotobyname_r_proto=0
13699                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13700         * )     case "$getprotobyname_r_proto" in
13701                 REENTRANT_PROTO*) ;;
13702                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13703                 esac
13704                 echo "Prototype: $try" ;;
13705         esac
13706         ;;
13707         *)      case "$usethreads" in
13708                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13709                 esac
13710                 d_getprotobyname_r=undef
13711                 getprotobyname_r_proto=0
13712                 ;;
13713         esac
13714         ;;
13715 *)      getprotobyname_r_proto=0
13716         ;;
13717 esac
13718
13719 : see if getprotobynumber_r exists
13720 set getprotobynumber_r d_getprotobynumber_r
13721 eval $inlibc
13722 case "$d_getprotobynumber_r" in
13723 "$define")
13724         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13725         case "$d_getprotobynumber_r_proto:$usethreads" in
13726         ":define")      d_getprotobynumber_r_proto=define
13727                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13728                 eval $hasproto ;;
13729         *)      ;;
13730         esac
13731         case "$d_getprotobynumber_r_proto" in
13732         define)
13733         case "$getprotobynumber_r_proto" in
13734         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13735         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13736         esac
13737         case "$getprotobynumber_r_proto" in
13738         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13739         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13740         esac
13741         case "$getprotobynumber_r_proto" in
13742         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13743         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13744         esac
13745         case "$getprotobynumber_r_proto" in
13746         ''|0)   d_getprotobynumber_r=undef
13747                 getprotobynumber_r_proto=0
13748                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13749         * )     case "$getprotobynumber_r_proto" in
13750                 REENTRANT_PROTO*) ;;
13751                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13752                 esac
13753                 echo "Prototype: $try" ;;
13754         esac
13755         ;;
13756         *)      case "$usethreads" in
13757                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13758                 esac
13759                 d_getprotobynumber_r=undef
13760                 getprotobynumber_r_proto=0
13761                 ;;
13762         esac
13763         ;;
13764 *)      getprotobynumber_r_proto=0
13765         ;;
13766 esac
13767
13768 : see if getprotoent_r exists
13769 set getprotoent_r d_getprotoent_r
13770 eval $inlibc
13771 case "$d_getprotoent_r" in
13772 "$define")
13773         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13774         case "$d_getprotoent_r_proto:$usethreads" in
13775         ":define")      d_getprotoent_r_proto=define
13776                 set d_getprotoent_r_proto getprotoent_r $hdrs
13777                 eval $hasproto ;;
13778         *)      ;;
13779         esac
13780         case "$d_getprotoent_r_proto" in
13781         define)
13782         case "$getprotoent_r_proto" in
13783         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13784         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13785         esac
13786         case "$getprotoent_r_proto" in
13787         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13788         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13789         esac
13790         case "$getprotoent_r_proto" in
13791         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13792         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13793         esac
13794         case "$getprotoent_r_proto" in
13795         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13796         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13797         esac
13798         case "$getprotoent_r_proto" in
13799         ''|0)   d_getprotoent_r=undef
13800                 getprotoent_r_proto=0
13801                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13802         * )     case "$getprotoent_r_proto" in
13803                 REENTRANT_PROTO*) ;;
13804                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13805                 esac
13806                 echo "Prototype: $try" ;;
13807         esac
13808         ;;
13809         *)      case "$usethreads" in
13810                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13811                 esac
13812                 d_getprotoent_r=undef
13813                 getprotoent_r_proto=0
13814                 ;;
13815         esac
13816         ;;
13817 *)      getprotoent_r_proto=0
13818         ;;
13819 esac
13820
13821 : see if prototypes for various getprotoxxx netdb.h functions are available
13822 echo " "
13823 set d_getprotoprotos getprotoent $i_netdb netdb.h
13824 eval $hasproto
13825
13826 : see if getprpwnam exists
13827 set getprpwnam d_getprpwnam
13828 eval $inlibc
13829
13830 : see if getpwent exists
13831 set getpwent d_getpwent
13832 eval $inlibc
13833
13834 : see if getpwent_r exists
13835 set getpwent_r d_getpwent_r
13836 eval $inlibc
13837 case "$d_getpwent_r" in
13838 "$define")
13839         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13840         case "$d_getpwent_r_proto:$usethreads" in
13841         ":define")      d_getpwent_r_proto=define
13842                 set d_getpwent_r_proto getpwent_r $hdrs
13843                 eval $hasproto ;;
13844         *)      ;;
13845         esac
13846         case "$d_getpwent_r_proto" in
13847         define)
13848         case "$getpwent_r_proto" in
13849         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13850         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13851         esac
13852         case "$getpwent_r_proto" in
13853         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13854         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13855         esac
13856         case "$getpwent_r_proto" in
13857         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13858         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13859         esac
13860         case "$getpwent_r_proto" in
13861         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13862         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13863         esac
13864         case "$getpwent_r_proto" in
13865         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13866         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13867         esac
13868         case "$getpwent_r_proto" in
13869         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13870         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13871         esac
13872         case "$getpwent_r_proto" in
13873         ''|0)   d_getpwent_r=undef
13874                 getpwent_r_proto=0
13875                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13876         * )     case "$getpwent_r_proto" in
13877                 REENTRANT_PROTO*) ;;
13878                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13879                 esac
13880                 echo "Prototype: $try" ;;
13881         esac
13882         ;;
13883         *)      case "$usethreads" in
13884                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13885                 esac
13886                 d_getpwent_r=undef
13887                 getpwent_r_proto=0
13888                 ;;
13889         esac
13890         ;;
13891 *)      getpwent_r_proto=0
13892         ;;
13893 esac
13894
13895 : see if getpwnam_r exists
13896 set getpwnam_r d_getpwnam_r
13897 eval $inlibc
13898 case "$d_getpwnam_r" in
13899 "$define")
13900         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13901         case "$d_getpwnam_r_proto:$usethreads" in
13902         ":define")      d_getpwnam_r_proto=define
13903                 set d_getpwnam_r_proto getpwnam_r $hdrs
13904                 eval $hasproto ;;
13905         *)      ;;
13906         esac
13907         case "$d_getpwnam_r_proto" in
13908         define)
13909         case "$getpwnam_r_proto" in
13910         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13911         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13912         esac
13913         case "$getpwnam_r_proto" in
13914         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13915         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13916         esac
13917         case "$getpwnam_r_proto" in
13918         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13919         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13920         esac
13921         case "$getpwnam_r_proto" in
13922         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13923         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13924         esac
13925         case "$getpwnam_r_proto" in
13926         ''|0)   d_getpwnam_r=undef
13927                 getpwnam_r_proto=0
13928                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13929         * )     case "$getpwnam_r_proto" in
13930                 REENTRANT_PROTO*) ;;
13931                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13932                 esac
13933                 echo "Prototype: $try" ;;
13934         esac
13935         ;;
13936         *)      case "$usethreads" in
13937                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13938                 esac
13939                 d_getpwnam_r=undef
13940                 getpwnam_r_proto=0
13941                 ;;
13942         esac
13943         ;;
13944 *)      getpwnam_r_proto=0
13945         ;;
13946 esac
13947
13948 : see if getpwuid_r exists
13949 set getpwuid_r d_getpwuid_r
13950 eval $inlibc
13951 case "$d_getpwuid_r" in
13952 "$define")
13953         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13954         case "$d_getpwuid_r_proto:$usethreads" in
13955         ":define")      d_getpwuid_r_proto=define
13956                 set d_getpwuid_r_proto getpwuid_r $hdrs
13957                 eval $hasproto ;;
13958         *)      ;;
13959         esac
13960         case "$d_getpwuid_r_proto" in
13961         define)
13962         case "$getpwuid_r_proto" in
13963         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13964         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13965         esac
13966         case "$getpwuid_r_proto" in
13967         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13968         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13969         esac
13970         case "$getpwuid_r_proto" in
13971         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13972         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13973         esac
13974         case "$getpwuid_r_proto" in
13975         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13976         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13977         esac
13978         case "$getpwuid_r_proto" in
13979         ''|0)   d_getpwuid_r=undef
13980                 getpwuid_r_proto=0
13981                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13982         * )     case "$getpwuid_r_proto" in
13983                 REENTRANT_PROTO*) ;;
13984                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13985                 esac
13986                 echo "Prototype: $try" ;;
13987         esac
13988         ;;
13989         *)      case "$usethreads" in
13990                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13991                 esac
13992                 d_getpwuid_r=undef
13993                 getpwuid_r_proto=0
13994                 ;;
13995         esac
13996         ;;
13997 *)      getpwuid_r_proto=0
13998         ;;
13999 esac
14000
14001
14002 : see if getservbyname exists
14003 set getservbyname d_getsbyname
14004 eval $inlibc
14005
14006 : see if getservbyport exists
14007 set getservbyport d_getsbyport
14008 eval $inlibc
14009
14010 : see if getservent exists
14011 set getservent d_getsent
14012 eval $inlibc
14013
14014 : see if getservbyname_r exists
14015 set getservbyname_r d_getservbyname_r
14016 eval $inlibc
14017 case "$d_getservbyname_r" in
14018 "$define")
14019         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14020         case "$d_getservbyname_r_proto:$usethreads" in
14021         ":define")      d_getservbyname_r_proto=define
14022                 set d_getservbyname_r_proto getservbyname_r $hdrs
14023                 eval $hasproto ;;
14024         *)      ;;
14025         esac
14026         case "$d_getservbyname_r_proto" in
14027         define)
14028         case "$getservbyname_r_proto" in
14029         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14030         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14031         esac
14032         case "$getservbyname_r_proto" in
14033         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14034         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14035         esac
14036         case "$getservbyname_r_proto" in
14037         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14038         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14039         esac
14040         case "$getservbyname_r_proto" in
14041         ''|0)   d_getservbyname_r=undef
14042                 getservbyname_r_proto=0
14043                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14044         * )     case "$getservbyname_r_proto" in
14045                 REENTRANT_PROTO*) ;;
14046                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14047                 esac
14048                 echo "Prototype: $try" ;;
14049         esac
14050         ;;
14051         *)      case "$usethreads" in
14052                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14053                 esac
14054                 d_getservbyname_r=undef
14055                 getservbyname_r_proto=0
14056                 ;;
14057         esac
14058         ;;
14059 *)      getservbyname_r_proto=0
14060         ;;
14061 esac
14062
14063 : see if getservbyport_r exists
14064 set getservbyport_r d_getservbyport_r
14065 eval $inlibc
14066 case "$d_getservbyport_r" in
14067 "$define")
14068         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14069         case "$d_getservbyport_r_proto:$usethreads" in
14070         ":define")      d_getservbyport_r_proto=define
14071                 set d_getservbyport_r_proto getservbyport_r $hdrs
14072                 eval $hasproto ;;
14073         *)      ;;
14074         esac
14075         case "$d_getservbyport_r_proto" in
14076         define)
14077         case "$getservbyport_r_proto" in
14078         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14079         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14080         esac
14081         case "$getservbyport_r_proto" in
14082         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14083         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14084         esac
14085         case "$getservbyport_r_proto" in
14086         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14087         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14088         esac
14089         case "$getservbyport_r_proto" in
14090         ''|0)   d_getservbyport_r=undef
14091                 getservbyport_r_proto=0
14092                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14093         * )     case "$getservbyport_r_proto" in
14094                 REENTRANT_PROTO*) ;;
14095                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14096                 esac
14097                 echo "Prototype: $try" ;;
14098         esac
14099         ;;
14100         *)      case "$usethreads" in
14101                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14102                 esac
14103                 d_getservbyport_r=undef
14104                 getservbyport_r_proto=0
14105                 ;;
14106         esac
14107         ;;
14108 *)      getservbyport_r_proto=0
14109         ;;
14110 esac
14111
14112 : see if getservent_r exists
14113 set getservent_r d_getservent_r
14114 eval $inlibc
14115 case "$d_getservent_r" in
14116 "$define")
14117         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14118         case "$d_getservent_r_proto:$usethreads" in
14119         ":define")      d_getservent_r_proto=define
14120                 set d_getservent_r_proto getservent_r $hdrs
14121                 eval $hasproto ;;
14122         *)      ;;
14123         esac
14124         case "$d_getservent_r_proto" in
14125         define)
14126         case "$getservent_r_proto" in
14127         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14128         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14129         esac
14130         case "$getservent_r_proto" in
14131         ''|0) try='int getservent_r(struct servent*, char*, int);'
14132         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14133         esac
14134         case "$getservent_r_proto" in
14135         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14136         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14137         esac
14138         case "$getservent_r_proto" in
14139         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14140         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14141         esac
14142         case "$getservent_r_proto" in
14143         ''|0)   d_getservent_r=undef
14144                 getservent_r_proto=0
14145                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14146         * )     case "$getservent_r_proto" in
14147                 REENTRANT_PROTO*) ;;
14148                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14149                 esac
14150                 echo "Prototype: $try" ;;
14151         esac
14152         ;;
14153         *)      case "$usethreads" in
14154                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14155                 esac
14156                 d_getservent_r=undef
14157                 getservent_r_proto=0
14158                 ;;
14159         esac
14160         ;;
14161 *)      getservent_r_proto=0
14162         ;;
14163 esac
14164
14165 : see if prototypes for various getservxxx netdb.h functions are available
14166 echo " "
14167 set d_getservprotos getservent $i_netdb netdb.h
14168 eval $hasproto
14169
14170 : see if getspnam exists
14171 set getspnam d_getspnam
14172 eval $inlibc
14173
14174 : see if this is a shadow.h system
14175 set shadow.h i_shadow
14176 eval $inhdr
14177
14178 : see if getspnam_r exists
14179 set getspnam_r d_getspnam_r
14180 eval $inlibc
14181 case "$d_getspnam_r" in
14182 "$define")
14183         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14184         case "$d_getspnam_r_proto:$usethreads" in
14185         ":define")      d_getspnam_r_proto=define
14186                 set d_getspnam_r_proto getspnam_r $hdrs
14187                 eval $hasproto ;;
14188         *)      ;;
14189         esac
14190         case "$d_getspnam_r_proto" in
14191         define)
14192         case "$getspnam_r_proto" in
14193         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14194         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14195         esac
14196         case "$getspnam_r_proto" in
14197         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14198         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14199         esac
14200         case "$getspnam_r_proto" in
14201         ''|0)   d_getspnam_r=undef
14202                 getspnam_r_proto=0
14203                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14204         * )     case "$getspnam_r_proto" in
14205                 REENTRANT_PROTO*) ;;
14206                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14207                 esac
14208                 echo "Prototype: $try" ;;
14209         esac
14210         ;;
14211         *)      case "$usethreads" in
14212                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14213                 esac
14214                 d_getspnam_r=undef
14215                 getspnam_r_proto=0
14216                 ;;
14217         esac
14218         ;;
14219 *)      getspnam_r_proto=0
14220         ;;
14221 esac
14222
14223 : see if gettimeofday or ftime exists
14224 set gettimeofday d_gettimeod
14225 eval $inlibc
14226 case "$d_gettimeod" in
14227 "$undef")
14228         set ftime d_ftime 
14229         eval $inlibc
14230         ;;
14231 *)
14232         val="$undef"; set d_ftime; eval $setvar
14233         ;;
14234 esac
14235 case "$d_gettimeod$d_ftime" in
14236 "$undef$undef")
14237         echo " "
14238         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14239         ;;
14240 esac
14241
14242 : see if gmtime_r exists
14243 set gmtime_r d_gmtime_r
14244 eval $inlibc
14245 case "$d_gmtime_r" in
14246 "$define")
14247         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14248         case "$d_gmtime_r_proto:$usethreads" in
14249         ":define")      d_gmtime_r_proto=define
14250                 set d_gmtime_r_proto gmtime_r $hdrs
14251                 eval $hasproto ;;
14252         *)      ;;
14253         esac
14254         case "$d_gmtime_r_proto" in
14255         define)
14256         case "$gmtime_r_proto" in
14257         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14258         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14259         esac
14260         case "$gmtime_r_proto" in
14261         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14262         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14263         esac
14264         case "$gmtime_r_proto" in
14265         ''|0)   d_gmtime_r=undef
14266                 gmtime_r_proto=0
14267                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14268         * )     case "$gmtime_r_proto" in
14269                 REENTRANT_PROTO*) ;;
14270                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14271                 esac
14272                 echo "Prototype: $try" ;;
14273         esac
14274         ;;
14275         *)      case "$usethreads" in
14276                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14277                 esac
14278                 d_gmtime_r=undef
14279                 gmtime_r_proto=0
14280                 ;;
14281         esac
14282         ;;
14283 *)      gmtime_r_proto=0
14284         ;;
14285 esac
14286
14287 : see if hasmntopt exists
14288 set hasmntopt d_hasmntopt
14289 eval $inlibc
14290
14291 : see if this is a netinet/in.h or sys/in.h system
14292 set netinet/in.h i_niin sys/in.h i_sysin
14293 eval $inhdr
14294
14295 : see if arpa/inet.h has to be included
14296 set arpa/inet.h i_arpainet
14297 eval $inhdr
14298
14299 : see if htonl --and friends-- exists
14300 val=''
14301 set htonl val
14302 eval $inlibc
14303
14304 : Maybe they are macros.
14305 case "$val" in
14306 $undef)
14307         $cat >htonl.c <<EOM
14308 #include <stdio.h>
14309 #include <sys/types.h>
14310 #$i_niin I_NETINET_IN
14311 #$i_sysin I_SYS_IN
14312 #$i_arpainet I_ARPA_INET
14313 #ifdef I_NETINET_IN
14314 #include <netinet/in.h>
14315 #endif
14316 #ifdef I_SYS_IN
14317 #include <sys/in.h>
14318 #endif
14319 #ifdef I_ARPA_INET
14320 #include <arpa/inet.h>
14321 #endif
14322 #ifdef htonl
14323 printf("Defined as a macro.");
14324 #endif
14325 EOM
14326         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14327         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14328                 val="$define"
14329                 echo "But it seems to be defined as a macro." >&4
14330         fi
14331         $rm -f htonl.?
14332         ;;
14333 esac
14334 set d_htonl
14335 eval $setvar
14336
14337 : see if ilogbl exists
14338 set ilogbl d_ilogbl
14339 eval $inlibc
14340
14341 : index or strchr
14342 echo " "
14343 if set index val -f; eval $csym; $val; then
14344         if set strchr val -f d_strchr; eval $csym; $val; then
14345                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14346                         val="$define"
14347                         vali="$undef"
14348                         echo "strchr() found." >&4
14349                 else
14350                         val="$undef"
14351                         vali="$define"
14352                         echo "index() found." >&4
14353                 fi
14354         else
14355                 val="$undef"
14356                 vali="$define"
14357                 echo "index() found." >&4
14358         fi
14359 else
14360         if set strchr val -f d_strchr; eval $csym; $val; then
14361                 val="$define"
14362                 vali="$undef"
14363                 echo "strchr() found." >&4
14364         else
14365                 echo "No index() or strchr() found!" >&4
14366                 val="$undef"
14367                 vali="$undef"
14368         fi
14369 fi
14370 set d_strchr; eval $setvar
14371 val="$vali"
14372 set d_index; eval $setvar
14373
14374 : check whether inet_aton exists
14375 set inet_aton d_inetaton
14376 eval $inlibc
14377
14378 : Look for isascii
14379 echo " "
14380 $cat >isascii.c <<EOCP
14381 #include <stdio.h>
14382 #include <ctype.h>
14383 #$i_stdlib I_STDLIB
14384 #ifdef I_STDLIB
14385 #include <stdlib.h>
14386 #endif
14387 int main() {
14388         int c = 'A';
14389         if (isascii(c))
14390                 exit(0);
14391         else
14392                 exit(1);
14393 }
14394 EOCP
14395 set isascii
14396 if eval $compile; then
14397         echo "isascii() found." >&4
14398         val="$define"
14399 else
14400         echo "isascii() NOT found." >&4
14401         val="$undef"
14402 fi
14403 set d_isascii
14404 eval $setvar
14405 $rm -f isascii*
14406
14407 : see if isfinite exists
14408 set isfinite d_isfinite
14409 eval $inlibc
14410
14411 : see if isinf exists
14412 set isinf d_isinf
14413 eval $inlibc
14414
14415 : see if isnan exists
14416 set isnan d_isnan
14417 eval $inlibc
14418
14419 : see if isnanl exists
14420 set isnanl d_isnanl
14421 eval $inlibc
14422
14423 : see if killpg exists
14424 set killpg d_killpg
14425 eval $inlibc
14426
14427 : see if lchown exists
14428 echo " "
14429 $cat > try.c <<'EOCP'
14430 /* System header to define __stub macros and hopefully few prototypes,
14431     which can conflict with char lchown(); below.  */
14432 #include <assert.h>
14433 /* Override any gcc2 internal prototype to avoid an error.  */
14434 /* We use char because int might match the return type of a gcc2
14435    builtin and then its argument prototype would still apply.  */
14436 char lchown();
14437 int main() {
14438     /*  The GNU C library defines this for functions which it implements
14439         to always fail with ENOSYS.  Some functions are actually named
14440         something starting with __ and the normal name is an alias.  */
14441 #if defined (__stub_lchown) || defined (__stub___lchown)
14442 choke me
14443 #else
14444 lchown();
14445 #endif
14446 ; return 0; }
14447 EOCP
14448 set try
14449 if eval $compile; then
14450     $echo "lchown() found." >&4
14451     val="$define"
14452 else
14453     $echo "lchown() NOT found." >&4
14454     val="$undef"
14455 fi
14456 set d_lchown
14457 eval $setvar
14458
14459 : See if number of significant digits in a double precision number is known
14460 echo " "
14461 $cat >ldbl_dig.c <<EOM
14462 #$i_limits I_LIMITS
14463 #$i_float I_FLOAT
14464 #ifdef I_LIMITS
14465 #include <limits.h>
14466 #endif
14467 #ifdef I_FLOAT
14468 #include <float.h>
14469 #endif
14470 #ifdef LDBL_DIG
14471 printf("Contains LDBL_DIG");
14472 #endif
14473 EOM
14474 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14475 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14476         echo "LDBL_DIG found." >&4
14477         val="$define"
14478 else
14479         echo "LDBL_DIG NOT found." >&4
14480         val="$undef"
14481 fi
14482 $rm -f ldbl_dig.?
14483 set d_ldbl_dig
14484 eval $setvar
14485
14486 : see if this is a math.h system
14487 set math.h i_math
14488 eval $inhdr
14489
14490 d_libm_lib_version="$undef"
14491 case $i_math in
14492     $define)
14493         : check to see if math.h defines _LIB_VERSION
14494         echo " "
14495         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14496         $cat >try.c <<EOCP
14497 #include <unistd.h>
14498 #include <math.h>
14499 int main (int argc, char *argv[])
14500 {
14501     printf ("%d\n", _LIB_VERSION);
14502     return (0);
14503     } /* main */
14504 EOCP
14505         set try
14506         if eval $compile; then
14507             foo=`$run ./try`
14508             echo "Yes, it does ($foo)" >&4
14509             d_libm_lib_version="$define"
14510         else
14511             echo "No, it does not (probably harmless)\n" >&4
14512             fi
14513         $rm -f try.* try core core.try.*
14514         ;;
14515
14516     esac
14517
14518 : see if link exists
14519 set link d_link
14520 eval $inlibc
14521
14522 : see if localtime_r exists
14523 set localtime_r d_localtime_r
14524 eval $inlibc
14525 case "$d_localtime_r" in
14526 "$define")
14527         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14528         case "$d_localtime_r_proto:$usethreads" in
14529         ":define")      d_localtime_r_proto=define
14530                 set d_localtime_r_proto localtime_r $hdrs
14531                 eval $hasproto ;;
14532         *)      ;;
14533         esac
14534         case "$d_localtime_r_proto" in
14535         define)
14536         case "$localtime_r_proto" in
14537         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14538         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14539         esac
14540         case "$localtime_r_proto" in
14541         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14542         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14543         esac
14544         case "$localtime_r_proto" in
14545         ''|0)   d_localtime_r=undef
14546                 localtime_r_proto=0
14547                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14548         * )     case "$localtime_r_proto" in
14549                 REENTRANT_PROTO*) ;;
14550                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14551                 esac
14552                 echo "Prototype: $try" ;;
14553         esac
14554         ;;
14555         *)      case "$usethreads" in
14556                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14557                 esac
14558                 d_localtime_r=undef
14559                 localtime_r_proto=0
14560                 ;;
14561         esac
14562         ;;
14563 *)      localtime_r_proto=0
14564         ;;
14565 esac
14566
14567 : see if localtime_r calls tzset
14568 case "$localtime_r_proto" in
14569 REENTRANT_PROTO*)
14570         $cat >try.c <<EOCP
14571 /*  Does our libc's localtime_r call tzset ?
14572  *  return 0 if so, 1 otherwise.
14573  */
14574 #include <sys/types.h>
14575 #include <unistd.h>
14576 #include <time.h>
14577 #include <string.h>
14578 #include <malloc.h>
14579 int main()
14580 {
14581     time_t t = time(0L);
14582     char w_tz[]="TZ" "=GMT+5",
14583          e_tz[]="TZ" "=GMT-5",
14584         *tz_e = (char*)malloc(16),
14585         *tz_w = (char*)malloc(16);
14586     struct tm tm_e, tm_w;
14587     memset(&tm_e,'\0',sizeof(struct tm));
14588     memset(&tm_w,'\0',sizeof(struct tm));
14589     strcpy(tz_e,e_tz);
14590     strcpy(tz_w,w_tz);
14591
14592     putenv(tz_e);
14593     localtime_r(&t, &tm_e);
14594
14595     putenv(tz_w);
14596     localtime_r(&t, &tm_w);
14597
14598     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14599         return 1;
14600     return 0;
14601 }
14602 EOCP
14603         set try
14604         if eval $compile; then
14605             if ./try; then
14606                 d_localtime_r_needs_tzset=undef;
14607             else
14608                 d_localtime_r_needs_tzset=define;
14609             fi;
14610         else
14611             d_localtime_r_needs_tzset=undef;
14612         fi;
14613      ;;
14614   *)
14615      d_localtime_r_needs_tzset=undef;
14616      ;;
14617 esac
14618 $rm -f try try.* core
14619
14620 : see if localeconv exists
14621 set localeconv d_locconv
14622 eval $inlibc
14623
14624 : see if lockf exists
14625 set lockf d_lockf
14626 eval $inlibc
14627
14628 : see if prototype for lseek is available
14629 echo " "
14630 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14631 eval $hasproto
14632
14633 : see if lstat exists
14634 set lstat d_lstat
14635 eval $inlibc
14636
14637 : see if madvise exists
14638 set madvise d_madvise
14639 eval $inlibc
14640
14641 : see if malloc_size exists
14642 set malloc_size d_malloc_size
14643 eval $inlibc
14644
14645 : see if malloc_size_good exists
14646 set malloc_good_size d_malloc_good_size
14647 eval $inlibc
14648
14649 : see if mblen exists
14650 set mblen d_mblen
14651 eval $inlibc
14652
14653 : see if mbstowcs exists
14654 set mbstowcs d_mbstowcs
14655 eval $inlibc
14656
14657 : see if mbtowc exists
14658 set mbtowc d_mbtowc
14659 eval $inlibc
14660
14661 : see if memchr exists
14662 set memchr d_memchr
14663 eval $inlibc
14664
14665 : see if memcmp exists
14666 set memcmp d_memcmp
14667 eval $inlibc
14668
14669 : see if memcpy exists
14670 set memcpy d_memcpy
14671 eval $inlibc
14672
14673 : see if memmove exists
14674 set memmove d_memmove
14675 eval $inlibc
14676
14677 : see if memset exists
14678 set memset d_memset
14679 eval $inlibc
14680
14681 : see if mkdir exists
14682 set mkdir d_mkdir
14683 eval $inlibc
14684
14685 : see if mkdtemp exists
14686 set mkdtemp d_mkdtemp
14687 eval $inlibc
14688
14689 : see if mkfifo exists
14690 set mkfifo d_mkfifo
14691 eval $inlibc
14692
14693 : see if mkstemp exists
14694 set mkstemp d_mkstemp
14695 eval $inlibc
14696
14697 : see if mkstemps exists
14698 set mkstemps d_mkstemps
14699 eval $inlibc
14700
14701 : see if mktime exists
14702 set mktime d_mktime
14703 eval $inlibc
14704
14705 : see if this is a sys/mman.h system
14706 set sys/mman.h i_sysmman
14707 eval $inhdr
14708
14709 : see if mmap exists
14710 set mmap d_mmap
14711 eval $inlibc
14712 : see what shmat returns
14713 : default to something harmless
14714 mmaptype='void *'
14715 case "$i_sysmman$d_mmap" in
14716 "$define$define")
14717         $cat >mmap.c <<'END'
14718 #include <sys/mman.h>
14719 void *mmap();
14720 END
14721         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14722                 mmaptype='void *'
14723         else
14724                 mmaptype='caddr_t'
14725         fi
14726         echo "and it returns ($mmaptype)." >&4
14727         ;;
14728 esac
14729
14730
14731
14732 : see if sqrtl exists
14733 set sqrtl d_sqrtl
14734 eval $inlibc
14735
14736 : see if scalbnl exists
14737 set scalbnl d_scalbnl
14738 eval $inlibc
14739
14740 : see if modfl exists
14741 set modfl d_modfl
14742 eval $inlibc
14743
14744 : see if prototype for modfl is available
14745 echo " "
14746 set d_modflproto modfl $i_math math.h
14747 eval $hasproto
14748
14749 d_modfl_pow32_bug="$undef"
14750
14751 case "$d_longdbl$d_modfl" in
14752 $define$define)
14753         $cat <<EOM
14754 Checking to see whether your modfl() is okay for large values...
14755 EOM
14756 $cat >try.c <<EOCP
14757 #include <math.h> 
14758 #include <stdio.h>
14759 EOCP
14760 if $test "X$d_modflproto" != "X$define"; then
14761         $cat >>try.c <<EOCP
14762 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14763 long double modfl (long double, long double *);
14764 EOCP
14765 fi
14766 $cat >>try.c <<EOCP
14767 int main() {
14768     long double nv = 4294967303.15;
14769     long double v, w;
14770     v = modfl(nv, &w);         
14771 #ifdef __GLIBC__
14772     printf("glibc");
14773 #endif
14774     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14775     return 0;
14776 }
14777 EOCP
14778         case "$osname:$gccversion" in
14779         aix:)   saveccflags="$ccflags"
14780                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14781         esac
14782         set try
14783         if eval $compile; then
14784                 foo=`$run ./try`
14785                 case "$foo" in
14786                 *" 4294967303.150000 1.150000 4294967302.000000")
14787                         echo >&4 "Your modfl() is broken for large values."
14788                         d_modfl_pow32_bug="$define"
14789                         case "$foo" in
14790                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14791                         ;;
14792                         esac
14793                         ;;
14794                 *" 4294967303.150000 0.150000 4294967303.000000")
14795                         echo >&4 "Your modfl() seems okay for large values."
14796                         ;;
14797                 *)      echo >&4 "I don't understand your modfl() at all."
14798                         d_modfl="$undef"
14799                         ;;
14800                 esac
14801                 $rm -f try.* try core core.try.*
14802         else
14803                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14804                 d_modfl="$undef"
14805         fi
14806         case "$osname:$gccversion" in
14807         aix:)   ccflags="$saveccflags" ;; # restore
14808         esac
14809         ;;
14810 esac
14811
14812 if $test "$uselongdouble" = "$define"; then
14813     message=""
14814     if $test "$d_sqrtl" != "$define"; then
14815         message="$message sqrtl"
14816     fi
14817     if $test "$d_modfl" != "$define"; then
14818         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14819             echo "You have both aintl and copysignl, so I can emulate modfl."
14820         else
14821             message="$message modfl"
14822         fi
14823     fi
14824     if $test "$d_frexpl" != "$define"; then
14825         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14826             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14827         else
14828             message="$message frexpl"
14829         fi
14830     fi
14831
14832     if $test "$message" != ""; then
14833         $cat <<EOM >&4
14834
14835 *** You requested the use of long doubles but you do not seem to have
14836 *** the following mathematical functions needed for long double support:
14837 ***    $message
14838 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14839 *** Cannot continue, aborting.
14840
14841 EOM
14842
14843         exit 1
14844     fi
14845 fi
14846
14847 : see if mprotect exists
14848 set mprotect d_mprotect
14849 eval $inlibc
14850
14851 : see if msgctl exists
14852 set msgctl d_msgctl
14853 eval $inlibc
14854
14855 : see if msgget exists
14856 set msgget d_msgget
14857 eval $inlibc
14858
14859 : see if msgsnd exists
14860 set msgsnd d_msgsnd
14861 eval $inlibc
14862
14863 : see if msgrcv exists
14864 set msgrcv d_msgrcv
14865 eval $inlibc
14866
14867 : see how much of the 'msg*(2)' library is present.
14868 h_msg=true
14869 echo " "
14870 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14871 *"$undef"*) h_msg=false;;
14872 esac
14873 case "$osname" in
14874 freebsd)
14875     case "`ipcs 2>&1`" in
14876     "SVID messages"*"not configured"*)
14877         echo "Your $osname does not have the msg*(2) configured." >&4
14878         h_msg=false
14879         val="$undef"
14880         set msgctl d_msgctl
14881         eval $setvar
14882         set msgget d_msgget
14883         eval $setvar
14884         set msgsnd d_msgsnd
14885         eval $setvar
14886         set msgrcv d_msgrcv
14887         eval $setvar
14888         ;;
14889     esac
14890     ;;
14891 esac
14892 : we could also check for sys/ipc.h ...
14893 if $h_msg && $test `./findhdr sys/msg.h`; then
14894         echo "You have the full msg*(2) library." >&4
14895         val="$define"
14896 else
14897         echo "You don't have the full msg*(2) library." >&4
14898         val="$undef"
14899 fi
14900 set d_msg
14901 eval $setvar
14902
14903
14904 echo " "
14905 echo "Checking to see if your system supports struct msghdr..." >&4
14906 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14907 eval $hasstruct
14908 case "$d_msghdr_s" in
14909 "$define")      echo "Yes, it does."   ;;
14910 *)              echo "No, it doesn't." ;;
14911 esac
14912
14913
14914 : see if msync exists
14915 set msync d_msync
14916 eval $inlibc
14917
14918 : see if munmap exists
14919 set munmap d_munmap
14920 eval $inlibc
14921
14922 : see if nice exists
14923 set nice d_nice
14924 eval $inlibc
14925
14926 : see if this is a langinfo.h system
14927 set langinfo.h i_langinfo
14928 eval $inhdr
14929
14930 : see if nl_langinfo exists
14931 set nl_langinfo d_nl_langinfo
14932 eval $inlibc
14933
14934 : check for length of character
14935 echo " "
14936 case "$charsize" in
14937 '')
14938         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14939         $cat >try.c <<EOCP
14940 #include <stdio.h>
14941 #$i_stdlib I_STDLIB
14942 #ifdef I_STDLIB
14943 #include <stdlib.h>
14944 #endif
14945 int main()
14946 {
14947     printf("%d\n", (int)sizeof(char));
14948     exit(0);
14949 }
14950 EOCP
14951         set try
14952         if eval $compile_ok; then
14953                 dflt=`$run ./try`
14954         else
14955                 dflt='1'
14956                 echo "(I can't seem to compile the test program.  Guessing...)"
14957         fi
14958         ;;
14959 *)
14960         dflt="$charsize"
14961         ;;
14962 esac
14963 rp="What is the size of a character (in bytes)?"
14964 . ./myread
14965 charsize="$ans"
14966 $rm -f try.c try
14967
14968 : check for volatile keyword
14969 echo " "
14970 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14971 $cat >try.c <<'EOCP'
14972 int main()
14973 {
14974         typedef struct _goo_struct goo_struct;
14975         goo_struct * volatile goo = ((goo_struct *)0);
14976         struct _goo_struct {
14977                 long long_int;
14978                 int reg_int;
14979                 char char_var;
14980         };
14981         typedef unsigned short foo_t;
14982         char *volatile foo;
14983         volatile int bar;
14984         volatile foo_t blech;
14985         foo = foo;
14986 }
14987 EOCP
14988 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14989         val="$define"
14990         echo "Yup, it does."
14991 else
14992         val="$undef"
14993         echo "Nope, it doesn't."
14994 fi
14995 set d_volatile
14996 eval $setvar
14997 $rm -f try.*
14998
14999
15000 echo " "
15001 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15002
15003 case "$use64bitint:$d_quad:$quadtype" in
15004 define:define:?*)
15005         ivtype="$quadtype"
15006         uvtype="$uquadtype"
15007         ivsize=8
15008         uvsize=8
15009         ;;
15010 *)      ivtype="long"
15011         uvtype="unsigned long"
15012         ivsize=$longsize
15013         uvsize=$longsize
15014         ;;
15015 esac
15016
15017 case "$uselongdouble:$d_longdbl" in
15018 define:define)
15019         nvtype="long double"
15020         nvsize=$longdblsize
15021         ;;
15022 *)      nvtype=double
15023         nvsize=$doublesize
15024         ;;
15025 esac
15026
15027 $echo "(IV will be "$ivtype", $ivsize bytes)"
15028 $echo "(UV will be "$uvtype", $uvsize bytes)"
15029 $echo "(NV will be "$nvtype", $nvsize bytes)"
15030
15031 $cat >try.c <<EOCP
15032 #$i_inttypes I_INTTYPES
15033 #ifdef I_INTTYPES
15034 #include <inttypes.h>
15035 #endif
15036 #include <stdio.h>
15037 int main() {
15038 #ifdef INT8
15039    int8_t i =  INT8_MAX;
15040   uint8_t u = UINT8_MAX;
15041   printf("int8_t\n");
15042 #endif
15043 #ifdef INT16
15044    int16_t i =  INT16_MAX;
15045   uint16_t i = UINT16_MAX;
15046   printf("int16_t\n");
15047 #endif
15048 #ifdef INT32
15049    int32_t i =  INT32_MAX;
15050   uint32_t u = UINT32_MAX;
15051   printf("int32_t\n");
15052 #endif
15053 }
15054 EOCP
15055
15056 case "$i8type" in
15057 '')     case "$charsize" in
15058         1)      i8type=char
15059                 u8type="unsigned char"
15060                 i8size=$charsize
15061                 u8size=$charsize
15062                 ;;
15063         esac
15064         ;;
15065 esac
15066 case "$i8type" in
15067 '')     set try -DINT8
15068         if eval $compile; then
15069                 case "`$run ./try`" in
15070                 int8_t) i8type=int8_t
15071                         u8type=uint8_t
15072                         i8size=1
15073                         u8size=1
15074                         ;;
15075                 esac
15076         fi
15077         ;;
15078 esac
15079 case "$i8type" in
15080 '')     if $test $charsize -ge 1; then
15081                 i8type=char
15082                 u8type="unsigned char"
15083                 i8size=$charsize
15084                 u8size=$charsize
15085         fi
15086         ;;
15087 esac
15088
15089 case "$i16type" in
15090 '')     case "$shortsize" in
15091         2)      i16type=short
15092                 u16type="unsigned short"
15093                 i16size=$shortsize
15094                 u16size=$shortsize
15095                 ;;
15096         esac
15097         ;;
15098 esac
15099 case "$i16type" in
15100 '')     set try -DINT16
15101         if eval $compile; then
15102                 case "`$run ./try`" in
15103                 int16_t)
15104                         i16type=int16_t
15105                         u16type=uint16_t
15106                         i16size=2
15107                         u16size=2
15108                         ;;
15109                 esac
15110         fi
15111         ;;
15112 esac
15113 case "$i16type" in
15114 '')     if $test $shortsize -ge 2; then
15115                 i16type=short
15116                 u16type="unsigned short"
15117                 i16size=$shortsize
15118                 u16size=$shortsize
15119         fi
15120         ;;
15121 esac
15122
15123 case "$i32type" in
15124 '')     case "$longsize" in
15125         4)      i32type=long
15126                 u32type="unsigned long"
15127                 i32size=$longsize
15128                 u32size=$longsize
15129                 ;;
15130         *)      case "$intsize" in
15131                 4)      i32type=int
15132                         u32type="unsigned int"
15133                         i32size=$intsize
15134                         u32size=$intsize
15135                         ;;
15136                 esac
15137                 ;;
15138         esac
15139         ;;
15140 esac
15141 case "$i32type" in
15142 '')     set try -DINT32
15143         if eval $compile; then
15144                 case "`$run ./try`" in
15145                 int32_t)
15146                         i32type=int32_t
15147                         u32type=uint32_t
15148                         i32size=4
15149                         u32size=4
15150                         ;;
15151                 esac
15152         fi
15153         ;;
15154 esac
15155 case "$i32type" in
15156 '')     if $test $intsize -ge 4; then
15157                 i32type=int
15158                 u32type="unsigned int"
15159                 i32size=$intsize
15160                 u32size=$intsize
15161         fi
15162         ;;
15163 esac
15164
15165 case "$i64type" in
15166 '')     case "$d_quad:$quadtype" in
15167         define:?*)
15168                 i64type="$quadtype"
15169                 u64type="$uquadtype"
15170                 i64size=8
15171                 u64size=8
15172                 ;;
15173         esac
15174         ;;
15175 esac
15176
15177 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15178 : volatile so that the compiler has to store it out to memory.
15179 if test X"$d_volatile" = X"$define"; then
15180         volatile=volatile
15181 fi
15182 $cat <<EOP >try.c
15183 #include <stdio.h>
15184 #$i_stdlib I_STDLIB
15185 #ifdef I_STDLIB
15186 #include <stdlib.h>
15187 #endif
15188 #include <sys/types.h>
15189 #include <signal.h>
15190 #ifdef SIGFPE
15191 $volatile int bletched = 0;
15192 $signal_t blech(int s) { bletched = 1; }
15193 #endif
15194 int main() {
15195     $uvtype u = 0;
15196     $nvtype d;
15197     int     n = 8 * $uvsize;
15198     int     i;
15199 #ifdef SIGFPE
15200     signal(SIGFPE, blech);
15201 #endif
15202
15203     for (i = 0; i < n; i++) {
15204       u = u << 1 | ($uvtype)1;
15205       d = ($nvtype)u;
15206       if (($uvtype)d != u)
15207         break;
15208       if (d <= 0)
15209         break;
15210       d = ($nvtype)(u - 1);
15211       if (($uvtype)d != (u - 1))
15212         break;
15213 #ifdef SIGFPE
15214       if (bletched) {
15215         break;
15216 #endif
15217       } 
15218     }
15219     printf("%d\n", ((i == n) ? -n : i));
15220     exit(0);
15221 }
15222 EOP
15223 set try
15224
15225 d_nv_preserves_uv="$undef"
15226 if eval $compile; then
15227         nv_preserves_uv_bits="`$run ./try`"
15228 fi
15229 case "$nv_preserves_uv_bits" in
15230 \-[1-9]*)       
15231         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15232         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15233         d_nv_preserves_uv="$define"
15234         ;;
15235 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15236         d_nv_preserves_uv="$undef" ;;
15237 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15238         nv_preserves_uv_bits="$undef" ;;
15239 esac
15240
15241 $rm -f try.* try
15242
15243 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15244 : volatile so that the compiler has to store it out to memory.
15245 if test X"$d_volatile" = X"$define"; then
15246         volatile=volatile
15247 fi
15248 $cat <<EOP >try.c
15249 #include <stdio.h>
15250 #$i_stdlib I_STDLIB
15251 #ifdef I_STDLIB
15252 #include <stdlib.h>
15253 #endif
15254 #$i_string I_STRING
15255 #ifdef I_STRING
15256 #  include <string.h>
15257 #else
15258 #  include <strings.h>
15259 #endif
15260 #include <sys/types.h>
15261 #include <signal.h>
15262 #ifdef SIGFPE
15263 $volatile int bletched = 0;
15264 $signal_t blech(int s) { bletched = 1; }
15265 #endif
15266
15267 int checkit($nvtype d, char *where) {
15268     unsigned char *p = (char *)&d;
15269     unsigned char *end = p + sizeof(d);
15270     int fail = 0;
15271
15272     while (p < end)
15273         fail += *p++;
15274
15275     if (!fail)
15276         return 0;
15277
15278     p = (char *)&d;
15279     printf("No - %s: 0x", where);
15280     while (p < end)
15281         printf ("%02X", *p++);
15282     printf("\n");
15283     return 1;
15284 }
15285
15286 int main(int argc, char **argv) {
15287     $nvtype d = 0.0;
15288     int fail = 0;
15289     fail += checkit(d, "0.0");
15290
15291     /* The compiler shouldn't be assuming that bletched is 0  */
15292     d = bletched;
15293
15294     fail += checkit(d, "bleched");
15295
15296 #ifdef SIGFPE
15297     signal(SIGFPE, blech);
15298 #endif
15299
15300     /* Paranoia - the compiler should have no way of knowing that ANSI says
15301        that argv[argc] will always be NULL.  Actually, if it did assume this it
15302        would be buggy, as this is C and main() can be called from elsewhere in
15303        the program.  */
15304     d = argv[argc] ? 1 : 0;
15305
15306     if (d) {
15307         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15308     }
15309
15310     fail += checkit(d, "ternary");
15311
15312     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15313
15314     if (d != 0.0) {
15315         printf("No - memset doesn't give 0.0\n");
15316         /* This might just blow up:  */
15317         printf("(gives %g)\n", d);
15318         return 1;
15319     }
15320     
15321 #ifdef SIGFPE
15322     if (bletched) {
15323         printf("No - something bleched\n");
15324         return 1;
15325     }
15326 #endif
15327     if (fail) {
15328       printf("No - %d fail(s)\n", fail);
15329       return 1;
15330     }
15331     printf("Yes\n");
15332     return 0;
15333 }
15334 EOP
15335 set try
15336
15337 d_nv_zero_is_allbits_zero="$undef"
15338 if eval $compile; then
15339     xxx="`$run ./try`"
15340     case "$?" in
15341         0)
15342             case "$xxx" in
15343                 Yes)  cat >&4 <<EOM
15344 0.0 is represented as all bits zero in memory
15345 EOM
15346                     d_nv_zero_is_allbits_zero="$define"
15347                     ;;
15348                 *)  cat >&4 <<EOM
15349 0.0 is not represented as all bits zero in memory
15350 EOM
15351                     d_nv_zero_is_allbits_zero="$undef"
15352                     ;;
15353             esac
15354             ;;
15355         *)  cat >&4 <<EOM
15356 0.0 is not represented as all bits zero in memory
15357 EOM
15358             d_nv_zero_is_allbits_zero="$undef"
15359             ;;
15360     esac
15361 fi
15362
15363 $rm -f try.* try
15364
15365
15366 : check for off64_t
15367 echo " "
15368 echo "Checking to see if you have off64_t..." >&4
15369 $cat >try.c <<EOCP
15370 #include <sys/types.h>
15371 #include <unistd.h>
15372 int main() { off64_t x = 7; }
15373 EOCP
15374 set try
15375 if eval $compile; then
15376         val="$define"
15377         echo "You have off64_t."
15378 else
15379         val="$undef"
15380         echo "You do not have off64_t."
15381         case "$lseeksize" in
15382         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15383         esac
15384 fi
15385 $rm -f try.* try
15386 set d_off64_t
15387 eval $setvar
15388
15389 : how to create joinable pthreads
15390 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15391         echo " "
15392         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15393         $cat >try.c <<'EOCP'
15394 #include <pthread.h>
15395 int main() {
15396     int detachstate = JOINABLE;
15397 }
15398 EOCP
15399         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15400         if eval $compile; then
15401                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15402                 val="$undef" # Yes, undef.
15403                 set d_old_pthread_create_joinable
15404                 eval $setvar
15405                 val=""
15406                 set old_pthread_create_joinable
15407                 eval $setvar
15408         else
15409                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15410                 if eval $compile; then
15411                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15412                         val="$define"
15413                         set d_old_pthread_create_joinable
15414                         eval $setvar
15415                         val=PTHREAD_CREATE_UNDETACHED
15416                         set old_pthread_create_joinable
15417                         eval $setvar
15418                 else            
15419                         set try -DJOINABLE=__UNDETACHED
15420                         if eval $compile; then
15421                                 echo "You seem to use __UNDETACHED." >&4
15422                                 val="$define"
15423                                 set d_old_pthread_create_joinable
15424                                 eval $setvar
15425                                 val=__UNDETACHED
15426                                 set old_pthread_create_joinable
15427                                 eval $setvar
15428                         else
15429                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15430                                 val="$define"
15431                                 set d_old_pthread_create_joinable
15432                                 eval $setvar
15433                                 val=0
15434                                 set old_pthread_create_joinable
15435                                 eval $setvar
15436                         fi
15437                 fi
15438         fi
15439         $rm -f try try.*
15440 else
15441     d_old_pthread_create_joinable="$undef"
15442     old_pthread_create_joinable=""
15443 fi
15444
15445 : see if pause exists
15446 set pause d_pause
15447 eval $inlibc
15448
15449 : see if pipe exists
15450 set pipe d_pipe
15451 eval $inlibc
15452
15453 : see if poll exists
15454 set poll d_poll
15455 eval $inlibc
15456
15457 : see if readlink exists
15458 set readlink d_readlink
15459 eval $inlibc
15460
15461 echo " "
15462 procselfexe=''
15463 val="$undef"
15464 case "$d_readlink" in
15465 "$define")
15466         if $issymlink /proc/self/exe ; then
15467                 $ls -l /proc/self/exe > reflect
15468                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15469                         echo "You have Linux-like /proc/self/exe."
15470                         procselfexe='"/proc/self/exe"'
15471                         val="$define"
15472                 fi
15473         fi
15474         if $issymlink /proc/curproc/file ; then
15475                 $ls -l /proc/curproc/file > reflect
15476                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15477                         echo "You have BSD-like /proc/curproc/file."
15478                         procselfexe='"/proc/curproc/file"'
15479                         val="$define"
15480                 fi
15481         fi
15482         ;;
15483 esac
15484 $rm -f reflect
15485 set d_procselfexe
15486 eval $setvar
15487
15488 : see whether the pthread_atfork exists
15489 $cat >try.c <<EOP
15490 #include <pthread.h>
15491 #include <stdio.h>
15492 int main() {
15493 #ifdef  PTHREAD_ATFORK
15494         pthread_atfork(NULL,NULL,NULL);
15495 #endif
15496 }
15497 EOP
15498
15499 : see if pthread_atfork exists
15500 set try -DPTHREAD_ATFORK
15501 if eval $compile; then
15502     val="$define"
15503 else
15504     val="$undef"
15505 fi
15506 case "$usethreads" in
15507 $define)
15508         case "$val" in
15509         $define) echo 'pthread_atfork found.' >&4        ;;
15510         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15511         esac
15512 esac
15513 set d_pthread_atfork
15514 eval $setvar
15515
15516 : see if pthread_attr_setscope exists
15517 set pthread_attr_setscope d_pthread_attr_setscope
15518 eval $inlibc
15519
15520
15521 : see whether the various POSIXish _yields exist
15522 $cat >try.c <<EOP
15523 #include <pthread.h>
15524 #include <stdio.h>
15525 int main() {
15526 #ifdef SCHED_YIELD
15527         sched_yield();
15528 #else
15529 #ifdef PTHREAD_YIELD
15530         pthread_yield();
15531 #else
15532 #ifdef PTHREAD_YIELD_NULL
15533         pthread_yield(NULL);
15534 #endif
15535 #endif
15536 #endif
15537 }
15538 EOP
15539 : see if sched_yield exists
15540 set try -DSCHED_YIELD
15541 if eval $compile; then
15542     val="$define"
15543     sched_yield='sched_yield()'
15544 else
15545     val="$undef"
15546 fi
15547 case "$usethreads" in
15548 $define)
15549         case "$val" in
15550         $define) echo 'sched_yield() found.' >&4        ;;
15551         *)       echo 'sched_yield() NOT found.' >&4    ;;
15552         esac
15553 esac
15554 set d_sched_yield
15555 eval $setvar
15556
15557 : see if pthread_yield exists
15558 set try -DPTHREAD_YIELD
15559 if eval $compile; then
15560     val="$define"
15561     case "$sched_yield" in
15562     '') sched_yield='pthread_yield()' ;;
15563     esac
15564 else
15565     set try -DPTHREAD_YIELD_NULL
15566     if eval $compile; then
15567         val="$define"
15568         case "$sched_yield" in
15569         '') sched_yield='pthread_yield(NULL)' ;;
15570         esac
15571     else
15572         val="$undef"
15573     fi
15574 fi
15575 case "$usethreads" in
15576 $define)
15577         case "$val" in
15578         $define) echo 'pthread_yield() found.' >&4      ;;
15579         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15580         esac
15581         ;;
15582 esac
15583 set d_pthread_yield
15584 eval $setvar
15585
15586 case "$sched_yield" in
15587 '') sched_yield=undef ;;
15588 esac
15589
15590 $rm -f try try.*
15591
15592 : see if random_r exists
15593 set random_r d_random_r
15594 eval $inlibc
15595 case "$d_random_r" in
15596 "$define")
15597         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15598         case "$d_random_r_proto:$usethreads" in
15599         ":define")      d_random_r_proto=define
15600                 set d_random_r_proto random_r $hdrs
15601                 eval $hasproto ;;
15602         *)      ;;
15603         esac
15604         case "$d_random_r_proto" in
15605         define)
15606         case "$random_r_proto" in
15607         ''|0) try='int random_r(int*, struct random_data*);'
15608         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15609         esac
15610         case "$random_r_proto" in
15611         ''|0) try='int random_r(long*, struct random_data*);'
15612         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15613         esac
15614         case "$random_r_proto" in
15615         ''|0) try='int random_r(struct random_data*, int32_t*);'
15616         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15617         esac
15618         case "$random_r_proto" in
15619         ''|0)   d_random_r=undef
15620                 random_r_proto=0
15621                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15622         * )     case "$random_r_proto" in
15623                 REENTRANT_PROTO*) ;;
15624                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15625                 esac
15626                 echo "Prototype: $try" ;;
15627         esac
15628         ;;
15629         *)      case "$usethreads" in
15630                 define) echo "random_r has no prototype, not using it." >&4 ;;
15631                 esac
15632                 d_random_r=undef
15633                 random_r_proto=0
15634                 ;;
15635         esac
15636         ;;
15637 *)      random_r_proto=0
15638         ;;
15639 esac
15640
15641 : see if readdir and friends exist
15642 set readdir d_readdir
15643 eval $inlibc
15644 set seekdir d_seekdir
15645 eval $inlibc
15646 set telldir d_telldir
15647 eval $inlibc
15648 set rewinddir d_rewinddir
15649 eval $inlibc
15650
15651 : see if readdir64_r exists
15652 set readdir64_r d_readdir64_r
15653 eval $inlibc
15654 case "$d_readdir64_r" in
15655 "$define")
15656         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15657         case "$d_readdir64_r_proto:$usethreads" in
15658         ":define")      d_readdir64_r_proto=define
15659                 set d_readdir64_r_proto readdir64_r $hdrs
15660                 eval $hasproto ;;
15661         *)      ;;
15662         esac
15663         case "$d_readdir64_r_proto" in
15664         define)
15665         case "$readdir64_r_proto" in
15666         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15667         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15668         esac
15669         case "$readdir64_r_proto" in
15670         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15671         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15672         esac
15673         case "$readdir64_r_proto" in
15674         ''|0)   d_readdir64_r=undef
15675                 readdir64_r_proto=0
15676                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15677         * )     case "$readdir64_r_proto" in
15678                 REENTRANT_PROTO*) ;;
15679                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15680                 esac
15681                 echo "Prototype: $try" ;;
15682         esac
15683         ;;
15684         *)      case "$usethreads" in
15685                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15686                 esac
15687                 d_readdir64_r=undef
15688                 readdir64_r_proto=0
15689                 ;;
15690         esac
15691         ;;
15692 *)      readdir64_r_proto=0
15693         ;;
15694 esac
15695
15696 : see if readdir_r exists
15697 set readdir_r d_readdir_r
15698 eval $inlibc
15699 case "$d_readdir_r" in
15700 "$define")
15701         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15702         case "$d_readdir_r_proto:$usethreads" in
15703         ":define")      d_readdir_r_proto=define
15704                 set d_readdir_r_proto readdir_r $hdrs
15705                 eval $hasproto ;;
15706         *)      ;;
15707         esac
15708         case "$d_readdir_r_proto" in
15709         define)
15710         case "$readdir_r_proto" in
15711         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15712         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15713         esac
15714         case "$readdir_r_proto" in
15715         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15716         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15717         esac
15718         case "$readdir_r_proto" in
15719         ''|0)   d_readdir_r=undef
15720                 readdir_r_proto=0
15721                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15722         * )     case "$readdir_r_proto" in
15723                 REENTRANT_PROTO*) ;;
15724                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15725                 esac
15726                 echo "Prototype: $try" ;;
15727         esac
15728         ;;
15729         *)      case "$usethreads" in
15730                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15731                 esac
15732                 d_readdir_r=undef
15733                 readdir_r_proto=0
15734                 ;;
15735         esac
15736         ;;
15737 *)      readdir_r_proto=0
15738         ;;
15739 esac
15740
15741 : see if readv exists
15742 set readv d_readv
15743 eval $inlibc
15744
15745 : see if recvmsg exists
15746 set recvmsg d_recvmsg
15747 eval $inlibc
15748
15749 : see if rename exists
15750 set rename d_rename
15751 eval $inlibc
15752
15753 : see if rmdir exists
15754 set rmdir d_rmdir
15755 eval $inlibc
15756
15757 : see if memory.h is available.
15758 val=''
15759 set memory.h val
15760 eval $inhdr
15761
15762 : See if it conflicts with string.h
15763 case "$val" in
15764 $define)
15765         case "$strings" in
15766         '') ;;
15767         *)
15768                 $cppstdin $cppflags $cppminus < $strings > mem.h
15769                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15770                         echo " "
15771                         echo "We won't be including <memory.h>."
15772                         val="$undef"
15773                 fi
15774                 $rm -f mem.h
15775                 ;;
15776         esac
15777 esac
15778 set i_memory
15779 eval $setvar
15780
15781 : can bcopy handle overlapping blocks?
15782 echo " "
15783 val="$undef"
15784 case "$d_memmove" in
15785 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15786 *)      case "$d_bcopy" in
15787         "$define")
15788                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15789                 $cat >try.c <<EOCP
15790 #$i_memory I_MEMORY
15791 #$i_stdlib I_STDLIB
15792 #$i_string I_STRING
15793 #$i_unistd I_UNISTD
15794 EOCP
15795         $cat >>try.c <<'EOCP'
15796 #include <stdio.h>
15797 #ifdef I_MEMORY
15798 #  include <memory.h>
15799 #endif
15800 #ifdef I_STDLIB
15801 #  include <stdlib.h>
15802 #endif
15803 #ifdef I_STRING
15804 #  include <string.h>
15805 #else
15806 #  include <strings.h>
15807 #endif
15808 #ifdef I_UNISTD
15809 #  include <unistd.h>  /* Needed for NetBSD */
15810 #endif
15811 int main()
15812 {
15813 char buf[128], abc[128];
15814 char *b;
15815 int len;
15816 int off;
15817 int align;
15818
15819 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15820    try to store the string in read-only memory. */
15821 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15822
15823 for (align = 7; align >= 0; align--) {
15824         for (len = 36; len; len--) {
15825                 b = buf+align;
15826                 bcopy(abc, b, len);
15827                 for (off = 1; off <= len; off++) {
15828                         bcopy(b, b+off, len);
15829                         bcopy(b+off, b, len);
15830                         if (bcmp(b, abc, len))
15831                                 exit(1);
15832                 }
15833         }
15834 }
15835 exit(0);
15836 }
15837 EOCP
15838                 set try
15839                 if eval $compile_ok; then
15840                         if ./try 2>/dev/null; then
15841                                 echo "Yes, it can."
15842                                 val="$define"
15843                         else
15844                                 echo "It can't, sorry."
15845                         fi
15846                 else
15847                         echo "(I can't compile the test program, so we'll assume not...)"
15848                 fi
15849                 ;;
15850         esac
15851         $rm -f try.* try core
15852         ;;
15853 esac
15854 set d_safebcpy
15855 eval $setvar
15856
15857 : can memcpy handle overlapping blocks?
15858 echo " "
15859 val="$undef"
15860 case "$d_memmove" in
15861 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15862 *)      case "$d_memcpy" in
15863         "$define")
15864                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15865                 $cat >try.c <<EOCP
15866 #$i_memory I_MEMORY
15867 #$i_stdlib I_STDLIB
15868 #$i_string I_STRING
15869 #$i_unistd I_UNISTD
15870 EOCP
15871         $cat >>try.c <<'EOCP'
15872 #include <stdio.h>
15873 #ifdef I_MEMORY
15874 #  include <memory.h>
15875 #endif
15876 #ifdef I_STDLIB
15877 #  include <stdlib.h>
15878 #endif
15879 #ifdef I_STRING
15880 #  include <string.h>
15881 #else
15882 #  include <strings.h>
15883 #endif
15884 #ifdef I_UNISTD
15885 #  include <unistd.h>  /* Needed for NetBSD */
15886 #endif
15887 int main()
15888 {
15889 char buf[128], abc[128];
15890 char *b;
15891 int len;
15892 int off;
15893 int align;
15894
15895 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15896    try to store the string in read-only memory. */
15897 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15898
15899 for (align = 7; align >= 0; align--) {
15900         for (len = 36; len; len--) {
15901                 b = buf+align;
15902                 memcpy(b, abc, len);
15903                 for (off = 1; off <= len; off++) {
15904                         memcpy(b+off, b, len);
15905                         memcpy(b, b+off, len);
15906                         if (memcmp(b, abc, len))
15907                                 exit(1);
15908                 }
15909         }
15910 }
15911 exit(0);
15912 }
15913 EOCP
15914                 set try
15915                 if eval $compile_ok; then
15916                         if ./try 2>/dev/null; then
15917                                 echo "Yes, it can."
15918                                 val="$define"
15919                         else
15920                                 echo "It can't, sorry."
15921                         fi
15922                 else
15923                         echo "(I can't compile the test program, so we'll assume not...)"
15924                 fi
15925                 ;;
15926         esac
15927         $rm -f try.* try core
15928         ;;
15929 esac
15930 set d_safemcpy
15931 eval $setvar
15932
15933 : can memcmp be trusted to compare relative magnitude?
15934 val="$undef"
15935 case "$d_memcmp" in
15936 "$define")
15937         echo " "
15938         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15939         $cat >try.c <<EOCP
15940 #$i_memory I_MEMORY
15941 #$i_stdlib I_STDLIB
15942 #$i_string I_STRING
15943 #$i_unistd I_UNISTD
15944 EOCP
15945         $cat >>try.c <<'EOCP'
15946 #include <stdio.h>
15947 #ifdef I_MEMORY
15948 #  include <memory.h>
15949 #endif
15950 #ifdef I_STDLIB
15951 #  include <stdlib.h>
15952 #endif
15953 #ifdef I_STRING
15954 #  include <string.h>
15955 #else
15956 #  include <strings.h>
15957 #endif
15958 #ifdef I_UNISTD
15959 #  include <unistd.h>  /* Needed for NetBSD */
15960 #endif
15961 int main()
15962 {
15963 char a = -1;
15964 char b = 0;
15965 if ((a < b) && memcmp(&a, &b, 1) < 0)
15966         exit(1);
15967 exit(0);
15968 }
15969 EOCP
15970         set try
15971         if eval $compile_ok; then
15972                 if $run ./try 2>/dev/null; then
15973                         echo "Yes, it can."
15974                         val="$define"
15975                 else
15976                         echo "No, it can't (it uses signed chars)."
15977                 fi
15978         else
15979                 echo "(I can't compile the test program, so we'll assume not...)"
15980         fi
15981         ;;
15982 esac
15983 $rm -f try.* try core
15984 set d_sanemcmp
15985 eval $setvar
15986
15987 : see if prototype for sbrk is available
15988 echo " "
15989 set d_sbrkproto sbrk $i_unistd unistd.h
15990 eval $hasproto
15991
15992 : see if select exists
15993 set select d_select
15994 eval $inlibc
15995
15996 : see if semctl exists
15997 set semctl d_semctl
15998 eval $inlibc
15999
16000 : see if semget exists
16001 set semget d_semget
16002 eval $inlibc
16003
16004 : see if semop exists
16005 set semop d_semop
16006 eval $inlibc
16007
16008 : see how much of the 'sem*(2)' library is present.
16009 h_sem=true
16010 echo " "
16011 case "$d_semctl$d_semget$d_semop" in
16012 *"$undef"*) h_sem=false;;
16013 esac
16014 case "$osname" in
16015 freebsd)
16016     case "`ipcs 2>&1`" in
16017     "SVID messages"*"not configured"*)
16018         echo "Your $osname does not have the sem*(2) configured." >&4
16019         h_sem=false
16020         val="$undef"
16021         set semctl d_semctl
16022         eval $setvar
16023         set semget d_semget
16024         eval $setvar
16025         set semop d_semop
16026         eval $setvar
16027         ;;
16028     esac
16029     ;;
16030 esac
16031 : we could also check for sys/ipc.h ...
16032 if $h_sem && $test `./findhdr sys/sem.h`; then
16033         echo "You have the full sem*(2) library." >&4
16034         val="$define"
16035 else
16036         echo "You don't have the full sem*(2) library." >&4
16037         val="$undef"
16038 fi
16039 set d_sem
16040 eval $setvar
16041
16042 : see whether sys/sem.h defines union semun
16043 echo " "
16044 $cat > try.c <<'END'
16045 #include <sys/types.h>
16046 #include <sys/ipc.h>
16047 #include <sys/sem.h>
16048 int main () { union semun semun; semun.buf = 0; }
16049 END
16050 set try
16051 if eval $compile; then
16052     echo "You have union semun in <sys/sem.h>." >&4
16053     val="$define"
16054 else
16055     echo "You do not have union semun in <sys/sem.h>." >&4
16056     val="$undef"
16057 fi
16058 $rm -f try try.c
16059 set d_union_semun
16060 eval $setvar
16061
16062 : see how to do semctl IPC_STAT
16063 case "$d_sem" in
16064 $define)
16065     echo " "
16066     $cat > try.h <<END
16067 #ifndef S_IRUSR
16068 #   ifdef S_IREAD
16069 #       define S_IRUSR S_IREAD
16070 #       define S_IWUSR S_IWRITE
16071 #       define S_IXUSR S_IEXEC
16072 #   else
16073 #       define S_IRUSR 0400
16074 #       define S_IWUSR 0200
16075 #       define S_IXUSR 0100
16076 #   endif
16077 #   define S_IRGRP (S_IRUSR>>3)
16078 #   define S_IWGRP (S_IWUSR>>3)
16079 #   define S_IXGRP (S_IXUSR>>3)
16080 #   define S_IROTH (S_IRUSR>>6)
16081 #   define S_IWOTH (S_IWUSR>>6)
16082 #   define S_IXOTH (S_IXUSR>>6)
16083 #endif
16084 #ifndef S_IRWXU
16085 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16086 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16087 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16088 #endif
16089 END
16090     : see whether semctl IPC_STAT can use union semun
16091     case "$d_semctl_semun" in
16092     '')
16093       val="$undef"
16094       $cat > try.c <<END
16095 #include <sys/types.h>
16096 #include <sys/ipc.h>
16097 #include <sys/sem.h>
16098 #include <sys/stat.h>
16099 #include <stdio.h>
16100 #include <errno.h>
16101 #include "try.h"
16102 #ifndef errno
16103 extern int errno;
16104 #endif
16105 #$d_union_semun HAS_UNION_SEMUN
16106 int main() {
16107     union semun
16108 #ifndef HAS_UNION_SEMUN
16109     {
16110         int val;
16111         struct semid_ds *buf;
16112         unsigned short *array;
16113     }
16114 #endif
16115     arg;
16116     int sem, st;
16117
16118 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16119     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16120     if (sem > -1) {
16121         struct semid_ds argbuf;
16122         arg.buf = &argbuf;
16123 #       ifdef IPC_STAT
16124         st = semctl(sem, 0, IPC_STAT, arg);
16125         if (st == 0)
16126             printf("semun\n");
16127         else
16128 #       endif /* IPC_STAT */
16129             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16130 #       ifdef IPC_RMID
16131         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16132 #       endif /* IPC_RMID */
16133             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16134     } else
16135 #endif /* IPC_PRIVATE && ... */
16136         printf("semget failed: errno = %d\n", errno);
16137   return 0;
16138 }
16139 END
16140       set try
16141       if eval $compile; then
16142           xxx=`$run ./try`
16143           case "$xxx" in
16144           semun) val="$define" ;;
16145           esac
16146       fi
16147       $rm -f try try.c
16148       set d_semctl_semun
16149       eval $setvar
16150       ;;
16151     esac
16152     case "$d_semctl_semun" in
16153     $define)
16154         echo "You can use union semun for semctl IPC_STAT." >&4
16155         also='also'
16156         ;;
16157     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16158         also=''
16159         ;;
16160     esac
16161
16162     : see whether semctl IPC_STAT can use struct semid_ds pointer
16163     case "$d_semctl_semid_ds" in
16164     '')
16165       val="$undef"
16166       $cat > try.c <<'END'
16167 #include <sys/types.h>
16168 #include <sys/ipc.h>
16169 #include <sys/sem.h>
16170 #include <sys/stat.h>
16171 #include "try.h"
16172 #include <stdio.h>
16173 #include <errno.h>
16174 #ifndef errno
16175 extern int errno;
16176 #endif
16177 int main() {
16178     struct semid_ds arg;
16179     int sem, st;
16180
16181 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16182     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16183     if (sem > -1) {
16184 #       ifdef IPC_STAT
16185         st = semctl(sem, 0, IPC_STAT, &arg);
16186         if (st == 0)
16187             printf("semid_ds\n");
16188         else
16189 #       endif /* IPC_STAT */
16190             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16191 #       ifdef IPC_RMID
16192         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16193 #       endif /* IPC_RMID */
16194             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16195     } else
16196 #endif /* IPC_PRIVATE && ... */
16197         printf("semget failed: errno = %d\n", errno);
16198
16199     return 0;
16200 }
16201 END
16202       set try
16203       if eval $compile; then
16204           xxx=`$run ./try`
16205           case "$xxx" in
16206           semid_ds) val="$define" ;;
16207           esac
16208       fi
16209       $rm -f try try.c
16210       set d_semctl_semid_ds
16211       eval $setvar
16212       ;;
16213     esac
16214     case "$d_semctl_semid_ds" in
16215     $define)
16216         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16217         ;;
16218     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16219         ;;
16220     esac
16221     $rm -f try.h
16222     ;;
16223 *)  val="$undef"
16224
16225     # We do not have the full sem*(2) library, so assume we can not
16226     # use either.
16227
16228     set d_semctl_semun
16229     eval $setvar
16230
16231     set d_semctl_semid_ds
16232     eval $setvar
16233     ;;
16234 esac
16235
16236 : see if sendmsg exists
16237 set sendmsg d_sendmsg
16238 eval $inlibc
16239
16240 : see if setegid exists
16241 set setegid d_setegid
16242 eval $inlibc
16243
16244 : see if seteuid exists
16245 set seteuid d_seteuid
16246 eval $inlibc
16247
16248 : see if setgrent exists
16249 set setgrent d_setgrent
16250 eval $inlibc
16251
16252 : see if setgrent_r exists
16253 set setgrent_r d_setgrent_r
16254 eval $inlibc
16255 case "$d_setgrent_r" in
16256 "$define")
16257         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16258         case "$d_setgrent_r_proto:$usethreads" in
16259         ":define")      d_setgrent_r_proto=define
16260                 set d_setgrent_r_proto setgrent_r $hdrs
16261                 eval $hasproto ;;
16262         *)      ;;
16263         esac
16264         case "$d_setgrent_r_proto" in
16265         define)
16266         case "$setgrent_r_proto" in
16267         ''|0) try='int setgrent_r(FILE**);'
16268         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16269         esac
16270         case "$setgrent_r_proto" in
16271         ''|0) try='void setgrent_r(FILE**);'
16272         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16273         esac
16274         case "$setgrent_r_proto" in
16275         ''|0)   d_setgrent_r=undef
16276                 setgrent_r_proto=0
16277                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16278         * )     case "$setgrent_r_proto" in
16279                 REENTRANT_PROTO*) ;;
16280                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16281                 esac
16282                 echo "Prototype: $try" ;;
16283         esac
16284         ;;
16285         *)      case "$usethreads" in
16286                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16287                 esac
16288                 d_setgrent_r=undef
16289                 setgrent_r_proto=0
16290                 ;;
16291         esac
16292         ;;
16293 *)      setgrent_r_proto=0
16294         ;;
16295 esac
16296
16297 : see if sethostent exists
16298 set sethostent d_sethent
16299 eval $inlibc
16300
16301 : see if sethostent_r exists
16302 set sethostent_r d_sethostent_r
16303 eval $inlibc
16304 case "$d_sethostent_r" in
16305 "$define")
16306         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16307         case "$d_sethostent_r_proto:$usethreads" in
16308         ":define")      d_sethostent_r_proto=define
16309                 set d_sethostent_r_proto sethostent_r $hdrs
16310                 eval $hasproto ;;
16311         *)      ;;
16312         esac
16313         case "$d_sethostent_r_proto" in
16314         define)
16315         case "$sethostent_r_proto" in
16316         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16317         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16318         esac
16319         case "$sethostent_r_proto" in
16320         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16321         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16322         esac
16323         case "$sethostent_r_proto" in
16324         ''|0)   d_sethostent_r=undef
16325                 sethostent_r_proto=0
16326                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16327         * )     case "$sethostent_r_proto" in
16328                 REENTRANT_PROTO*) ;;
16329                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16330                 esac
16331                 echo "Prototype: $try" ;;
16332         esac
16333         ;;
16334         *)      case "$usethreads" in
16335                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16336                 esac
16337                 d_sethostent_r=undef
16338                 sethostent_r_proto=0
16339                 ;;
16340         esac
16341         ;;
16342 *)      sethostent_r_proto=0
16343         ;;
16344 esac
16345
16346 : see if setitimer exists
16347 set setitimer d_setitimer
16348 eval $inlibc
16349
16350 : see if setlinebuf exists
16351 set setlinebuf d_setlinebuf
16352 eval $inlibc
16353
16354 : see if setlocale exists
16355 set setlocale d_setlocale
16356 eval $inlibc
16357
16358 : see if locale.h is available
16359 set locale.h i_locale
16360 eval $inhdr
16361
16362 : see if setlocale_r exists
16363 set setlocale_r d_setlocale_r
16364 eval $inlibc
16365 case "$d_setlocale_r" in
16366 "$define")
16367         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16368         case "$d_setlocale_r_proto:$usethreads" in
16369         ":define")      d_setlocale_r_proto=define
16370                 set d_setlocale_r_proto setlocale_r $hdrs
16371                 eval $hasproto ;;
16372         *)      ;;
16373         esac
16374         case "$d_setlocale_r_proto" in
16375         define)
16376         case "$setlocale_r_proto" in
16377         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16378         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16379         esac
16380         case "$setlocale_r_proto" in
16381         ''|0)   d_setlocale_r=undef
16382                 setlocale_r_proto=0
16383                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16384         * )     case "$setlocale_r_proto" in
16385                 REENTRANT_PROTO*) ;;
16386                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16387                 esac
16388                 echo "Prototype: $try" ;;
16389         esac
16390         ;;
16391         *)      case "$usethreads" in
16392                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16393                 esac
16394                 d_setlocale_r=undef
16395                 setlocale_r_proto=0
16396                 ;;
16397         esac
16398         ;;
16399 *)      setlocale_r_proto=0
16400         ;;
16401 esac
16402
16403 : see if setnetent exists
16404 set setnetent d_setnent
16405 eval $inlibc
16406
16407 : see if setnetent_r exists
16408 set setnetent_r d_setnetent_r
16409 eval $inlibc
16410 case "$d_setnetent_r" in
16411 "$define")
16412         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16413         case "$d_setnetent_r_proto:$usethreads" in
16414         ":define")      d_setnetent_r_proto=define
16415                 set d_setnetent_r_proto setnetent_r $hdrs
16416                 eval $hasproto ;;
16417         *)      ;;
16418         esac
16419         case "$d_setnetent_r_proto" in
16420         define)
16421         case "$setnetent_r_proto" in
16422         ''|0) try='int setnetent_r(int, struct netent_data*);'
16423         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16424         esac
16425         case "$setnetent_r_proto" in
16426         ''|0) try='void setnetent_r(int, struct netent_data*);'
16427         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16428         esac
16429         case "$setnetent_r_proto" in
16430         ''|0)   d_setnetent_r=undef
16431                 setnetent_r_proto=0
16432                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16433         * )     case "$setnetent_r_proto" in
16434                 REENTRANT_PROTO*) ;;
16435                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16436                 esac
16437                 echo "Prototype: $try" ;;
16438         esac
16439         ;;
16440         *)      case "$usethreads" in
16441                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16442                 esac
16443                 d_setnetent_r=undef
16444                 setnetent_r_proto=0
16445                 ;;
16446         esac
16447         ;;
16448 *)      setnetent_r_proto=0
16449         ;;
16450 esac
16451
16452 : see if setprotoent exists
16453 set setprotoent d_setpent
16454 eval $inlibc
16455
16456 : see if setpgid exists
16457 set setpgid d_setpgid
16458 eval $inlibc
16459
16460 : see if setpgrp2 exists
16461 set setpgrp2 d_setpgrp2
16462 eval $inlibc
16463
16464 : see if setpriority exists
16465 set setpriority d_setprior
16466 eval $inlibc
16467
16468 : see if setproctitle exists
16469 set setproctitle d_setproctitle
16470 eval $inlibc
16471
16472 : see if setprotoent_r exists
16473 set setprotoent_r d_setprotoent_r
16474 eval $inlibc
16475 case "$d_setprotoent_r" in
16476 "$define")
16477         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16478         case "$d_setprotoent_r_proto:$usethreads" in
16479         ":define")      d_setprotoent_r_proto=define
16480                 set d_setprotoent_r_proto setprotoent_r $hdrs
16481                 eval $hasproto ;;
16482         *)      ;;
16483         esac
16484         case "$d_setprotoent_r_proto" in
16485         define)
16486         case "$setprotoent_r_proto" in
16487         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16488         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16489         esac
16490         case "$setprotoent_r_proto" in
16491         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16492         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16493         esac
16494         case "$setprotoent_r_proto" in
16495         ''|0)   d_setprotoent_r=undef
16496                 setprotoent_r_proto=0
16497                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16498         * )     case "$setprotoent_r_proto" in
16499                 REENTRANT_PROTO*) ;;
16500                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16501                 esac
16502                 echo "Prototype: $try" ;;
16503         esac
16504         ;;
16505         *)      case "$usethreads" in
16506                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16507                 esac
16508                 d_setprotoent_r=undef
16509                 setprotoent_r_proto=0
16510                 ;;
16511         esac
16512         ;;
16513 *)      setprotoent_r_proto=0
16514         ;;
16515 esac
16516
16517 : see if setpwent exists
16518 set setpwent d_setpwent
16519 eval $inlibc
16520
16521 : see if setpwent_r exists
16522 set setpwent_r d_setpwent_r
16523 eval $inlibc
16524 case "$d_setpwent_r" in
16525 "$define")
16526         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16527         case "$d_setpwent_r_proto:$usethreads" in
16528         ":define")      d_setpwent_r_proto=define
16529                 set d_setpwent_r_proto setpwent_r $hdrs
16530                 eval $hasproto ;;
16531         *)      ;;
16532         esac
16533         case "$d_setpwent_r_proto" in
16534         define)
16535         case "$setpwent_r_proto" in
16536         ''|0) try='int setpwent_r(FILE**);'
16537         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16538         esac
16539         case "$setpwent_r_proto" in
16540         ''|0) try='void setpwent_r(FILE**);'
16541         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16542         esac
16543         case "$setpwent_r_proto" in
16544         ''|0)   d_setpwent_r=undef
16545                 setpwent_r_proto=0
16546                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16547         * )     case "$setpwent_r_proto" in
16548                 REENTRANT_PROTO*) ;;
16549                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16550                 esac
16551                 echo "Prototype: $try" ;;
16552         esac
16553         ;;
16554         *)      case "$usethreads" in
16555                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16556                 esac
16557                 d_setpwent_r=undef
16558                 setpwent_r_proto=0
16559                 ;;
16560         esac
16561         ;;
16562 *)      setpwent_r_proto=0
16563         ;;
16564 esac
16565
16566 : see if setregid exists
16567 set setregid d_setregid
16568 eval $inlibc
16569 set setresgid d_setresgid
16570 eval $inlibc
16571
16572 : see if setreuid exists
16573 set setreuid d_setreuid
16574 eval $inlibc
16575 set setresuid d_setresuid
16576 eval $inlibc
16577
16578 : see if setrgid exists
16579 set setrgid d_setrgid
16580 eval $inlibc
16581
16582 : see if setruid exists
16583 set setruid d_setruid
16584 eval $inlibc
16585
16586 : see if setservent exists
16587 set setservent d_setsent
16588 eval $inlibc
16589
16590 : see if setservent_r exists
16591 set setservent_r d_setservent_r
16592 eval $inlibc
16593 case "$d_setservent_r" in
16594 "$define")
16595         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16596         case "$d_setservent_r_proto:$usethreads" in
16597         ":define")      d_setservent_r_proto=define
16598                 set d_setservent_r_proto setservent_r $hdrs
16599                 eval $hasproto ;;
16600         *)      ;;
16601         esac
16602         case "$d_setservent_r_proto" in
16603         define)
16604         case "$setservent_r_proto" in
16605         ''|0) try='int setservent_r(int, struct servent_data*);'
16606         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16607         esac
16608         case "$setservent_r_proto" in
16609         ''|0) try='void setservent_r(int, struct servent_data*);'
16610         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16611         esac
16612         case "$setservent_r_proto" in
16613         ''|0)   d_setservent_r=undef
16614                 setservent_r_proto=0
16615                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16616         * )     case "$setservent_r_proto" in
16617                 REENTRANT_PROTO*) ;;
16618                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16619                 esac
16620                 echo "Prototype: $try" ;;
16621         esac
16622         ;;
16623         *)      case "$usethreads" in
16624                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16625                 esac
16626                 d_setservent_r=undef
16627                 setservent_r_proto=0
16628                 ;;
16629         esac
16630         ;;
16631 *)      setservent_r_proto=0
16632         ;;
16633 esac
16634
16635 : see if setsid exists
16636 set setsid d_setsid
16637 eval $inlibc
16638
16639 : see if setvbuf exists
16640 set setvbuf d_setvbuf
16641 eval $inlibc
16642
16643 : see if sfio.h is available
16644 set sfio.h i_sfio
16645 eval $inhdr
16646
16647
16648 : see if sfio library is available
16649 case "$i_sfio" in
16650 $define)
16651         val=''
16652         set sfreserve val
16653         eval $inlibc
16654         ;;
16655 *)
16656         val="$undef"
16657         ;;
16658 esac
16659 : Ok, but do we want to use it.
16660 case "$val" in
16661 $define)
16662         case "$usesfio" in
16663         true|$define|[yY]*) dflt='y';;
16664         *) dflt='n';;
16665         esac
16666         echo "$package can use the sfio library, but it is experimental."
16667         case "$useperlio" in
16668         "$undef")
16669             echo "For sfio also the PerlIO abstraction layer is needed."
16670             echo "Earlier you said you wouldn't want that."
16671             ;;
16672         esac
16673         rp="You seem to have sfio available, do you want to try using it?"
16674         . ./myread
16675         case "$ans" in
16676         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16677                 useperlio="$define"
16678                 val="$define"
16679                 ;;
16680         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16681                 val="$undef"
16682                 ;;
16683         esac
16684         ;;
16685 *)      case "$usesfio" in
16686         true|$define|[yY]*)
16687                 echo "Sorry, cannot find sfio on this machine." >&4
16688                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16689                 val="$undef"
16690                 ;;
16691         esac
16692         ;;
16693 esac
16694 set d_sfio
16695 eval $setvar
16696 case "$d_sfio" in
16697 $define) usesfio='true';;
16698 *) usesfio='false';;
16699 esac
16700 case "$d_sfio" in
16701 $define) ;;
16702 *)      : Remove sfio from list of libraries to use
16703         case "$libs" in
16704         *-lsfio*)
16705                 echo "Removing unneeded -lsfio from library list" >&4
16706                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16707                 shift
16708                 libs="$*"
16709                 echo "libs = $libs" >&4
16710                 ;;
16711         esac
16712 ;;
16713 esac
16714
16715
16716 : see if shmctl exists
16717 set shmctl d_shmctl
16718 eval $inlibc
16719
16720 : see if shmget exists
16721 set shmget d_shmget
16722 eval $inlibc
16723
16724 : see if shmat exists
16725 set shmat d_shmat
16726 eval $inlibc
16727 : see what shmat returns
16728 case "$d_shmat" in
16729 "$define")
16730         $cat >shmat.c <<'END'
16731 #include <sys/shm.h>
16732 void *shmat();
16733 END
16734         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16735                 shmattype='void *'
16736         else
16737                 shmattype='char *'
16738         fi
16739         echo "and it returns ($shmattype)." >&4
16740         : see if a prototype for shmat is available
16741         xxx=`./findhdr sys/shm.h`
16742         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16743         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16744                 val="$define"
16745         else
16746                 val="$undef"
16747         fi
16748         $rm -f shmat.[co]
16749         ;;
16750 *)
16751         val="$undef"
16752         ;;
16753 esac
16754 set d_shmatprototype
16755 eval $setvar
16756
16757 : see if shmdt exists
16758 set shmdt d_shmdt
16759 eval $inlibc
16760
16761 : see how much of the 'shm*(2)' library is present.
16762 h_shm=true
16763 echo " "
16764 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16765 *"$undef"*) h_shm=false;;
16766 esac
16767 case "$osname" in
16768 freebsd)
16769     case "`ipcs 2>&1`" in
16770     "SVID shared memory"*"not configured"*)
16771         echo "Your $osname does not have the shm*(2) configured." >&4
16772         h_shm=false
16773         val="$undef"
16774         set shmctl d_shmctl
16775         evat $setvar
16776         set shmget d_shmget
16777         evat $setvar
16778         set shmat d_shmat
16779         evat $setvar
16780         set shmdt d_shmdt
16781         evat $setvar
16782         ;;
16783     esac
16784     ;;
16785 esac
16786 : we could also check for sys/ipc.h ...
16787 if $h_shm && $test `./findhdr sys/shm.h`; then
16788         echo "You have the full shm*(2) library." >&4
16789         val="$define"
16790 else
16791         echo "You don't have the full shm*(2) library." >&4
16792         val="$undef"
16793 fi
16794 set d_shm
16795 eval $setvar
16796
16797 echo " "
16798 : see if we have sigaction
16799 if set sigaction val -f d_sigaction; eval $csym; $val; then
16800         echo 'sigaction() found.' >&4
16801         $cat > try.c <<EOP
16802 #include <stdio.h>
16803 #include <sys/types.h>
16804 #include <signal.h>
16805 #$i_stdlib I_STDLIB
16806 #ifdef I_STDLIB
16807 #include <stdlib.h>
16808 #endif
16809 int main()
16810 {
16811     struct sigaction act, oact;
16812     act.sa_flags = 0;
16813     oact.sa_handler = 0;
16814     /* so that act and oact are used */
16815     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16816 }
16817 EOP
16818         set try
16819         if eval $compile_ok; then
16820                 val="$define"
16821         else
16822                 echo "But you don't seem to have a useable struct sigaction." >&4
16823                 val="$undef"
16824         fi
16825 else
16826         echo 'sigaction NOT found.' >&4
16827         val="$undef"
16828 fi
16829 set d_sigaction; eval $setvar
16830 $rm -f try try$_o try.c
16831
16832 : see if sigprocmask exists
16833 set sigprocmask d_sigprocmask
16834 eval $inlibc
16835
16836 : see if sigsetjmp exists
16837 echo " "
16838 case "$d_sigsetjmp" in
16839 '')
16840         $cat >try.c <<EOP
16841 #include <setjmp.h>
16842 #$i_stdlib I_STDLIB
16843 #ifdef I_STDLIB
16844 #include <stdlib.h>
16845 #endif
16846 sigjmp_buf env;
16847 int set = 1;
16848 int main()
16849 {
16850         if (sigsetjmp(env,1))
16851                 exit(set);
16852         set = 0;
16853         siglongjmp(env, 1);
16854         exit(1);
16855 }
16856 EOP
16857         set try
16858         if eval $compile; then
16859                 if $run ./try >/dev/null 2>&1; then
16860                         echo "POSIX sigsetjmp found." >&4
16861                         val="$define"
16862                 else
16863                         $cat >&4 <<EOM
16864 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16865 I'll ignore them.
16866 EOM
16867                         val="$undef"
16868                 fi
16869         else
16870                 echo "sigsetjmp not found." >&4
16871                 val="$undef"
16872         fi
16873         ;;
16874 *) val="$d_sigsetjmp"
16875         case "$d_sigsetjmp" in
16876         $define) echo "POSIX sigsetjmp found." >&4;;
16877         $undef) echo "sigsetjmp not found." >&4;;
16878         esac
16879         ;;
16880 esac
16881 set d_sigsetjmp
16882 eval $setvar
16883 $rm -f try.c try
16884
16885 : see if snprintf exists
16886 set snprintf d_snprintf
16887 eval $inlibc
16888
16889 : see if vsnprintf exists
16890 set vsnprintf d_vsnprintf
16891 eval $inlibc
16892
16893 case "$d_snprintf-$d_vsnprintf" in
16894 "$define-$define")
16895     $cat <<EOM
16896 Checking whether your snprintf() and vsnprintf() work okay...
16897 EOM
16898     $cat >try.c <<'EOCP'
16899 /* v?snprintf testing logic courtesy of Russ Allbery.
16900  * According to C99:
16901  * - if the buffer is too short it still must be \0-terminated
16902  * - if the buffer is too short the potentially required length
16903  *   must be returned and not -1
16904  * - if the buffer is NULL the potentially required length
16905  *   must be returned and not -1 or core dump
16906  */
16907 #include <stdio.h>
16908 #include <stdarg.h>
16909
16910 char buf[2];
16911
16912 int test (char *format, ...)
16913 {
16914     va_list args;
16915     int count;
16916
16917     va_start (args, format);
16918     count = vsnprintf (buf, sizeof buf, format, args);
16919     va_end (args);
16920     return count;
16921 }
16922
16923 int main ()
16924 {
16925     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16926              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16927 }
16928 EOCP
16929     set try
16930     if eval $compile; then
16931         `$run ./try`
16932         case "$?" in
16933         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16934         *) cat <<EOM >&4
16935 Your snprintf() and snprintf() don't seem to be working okay.
16936 EOM
16937            d_snprintf="$undef"
16938            d_vsnprintf="$undef"
16939            ;;
16940         esac
16941     else
16942         echo "(I can't seem to compile the test program--assuming they don't)"
16943         d_snprintf="$undef"
16944         d_vsnprintf="$undef"
16945     fi
16946     $rm -f try.* try core core.try.*
16947     ;;
16948 esac
16949
16950 : see if sockatmark exists
16951 set sockatmark d_sockatmark
16952 eval $inlibc
16953
16954 : see if prototype for sockatmark is available
16955 echo " "
16956 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16957 eval $hasproto
16958
16959 : see if socks5_init exists
16960 set socks5_init d_socks5_init
16961 eval $inlibc
16962
16963 : see if sprintf returns the length of the string in the buffer as per ANSI
16964 $echo "Checking whether sprintf returns the length of the string..." >&4
16965 $cat <<EOP >try.c
16966 #include <stdio.h>
16967 #$i_stdlib I_STDLIB
16968 #ifdef I_STDLIB
16969 #include <stdlib.h>
16970 #endif
16971 #$i_string I_STRING
16972 #ifdef I_STRING
16973 #  include <string.h>
16974 #else
16975 #  include <strings.h>
16976 #endif
16977 #$i_math I_MATH
16978 #ifdef I_MATH
16979 #include <math.h>
16980 #endif
16981
16982 char buffer[256];
16983
16984 int check (size_t expect, int test) {
16985   size_t got = strlen(buffer);
16986   if (expect == got)
16987     return 0;
16988
16989   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16990        test, buffer);
16991   exit (test);
16992 }
16993
16994 int main(int argc, char **argv) {
16995   int test = 0;
16996
16997   check(sprintf(buffer, ""), ++test);
16998   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16999   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17000
17001   return 0;
17002 }
17003 EOP
17004 set try
17005
17006 d_sprintf_returns_strlen="$undef"
17007 if eval $compile; then
17008     xxx="`$run ./try`"
17009     case "$?" in
17010         0) cat >&4 <<EOM
17011 sprintf returns the length of the string (as ANSI says it should)
17012 EOM
17013         d_sprintf_returns_strlen="$define"
17014         ;;
17015         *) cat >&4 <<EOM
17016 sprintf does not return the length of the string (how old is this system?)
17017 EOM
17018         d_sprintf_returns_strlen="$undef"
17019         ;;
17020     esac
17021 fi
17022
17023 $rm -f try.* try
17024
17025 : see if srand48_r exists
17026 set srand48_r d_srand48_r
17027 eval $inlibc
17028 case "$d_srand48_r" in
17029 "$define")
17030         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17031         case "$d_srand48_r_proto:$usethreads" in
17032         ":define")      d_srand48_r_proto=define
17033                 set d_srand48_r_proto srand48_r $hdrs
17034                 eval $hasproto ;;
17035         *)      ;;
17036         esac
17037         case "$d_srand48_r_proto" in
17038         define)
17039         case "$srand48_r_proto" in
17040         ''|0) try='int srand48_r(long, struct drand48_data*);'
17041         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17042         esac
17043         case "$srand48_r_proto" in
17044         ''|0)   d_srand48_r=undef
17045                 srand48_r_proto=0
17046                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17047         * )     case "$srand48_r_proto" in
17048                 REENTRANT_PROTO*) ;;
17049                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17050                 esac
17051                 echo "Prototype: $try" ;;
17052         esac
17053         ;;
17054         *)      case "$usethreads" in
17055                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17056                 esac
17057                 d_srand48_r=undef
17058                 srand48_r_proto=0
17059                 ;;
17060         esac
17061         ;;
17062 *)      srand48_r_proto=0
17063         ;;
17064 esac
17065
17066 : see if srandom_r exists
17067 set srandom_r d_srandom_r
17068 eval $inlibc
17069 case "$d_srandom_r" in
17070 "$define")
17071         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17072         case "$d_srandom_r_proto:$usethreads" in
17073         ":define")      d_srandom_r_proto=define
17074                 set d_srandom_r_proto srandom_r $hdrs
17075                 eval $hasproto ;;
17076         *)      ;;
17077         esac
17078         case "$d_srandom_r_proto" in
17079         define)
17080         case "$srandom_r_proto" in
17081         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17082         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17083         esac
17084         case "$srandom_r_proto" in
17085         ''|0)   d_srandom_r=undef
17086                 srandom_r_proto=0
17087                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17088         * )     case "$srandom_r_proto" in
17089                 REENTRANT_PROTO*) ;;
17090                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17091                 esac
17092                 echo "Prototype: $try" ;;
17093         esac
17094         ;;
17095         *)      case "$usethreads" in
17096                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17097                 esac
17098                 d_srandom_r=undef
17099                 srandom_r_proto=0
17100                 ;;
17101         esac
17102         ;;
17103 *)      srandom_r_proto=0
17104         ;;
17105 esac
17106
17107 : see if prototype for setresgid is available
17108 echo " "
17109 set d_sresgproto setresgid $i_unistd unistd.h
17110 eval $hasproto
17111
17112 : see if prototype for setresuid is available
17113 echo " "
17114 set d_sresuproto setresuid $i_unistd unistd.h
17115 eval $hasproto
17116
17117 : see if sys/stat.h is available
17118 set sys/stat.h i_sysstat
17119 eval $inhdr
17120
17121
17122 : see if stat knows about block sizes
17123 echo " "
17124 echo "Checking to see if your struct stat has st_blocks field..." >&4
17125 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17126 eval $hasfield
17127
17128
17129 : see if this is a sys/vfs.h system
17130 set sys/vfs.h i_sysvfs
17131 eval $inhdr
17132
17133
17134 : see if this is a sys/statfs.h system
17135 set sys/statfs.h i_sysstatfs
17136 eval $inhdr
17137
17138
17139 echo " "
17140 echo "Checking to see if your system supports struct statfs..." >&4
17141 set d_statfs_s statfs $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
17142 eval $hasstruct
17143 case "$d_statfs_s" in
17144 "$define")      echo "Yes, it does."   ;;
17145 *)              echo "No, it doesn't." ;;
17146 esac
17147
17148
17149
17150 : see if struct statfs knows about f_flags
17151 case "$d_statfs_s" in
17152 define) 
17153         echo " "
17154         echo "Checking to see if your struct statfs has f_flags field..." >&4
17155         set d_statfs_f_flags statfs f_flags $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
17156         eval $hasfield
17157         ;;
17158 *)      val="$undef"
17159         set d_statfs_f_flags
17160         eval $setvar
17161         ;;
17162 esac
17163 case "$d_statfs_f_flags" in
17164 "$define")      echo "Yes, it does."   ;;
17165 *)              echo "No, it doesn't." ;;
17166 esac
17167
17168 $cat >&4 <<EOM
17169 Checking how to access stdio streams by file descriptor number...
17170 EOM
17171 case "$stdio_stream_array" in
17172 '')     $cat >try.c <<EOCP
17173 #include <stdio.h>
17174 int main() {
17175   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17176     printf("yes\n");
17177 }
17178 EOCP
17179         for s in _iob __iob __sF
17180         do
17181                 set try -DSTDIO_STREAM_ARRAY=$s
17182                 if eval $compile; then
17183                         case "`$run ./try`" in
17184                         yes)    stdio_stream_array=$s; break ;;
17185                         esac
17186                 fi
17187         done
17188         $rm -f try.* try$exe_ext
17189 esac
17190 case "$stdio_stream_array" in
17191 '')     $cat >&4 <<EOM
17192 I can't figure out how to access stdio streams by file descriptor number.
17193 EOM
17194         d_stdio_stream_array="$undef"
17195         ;;
17196 *)      $cat >&4 <<EOM
17197 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17198 EOM
17199         d_stdio_stream_array="$define"
17200         ;;
17201 esac
17202
17203 : see if strcoll exists
17204 set strcoll d_strcoll
17205 eval $inlibc
17206
17207 : check for structure copying
17208 echo " "
17209 echo "Checking to see if your C compiler can copy structs..." >&4
17210 $cat >try.c <<'EOCP'
17211 int main()
17212 {
17213         struct blurfl {
17214                 int dyick;
17215         } foo, bar;
17216
17217         foo = bar;
17218 }
17219 EOCP
17220 if $cc -c try.c >/dev/null 2>&1 ; then
17221         val="$define"
17222         echo "Yup, it can."
17223 else
17224         val="$undef"
17225         echo "Nope, it can't."
17226 fi
17227 set d_strctcpy
17228 eval $setvar
17229 $rm -f try.*
17230
17231 : see if strerror and/or sys_errlist[] exist
17232 echo " "
17233 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17234     if set strerror val -f d_strerror; eval $csym; $val; then
17235                 echo 'strerror() found.' >&4
17236                 d_strerror="$define"
17237                 d_strerrm='strerror(e)'
17238                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17239                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17240                         d_syserrlst="$define"
17241                 else
17242                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17243                         d_syserrlst="$undef"
17244                 fi
17245     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17246                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17247                 echo 'strerror() found in string header.' >&4
17248                 d_strerror="$define"
17249                 d_strerrm='strerror(e)'
17250                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17251                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17252                                 d_syserrlst="$define"
17253                 else
17254                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17255                         d_syserrlst="$undef"
17256                 fi
17257     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17258                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17259                 d_strerror="$undef"
17260                 d_syserrlst="$define"
17261                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17262     else
17263                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17264                 d_strerror="$undef"
17265                 d_syserrlst="$undef"
17266                 d_strerrm='"unknown"'
17267     fi
17268 fi
17269
17270 : see if strerror_r exists
17271 set strerror_r d_strerror_r
17272 eval $inlibc
17273 case "$d_strerror_r" in
17274 "$define")
17275         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17276         case "$d_strerror_r_proto:$usethreads" in
17277         ":define")      d_strerror_r_proto=define
17278                 set d_strerror_r_proto strerror_r $hdrs
17279                 eval $hasproto ;;
17280         *)      ;;
17281         esac
17282         case "$d_strerror_r_proto" in
17283         define)
17284         case "$strerror_r_proto" in
17285         ''|0) try='int strerror_r(int, char*, size_t);'
17286         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17287         esac
17288         case "$strerror_r_proto" in
17289         ''|0) try='int strerror_r(int, char*, int);'
17290         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17291         esac
17292         case "$strerror_r_proto" in
17293         ''|0) try='char* strerror_r(int, char*, size_t);'
17294         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17295         esac
17296         case "$strerror_r_proto" in
17297         ''|0)   d_strerror_r=undef
17298                 strerror_r_proto=0
17299                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17300         * )     case "$strerror_r_proto" in
17301                 REENTRANT_PROTO*) ;;
17302                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17303                 esac
17304                 echo "Prototype: $try" ;;
17305         esac
17306         ;;
17307         *)      case "$usethreads" in
17308                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17309                 esac
17310                 d_strerror_r=undef
17311                 strerror_r_proto=0
17312                 ;;
17313         esac
17314         ;;
17315 *)      strerror_r_proto=0
17316         ;;
17317 esac
17318
17319 : see if strftime exists
17320 set strftime d_strftime
17321 eval $inlibc
17322
17323 : see if strlcat exists
17324 set strlcat d_strlcat
17325 eval $inlibc
17326
17327 : see if strlcpy exists
17328 set strlcpy d_strlcpy
17329 eval $inlibc
17330
17331 : see if strtod exists
17332 set strtod d_strtod
17333 eval $inlibc
17334
17335 : see if strtol exists
17336 set strtol d_strtol
17337 eval $inlibc
17338
17339 : see if strtold exists
17340 set strtold d_strtold
17341 eval $inlibc
17342
17343 : see if strtoll exists
17344 set strtoll d_strtoll
17345 eval $inlibc
17346
17347 case "$d_longlong-$d_strtoll" in
17348 "$define-$define")
17349         $cat <<EOM
17350 Checking whether your strtoll() works okay...
17351 EOM
17352         $cat >try.c <<'EOCP'
17353 #include <errno.h>
17354 #ifdef __hpux
17355 #define strtoll __strtoll
17356 #endif
17357 #ifdef __EMX__
17358 #define strtoll _strtoll
17359 #endif
17360 #include <stdio.h>
17361 extern long long int strtoll(char *s, char **, int); 
17362 static int bad = 0;
17363 int check(char *s, long long ell, int een) {
17364         long long gll;
17365         errno = 0;
17366         gll = strtoll(s, 0, 10);
17367         if (!((gll == ell) && (errno == een)))
17368                 bad++;
17369 }
17370 int main() {
17371         check(" 1",                                      1LL, 0);
17372         check(" 0",                                      0LL, 0);
17373         check("-1",                                     -1LL, 0);
17374         check("-9223372036854775808", -9223372036854775808LL, 0);
17375         check("-9223372036854775808", -9223372036854775808LL, 0);
17376         check(" 9223372036854775807",  9223372036854775807LL, 0);
17377         check("-9223372036854775808", -9223372036854775808LL, 0);
17378         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17379         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17380         if (!bad)
17381                 printf("ok\n");
17382 }
17383 EOCP
17384         set try
17385         if eval $compile; then
17386                 yyy=`$run ./try`
17387                 case "$yyy" in
17388                 ok) echo "Your strtoll() seems to be working okay." ;;
17389                 *) cat <<EOM >&4
17390 Your strtoll() doesn't seem to be working okay.
17391 EOM
17392                    d_strtoll="$undef"
17393                    ;;
17394                 esac
17395         else
17396                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17397                 d_strtoll="$undef"
17398         fi
17399         ;;
17400 esac
17401
17402 : see if strtoq exists
17403 set strtoq d_strtoq
17404 eval $inlibc
17405
17406 : see if strtoul exists
17407 set strtoul d_strtoul
17408 eval $inlibc
17409
17410 case "$d_strtoul" in
17411 "$define")
17412         $cat <<EOM
17413 Checking whether your strtoul() works okay...
17414 EOM
17415         $cat >try.c <<'EOCP'
17416 #include <errno.h>
17417 #include <stdio.h>
17418 extern unsigned long int strtoul(char *s, char **, int); 
17419 static int bad = 0;
17420 void check(char *s, unsigned long eul, int een) {
17421         unsigned long gul;
17422         errno = 0;
17423         gul = strtoul(s, 0, 10);
17424         if (!((gul == eul) && (errno == een)))
17425                 bad++;
17426 }
17427 int main() {
17428         check(" 1", 1L, 0);
17429         check(" 0", 0L, 0);
17430 EOCP
17431         case "$longsize" in
17432         8)
17433             $cat >>try.c <<'EOCP'
17434         check("18446744073709551615", 18446744073709551615UL, 0);
17435         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17436 #if 0 /* strtoul() for /^-/ strings is undefined. */
17437         check("-1", 18446744073709551615UL, 0);
17438         check("-18446744073709551614", 2, 0);
17439         check("-18446744073709551615", 1, 0);
17440         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17441         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17442 #endif
17443 EOCP
17444                 ;;
17445         4)
17446                     $cat >>try.c <<'EOCP'
17447         check("4294967295", 4294967295UL, 0);
17448         check("4294967296", 4294967295UL, ERANGE);
17449 #if 0 /* strtoul() for /^-/ strings is undefined. */
17450         check("-1", 4294967295UL, 0);
17451         check("-4294967294", 2, 0);
17452         check("-4294967295", 1, 0);
17453         check("-4294967296", 4294967295UL, ERANGE);
17454         check("-4294967297", 4294967295UL, ERANGE);
17455 #endif
17456 EOCP
17457                 ;;
17458         *)
17459 : Should we write these tests to be more portable by sprintf-ing
17460 : ~0 and then manipulating that char string as input for strtol?
17461                 ;;
17462         esac
17463         $cat >>try.c <<'EOCP'
17464         if (!bad)
17465                 printf("ok\n");
17466         return 0;
17467 }
17468 EOCP
17469         set try
17470         if eval $compile; then
17471                 case "`$run ./try`" in
17472                 ok) echo "Your strtoul() seems to be working okay." ;;
17473                 *) cat <<EOM >&4
17474 Your strtoul() doesn't seem to be working okay.
17475 EOM
17476                    d_strtoul="$undef"
17477                    ;;
17478                 esac
17479         fi
17480         ;;
17481 esac
17482
17483 : see if strtoull exists
17484 set strtoull d_strtoull
17485 eval $inlibc
17486
17487 case "$d_longlong-$d_strtoull" in
17488 "$define-$define")
17489         $cat <<EOM
17490 Checking whether your strtoull() works okay...
17491 EOM
17492         $cat >try.c <<'EOCP'
17493 #include <errno.h>
17494 #ifdef __hpux
17495 #define strtoull __strtoull
17496 #endif
17497 #include <stdio.h>
17498 extern unsigned long long int strtoull(char *s, char **, int); 
17499 static int bad = 0;
17500 int check(char *s, long long eull, int een) {
17501         long long gull;
17502         errno = 0;
17503         gull = strtoull(s, 0, 10);
17504         if (!((gull == eull) && (errno == een)))
17505                 bad++;
17506 }
17507 int main() {
17508         check(" 1",                                        1LL, 0);
17509         check(" 0",                                        0LL, 0);
17510         check("18446744073709551615",  18446744073709551615ULL, 0);
17511         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17512 #if 0 /* strtoull() for /^-/ strings is undefined. */
17513         check("-1",                    18446744073709551615ULL, 0);
17514         check("-18446744073709551614",                     2LL, 0);
17515         check("-18446744073709551615",                     1LL, 0);
17516         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17517         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17518 #endif
17519         if (!bad)
17520                 printf("ok\n");
17521 }
17522 EOCP
17523         set try
17524         if eval $compile; then
17525                 case "`$run ./try`" in
17526                 ok) echo "Your strtoull() seems to be working okay." ;;
17527                 *) cat <<EOM >&4
17528 Your strtoull() doesn't seem to be working okay.
17529 EOM
17530                    d_strtoull="$undef"
17531                    ;;
17532                 esac
17533         fi
17534         ;;
17535 esac
17536
17537 : see if strtouq exists
17538 set strtouq d_strtouq
17539 eval $inlibc
17540
17541 case "$d_strtouq" in
17542 "$define")
17543         $cat <<EOM
17544 Checking whether your strtouq() works okay...
17545 EOM
17546         $cat >try.c <<'EOCP'
17547 #include <errno.h>
17548 #include <stdio.h>
17549 extern unsigned long long int strtouq(char *s, char **, int); 
17550 static int bad = 0;
17551 void check(char *s, unsigned long long eull, int een) {
17552         unsigned long long gull;
17553         errno = 0;
17554         gull = strtouq(s, 0, 10);
17555         if (!((gull == eull) && (errno == een)))
17556                 bad++;
17557 }
17558 int main() {
17559         check(" 1",                                        1LL, 0);
17560         check(" 0",                                        0LL, 0);
17561         check("18446744073709551615",  18446744073709551615ULL, 0);
17562         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17563 #if 0 /* strtouq() for /^-/ strings is undefined. */
17564         check("-1",                    18446744073709551615ULL, 0);
17565         check("-18446744073709551614",                     2LL, 0);
17566         check("-18446744073709551615",                     1LL, 0);
17567         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17568         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17569 #endif
17570         if (!bad)
17571                 printf("ok\n");
17572         return 0;
17573 }
17574 EOCP
17575         set try
17576         if eval $compile; then
17577                 case "`$run ./try`" in
17578                 ok) echo "Your strtouq() seems to be working okay." ;;
17579                 *) cat <<EOM >&4
17580 Your strtouq() doesn't seem to be working okay.
17581 EOM
17582                    d_strtouq="$undef"
17583                    ;;
17584                 esac
17585         fi
17586         ;;
17587 esac
17588
17589 : see if strxfrm exists
17590 set strxfrm d_strxfrm
17591 eval $inlibc
17592
17593 : see if symlink exists
17594 set symlink d_symlink
17595 eval $inlibc
17596
17597 : see if syscall exists
17598 set syscall d_syscall
17599 eval $inlibc
17600
17601 : see if prototype for syscall is available
17602 echo " "
17603 set d_syscallproto syscall $i_unistd unistd.h
17604 eval $hasproto
17605
17606 : see if sysconf exists
17607 set sysconf d_sysconf
17608 eval $inlibc
17609
17610 : see if system exists
17611 set system d_system
17612 eval $inlibc
17613
17614 : see if tcgetpgrp exists
17615 set tcgetpgrp d_tcgetpgrp
17616 eval $inlibc
17617
17618 : see if tcsetpgrp exists
17619 set tcsetpgrp d_tcsetpgrp
17620 eval $inlibc
17621
17622 : see if prototype for telldir is available
17623 echo " "
17624 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17625 eval $hasproto
17626
17627 : see if time exists
17628 echo " "
17629 if test "X$d_time" = X -o X"$timetype" = X; then
17630     if set time val -f d_time; eval $csym; $val; then
17631                 echo 'time() found.' >&4
17632                 val="$define"
17633                 rp="What is the type returned by time() on this system?"
17634                 set time_t timetype long stdio.h sys/types.h
17635                 eval $typedef_ask
17636     else
17637                 echo 'time() not found, hope that will do.' >&4
17638                 val="$undef"
17639                 timetype='int';
17640     fi
17641     set d_time
17642     eval $setvar
17643 fi
17644
17645 : see if this is a sys/times.h system
17646 set sys/times.h i_systimes
17647 eval $inhdr
17648
17649 : see if times exists
17650 echo " "
17651 if set times val -f d_times; eval $csym; $val; then
17652         echo 'times() found.' >&4
17653         d_times="$define"
17654         inc=''
17655         case "$i_systimes" in
17656         "$define") inc='sys/times.h';;
17657         esac
17658         rp="What is the type returned by times() on this system?"
17659         set clock_t clocktype long stdio.h sys/types.h $inc
17660         eval $typedef_ask
17661 else
17662         echo 'times() NOT found, hope that will do.' >&4
17663         d_times="$undef"
17664         clocktype='int'
17665 fi
17666
17667 : see if tmpnam_r exists
17668 set tmpnam_r d_tmpnam_r
17669 eval $inlibc
17670 case "$d_tmpnam_r" in
17671 "$define")
17672         hdrs="$i_systypes sys/types.h define stdio.h "
17673         case "$d_tmpnam_r_proto:$usethreads" in
17674         ":define")      d_tmpnam_r_proto=define
17675                 set d_tmpnam_r_proto tmpnam_r $hdrs
17676                 eval $hasproto ;;
17677         *)      ;;
17678         esac
17679         case "$d_tmpnam_r_proto" in
17680         define)
17681         case "$tmpnam_r_proto" in
17682         ''|0) try='char* tmpnam_r(char*);'
17683         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17684         esac
17685         case "$tmpnam_r_proto" in
17686         ''|0)   d_tmpnam_r=undef
17687                 tmpnam_r_proto=0
17688                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17689         * )     case "$tmpnam_r_proto" in
17690                 REENTRANT_PROTO*) ;;
17691                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17692                 esac
17693                 echo "Prototype: $try" ;;
17694         esac
17695         ;;
17696         *)      case "$usethreads" in
17697                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17698                 esac
17699                 d_tmpnam_r=undef
17700                 tmpnam_r_proto=0
17701                 ;;
17702         esac
17703         ;;
17704 *)      tmpnam_r_proto=0
17705         ;;
17706 esac
17707
17708 : see if truncate exists
17709 set truncate d_truncate
17710 eval $inlibc
17711
17712 : see if ttyname_r exists
17713 set ttyname_r d_ttyname_r
17714 eval $inlibc
17715 case "$d_ttyname_r" in
17716 "$define")
17717         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17718         case "$d_ttyname_r_proto:$usethreads" in
17719         ":define")      d_ttyname_r_proto=define
17720                 set d_ttyname_r_proto ttyname_r $hdrs
17721                 eval $hasproto ;;
17722         *)      ;;
17723         esac
17724         case "$d_ttyname_r_proto" in
17725         define)
17726         case "$ttyname_r_proto" in
17727         ''|0) try='int ttyname_r(int, char*, size_t);'
17728         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17729         esac
17730         case "$ttyname_r_proto" in
17731         ''|0) try='int ttyname_r(int, char*, int);'
17732         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17733         esac
17734         case "$ttyname_r_proto" in
17735         ''|0) try='char* ttyname_r(int, char*, int);'
17736         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17737         esac
17738         case "$ttyname_r_proto" in
17739         ''|0)   d_ttyname_r=undef
17740                 ttyname_r_proto=0
17741                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17742         * )     case "$ttyname_r_proto" in
17743                 REENTRANT_PROTO*) ;;
17744                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17745                 esac
17746                 echo "Prototype: $try" ;;
17747         esac
17748         ;;
17749         *)      case "$usethreads" in
17750                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17751                 esac
17752                 d_ttyname_r=undef
17753                 ttyname_r_proto=0
17754                 ;;
17755         esac
17756         ;;
17757 *)      ttyname_r_proto=0
17758         ;;
17759 esac
17760
17761 : see if tzname[] exists
17762 echo " "
17763 if set tzname val -a d_tzname; eval $csym; $val; then
17764         val="$define"
17765         echo 'tzname[] found.' >&4
17766 else
17767         val="$undef"
17768         echo 'tzname[] NOT found.' >&4
17769 fi
17770 set d_tzname
17771 eval $setvar
17772
17773 case "$osname" in
17774 next|rhapsody|darwin) multiarch="$define" ;;
17775 esac
17776 case "$multiarch" in
17777 ''|[nN]*) multiarch="$undef" ;;
17778 esac
17779
17780 : check for ordering of bytes in a UV
17781 echo " "
17782 case "$usecrosscompile$multiarch" in
17783 *$define*)
17784         $cat <<EOM
17785 You seem to be either cross-compiling or doing a multiarchitecture build,
17786 skipping the byteorder check.
17787
17788 EOM
17789         byteorder='ffff'
17790         ;;
17791 *)
17792         case "$byteorder" in
17793         '')
17794                 $cat <<'EOM'
17795 In the following, larger digits indicate more significance.  A big-endian
17796 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17797 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17798 machines may have weird orders like 3412.  A Cray will report 87654321,
17799 an Alpha will report 12345678. If the test program works the default is
17800 probably right.
17801 I'm now running the test program...
17802 EOM
17803                 $cat >try.c <<EOCP
17804 #include <stdio.h>
17805 #$i_stdlib I_STDLIB
17806 #ifdef I_STDLIB
17807 #include <stdlib.h>
17808 #endif
17809 #include <sys/types.h>
17810 typedef $uvtype UV;
17811 int main()
17812 {
17813         int i;
17814         union {
17815                 UV l;
17816                 char c[$uvsize];
17817         } u;
17818
17819         if ($uvsize > 4)
17820                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17821         else
17822                 u.l = (UV)0x04030201;
17823         for (i = 0; i < $uvsize; i++)
17824                 printf("%c", u.c[i]+'0');
17825         printf("\n");
17826         exit(0);
17827 }
17828 EOCP
17829                 xxx_prompt=y
17830                 set try
17831                 if eval $compile && ./try > /dev/null; then
17832                         dflt=`$run ./try`
17833                         case "$dflt" in
17834                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17835                                 echo "(The test program ran ok.)"
17836                                 echo "byteorder=$dflt"
17837                                 xxx_prompt=n
17838                         ;;
17839                         ????|????????) echo "(The test program ran ok.)" ;;
17840                         *) echo "(The test program didn't run right for some reason.)" ;;
17841                         esac
17842                 else
17843                         dflt='4321'
17844                         cat <<'EOM'
17845 (I can't seem to compile the test program.  Guessing big-endian...)
17846 EOM
17847                 fi
17848                 case "$xxx_prompt" in
17849                 y)
17850                         rp="What is the order of bytes in $uvtype?"
17851                         . ./myread
17852                         byteorder="$ans"
17853                         ;;
17854                 *)      byteorder=$dflt
17855                         ;;
17856                 esac
17857                 ;;
17858         esac
17859         $rm -f try.c try
17860         ;;
17861 esac
17862
17863
17864 $cat <<EOM
17865
17866 Checking to see whether you can access character data unalignedly...
17867 EOM
17868 case "$d_u32align" in
17869 '')   $cat >try.c <<EOCP
17870 #include <stdio.h>
17871 #$i_stdlib I_STDLIB
17872 #ifdef I_STDLIB
17873 #include <stdlib.h>
17874 #endif
17875 #define U32 $u32type
17876 #define BYTEORDER 0x$byteorder
17877 #define U8 $u8type
17878 #include <signal.h>
17879 #ifdef SIGBUS
17880 $signal_t bletch(int s) { exit(4); }
17881 #endif
17882 int main() {
17883 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17884     U8 buf[8];
17885     U32 *up;
17886     int i;
17887
17888     if (sizeof(U32) != 4) {
17889         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17890         exit(1);
17891     }
17892
17893     fflush(stdout);
17894
17895 #ifdef SIGBUS
17896     signal(SIGBUS, bletch);
17897 #endif
17898
17899     buf[0] = 0;
17900     buf[1] = 0;
17901     buf[2] = 0;
17902     buf[3] = 1;
17903     buf[4] = 0;
17904     buf[5] = 0;
17905     buf[6] = 0;
17906     buf[7] = 1;
17907
17908     for (i = 0; i < 4; i++) {
17909         up = (U32*)(buf + i);
17910         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17911                (*up == 1 << (8*(3-i)))  /* little-endian */
17912               )
17913            )
17914         {
17915             printf("read failed (%x)\n", *up);
17916             exit(2);
17917         }
17918     }
17919
17920     /* write test */
17921     for (i = 0; i < 4; i++) {
17922         up = (U32*)(buf + i);
17923         *up = 0xBeef;
17924         if (*up != 0xBeef) {
17925             printf("write failed (%x)\n", *up);
17926             exit(3);
17927         }
17928     }
17929
17930     exit(0);
17931 #else
17932     printf("1\n");
17933     exit(1);
17934 #endif
17935     return 0;
17936 }
17937 EOCP
17938 set try
17939 if eval $compile_ok; then
17940         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17941         $run ./try 2>&1 >/dev/null
17942         case "$?" in
17943         0)      cat >&4 <<EOM
17944 You can access character data pretty unalignedly.
17945 EOM
17946                 d_u32align="$undef"
17947                 ;;
17948         *)      cat >&4 <<EOM
17949 It seems that you must access character data in an aligned manner.
17950 EOM
17951                 d_u32align="$define"
17952                 ;;
17953         esac
17954 else
17955         rp='Can you access character data at unaligned addresses?'
17956         dflt='n'
17957         . ./myread
17958         case "$ans" in
17959         [yY]*)  d_u32align="$undef"  ;;
17960         *)      d_u32align="$define" ;;
17961         esac
17962 fi
17963 $rm -f core core.try.* try.core
17964 ;;
17965 esac
17966
17967 : see if ualarm exists
17968 set ualarm d_ualarm
17969 eval $inlibc
17970
17971 : see if umask exists
17972 set umask d_umask
17973 eval $inlibc
17974
17975 : see if unordered exists
17976 set unordered d_unordered
17977 eval $inlibc
17978
17979 : see if unsetenv exists
17980 set unsetenv d_unsetenv
17981 eval $inlibc
17982
17983 : see if usleep exists
17984 set usleep d_usleep
17985 eval $inlibc
17986
17987 : see if prototype for usleep is available
17988 echo " "
17989 set d_usleepproto usleep $i_unistd unistd.h
17990 eval $hasproto
17991
17992 : see if ustat exists
17993 set ustat d_ustat
17994 eval $inlibc
17995
17996 : backward compatibility for d_hvfork
17997 if test X$d_hvfork != X; then
17998         d_vfork="$d_hvfork"
17999         d_hvfork=''
18000 fi
18001 : see if there is a vfork
18002 val=''
18003 set vfork val
18004 eval $inlibc
18005
18006 : Ok, but do we want to use it. vfork is reportedly unreliable in 
18007 : perl on Solaris 2.x, and probably elsewhere.
18008 case "$val" in
18009 $define)
18010         echo " "
18011         case "$usevfork" in
18012         false) dflt='n';;
18013         *) dflt='y';;
18014         esac
18015         cat <<'EOM'
18016  
18017 Perl can only use a vfork() that doesn't suffer from strict
18018 restrictions on calling functions or modifying global data in
18019 the child.  For example, glibc-2.1 contains such a vfork()
18020 that is unsuitable.  If your system provides a proper fork()
18021 call, chances are that you do NOT want perl to use vfork().
18022
18023 EOM
18024         rp="Do you still want to use vfork()?"
18025         . ./myread
18026         case "$ans" in
18027         y|Y) ;;
18028         *)
18029                 echo "Ok, we won't use vfork()."
18030                 val="$undef"
18031                 ;;
18032         esac
18033         ;;
18034 esac
18035 set d_vfork
18036 eval $setvar
18037 case "$d_vfork" in
18038 $define) usevfork='true';;
18039 *) usevfork='false';;
18040 esac
18041
18042 : see if closedir exists
18043 set closedir d_closedir
18044 eval $inlibc
18045
18046 case "$d_closedir" in
18047 "$define")
18048         echo " "
18049         echo "Checking whether closedir() returns a status..." >&4
18050         cat > try.c <<EOM
18051 #$i_dirent I_DIRENT             /**/
18052 #$i_sysdir I_SYS_DIR            /**/
18053 #$i_sysndir I_SYS_NDIR          /**/
18054 #$i_systypes I_SYS_TYPES        /**/
18055
18056 #if defined(I_SYS_TYPES)
18057 #include <sys/types.h>
18058 #endif
18059 #if defined(I_DIRENT)
18060 #include <dirent.h>
18061 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18062 #include <sys/dir.h>
18063 #endif
18064 #else
18065 #ifdef I_SYS_NDIR
18066 #include <sys/ndir.h>
18067 #else
18068 #ifdef I_SYS_DIR
18069 #ifdef hp9000s500
18070 #include <ndir.h>       /* may be wrong in the future */
18071 #else
18072 #include <sys/dir.h>
18073 #endif
18074 #endif
18075 #endif
18076 #endif 
18077 int main() { return closedir(opendir(".")); }
18078 EOM
18079         set try
18080         if eval $compile_ok; then
18081                 if $run ./try > /dev/null 2>&1 ; then
18082                         echo "Yes, it does."
18083                         val="$undef"
18084                 else
18085                         echo "No, it doesn't."
18086                         val="$define"
18087                 fi
18088         else
18089                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18090                 val="$define"
18091         fi
18092         ;;
18093 *)
18094         val="$undef";
18095         ;;
18096 esac
18097 set d_void_closedir
18098 eval $setvar
18099 $rm -f try try.*
18100 : see if there is a wait4
18101 set wait4 d_wait4
18102 eval $inlibc
18103
18104 : see if waitpid exists
18105 set waitpid d_waitpid
18106 eval $inlibc
18107
18108 : see if wcstombs exists
18109 set wcstombs d_wcstombs
18110 eval $inlibc
18111
18112 : see if wctomb exists
18113 set wctomb d_wctomb
18114 eval $inlibc
18115
18116 : see if writev exists
18117 set writev d_writev
18118 eval $inlibc
18119
18120 : preserve RCS keywords in files with variable substitution, grrr
18121 Date='$Date'
18122 Id='$Id'
18123 Log='$Log'
18124 RCSfile='$RCSfile'
18125 Revision='$Revision'
18126
18127 : check for alignment requirements
18128 echo " "
18129 case "$usecrosscompile$multiarch" in
18130 *$define*)
18131         $cat <<EOM
18132 You seem to be either cross-compiling or doing a multiarchitecture build,
18133 skipping the memory alignment check.
18134
18135 EOM
18136         case "$alignbytes" in
18137         '') alignbytes=8 ;;
18138         esac
18139         ;;
18140 *)
18141         case "$alignbytes" in
18142         '') echo "Checking alignment constraints..." >&4
18143                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18144                         $cat >try.c <<'EOCP'
18145 typedef long double NV;
18146 EOCP
18147                 else
18148                         $cat >try.c <<'EOCP'
18149 typedef double NV;
18150 EOCP
18151                 fi
18152                 $cat >>try.c <<'EOCP'
18153 #include <stdio.h>
18154 struct foobar {
18155         char foo;
18156         NV bar;
18157 } try_algn;
18158 int main()
18159 {
18160     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18161     return(0);
18162 }
18163 EOCP
18164                 set try
18165                 if eval $compile_ok; then
18166                         dflt=`$run ./try`
18167                 else
18168                         dflt='8'
18169                         echo "(I can't seem to compile the test program...)"
18170                 fi
18171                 ;;
18172         *) dflt="$alignbytes"
18173                 ;;
18174         esac
18175         rp="Doubles must be aligned on a how-many-byte boundary?"
18176         . ./myread
18177         alignbytes="$ans"
18178         $rm -f try.c try
18179         ;;
18180 esac
18181
18182
18183 : set the base revision
18184 baserev=5.0
18185
18186 : how do we concatenate cpp tokens here?
18187 echo " "
18188 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18189 $cat >cpp_stuff.c <<'EOCP'
18190 #define RCAT(a,b)a/**/b
18191 #define ACAT(a,b)a ## b
18192 RCAT(Rei,ser)
18193 ACAT(Cir,cus)
18194 EOCP
18195 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18196 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18197         echo "Oh!  Smells like ANSI's been here." >&4
18198         echo "We can catify or stringify, separately or together!"
18199         cpp_stuff=42
18200 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18201         echo "Ah, yes!  The good old days!" >&4
18202         echo "However, in the good old days we don't know how to stringify and"
18203         echo "catify at the same time."
18204         cpp_stuff=1
18205 else
18206         $cat >&4 <<EOM
18207 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18208 You're going to have to edit the values of CAT[2-5] in config.h...
18209 EOM
18210         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18211 fi
18212 $rm -f cpp_stuff.*
18213
18214 : see if this is a db.h system
18215 set db.h i_db
18216 eval $inhdr
18217
18218 case "$i_db" in
18219 $define)
18220         : Check db version.
18221         echo " "
18222         echo "Checking Berkeley DB version ..." >&4
18223         $cat >try.c <<EOCP
18224 #$d_const HASCONST
18225 #ifndef HASCONST
18226 #define const
18227 #endif
18228 #include <sys/types.h>
18229 #include <stdio.h>
18230 #$i_stdlib I_STDLIB
18231 #ifdef I_STDLIB
18232 #include <stdlib.h>
18233 #endif
18234 #include <db.h>
18235 int main(int argc, char *argv[])
18236 {
18237 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18238     int Major, Minor, Patch ;
18239     unsigned long Version ;
18240     (void)db_version(&Major, &Minor, &Patch) ;
18241     if (argc == 2) {
18242         printf("%d %d %d %d %d %d\n",
18243                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18244                Major, Minor, Patch);
18245         exit(0);
18246     }
18247     printf("You have Berkeley DB Version 2 or greater.\n");
18248
18249     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18250                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18251     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18252                 Major, Minor, Patch) ;
18253
18254     /* check that db.h & libdb are compatible */
18255     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18256         printf("db.h and libdb are incompatible.\n") ;
18257         exit(3);        
18258     }
18259
18260     printf("db.h and libdb are compatible.\n") ;
18261
18262     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18263                 + DB_VERSION_PATCH ;
18264
18265     /* needs to be >= 2.3.4 */
18266     if (Version < 2003004) {
18267     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18268         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18269         exit(2);        
18270     }
18271
18272     exit(0);
18273 #else
18274 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18275     if (argc == 2) {
18276         printf("1 0 0\n");
18277         exit(0);
18278     }
18279     printf("You have Berkeley DB Version 1.\n");
18280     exit(0);    /* DB version < 2: the coast is clear. */
18281 #else
18282     exit(1);    /* <db.h> not Berkeley DB? */
18283 #endif
18284 #endif
18285 }
18286 EOCP
18287         set try
18288         if eval $compile_ok && $run ./try; then
18289                 echo 'Looks OK.' >&4
18290                 set `$run ./try 1`
18291                 db_version_major=$1
18292                 db_version_minor=$2
18293                 db_version_patch=$3
18294         else
18295                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18296                 i_db=$undef
18297                 case " $libs " in
18298                 *"-ldb "*)
18299                         : Remove db from list of libraries to use
18300                         echo "Removing unusable -ldb from library list" >&4
18301                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18302                         shift
18303                         libs="$*"
18304                         echo "libs = $libs" >&4
18305                         ;;
18306                 esac
18307         fi
18308         $rm -f try.*
18309         ;;
18310 esac
18311
18312 case "$i_db" in
18313 define)
18314         : Check the return type needed for hash 
18315         echo " "
18316         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18317         $cat >try.c <<EOCP
18318 #$d_const HASCONST
18319 #ifndef HASCONST
18320 #define const
18321 #endif
18322 #include <sys/types.h>
18323 #include <db.h>
18324
18325 #ifndef DB_VERSION_MAJOR
18326 u_int32_t hash_cb (ptr, size)
18327 const void *ptr;
18328 size_t size;
18329 {
18330 }
18331 HASHINFO info;
18332 int main()
18333 {
18334         info.hash = hash_cb;
18335 }
18336 #endif
18337 EOCP
18338         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18339                 if $contains warning try.out >>/dev/null 2>&1 ; then
18340                         db_hashtype='int'
18341                 else
18342                         db_hashtype='u_int32_t'
18343                 fi
18344         else
18345                 : XXX Maybe we should just give up here.
18346                 db_hashtype=u_int32_t
18347                 $cat try.out >&4
18348                 echo "Help:  I can't seem to compile the db test program." >&4
18349                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18350         fi
18351         $rm -f try.*
18352         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18353         ;;
18354 *)      db_hashtype=u_int32_t
18355         ;;
18356 esac
18357 case "$i_db" in
18358 define)
18359         : Check the return type needed for prefix 
18360         echo " "
18361         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18362         cat >try.c <<EOCP
18363 #$d_const HASCONST
18364 #ifndef HASCONST
18365 #define const
18366 #endif
18367 #include <sys/types.h>
18368 #include <db.h>
18369
18370 #ifndef DB_VERSION_MAJOR
18371 size_t prefix_cb (key1, key2)
18372 const DBT *key1;
18373 const DBT *key2;
18374 {
18375 }
18376 BTREEINFO info;
18377 int main()
18378 {
18379         info.prefix = prefix_cb;
18380 }
18381 #endif
18382 EOCP
18383         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18384                 if $contains warning try.out >>/dev/null 2>&1 ; then
18385                         db_prefixtype='int'
18386                 else
18387                         db_prefixtype='size_t'
18388                 fi
18389         else
18390                 db_prefixtype='size_t'
18391                 : XXX Maybe we should just give up here.
18392                 $cat try.out >&4
18393                 echo "Help:  I can't seem to compile the db test program." >&4
18394                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18395         fi
18396         $rm -f try.*
18397         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18398         ;;
18399 *)      db_prefixtype='size_t'
18400         ;;
18401 esac
18402
18403
18404 : How can we generate normalized random numbers ?
18405 echo " "
18406 echo "Looking for a random number function..." >&4
18407 case "$randfunc" in
18408 '')
18409         if set drand48 val -f; eval $csym; $val; then
18410                 dflt="drand48"
18411                 echo "Good, found drand48()." >&4
18412         elif set random val -f; eval $csym; $val; then
18413                 dflt="random"
18414                 echo "OK, found random()." >&4
18415         else
18416                 dflt="rand"
18417                 echo "Yick, looks like I have to use rand()." >&4
18418         fi
18419         echo " "
18420         ;;
18421 *)
18422         dflt="$randfunc"
18423         ;;
18424 esac
18425 cont=true
18426
18427 case "$ccflags" in
18428 *-Dmy_rand=*|*-Dmy_srand=*)
18429         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18430         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18431         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18432         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18433         ;;
18434 esac
18435
18436 while $test "$cont"; do
18437         rp="Use which function to generate random numbers?"
18438         . ./myread
18439         if $test "$ans" = "$dflt"; then
18440                 : null
18441         else
18442                 randbits=''
18443         fi
18444         randfunc="$ans"
18445         if set $ans val -f; eval $csym; $val; then
18446                 cont=''
18447         else
18448                 dflt=y
18449                 rp="I cannot find function $ans. Use that name anyway?"
18450                 . ./myread
18451                 dflt=rand
18452                 case "$ans" in
18453                         [yY]*) cont='';;
18454                 esac
18455         fi
18456         case "$cont" in
18457         '')
18458                 case "$randfunc" in
18459                 drand48)
18460                         drand01="drand48()"
18461                         seedfunc="srand48"
18462                         randbits=48
18463                         randseedtype=long
18464                         ;;
18465                 rand|random)
18466                         case "$randbits" in
18467                         '')
18468 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18469                                 $cat >try.c <<EOCP
18470 #$i_unistd I_UNISTD
18471 #$i_stdlib I_STDLIB
18472 #include <stdio.h>
18473 #ifdef I_UNISTD
18474 #  include <unistd.h>
18475 #endif
18476 #ifdef I_STDLIB
18477 #  include <stdlib.h>
18478 #endif
18479 int main()
18480 {
18481         register int i;
18482         register unsigned long tmp;
18483         register unsigned long max = 0L;
18484
18485         for (i = 1000; i; i--) {
18486                 tmp = (unsigned long) $randfunc();
18487                 if (tmp > max) max = tmp;
18488         }
18489         for (i = 0; max; i++)
18490                 max /= 2;
18491         printf("%d\n",i);
18492 }
18493 EOCP
18494                                 set try
18495                                 if eval $compile_ok; then
18496                                         dflt=`try`
18497                                 else
18498                                         dflt='?'
18499                                         echo "(I can't seem to compile the test program...)"
18500                                 fi
18501                                 ;;
18502                         *)
18503                                 dflt="$randbits"
18504                                 ;;
18505                         esac
18506                         rp="How many bits does your $randfunc() function produce?"
18507                         . ./myread
18508                         randbits="$ans"
18509                         $rm -f try.c try
18510                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18511                         seedfunc="s$randfunc"
18512                         randseedtype=unsigned
18513                         ;;
18514                 *)
18515                         dflt="31"
18516                         rp="How many bits does your $randfunc() function produce?"
18517                         . ./myread
18518                         randbits="$ans"
18519                         seedfunc="s$randfunc"
18520                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18521                         if set $seedfunc val -f; eval $csym; $val; then
18522                                 echo "(Using $seedfunc() to seed random generator)"
18523                         else
18524                                 echo "(Warning: no $seedfunc() to seed random generator)"
18525                                 seedfunc=rand
18526                         fi
18527                         randseedtype=unsigned
18528                         ;;
18529                 esac
18530                 ;;
18531         esac
18532 done
18533
18534 echo " "
18535 echo "Determining whether or not we are on an EBCDIC system..." >&4
18536 $cat >try.c <<'EOM'
18537 int main()
18538 {
18539   if ('M'==0xd4) return 0;
18540   return 1;
18541 }
18542 EOM
18543
18544 val=$undef
18545 set try
18546 if eval $compile_ok; then
18547         if $run ./try; then
18548                 echo "You seem to speak EBCDIC." >&4
18549                 val="$define"
18550         else
18551                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18552         fi
18553 else
18554         echo "I'm unable to compile the test program." >&4
18555         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18556 fi
18557 $rm -f try try.*
18558 set ebcdic
18559 eval $setvar
18560
18561 echo " "
18562 $cat >&4 <<EOM
18563 Checking how to flush all pending stdio output...
18564 EOM
18565 # I only know how to find the first 32 possibly open files on SunOS.
18566 # See also hints/sunos_4_1.sh and util.c  --AD
18567 case "$osname" in
18568 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18569 esac
18570 $cat >>try.c <<EOCP
18571 #include <stdio.h>
18572 #$i_stdlib I_STDLIB
18573 #ifdef I_STDLIB
18574 #include <stdlib.h>
18575 #endif
18576 #$i_unistd I_UNISTD
18577 #ifdef I_UNISTD
18578 # include <unistd.h>
18579 #endif
18580 #$d_sysconf HAS_SYSCONF
18581 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18582 #ifdef HAS_STDIO_STREAM_ARRAY
18583 # define STDIO_STREAM_ARRAY $stdio_stream_array
18584 #endif
18585 int main() {
18586   FILE* p;
18587   unlink("try.out");
18588   p = fopen("try.out", "w");
18589 #ifdef TRY_FPUTC
18590   fputc('x', p);
18591 #else
18592 # ifdef TRY_FPRINTF
18593   fprintf(p, "x");
18594 # endif
18595 #endif
18596 #ifdef TRY_FFLUSH_NULL
18597   fflush(NULL);
18598 #endif
18599 #ifdef TRY_FFLUSH_ALL
18600   {
18601     long open_max = -1;
18602 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18603     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18604 # else
18605 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18606     open_max = sysconf(_SC_OPEN_MAX);
18607 #  else
18608 #   ifdef FOPEN_MAX
18609     open_max = FOPEN_MAX;
18610 #   else
18611 #    ifdef OPEN_MAX
18612     open_max = OPEN_MAX;
18613 #    else
18614 #     ifdef _NFILE
18615     open_max = _NFILE;
18616 #     endif
18617 #    endif
18618 #   endif
18619 #  endif
18620 # endif 
18621 # ifdef HAS_STDIO_STREAM_ARRAY
18622     if (open_max > 0) {
18623       long i;
18624       for (i = 0; i < open_max; i++)
18625             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18626                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18627                 STDIO_STREAM_ARRAY[i]._flag)
18628                 fflush(&STDIO_STREAM_ARRAY[i]);
18629     }   
18630   }
18631 # endif
18632 #endif
18633   _exit(42);
18634 }
18635 EOCP
18636 : first we have to find out how _not_ to flush
18637 $to try.c
18638 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18639     output=''
18640     set try -DTRY_FPUTC
18641     if eval $compile; then
18642             $run ./try 2>/dev/null
18643             code="$?"
18644             $from try.out
18645             if $test ! -s try.out -a "X$code" = X42; then
18646                 output=-DTRY_FPUTC
18647             fi
18648     fi
18649     case "$output" in
18650     '')
18651             set try -DTRY_FPRINTF
18652             if eval $compile; then
18653                     $run ./try 2>/dev/null
18654                     code="$?"
18655                     $from try.out
18656                     if $test ! -s try.out -a "X$code" = X42; then
18657                         output=-DTRY_FPRINTF
18658                     fi
18659             fi
18660         ;;
18661     esac
18662 fi
18663 : check for fflush NULL behaviour
18664 case "$fflushNULL" in
18665 '')     set try -DTRY_FFLUSH_NULL $output
18666         if eval $compile; then
18667                 $run ./try 2>/dev/null
18668                 code="$?"
18669                 $from try.out
18670                 if $test -s try.out -a "X$code" = X42; then
18671                         fflushNULL="`$cat try.out`"
18672                 else
18673                         if $test "X$code" != X42; then
18674                                 $cat >&4 <<EOM
18675 (If this test failed, don't worry, we'll try another method shortly.)
18676 EOM
18677                         fi
18678                 fi
18679         fi
18680         $rm -f core try.core core.try.*
18681         case "$fflushNULL" in
18682         x)      $cat >&4 <<EOM
18683 Your fflush(NULL) works okay for output streams.
18684 Let's see if it clobbers input pipes...
18685 EOM
18686 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18687 # bug that improperly flushes the input end of pipes.  So we avoid the
18688 # autoflush on fork/system/exec support for now. :-(
18689 $cat >tryp.c <<EOCP
18690 #include <stdio.h>
18691 int
18692 main(int argc, char **argv)
18693 {
18694     char buf[1024];
18695     int i;
18696     char *bp = buf;
18697     while (1) {
18698         while ((i = getc(stdin)) != -1
18699                && (*bp++ = i) != '\n'
18700                && bp < &buf[1024])
18701         /* DO NOTHING */ ;
18702         *bp = '\0';
18703         fprintf(stdout, "%s", buf);
18704         fflush(NULL);
18705         if (i == -1)
18706             return 0;
18707         bp = buf;
18708     }
18709 }
18710 EOCP
18711                 fflushNULL="$define"
18712                 set tryp
18713                 if eval $compile; then
18714                     $rm -f tryp.out
18715                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18716                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18717                        $cat >&4 <<EOM
18718 fflush(NULL) seems to behave okay with input streams.
18719 EOM
18720                         fflushNULL="$define"
18721                     else
18722                         $cat >&4 <<EOM
18723 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18724 EOM
18725                         fflushNULL="$undef"
18726                     fi
18727                 fi
18728                 $rm -f core tryp.c tryp.core core.tryp.*
18729                 ;;
18730         '')     $cat >&4 <<EOM
18731 Your fflush(NULL) isn't working (contrary to ANSI C).
18732 EOM
18733                 fflushNULL="$undef"
18734                 ;;
18735         *)      $cat >&4 <<EOM
18736 Cannot figure out whether your fflush(NULL) works or not.
18737 I'm assuming it doesn't (contrary to ANSI C).
18738 EOM
18739                 fflushNULL="$undef"
18740                 ;;
18741         esac
18742         ;;
18743 $define|true|[yY]*)
18744         fflushNULL="$define"
18745         ;;
18746 *)
18747         fflushNULL="$undef"
18748         ;;
18749 esac
18750 : check explicit looping only if NULL did not work, and if the pipe
18751 : bug does not show up on an explicit flush too
18752 case "$fflushNULL" in
18753 "$undef")
18754         $cat >tryp.c <<EOCP
18755 #include <stdio.h>
18756 int
18757 main(int argc, char **argv)
18758 {
18759     char buf[1024];
18760     int i;
18761     char *bp = buf;
18762     while (1) {
18763         while ((i = getc(stdin)) != -1
18764                && (*bp++ = i) != '\n'
18765                && bp < &buf[1024])
18766         /* DO NOTHING */ ;
18767         *bp = '\0';
18768         fprintf(stdout, "%s", buf);
18769         fflush(stdin);
18770         if (i == -1)
18771             return 0;
18772         bp = buf;
18773     }
18774 }
18775 EOCP
18776         set tryp
18777         if eval $compile; then
18778             $rm -f tryp.out
18779             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18780             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18781                $cat >&4 <<EOM
18782 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18783 EOM
18784                 : now check for fflushall behaviour
18785                 case "$fflushall" in
18786                 '')     set try -DTRY_FFLUSH_ALL $output
18787                         if eval $compile; then
18788                                 $cat >&4 <<EOM
18789 (Now testing the other method--but note that this also may fail.)
18790 EOM
18791                                 $run ./try 2>/dev/null
18792                                 code=$?
18793                                 $from try.out
18794                                 if $test -s try.out -a "X$code" = X42; then
18795                                         fflushall="`$cat try.out`"
18796                                 fi
18797                         fi
18798                         $rm -f core try.core core.try.*
18799                         case "$fflushall" in
18800                         x)      $cat >&4 <<EOM
18801 Whew. Flushing explicitly all the stdio streams works.
18802 EOM
18803                                 fflushall="$define"
18804                                 ;;
18805                         '')     $cat >&4 <<EOM
18806 Sigh. Flushing explicitly all the stdio streams doesn't work.
18807 EOM
18808                                 fflushall="$undef"
18809                                 ;;
18810                         *)      $cat >&4 <<EOM
18811 Cannot figure out whether flushing stdio streams explicitly works or not.
18812 I'm assuming it doesn't.
18813 EOM
18814                                 fflushall="$undef"
18815                                 ;;
18816                         esac
18817                         ;;
18818                 "$define"|true|[yY]*)
18819                         fflushall="$define"
18820                         ;;
18821                 *)
18822                         fflushall="$undef"
18823                         ;;
18824                 esac
18825             else
18826                 $cat >&4 <<EOM
18827 All is futile.  Even fflush(stdin) clobbers input pipes!
18828 EOM
18829                 fflushall="$undef"
18830             fi
18831         else
18832             fflushall="$undef"
18833         fi
18834         $rm -f core tryp.c tryp.core core.tryp.*
18835         ;;
18836 *)      fflushall="$undef"
18837         ;;
18838 esac
18839
18840 case "$fflushNULL$fflushall" in
18841 undefundef)
18842         $cat <<EOM
18843 OK, I give up.  I cannot figure out how to flush pending stdio output.
18844 We won't be flushing handles at all before fork/exec/popen.
18845 EOM
18846         ;;
18847 esac
18848 $rm -f try.* try$exe_ext
18849
18850 : Store the full pathname to the ar program for use in the C program
18851 : Respect a hint or command line value for full_ar.
18852 case "$full_ar" in
18853 '') full_ar=$ar ;;
18854 esac
18855
18856 : Store the full pathname to the sed program for use in the C program
18857 full_sed=$sed
18858
18859 : see what type gids are declared as in the kernel
18860 echo " "
18861 echo "Looking for the type for group ids returned by getgid()."
18862 set gid_t gidtype xxx stdio.h sys/types.h
18863 eval $typedef
18864 case "$gidtype" in
18865 xxx)
18866         xxx=`./findhdr sys/user.h`
18867         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18868         case $1 in
18869         unsigned) dflt="$1 $2" ;;
18870         *) dflt="$1" ;;
18871         esac
18872         ;;
18873 *) dflt="$gidtype";;
18874 esac
18875 case "$gidtype" in
18876 gid_t) echo "gid_t found." ;;
18877 *)      rp="What is the type for group ids returned by getgid()?"
18878         . ./myread
18879         gidtype="$ans"
18880         ;;
18881 esac
18882
18883 echo " "
18884 case "$gidtype" in
18885 *_t) zzz="$gidtype"     ;;
18886 *)   zzz="gid"          ;;
18887 esac
18888 echo "Checking the size of $zzz..." >&4 
18889 cat > try.c <<EOCP
18890 #include <sys/types.h>
18891 #include <stdio.h>
18892 #$i_stdlib I_STDLIB
18893 #ifdef I_STDLIB
18894 #include <stdlib.h>
18895 #endif
18896 int main() {
18897     printf("%d\n", (int)sizeof($gidtype));
18898     exit(0);
18899 }
18900 EOCP
18901 set try
18902 if eval $compile_ok; then
18903         yyy=`$run ./try`
18904         case "$yyy" in
18905         '')     gidsize=4
18906                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18907                 ;;
18908         *)      gidsize=$yyy
18909                 echo "Your $zzz is $gidsize bytes long."
18910                 ;;
18911         esac
18912 else
18913         gidsize=4
18914         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18915 fi
18916
18917
18918 echo " "
18919 case "$gidtype" in
18920 *_t) zzz="$gidtype"     ;;
18921 *)   zzz="gid"          ;;
18922 esac
18923 echo "Checking the sign of $zzz..." >&4 
18924 cat > try.c <<EOCP
18925 #include <sys/types.h>
18926 #include <stdio.h>
18927 int main() {
18928         $gidtype foo = -1;
18929         if (foo < 0)
18930                 printf("-1\n");
18931         else
18932                 printf("1\n");
18933 }
18934 EOCP
18935 set try
18936 if eval $compile; then
18937         yyy=`$run ./try`
18938         case "$yyy" in
18939         '')     gidsign=1
18940                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18941                 ;;
18942         *)      gidsign=$yyy
18943                 case "$gidsign" in
18944                  1) echo "Your $zzz is unsigned." ;;
18945                 -1) echo "Your $zzz is signed."   ;;
18946                 esac
18947                 ;;
18948         esac
18949 else
18950         gidsign=1
18951         echo "(I can't compile the test program--guessing unsigned.)" >&4
18952 fi
18953
18954
18955 echo " "
18956
18957 if $test X"$quadtype" != X; then
18958
18959 echo "Checking how to print 64-bit integers..." >&4
18960
18961 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18962         $cat >try.c <<'EOCP'
18963 #include <sys/types.h>
18964 #include <stdio.h>
18965 int main() {
18966   int q = 12345678901;
18967   printf("%ld\n", q);
18968 }
18969 EOCP
18970         set try
18971         if eval $compile; then
18972                 yyy=`$run ./try`
18973                 case "$yyy" in
18974                 12345678901)
18975                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18976                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18977                         echo "We will use %d."
18978                         ;;
18979                 esac
18980         fi
18981 fi
18982
18983 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18984         $cat >try.c <<'EOCP'
18985 #include <sys/types.h>
18986 #include <stdio.h>
18987 int main() {
18988   long q = 12345678901;
18989   printf("%ld\n", q);
18990 }
18991 EOCP
18992         set try
18993         if eval $compile; then
18994                 yyy=`$run ./try`
18995                 case "$yyy" in
18996                 12345678901)
18997                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18998                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18999                         echo "We will use %ld."
19000                         ;;
19001                 esac
19002         fi
19003 fi
19004
19005 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19006         $cat >try.c <<'EOCP'
19007 #include <sys/types.h>
19008 #include <inttypes.h>
19009 #include <stdio.h>
19010 int main() {
19011   int64_t q = 12345678901;
19012   printf("%" PRId64 "\n", q);
19013 }
19014 EOCP
19015         set try
19016         if eval $compile; then
19017                 yyy=`$run ./try`
19018                 case "$yyy" in
19019                 12345678901)
19020                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19021                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19022                         echo "We will use the C9X style."
19023                         ;;
19024                 esac
19025         fi
19026 fi
19027
19028 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19029         $cat >try.c <<EOCP
19030 #include <sys/types.h>
19031 #include <stdio.h>
19032 int main() {
19033   $quadtype q = 12345678901;
19034   printf("%Ld\n", q);
19035 }
19036 EOCP
19037         set try
19038         if eval $compile; then
19039                 yyy=`$run ./try`
19040                 case "$yyy" in
19041                 12345678901)
19042                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19043                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19044                         echo "We will use %Ld."
19045                         ;;
19046                 esac
19047         fi
19048 fi
19049
19050 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19051         $cat >try.c <<'EOCP'
19052 #include <sys/types.h>
19053 #include <stdio.h>
19054 int main() {
19055   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19056   printf("%lld\n", q);
19057 }
19058 EOCP
19059         set try
19060         if eval $compile; then
19061                 yyy=`$run ./try`
19062                 case "$yyy" in
19063                 12345678901)
19064                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19065                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19066                         echo "We will use the %lld style."
19067                         ;;
19068                 esac
19069         fi
19070 fi
19071
19072 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19073         $cat >try.c <<EOCP
19074 #include <sys/types.h>
19075 #include <stdio.h>
19076 int main() {
19077   $quadtype q = 12345678901;
19078   printf("%qd\n", q);
19079 }
19080 EOCP
19081         set try
19082         if eval $compile; then
19083                 yyy=`$run ./try`
19084                 case "$yyy" in
19085                 12345678901)
19086                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19087                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19088                         echo "We will use %qd."
19089                         ;;
19090                 esac
19091         fi
19092 fi
19093
19094 if $test X"$sPRId64" = X; then
19095         echo "Cannot figure out how to print 64-bit integers." >&4
19096 fi
19097
19098 $rm -f try try.*
19099
19100 fi
19101
19102 case "$sPRId64" in
19103 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
19104         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
19105         ;;
19106 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
19107         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
19108         ;;
19109 esac
19110
19111
19112 echo " "
19113 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19114
19115 if $test X"$ivsize" = X8; then
19116         ivdformat="$sPRId64"
19117         uvuformat="$sPRIu64"
19118         uvoformat="$sPRIo64"
19119         uvxformat="$sPRIx64"
19120         uvXUformat="$sPRIXU64"
19121 else
19122         if $test X"$ivsize" = X"$longsize"; then
19123                 ivdformat='"ld"'
19124                 uvuformat='"lu"'
19125                 uvoformat='"lo"'
19126                 uvxformat='"lx"'
19127                 uvXUformat='"lX"'
19128         else
19129                 if $test X"$ivsize" = X"$intsize"; then
19130                         ivdformat='"d"'
19131                         uvuformat='"u"'
19132                         uvoformat='"o"'
19133                         uvxformat='"x"'
19134                         uvXUformat='"X"'
19135                 else
19136                         : far out
19137                         if $test X"$ivsize" = X"$shortsize"; then
19138                                 ivdformat='"hd"'
19139                                 uvuformat='"hu"'
19140                                 uvoformat='"ho"'
19141                                 uvxformat='"hx"'
19142                                 uvXUformat='"hX"'
19143                         fi
19144                 fi
19145         fi
19146 fi
19147
19148 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19149         nveformat="$sPRIeldbl"
19150         nvfformat="$sPRIfldbl"
19151         nvgformat="$sPRIgldbl"
19152         nvEUformat="$sPRIEUldbl"
19153         nvFUformat="$sPRIFUldbl"
19154         nvGUformat="$sPRIGUldbl"
19155 else
19156         nveformat='"e"'
19157         nvfformat='"f"'
19158         nvgformat='"g"'
19159         nvEUformat='"E"'
19160         nvFUformat='"F"'
19161         nvGUformat='"G"'
19162 fi
19163
19164 case "$ivdformat" in
19165 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19166     exit 1
19167     ;;
19168 esac
19169
19170
19171 echo " "
19172 $echo "Checking the format string to be used for gids..." >&4
19173
19174 case "$gidsign" in
19175 -1)     if $test X"$gidsize" = X"$ivsize"; then
19176                 gidformat="$ivdformat"
19177         else
19178                 if $test X"$gidsize" = X"$longsize"; then
19179                         gidformat='"ld"'
19180                 else
19181                         if $test X"$gidsize" = X"$intsize"; then
19182                                 gidformat='"d"'
19183                         else
19184                                 if $test X"$gidsize" = X"$shortsize"; then
19185                                         gidformat='"hd"'
19186                                 fi
19187                         fi
19188                 fi
19189         fi
19190         ;;
19191 *)      if $test X"$gidsize" = X"$uvsize"; then
19192                 gidformat="$uvuformat"
19193         else
19194                 if $test X"$gidsize" = X"$longsize"; then
19195                         gidformat='"lu"'
19196                 else
19197                         if $test X"$gidsize" = X"$intsize"; then
19198                                 gidformat='"u"'
19199                         else
19200                                 if $test X"$gidsize" = X"$shortsize"; then
19201                                         gidformat='"hu"'
19202                                 fi
19203                         fi
19204                 fi
19205         fi
19206         ;;
19207 esac
19208
19209 : see if getgroups exists
19210 set getgroups d_getgrps
19211 eval $inlibc
19212
19213 : see if setgroups exists
19214 set setgroups d_setgrps
19215 eval $inlibc
19216
19217
19218 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19219 echo " "
19220 case "$d_getgrps$d_setgrps" in
19221 *define*)
19222         case "$groupstype" in
19223         '') dflt="$gidtype" ;;
19224         *)  dflt="$groupstype" ;;
19225         esac
19226         $cat <<EOM
19227 What type of pointer is the second argument to getgroups() and setgroups()?
19228 Usually this is the same as group ids, $gidtype, but not always.
19229
19230 EOM
19231         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19232         . ./myread
19233         groupstype="$ans"
19234         ;;
19235 *)  groupstype="$gidtype";;
19236 esac
19237
19238
19239 if $test $patchlevel -lt 9; then
19240 : MAD is not available in 5.8.x or earlier.
19241     ans=n;
19242 else
19243     case "$mad" in
19244     $define|true|[yY]*) dflt='y' ;;
19245     *)                  dflt='n' ;;
19246     esac
19247     cat <<EOM
19248
19249 Would you like to build with Misc Attribute Decoration? This is development
19250 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19251 overhead on the interpreter.
19252
19253 If this doesn't make any sense to you, just accept the default '$dflt'.
19254 EOM
19255     rp='Build Perl with MAD?'
19256     . ./myread
19257 fi
19258 case "$ans" in
19259 y|Y)    val="$define"
19260         madlyh='madly.h madly.act madly.tab'
19261         madlysrc='madly.c'
19262         madlyobj="madly$_o" ;;
19263 *)      val="$undef"
19264         madlyh=''
19265         madlysrc=''
19266         madlyobj='' ;;
19267 esac
19268 set mad
19269 eval $setvar
19270
19271 echo " "
19272 echo "Checking if your $make program sets \$(MAKE)..." >&4
19273 case "$make_set_make" in
19274 '')
19275         $sed 's/^X //' > testmake.mak << 'EOF'
19276 Xall:
19277 X       @echo 'maketemp="$(MAKE)"'
19278 EOF
19279         case "`$make -f testmake.mak 2>/dev/null`" in
19280         *maketemp=*) make_set_make='#' ;;
19281         *)      make_set_make="MAKE=$make" ;;
19282         esac
19283         $rm -f testmake.mak
19284         ;;
19285 esac
19286 case "$make_set_make" in
19287 '#') echo "Yup, it does.";;
19288 *) echo "Nope, it doesn't.";;
19289 esac
19290
19291 : see what type is used for mode_t
19292 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19293 set mode_t modetype int stdio.h sys/types.h
19294 eval $typedef_ask
19295
19296 : see if we need va_copy
19297 echo " "
19298 case "$i_stdarg" in
19299 "$define")
19300         $cat >try.c <<EOCP
19301 #include <stdarg.h>
19302 #include <stdio.h>
19303 #$i_stdlib I_STDLIB
19304 #ifdef I_STDLIB
19305 #include <stdlib.h>
19306 #endif
19307 #include <signal.h>
19308
19309 int
19310 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19311 {
19312   return vfprintf(f, fmt, *valp);
19313 }
19314  
19315 int    
19316 myvfprintf(FILE *f, const  char *fmt, va_list val)
19317 {
19318   return ivfprintf(f, fmt, &val);
19319 }
19320       
19321 int
19322 myprintf(char *fmt, ...) 
19323 {
19324   va_list val;
19325   va_start(val, fmt);
19326   return myvfprintf(stdout, fmt, val); 
19327 }         
19328
19329 int
19330 main(int ac, char **av)
19331 {
19332   signal(SIGSEGV, exit);
19333
19334   myprintf("%s%cs all right, then\n", "that", '\'');                            
19335   exit(0);      
19336 }
19337 EOCP
19338         set try
19339         if eval $compile && $run ./try 2>&1 >/dev/null; then
19340                 case "`$run ./try`" in
19341                 "that's all right, then")
19342                         okay=yes
19343                         ;;
19344                 esac
19345         fi
19346         case "$okay" in
19347         yes)    echo "It seems that you don't need va_copy()." >&4
19348                 need_va_copy="$undef"
19349                 ;;
19350         *)      echo "It seems that va_copy() or similar will be needed." >&4
19351                 need_va_copy="$define"
19352                 ;;
19353         esac
19354         $rm -f try.* core core.* *.core *.core.*
19355         ;;
19356 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19357         ;;
19358 esac
19359
19360 : see what type is used for size_t
19361 rp="What is the type used for the length parameter for string functions?"
19362 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19363 eval $typedef_ask
19364
19365 : check for type of arguments to gethostbyaddr. 
19366 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19367         case "$d_gethbyaddr" in
19368         $define)
19369                 $cat <<EOM
19370
19371 Checking to see what type of arguments are accepted by gethostbyaddr().
19372 EOM
19373                 hdrs="$define sys/types.h
19374                         $d_socket sys/socket.h 
19375                         $i_niin netinet/in.h 
19376                         $i_netdb netdb.h
19377                         $i_unistd unistd.h"
19378                 : The first arg can 'char *' or 'void *'
19379                 : The second arg is some of integral type
19380                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19381                         for yyy in size_t long int; do
19382                                 case "$netdb_host_type" in
19383                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19384                                         if ./protochk "$try" $hdrs; then
19385                                                 echo "Your system accepts $xxx for the first arg."
19386                                                 echo "...and $yyy for the second arg."
19387                                                 netdb_host_type="$xxx"
19388                                                 netdb_hlen_type="$yyy"
19389                                         fi
19390                                         ;;
19391                                 esac
19392                         done
19393                 done
19394                 : In case none of those worked, prompt the user.
19395                 case "$netdb_host_type" in
19396                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19397                         dflt='char *'
19398                         . ./myread
19399                         netdb_host_type=$ans
19400                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19401                         dflt="$sizetype"
19402                         . ./myread
19403                         netdb_hlen_type=$ans
19404                         ;;
19405                 esac
19406                 ;;
19407         *)      : no gethostbyaddr, so pick harmless defaults
19408                 netdb_host_type='char *'
19409                 netdb_hlen_type="$sizetype"
19410                 ;;
19411         esac
19412         # Remove the "const" if needed. -- but then we'll have a 
19413         # prototype clash!
19414         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19415 fi
19416
19417 : check for type of argument to gethostbyname. 
19418 if test "X$netdb_name_type" = X ; then
19419         case "$d_gethbyname" in
19420         $define)
19421                 $cat <<EOM
19422
19423 Checking to see what type of argument is accepted by gethostbyname().
19424 EOM
19425                 hdrs="$define sys/types.h
19426                         $d_socket sys/socket.h 
19427                         $i_niin netinet/in.h 
19428                         $i_netdb netdb.h
19429                         $i_unistd unistd.h"
19430                 for xxx in "const char *" "char *"; do
19431                         case "$netdb_name_type" in
19432                         '')     try="extern struct hostent *gethostbyname($xxx);"
19433                                 if ./protochk "$try" $hdrs; then
19434                                         echo "Your system accepts $xxx."
19435                                         netdb_name_type="$xxx"
19436                                 fi
19437                                 ;;
19438                         esac
19439                 done
19440                 : In case none of those worked, prompt the user.
19441                 case "$netdb_name_type" in
19442                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19443                         dflt='char *'
19444                         . ./myread
19445                         netdb_name_type=$ans
19446                         ;;
19447                 esac
19448                 ;;
19449         *)      : no gethostbyname, so pick harmless default
19450                 netdb_name_type='char *'
19451                 ;;
19452         esac
19453 fi
19454
19455 : check for type of 1st argument to getnetbyaddr. 
19456 if test "X$netdb_net_type" = X ; then
19457         case "$d_getnbyaddr" in
19458         $define)
19459                 $cat <<EOM
19460
19461 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19462 EOM
19463                 hdrs="$define sys/types.h
19464                         $d_socket sys/socket.h 
19465                         $i_niin netinet/in.h 
19466                         $i_netdb netdb.h
19467                         $i_unistd unistd.h"
19468                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19469                         case "$netdb_net_type" in
19470                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19471                                 if ./protochk "$try" $hdrs; then
19472                                         echo "Your system accepts $xxx."
19473                                         netdb_net_type="$xxx"
19474                                 fi
19475                                 ;;
19476                         esac
19477                 done
19478                 : In case none of those worked, prompt the user.
19479                 case "$netdb_net_type" in
19480                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19481                         dflt='long'
19482                         . ./myread
19483                         netdb_net_type=$ans
19484                         ;;
19485                 esac
19486                 ;;
19487         *)      : no getnetbyaddr, so pick harmless default
19488                 netdb_net_type='long'
19489                 ;;
19490         esac
19491 fi
19492 : locate the preferred pager for this system
19493 fn=f/
19494 case "$pager" in
19495 '')
19496         dflt=''
19497         case "$pg" in
19498         /*) dflt=$pg;;
19499         [a-zA-Z]:/*) dflt=$pg;;
19500         esac
19501         case "$more" in
19502         /*) dflt=$more;;
19503         [a-zA-Z]:/*) dflt=$more;;
19504         esac
19505         case "$less" in
19506         /*) dflt=$less;;
19507         [a-zA-Z]:/*) dflt=$less;;
19508         esac
19509         case "$dflt" in
19510         '') dflt=/usr/ucb/more;;
19511         esac
19512         ;;
19513 *)      dflt="$pager"
19514         : Instruct ./getfile to trust the hinted or previous pager value,
19515         : even if it does not begin with a slash.  For example, on os2,
19516         : pager might be cmd /c more.  See comments in UU/getfile.
19517         fn="f/($pager)"
19518         ;;
19519 esac
19520 echo " "
19521 rp='What pager is used on your system?'
19522 . ./getfile
19523 pager="$ans"
19524
19525 : see what type pids are declared as in the kernel
19526 rp="What is the type of process ids on this system?"
19527 set pid_t pidtype int stdio.h sys/types.h
19528 eval $typedef_ask
19529
19530 : see if ar generates random libraries by itself
19531 echo " "
19532 echo "Checking how to generate random libraries on your machine..." >&4
19533 echo 'int bar1() { return bar2(); }' > bar1.c
19534 echo 'int bar2() { return 2; }' > bar2.c
19535 $cat > foo.c <<EOP
19536 #$i_stdlib I_STDLIB
19537 #ifdef I_STDLIB
19538 #include <stdlib.h>
19539 #endif
19540 int main() { printf("%d\n", bar1()); exit(0); }
19541 EOP
19542 $cc $ccflags -c bar1.c >/dev/null 2>&1
19543 $cc $ccflags -c bar2.c >/dev/null 2>&1
19544 $cc $ccflags -c foo.c >/dev/null 2>&1
19545 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19546 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19547         $run ./foobar >/dev/null 2>&1; then
19548         echo "$ar appears to generate random libraries itself."
19549         orderlib=false
19550         if [ "X$ranlib" = "X" ]; then
19551             ranlib=":"
19552         fi
19553 elif $ar s bar$_a >/dev/null 2>&1 &&
19554         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19555         $run ./foobar >/dev/null 2>&1; then
19556                 echo "a table of contents needs to be added with '$ar s'."
19557                 orderlib=false
19558                 ranlib="$ar s"
19559 elif $ar ts bar$_a >/dev/null 2>&1 &&
19560         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19561         $run ./foobar >/dev/null 2>&1; then
19562                 echo "a table of contents needs to be added with '$ar ts'."
19563                 orderlib=false
19564                 ranlib="$ar ts"
19565 else
19566         case "$ranlib" in
19567         :) ranlib='';;
19568         '')
19569                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19570                 $test -f $ranlib || ranlib=''
19571                 ;;
19572         esac
19573         if $test -n "$ranlib"; then
19574                 echo "your system has '$ranlib'; we'll use that."
19575                 orderlib=false
19576         else
19577                 echo "your system doesn't seem to support random libraries"
19578                 echo "so we'll use lorder and tsort to order the libraries."
19579                 orderlib=true
19580                 ranlib=":"
19581         fi
19582 fi
19583 $rm -f foo* bar*
19584
19585 : check for type of arguments to select. 
19586 case "$selecttype" in
19587 '') case "$d_select" in
19588         $define)
19589                 echo " "
19590                 $cat <<EOM
19591 Checking to see what type of arguments are accepted by select().
19592 EOM
19593                 hdrs="$define sys/types.h
19594                         $i_systime sys/time.h 
19595                         $i_sysselct sys/select.h
19596                         $d_socket sys/socket.h"
19597                 : The first arg can be int, unsigned, or size_t
19598                 : The last arg may or may not be 'const'
19599                 val=''
19600                 : void pointer has been seen but using that
19601                 : breaks the selectminbits test
19602                 for xxx in 'fd_set *' 'int *'; do
19603                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19604                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19605                                         case "$val" in
19606                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19607                                                 if ./protochk "$try" $hdrs; then
19608                                                         echo "Your system accepts $xxx."
19609                                                         val="$xxx"
19610                                                 fi
19611                                                 ;;
19612                                         esac
19613                                 done
19614                         done
19615                 done
19616                 case "$val" in
19617                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19618                         case "$d_fd_set" in
19619                                 $define) dflt="fd_set *" ;;
19620                                 *)              dflt="int *" ;;
19621                         esac
19622                         . ./myread
19623                         val=$ans
19624                         ;;
19625                 esac
19626                 selecttype="$val"
19627                 ;;
19628         *)      : no select, so pick a harmless default
19629                 selecttype='int *'
19630                 ;;
19631         esac
19632         ;;
19633 esac
19634
19635 : check for the select 'width'
19636 case "$selectminbits" in
19637 '') safebits=`expr $ptrsize \* 8`
19638     case "$d_select" in
19639         $define)
19640                 $cat <<EOM
19641
19642 Checking to see on how many bits at a time your select() operates...
19643 EOM
19644                 $cat >try.c <<EOCP
19645 #include <sys/types.h>
19646 #$i_time I_TIME
19647 #$i_systime I_SYS_TIME
19648 #$i_systimek I_SYS_TIME_KERNEL
19649 #ifdef I_TIME
19650 #   include <time.h>
19651 #endif
19652 #ifdef I_SYS_TIME
19653 #   ifdef I_SYS_TIME_KERNEL
19654 #       define KERNEL
19655 #   endif
19656 #   include <sys/time.h>
19657 #   ifdef I_SYS_TIME_KERNEL
19658 #       undef KERNEL
19659 #   endif
19660 #endif
19661 #$i_sysselct I_SYS_SELECT
19662 #ifdef I_SYS_SELECT
19663 #include <sys/select.h>
19664 #endif
19665 #$d_socket HAS_SOCKET
19666 #ifdef HAS_SOCKET
19667 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19668 #endif
19669 #include <stdio.h>
19670 #$i_stdlib I_STDLIB
19671 #ifdef I_STDLIB
19672 #include <stdlib.h>
19673 #endif
19674 $selecttype b;
19675 #define S sizeof(*(b))
19676 #define MINBITS 64
19677 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19678 #define NBITS  (NBYTES * 8)
19679 int main() {
19680     char *s = (char *)malloc(NBYTES);
19681     struct timeval t;
19682     int i;
19683     FILE* fp;
19684     int fd;
19685
19686     if (!s)
19687         exit(1);
19688     fclose(stdin);
19689     fp = fopen("try.c", "r");
19690     if (fp == 0)
19691       exit(2);
19692     fd = fileno(fp);
19693     if (fd < 0)
19694       exit(3);
19695     b = ($selecttype)s;
19696     for (i = 0; i < NBITS; i++)
19697         FD_SET(i, b);
19698     t.tv_sec  = 0;
19699     t.tv_usec = 0;
19700     select(fd + 1, b, 0, 0, &t);
19701     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19702     free(s);
19703     printf("%d\n", i + 1);
19704     return 0;
19705 }
19706 EOCP
19707                 set try
19708                 if eval $compile_ok; then
19709                         selectminbits=`$run ./try`
19710                         case "$selectminbits" in
19711                         '')     cat >&4 <<EOM
19712 Cannot figure out on how many bits at a time your select() operates.
19713 I'll play safe and guess it is $safebits bits.
19714 EOM
19715                                 selectminbits=$safebits
19716                                 bits="$safebits bits"
19717                                 ;;
19718                         1)      bits="1 bit" ;;
19719                         *)      bits="$selectminbits bits" ;;
19720                         esac
19721                         echo "Your select() operates on $bits at a time." >&4
19722                 else
19723                         rp='What is the minimum number of bits your select() operates on?'
19724                         case "$byteorder" in
19725                         12345678)       dflt=64 ;;
19726                         1234)           dflt=32 ;;
19727                         *)              dflt=1  ;;
19728                         esac
19729                         . ./myread
19730                         val=$ans
19731                         selectminbits="$val"
19732                 fi
19733                 $rm -f try.* try
19734                 ;;
19735         *)      : no select, so pick a harmless default
19736                 selectminbits=$safebits
19737                 ;;
19738         esac
19739         ;;
19740 esac
19741
19742 : Trace out the files included by signal.h, then look for SIGxxx names.
19743 : Remove SIGARRAYSIZE used by HPUX.
19744 : Remove SIGSTKSIZE used by Linux.
19745 : Remove SIGSTKSZ used by Posix.
19746 : Remove SIGTYP void lines used by OS2.
19747 : Some cpps, like os390, dont give the file name anywhere
19748 if [ "X$fieldn" = X ]; then
19749         : Just make some guesses.  We check them later.
19750         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19751 else
19752         xxx=`echo '#include <signal.h>' |
19753         $cppstdin $cppminus $cppflags 2>/dev/null |
19754         $grep '^[       ]*#.*include' | 
19755         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19756 fi
19757 : Check this list of files to be sure we have parsed the cpp output ok.
19758 : This will also avoid potentially non-existent files, such 
19759 : as ../foo/bar.h
19760 xxxfiles=''
19761 for xx in $xxx /dev/null ; do
19762         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19763 done
19764 : If we have found no files, at least try signal.h
19765 case "$xxxfiles" in
19766 '')     xxxfiles=`./findhdr signal.h` ;;
19767 esac
19768 xxx=`awk '
19769 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19770         print substr($2, 4, 20)
19771 }
19772 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19773         print substr($3, 4, 20)
19774 }' $xxxfiles`
19775 : Append some common names just in case the awk scan failed.
19776 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19777 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19778 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19779 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19780 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19781
19782 : generate a few handy files for later
19783 $cat > signal.c <<EOCP
19784 #include <sys/types.h>
19785 #include <signal.h>
19786 #$i_stdlib I_STDLIB
19787 #ifdef I_STDLIB
19788 #include <stdlib.h>
19789 #endif
19790 #include <stdio.h>
19791 int main() {
19792
19793 /* Strange style to avoid deeply-nested #if/#else/#endif */
19794 #ifndef NSIG
19795 #  ifdef _NSIG
19796 #    define NSIG (_NSIG)
19797 #  endif
19798 #endif
19799
19800 #ifndef NSIG
19801 #  ifdef SIGMAX
19802 #    define NSIG (SIGMAX+1)
19803 #  endif
19804 #endif
19805
19806 #ifndef NSIG
19807 #  ifdef SIG_MAX
19808 #    define NSIG (SIG_MAX+1)
19809 #  endif
19810 #endif
19811
19812 #ifndef NSIG
19813 #  ifdef _SIG_MAX
19814 #    define NSIG (_SIG_MAX+1)
19815 #  endif
19816 #endif
19817
19818 #ifndef NSIG
19819 #  ifdef MAXSIG
19820 #    define NSIG (MAXSIG+1)
19821 #  endif
19822 #endif
19823
19824 #ifndef NSIG
19825 #  ifdef MAX_SIG
19826 #    define NSIG (MAX_SIG+1)
19827 #  endif
19828 #endif
19829
19830 #ifndef NSIG
19831 #  ifdef SIGARRAYSIZE
19832 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19833 #  endif
19834 #endif
19835
19836 #ifndef NSIG
19837 #  ifdef _sys_nsig
19838 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19839 #  endif
19840 #endif
19841
19842 /* Default to some arbitrary number that's big enough to get most
19843    of the common signals.
19844 */
19845 #ifndef NSIG
19846 #    define NSIG 50
19847 #endif
19848
19849 printf("NSIG %d\n", NSIG);
19850
19851 #ifndef JUST_NSIG
19852
19853 EOCP
19854
19855 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19856 {
19857         printf "#ifdef SIG"; printf $1; printf "\n"
19858         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19859         printf $1; printf ");\n"
19860         printf "#endif\n"
19861 }
19862 END {
19863         printf "#endif /* JUST_NSIG */\n";
19864         printf "exit(0);\n}\n";
19865 }
19866 ' >>signal.c
19867 $cat >signal.awk <<'EOP'
19868 BEGIN { ndups = 0 }
19869 $1 ~ /^NSIG$/ { nsig = $2 }
19870 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19871     if ($2 > maxsig) { maxsig = $2 }
19872     if (sig_name[$2]) {
19873         dup_name[ndups] = $1
19874         dup_num[ndups] = $2
19875         ndups++ 
19876     }
19877     else {
19878         sig_name[$2] = $1
19879         sig_num[$2] = $2
19880     }
19881 }
19882 END { 
19883     if (nsig == 0) {
19884         nsig = maxsig + 1
19885     }
19886     printf("NSIG %d\n", nsig);
19887     for (n = 1; n < nsig; n++) {
19888         if (sig_name[n]) {
19889             printf("%s %d\n", sig_name[n], sig_num[n])
19890         }
19891         else {
19892             printf("NUM%d %d\n", n, n) 
19893         }
19894     }
19895     for (n = 0; n < ndups; n++) {
19896         printf("%s %d\n", dup_name[n], dup_num[n])
19897     }
19898 }
19899 EOP
19900 $cat >signal_cmd <<EOS
19901 $startsh
19902 if $test -s signal.lst; then
19903     echo "Using your existing signal.lst file"
19904         exit 0
19905 fi
19906 xxx="$xxx"
19907 EOS
19908 $cat >>signal_cmd <<'EOS'
19909
19910 set signal
19911 if eval $compile_ok; then
19912         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19913 else
19914         echo "(I can't seem be able to compile the whole test program)" >&4
19915         echo "(I'll try it in little pieces.)" >&4
19916         set signal -DJUST_NSIG
19917         if eval $compile_ok; then
19918                 $run ./signal$_exe > signal.nsg
19919                 $cat signal.nsg
19920         else
19921                 echo "I can't seem to figure out how many signals you have." >&4
19922                 echo "Guessing 50." >&4
19923                 echo 'NSIG 50' > signal.nsg
19924         fi
19925         : Now look at all the signal names, one at a time.
19926         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19927                 $cat > signal.c <<EOCP
19928 #include <sys/types.h>
19929 #include <signal.h>
19930 #include <stdio.h>
19931 int main() {
19932 printf("$xx %d\n", SIG${xx});
19933 return 0;
19934 }
19935 EOCP
19936                 set signal
19937                 if eval $compile; then
19938                         echo "SIG${xx} found."
19939                         $run ./signal$_exe  >> signal.ls1
19940                 else
19941                         echo "SIG${xx} NOT found."
19942                 fi
19943         done
19944         if $test -s signal.ls1; then
19945                 $cat signal.nsg signal.ls1 |
19946                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19947         fi
19948
19949 fi
19950 if $test -s signal.lst; then
19951         :
19952 else
19953         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19954         echo 'kill -l' >signal
19955         set X `csh -f <signal`
19956         $rm -f signal
19957         shift
19958         case $# in
19959         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19960         esac
19961         echo $@ | $tr ' ' $trnl | \
19962             $awk '{ printf "%s %d\n", $1, ++s; }
19963                   END { printf "NSIG %d\n", ++s }' >signal.lst
19964 fi
19965 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19966 EOS
19967 chmod a+x signal_cmd
19968 $eunicefix signal_cmd
19969
19970 : generate list of signal names
19971 echo " "
19972 case "$sig_name_init" in
19973 '') doinit=yes ;;
19974 *)  case "$sig_num_init" in
19975     ''|*,*) doinit=yes ;;
19976     esac ;;
19977 esac
19978 case "$doinit" in
19979 yes)
19980         echo "Generating a list of signal names and numbers..." >&4
19981         . ./signal_cmd
19982         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19983         sig_name=`$awk 'BEGIN { printf "ZERO " }
19984                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19985         sig_num=`$awk  'BEGIN { printf "0 " }
19986                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19987         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19988                              !/^NSIG/   { printf "\"%s\", ", $1 }
19989                              END        { printf "0\n" }' signal.lst`
19990         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19991                              !/^NSIG/   { printf "%d, ", $2}
19992                              END        { printf "0\n"}' signal.lst`
19993         ;;
19994 esac
19995 echo "The following $sig_count signals are available:"
19996 echo " "
19997 echo $sig_name | $awk \
19998 'BEGIN { linelen = 0 }
19999 {
20000         for (i = 1; i <= NF; i++) {
20001                 name = "SIG" $i " "
20002                 linelen = linelen + length(name)
20003                 if (linelen > 70) {
20004                         printf "\n"
20005                         linelen = length(name)
20006                 }
20007                 printf "%s", name
20008         }
20009         printf "\n"
20010 }'
20011 sig_size=`echo $sig_name | awk '{print NF}'`
20012 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20013
20014 echo " "
20015 case "$sizetype" in
20016 *_t) zzz="$sizetype"    ;;
20017 *)   zzz="filesize"     ;;
20018 esac
20019 echo "Checking the size of $zzz..." >&4 
20020 cat > try.c <<EOCP
20021 #include <sys/types.h>
20022 #include <stdio.h>
20023 #$i_stdlib I_STDLIB
20024 #ifdef I_STDLIB
20025 #include <stdlib.h>
20026 #endif
20027 int main() {
20028     printf("%d\n", (int)sizeof($sizetype));
20029     exit(0);
20030 }
20031 EOCP
20032 set try
20033 if eval $compile_ok; then
20034         yyy=`$run ./try`
20035         case "$yyy" in
20036         '')     sizesize=4
20037                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20038                 ;;
20039         *)      sizesize=$yyy
20040                 echo "Your $zzz size is $sizesize bytes."
20041                 ;;
20042         esac
20043 else
20044         sizesize=4
20045         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20046 fi
20047
20048
20049 : check for socklen_t
20050 echo " "
20051 echo "Checking to see if you have socklen_t..." >&4
20052 $cat >try.c <<EOCP
20053 #include <sys/types.h>
20054 #$d_socket HAS_SOCKET
20055 #ifdef HAS_SOCKET
20056 #include <sys/socket.h>
20057 #endif
20058 int main() { socklen_t x = 16; }
20059 EOCP
20060 set try
20061 if eval $compile; then
20062         val="$define"
20063         echo "You have socklen_t."
20064 else
20065         val="$undef"
20066         echo "You do not have socklen_t."
20067         case "$sizetype" in
20068         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20069         esac
20070 fi
20071 $rm -f try try.*
20072 set d_socklen_t
20073 eval $setvar
20074
20075 : see if this is a socks.h system
20076 set socks.h i_socks
20077 eval $inhdr
20078
20079 : check for type of the size argument to socket calls
20080 case "$d_socket" in
20081 "$define")
20082         $cat <<EOM
20083
20084 Checking to see what type is the last argument of accept().
20085 EOM
20086         yyy=''
20087         case "$d_socklen_t" in
20088         "$define") yyy="$yyy socklen_t"
20089         esac
20090         yyy="$yyy $sizetype int long unsigned"
20091         for xxx in $yyy; do
20092                 case "$socksizetype" in
20093                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20094                         case "$usesocks" in
20095                         "$define")
20096                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20097                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20098                                         socksizetype="$xxx"
20099                                 fi
20100                                 ;;
20101                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20102                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20103                                         socksizetype="$xxx"
20104                                 fi
20105                                 ;;
20106                         esac
20107                         ;;
20108                 esac
20109         done
20110 : In case none of those worked, prompt the user.
20111         case "$socksizetype" in
20112         '')     rp='What is the type for socket address structure sizes?'
20113                 dflt='int'
20114                 . ./myread
20115                 socksizetype=$ans
20116                 ;;
20117         esac
20118         ;;
20119 *)      : no sockets, so pick relatively harmless default
20120         socksizetype='int'
20121         ;;
20122 esac
20123
20124 : see what type is used for signed size_t
20125 set ssize_t ssizetype int stdio.h sys/types.h
20126 eval $typedef
20127 dflt="$ssizetype"
20128 $cat > try.c <<EOM
20129 #include <stdio.h>
20130 #$i_stdlib I_STDLIB
20131 #ifdef I_STDLIB
20132 #include <stdlib.h>
20133 #endif
20134 #include <sys/types.h>
20135 #define Size_t $sizetype
20136 #define SSize_t $dflt
20137 int main()
20138 {
20139         if (sizeof(Size_t) == sizeof(SSize_t))
20140                 printf("$dflt\n");
20141         else if (sizeof(Size_t) == sizeof(int))
20142                 printf("int\n");
20143         else 
20144                 printf("long\n");
20145         exit(0);
20146 }
20147 EOM
20148 echo " "
20149 set try
20150 if eval $compile_ok && $run ./try > /dev/null; then
20151         ssizetype=`$run ./try`
20152         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20153 else
20154         $cat >&4 <<EOM
20155 Help! I can't compile and run the ssize_t test program: please enlighten me!
20156 (This is probably a misconfiguration in your system or libraries, and
20157 you really ought to fix it.  Still, I'll try anyway.)
20158
20159 I need a type that is the same size as $sizetype, but is guaranteed to
20160 be signed.  Common values are ssize_t, int and long.
20161
20162 EOM
20163         rp="What signed type is the same size as $sizetype?"
20164         . ./myread
20165         ssizetype="$ans"
20166 fi
20167 $rm -f try try.*
20168
20169 : see what type of char stdio uses.
20170 echo " "
20171 echo '#include <stdio.h>' > stdio.c
20172 $cppstdin $cppminus < stdio.c > stdioh
20173 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20174         echo "Your stdio uses unsigned chars." >&4
20175         stdchar="unsigned char"
20176 else
20177         echo "Your stdio uses signed chars." >&4
20178         stdchar="char"
20179 fi
20180 $rm -f stdio.* stdioh
20181
20182 : see what type uids are declared as in the kernel
20183 echo " "
20184 echo "Looking for the type for user ids returned by getuid()."
20185 set uid_t uidtype xxx stdio.h sys/types.h
20186 eval $typedef
20187 case "$uidtype" in
20188 xxx)
20189         xxx=`./findhdr sys/user.h`
20190         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20191         case $1 in
20192         unsigned) dflt="$1 $2" ;;
20193         *) dflt="$1" ;;
20194         esac
20195         ;;
20196 *) dflt="$uidtype";;
20197 esac
20198 case "$uidtype" in
20199 uid_t)  echo "uid_t found." ;;
20200 *)      rp="What is the type for user ids returned by getuid()?"
20201         . ./myread
20202         uidtype="$ans"
20203         ;;
20204 esac
20205
20206 echo " "
20207 case "$uidtype" in
20208 *_t) zzz="$uidtype"     ;;
20209 *)   zzz="uid"          ;;
20210 esac
20211 echo "Checking the size of $zzz..." >&4 
20212 cat > try.c <<EOCP
20213 #include <sys/types.h>
20214 #include <stdio.h>
20215 #$i_stdlib I_STDLIB
20216 #ifdef I_STDLIB
20217 #include <stdlib.h>
20218 #endif
20219 int main() {
20220     printf("%d\n", (int)sizeof($uidtype));
20221     exit(0);
20222 }
20223 EOCP
20224 set try
20225 if eval $compile_ok; then
20226         yyy=`$run ./try`
20227         case "$yyy" in
20228         '')     uidsize=4
20229                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20230                 ;;
20231         *)      uidsize=$yyy
20232                 echo "Your $zzz is $uidsize bytes long."
20233                 ;;
20234         esac
20235 else
20236         uidsize=4
20237         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20238 fi
20239
20240 echo " "
20241 case "$uidtype" in
20242 *_t) zzz="$uidtype"     ;;
20243 *)   zzz="uid"          ;;
20244 esac
20245 echo "Checking the sign of $zzz..." >&4
20246 cat > try.c <<EOCP
20247 #include <sys/types.h>
20248 #include <stdio.h>
20249 int main() {
20250         $uidtype foo = -1;
20251         if (foo < 0)
20252                 printf("-1\n");
20253         else
20254                 printf("1\n");
20255 }
20256 EOCP
20257 set try
20258 if eval $compile; then
20259         yyy=`$run ./try`
20260         case "$yyy" in
20261         '')     uidsign=1
20262                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20263                 ;;
20264         *)      uidsign=$yyy
20265                 case "$uidsign" in
20266                  1) echo "Your $zzz is unsigned." ;;
20267                 -1) echo "Your $zzz is signed."   ;;
20268                 esac
20269                 ;;
20270         esac
20271 else
20272         uidsign=1
20273         echo "(I can't compile the test program--guessing unsigned.)" >&4
20274 fi
20275
20276
20277
20278 echo " "
20279 $echo "Checking the format string to be used for uids..." >&4
20280
20281 case "$uidsign" in
20282 -1)     if $test X"$uidsize" = X"$ivsize"; then
20283                 uidformat="$ivdformat"
20284         else
20285                 if $test X"$uidsize" = X"$longsize"; then
20286                         uidformat='"ld"'
20287                 else
20288                         if $test X"$uidsize" = X"$intsize"; then
20289                                 uidformat='"d"'
20290                         else
20291                                 if $test X"$uidsize" = X"$shortsize"; then
20292                                         uidformat='"hd"'
20293                                 fi
20294                         fi
20295                 fi
20296         fi
20297         ;;
20298 *)      if $test X"$uidsize" = X"$uvsize"; then
20299                 uidformat="$uvuformat"
20300         else
20301                 if $test X"$uidsize" = X"$longsize"; then
20302                         uidformat='"lu"'
20303                 else
20304                         if $test X"$uidsize" = X"$intsize"; then
20305                                 uidformat='"u"'
20306                         else
20307                                 if $test X"$uidsize" = X"$shortsize"; then
20308                                         uidformat='"hu"'
20309                                 fi
20310                         fi
20311                 fi
20312         fi
20313         ;;
20314 esac
20315
20316
20317 case "$usesitecustomize" in
20318     $define|true|[Yy]*)
20319         usesitecustomize="$define"
20320         ;;
20321     *)
20322         usesitecustomize="$undef"
20323         ;;
20324     esac
20325
20326 : determine compiler compiler
20327 case "$yacc" in
20328 '')
20329         dflt=yacc;;
20330 *)
20331         dflt="$yacc";;
20332 esac
20333 echo " "
20334 comp='yacc'
20335 if $test -f "$byacc$_exe"; then
20336         dflt="$byacc"
20337         comp="byacc or $comp"
20338 fi
20339 if $test -f "$bison$_exe"; then
20340         comp="$comp or bison -y"
20341 fi
20342 rp="Which compiler compiler ($comp) shall I use?"
20343 . ./myread
20344 yacc="$ans"
20345 case "$yacc" in
20346 *bis*)
20347         case "$yacc" in
20348         *-y*) ;;
20349         *)
20350                 yacc="$yacc -y"
20351                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20352                 ;;
20353         esac
20354         ;;
20355 esac
20356
20357 : see if this is a fp.h system
20358 set fp.h i_fp
20359 eval $inhdr
20360
20361 : see if this is a fp_class.h system
20362 set fp_class.h i_fp_class
20363 eval $inhdr
20364
20365 : see if gdbm.h is available
20366 set gdbm.h t_gdbm
20367 eval $inhdr
20368 case "$t_gdbm" in
20369 $define)
20370         : see if gdbm_open exists
20371         set gdbm_open d_gdbm_open
20372         eval $inlibc
20373         case "$d_gdbm_open" in
20374         $undef)
20375                 t_gdbm="$undef"
20376                 echo "We won't be including <gdbm.h>"
20377                 ;;
20378         esac
20379         ;;
20380 esac
20381 val="$t_gdbm"
20382 set i_gdbm
20383 eval $setvar
20384
20385 : see if this is a ieeefp.h system
20386 case "$i_ieeefp" in
20387 '' ) set ieeefp.h i_ieeefp
20388      eval $inhdr
20389      ;;
20390 esac
20391
20392 : see if this is a libutil.h system
20393 set libutil.h i_libutil
20394 eval $inhdr
20395
20396 : see if mach cthreads are available
20397 if test "X$usethreads" = "X$define"; then
20398         set mach/cthreads.h i_machcthr
20399         eval $inhdr
20400 else
20401         i_machcthr="$undef"
20402 fi
20403
20404
20405
20406 : see if this is a mntent.h system
20407 set mntent.h i_mntent
20408 eval $inhdr
20409
20410 : see if ndbm.h is available
20411 set ndbm.h t_ndbm
20412 eval $inhdr
20413
20414 case "$t_ndbm" in
20415 $undef)
20416     # Some Linux distributions such as RedHat 7.1 put the
20417     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20418     if $test -f /usr/include/gdbm/ndbm.h; then
20419         echo '<gdbm/ndbm.h> found.'
20420         ccflags="$ccflags -I/usr/include/gdbm"
20421         cppflags="$cppflags -I/usr/include/gdbm"
20422         t_ndbm=$define
20423     fi
20424     ;;
20425 esac
20426
20427 case "$t_ndbm" in
20428 $define)
20429         : see if dbm_open exists
20430         set dbm_open d_dbm_open
20431         eval $inlibc
20432         case "$d_dbm_open" in
20433         $undef)
20434                 t_ndbm="$undef"
20435                 echo "We won't be including <ndbm.h>"
20436                 ;;
20437         esac
20438         ;;
20439 esac
20440 val="$t_ndbm"
20441 set i_ndbm
20442 eval $setvar
20443
20444 : see if net/errno.h is available
20445 val=''
20446 set net/errno.h val
20447 eval $inhdr
20448
20449 : Unfortunately, it causes problems on some systems.  Arrgh.
20450 case "$val" in
20451 $define)
20452         cat > try.c <<'EOM'
20453 #include <stdio.h>
20454 #include <errno.h>
20455 #include <net/errno.h>
20456 int func()
20457 {
20458         return ENOTSOCK;
20459 }
20460 EOM
20461         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20462                 echo "We'll be including <net/errno.h>." >&4
20463         else
20464                 echo "We won't be including <net/errno.h>." >&4
20465                 val="$undef"
20466         fi
20467         $rm -f try.* try
20468         ;;
20469 esac
20470 set i_neterrno
20471 eval $setvar
20472
20473 : see if netinet/tcp.h is available
20474 set netinet/tcp.h i_netinettcp
20475 eval $inhdr
20476
20477 : see if this is a poll.h system
20478 set poll.h i_poll
20479 eval $inhdr
20480
20481 : see if this is a prot.h system
20482 set prot.h i_prot
20483 eval $inhdr
20484
20485 echo " "
20486 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20487 $cat <<'EOSH' > Cppsym.know
20488 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20489 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20490 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20491 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20492 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20493 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20494 bull c cadmus clipper CMU COFF COMPILER_VERSION
20495 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20496 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20497 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20498 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20499 GLIBC GLIBC_MINOR
20500 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20501 H3050R H3050RX hbullx20 hcx host_mips
20502 hp200 hp300 hp700 HP700 hp800 hp9000
20503 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20504 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20505 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20506 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20507 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20508 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20509 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20510 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20511 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20512 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20513 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20514 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20515 MATH_HAS_NO_SIDE_EFFECTS
20516 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20517 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20518 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20519 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20520 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20521 NetBSD news1500 news1700 news1800 news1900 news3700
20522 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20523 ns32016 ns32332 ns32k nsc32000
20524 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20525 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20526 pc532 pdp11 PGC PIC plexus PORTAR posix
20527 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20528 POSIX_C_SOURCE POSIX_SOURCE POWER
20529 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20530 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20531 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20532 sony sony_news sonyrisc sparc sparclite spectrum
20533 stardent stdc STDC_EXT stratos sun sun3 sun386
20534 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20535 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20536 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20537 sysV68 sysV88 Tek4132 Tek4300 titan
20538 TM3200 TM5400 TM5600
20539 tower tower32 tower32_200 tower32_600 tower32_700
20540 tower32_800 tower32_850 tss
20541 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20542 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20543 unix UNIX95 UNIX99 unixpc unos
20544 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20545 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20546 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20547 USGr4 USGr4_2
20548 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20549 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20550 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20551 z8000
20552 EOSH
20553 # Maybe put other stuff here too.
20554 cat <<EOSH >>Cppsym.know
20555 $osname
20556 EOSH
20557 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20558 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20559 $cat Cppsym.know > Cppsym.c
20560 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20561 $rm -f Cppsym.a Cppsym.b Cppsym.c
20562 cat <<EOSH > Cppsym
20563 $startsh
20564 if $test \$# -gt 0; then
20565     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20566     if $test -s Cppsym.got; then
20567         $rm -f Cppsym.got
20568         exit 0
20569     fi
20570     $rm -f Cppsym.got
20571     exit 1
20572 else
20573     $tr " " "$trnl" | ./Cppsym.try
20574     exit 0
20575 fi
20576 EOSH
20577 chmod +x Cppsym
20578 $eunicefix Cppsym
20579 cat <<EOSH > Cppsym.try
20580 $startsh
20581 cat <<'EOCP' > try.c
20582 #include <stdio.h>
20583 #if cpp_stuff == 1
20584 #define STRINGIFY(a)    "a"
20585 #endif
20586 #if cpp_stuff == 42
20587 #define StGiFy(a)  #a
20588 #define STRINGIFY(a)    StGiFy(a)
20589 #endif
20590 #if $cpp_stuff != 1 && $cpp_stuff != 42
20591 #   include "Bletch: How does this C preprocessor stringify macros?"
20592 #endif
20593 int main() {
20594 EOCP
20595 $awk \\
20596 EOSH
20597 cat <<'EOSH' >> Cppsym.try
20598 'length($1) > 0 {
20599     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20600     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20601     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20602     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20603 }'       >> try.c
20604 echo 'return 0;}' >> try.c
20605 EOSH
20606 cat <<EOSH >> Cppsym.try
20607 ccflags="$ccflags"
20608 case "$osname-$gccversion" in
20609 irix-) ccflags="\$ccflags -woff 1178" ;;
20610 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20611 esac
20612 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20613 EOSH
20614 chmod +x Cppsym.try
20615 $eunicefix Cppsym.try
20616 ./Cppsym < Cppsym.know > Cppsym.true
20617 : Add in any linux cpp "predefined macros":
20618 case "$osname::$gccversion" in
20619   *linux*::*.*)
20620     tHdrH=_tmpHdr
20621     rm -f $tHdrH'.h' $tHdrH
20622     touch $tHdrH'.h'
20623     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20624        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20625        if [ -s $tHdrH'_cppsym.real' ]; then
20626           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20627        fi
20628     fi
20629     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20630   ;;
20631 esac
20632 : now check the C compiler for additional symbols
20633 postprocess_cc_v=''
20634 case "$osname" in
20635 aix) postprocess_cc_v="|$tr , ' '" ;;
20636 esac
20637 $cat >ccsym <<EOS
20638 $startsh
20639 $cat >tmp.c <<EOF
20640 extern int foo;
20641 EOF
20642 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20643 do
20644         case "\$i" in
20645         -D*) echo "\$i" | $sed 's/^-D//';;
20646         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20647         esac
20648 done
20649 $rm -f try.c
20650 EOS
20651 postprocess_cc_v=''
20652 chmod +x ccsym
20653 $eunicefix ccsym
20654 ./ccsym > ccsym1.raw
20655 if $test -s ccsym1.raw; then
20656        $sort ccsym1.raw | $uniq >ccsym.raw
20657 else
20658        mv ccsym1.raw ccsym.raw
20659 fi
20660
20661 $awk '/\=/ { print $0; next }
20662         { print $0"=1" }' ccsym.raw >ccsym.list
20663 $comm -13 Cppsym.true ccsym.list >ccsym.own
20664 $comm -12 Cppsym.true ccsym.list >ccsym.com
20665 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20666 also=''
20667 if $test -z ccsym.raw; then
20668         echo "Your C compiler doesn't seem to define any symbols!" >&4
20669         echo " "
20670         echo "However, your C preprocessor defines the following symbols:"
20671         $cat Cppsym.true
20672         ccsymbols=''
20673         cppsymbols=`$cat Cppsym.true`
20674         cppsymbols=`echo $cppsymbols`
20675         cppccsymbols="$cppsymbols"
20676 else
20677         if $test -s ccsym.com; then
20678                 echo "Your C compiler and pre-processor define these symbols:"
20679                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20680                 also='also '
20681                 symbols='ones'
20682                 cppccsymbols=`$cat ccsym.com`
20683                 cppccsymbols=`echo $cppccsymbols`
20684                 $test "$silent" || sleep 1
20685         fi
20686         if $test -s ccsym.cpp; then
20687                 $test "$also" && echo " "
20688                 echo "Your C pre-processor ${also}defines the following symbols:"
20689                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20690                 also='further '
20691                 cppsymbols=`$cat ccsym.cpp`
20692                 cppsymbols=`echo $cppsymbols`
20693                 $test "$silent" || sleep 1
20694         fi
20695         if $test -s ccsym.own; then
20696                 $test "$also" && echo " "
20697                 echo "Your C compiler ${also}defines the following cpp symbols:"
20698                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20699                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20700                 ccsymbols=`$cat ccsym.own`
20701                 ccsymbols=`echo $ccsymbols`
20702                 $test "$silent" || sleep 1
20703         fi
20704 fi
20705
20706 : see if this is a termio system
20707 val="$undef"
20708 val2="$undef"
20709 val3="$undef"
20710 if $test `./findhdr termios.h`; then
20711         set tcsetattr i_termios
20712         eval $inlibc
20713         val3="$i_termios"
20714 fi
20715 echo " "
20716 case "$val3" in
20717 "$define") echo "You have POSIX termios.h... good!" >&4;;
20718 *) if ./Cppsym pyr; then
20719                 case "`/bin/universe`" in
20720                 ucb) if $test `./findhdr sgtty.h`; then
20721                                 val2="$define"
20722                                 echo "<sgtty.h> found." >&4
20723                         else
20724                                 echo "System is pyramid with BSD universe."
20725                                 echo "<sgtty.h> not found--you could have problems." >&4
20726                         fi;;
20727                 *) if $test `./findhdr termio.h`; then
20728                                 val="$define"
20729                                 echo "<termio.h> found." >&4
20730                         else
20731                                 echo "System is pyramid with USG universe."
20732                                 echo "<termio.h> not found--you could have problems." >&4
20733                         fi;;
20734                 esac
20735         elif ./usg; then
20736                 if $test `./findhdr termio.h`; then
20737                         echo "<termio.h> found." >&4
20738                         val="$define"
20739                 elif $test `./findhdr sgtty.h`; then
20740                         echo "<sgtty.h> found." >&4
20741                         val2="$define"
20742                 else
20743 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20744                 fi
20745         else
20746                 if $test `./findhdr sgtty.h`; then
20747                         echo "<sgtty.h> found." >&4
20748                         val2="$define"
20749                 elif $test `./findhdr termio.h`; then
20750                         echo "<termio.h> found." >&4
20751                         val="$define"
20752                 else
20753 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20754                 fi
20755         fi;;
20756 esac
20757 set i_termio; eval $setvar
20758 val=$val2; set i_sgtty; eval $setvar
20759 val=$val3; set i_termios; eval $setvar
20760
20761 : see if stddef is available
20762 set stddef.h i_stddef
20763 eval $inhdr
20764
20765 : see if this is a sunmath.h system
20766 set sunmath.h i_sunmath
20767 eval $inhdr
20768
20769 : see if sys/access.h is available
20770 set sys/access.h i_sysaccess
20771 eval $inhdr
20772
20773 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20774 set sys/filio.h i_sysfilio
20775 eval $inhdr
20776 echo " "
20777 if $test `./findhdr sys/ioctl.h`; then
20778         val="$define"
20779         echo '<sys/ioctl.h> found.' >&4
20780 else
20781         val="$undef"
20782         if $test $i_sysfilio = "$define"; then
20783             echo '<sys/ioctl.h> NOT found.' >&4
20784         else
20785                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20786                 $test $i_termio = "$define" && xxx="termio.h"
20787                 $test $i_termios = "$define" && xxx="termios.h"
20788 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20789         fi
20790 fi
20791 set i_sysioctl
20792 eval $setvar
20793
20794 : see if socket ioctl defs are in sys/sockio.h
20795 echo " "
20796 xxx=`./findhdr sys/sockio.h`
20797 if $test "$xxx"; then
20798         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20799                 val="$define"
20800                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20801         else
20802                 val="$undef"
20803                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20804         fi
20805 else
20806         val="$undef"
20807         $cat <<EOM
20808 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20809 EOM
20810 fi
20811 set i_syssockio
20812 eval $setvar
20813
20814
20815 : see if this is a syslog.h system
20816 set syslog.h i_syslog
20817 eval $inhdr
20818
20819
20820 : see if this is a sys/mode.h system
20821 set sys/mode.h i_sysmode
20822 eval $inhdr
20823
20824 : see if sys/resource.h has to be included
20825 set sys/resource.h i_sysresrc
20826 eval $inhdr
20827
20828 : see if sys/security.h is available
20829 set sys/security.h i_syssecrt
20830 eval $inhdr
20831
20832 : see if this is a sys/statvfs.h system
20833 set sys/statvfs.h i_sysstatvfs
20834 eval $inhdr
20835
20836 : see if this is a sys/un.h system
20837 set sys/un.h i_sysun
20838 eval $inhdr
20839
20840
20841 : see if this is a sys/utsname.h system
20842 set sys/utsname.h i_sysutsname
20843 eval $inhdr
20844
20845 : see if this is a syswait system
20846 set sys/wait.h i_syswait
20847 eval $inhdr
20848
20849 : see if this is a ustat.h system
20850 set ustat.h i_ustat
20851 eval $inhdr
20852
20853 : see if this is an utime system
20854 set utime.h i_utime
20855 eval $inhdr
20856
20857 : see if this is a values.h system
20858 set values.h i_values
20859 eval $inhdr
20860
20861 : see if this is a vfork system
20862 case "$d_vfork" in
20863 "$define")
20864         set vfork.h i_vfork
20865         eval $inhdr
20866         ;;
20867 *)
20868         i_vfork="$undef"
20869         ;;
20870 esac
20871
20872 echo " "
20873 echo "Looking for extensions..." >&4
20874 : If we are using the old config.sh, known_extensions may contain
20875 : old or inaccurate or duplicate values.
20876 known_extensions=''
20877 nonxs_extensions=''
20878 : We do not use find because it might not be available.
20879 : We do not just use MANIFEST because the user may have dropped
20880 : some additional extensions into the source tree and expect them
20881 : to be built.
20882
20883 : Function to recursively find available extensions, ignoring DynaLoader
20884 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20885 find_extensions='
20886     for xxx in *; do
20887        case "$xxx" in
20888            DynaLoader|dynaload) ;;
20889            *)
20890            if $test -f $xxx/$xxx.xs; then
20891                known_extensions="$known_extensions $1$xxx";
20892            elif $test -f $xxx/Makefile.PL; then
20893                nonxs_extensions="$nonxs_extensions $1$xxx";
20894            else
20895                if $test -d $xxx -a $# -lt 10; then
20896                    set $1$xxx/ $*;
20897                    cd "$xxx";
20898                    eval $find_extensions;
20899                    cd ..;
20900                    shift;
20901                fi;
20902            fi
20903            ;;
20904        esac;
20905     done'
20906 tdir=`pwd`
20907 cd "$rsrc/ext"
20908 set X
20909 shift
20910 eval $find_extensions
20911 # Special case:  Add in threads/shared since it is not picked up by the
20912 # recursive find above (and adding in general recursive finding breaks
20913 # SDBM_File/sdbm).  A.D.  10/25/2001.
20914 known_extensions="$known_extensions threads/shared"
20915 set X $nonxs_extensions
20916 shift
20917 nonxs_extensions="$*"
20918 set X $known_extensions
20919 shift
20920 known_extensions="$*"
20921 cd "$tdir"
20922
20923 : Now see which are supported on this system.
20924 avail_ext=''
20925 for xxx in $known_extensions ; do
20926         case "$xxx" in
20927         DB_File|db_file)
20928                 case "$i_db" in
20929                 $define) avail_ext="$avail_ext $xxx" ;;
20930                 esac
20931                 ;;
20932         GDBM_File|gdbm_fil)
20933                 case "$i_gdbm" in 
20934                 $define) avail_ext="$avail_ext $xxx" ;;
20935                 esac
20936                 ;;
20937         I18N/Langinfo|i18n_lan)
20938                 case "$i_langinfo$d_nl_langinfo" in 
20939                 $define$define) avail_ext="$avail_ext $xxx" ;;
20940                 esac
20941                 ;;
20942         NDBM_File|ndbm_fil)
20943                 case "$i_ndbm" in
20944                 $define)
20945                     case "$osname-$use64bitint" in
20946                     hpux-define)
20947                         case "$libs" in
20948                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20949                         esac
20950                         ;;
20951                     *) avail_ext="$avail_ext $xxx" ;;
20952                     esac
20953                     ;;
20954                 esac
20955                 ;;
20956         ODBM_File|odbm_fil) 
20957                 case "${i_dbm}${i_rpcsvcdbm}" in
20958                 *"${define}"*)
20959                     case "$osname-$use64bitint" in
20960                     hpux-define)
20961                         case "$libs" in
20962                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20963                         esac
20964                         ;;
20965                     *) avail_ext="$avail_ext $xxx" ;;
20966                     esac
20967                     ;;
20968                 esac
20969                 ;;
20970         POSIX|posix)
20971                 case "$useposix" in
20972                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20973                 esac
20974                 ;;
20975         Opcode|opcode)
20976                 case "$useopcode" in
20977                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20978                 esac
20979                 ;;
20980         Socket|socket)
20981                 case "$d_socket" in 
20982                 true|$define|y)
20983                     case "$osname" in
20984                     beos) ;; # not unless BONE
20985                     *) avail_ext="$avail_ext $xxx" ;;
20986                     esac
20987                     ;;
20988                 esac
20989                 ;;
20990         Sys/Syslog|sys/syslog)
20991                 : XXX syslog requires socket
20992                 case "$d_socket" in 
20993                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20994                 esac
20995                 ;;
20996         Thread|thread)
20997                 case "$usethreads" in
20998                 true|$define|y)
20999                         case "$useithreads" in
21000                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
21001                         esac
21002                 esac
21003                 ;;
21004         XS/APItest|xs/apitest)
21005                 # This is just for testing.  Skip it unless we have dynamic loading.
21006
21007                 case "$usedl" in
21008                 $define) avail_ext="$avail_ext $xxx" ;;
21009                 esac
21010                 ;;
21011         XS/Typemap|xs/typemap)
21012                 # This is just for testing.  Skip it unless we have dynamic loading.
21013                 case "$usedl" in
21014                 $define) avail_ext="$avail_ext $xxx" ;;
21015                 esac
21016                 ;;
21017         threads|threads/shared)
21018                 # threads and threads::shared are special cases.
21019                 # To stop people from asking "Perl 5.8.0 was supposed
21020                 # to have this new fancy threads implementation but my
21021                 # perl doesn't have it" and from people trying to
21022                 # (re)install the threads module using CPAN.pm and
21023                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21024                 # the threads.pm and threads/shared.pm will always be
21025                 # there, croaking informatively ("you need to rebuild
21026                 # all of Perl with threads, sorry") when threads haven't
21027                 # been compiled in.
21028                 # --jhi
21029                 avail_ext="$avail_ext $xxx"
21030                 ;;
21031         IPC/SysV|ipc/sysv)
21032                 : XXX Do we need a useipcsysv variable here
21033                 case "${d_msg}${d_sem}${d_shm}" in 
21034                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21035                 esac
21036                 ;;
21037         *)      avail_ext="$avail_ext $xxx"
21038                 ;;
21039         esac
21040 done
21041
21042 set X $avail_ext
21043 shift
21044 avail_ext="$*"
21045
21046 case "$onlyextensions" in
21047 '') ;;
21048 *)  keepextensions=''
21049     echo "You have requested that only certains extensions be included..." >&4
21050     for i in $onlyextensions; do
21051         case " $avail_ext " in
21052         *" $i "*)
21053             echo "Keeping extension $i."
21054             keepextensions="$keepextensions $i"
21055             ;;
21056         *) echo "Ignoring extension $i." ;;
21057         esac
21058     done
21059     avail_ext="$keepextensions"
21060     ;;
21061 esac
21062
21063 case "$noextensions" in
21064 '') ;;
21065 *)  keepextensions=''
21066     echo "You have requested that certain extensions be ignored..." >&4
21067     for i in $avail_ext; do
21068         case " $noextensions " in
21069         *" $i "*) echo "Ignoring extension $i." ;;
21070         *) echo "Keeping extension $i.";
21071            keepextensions="$keepextensions $i"
21072            ;;
21073         esac
21074     done
21075     avail_ext="$keepextensions"
21076     ;;
21077 esac
21078
21079 : Now see which nonxs extensions are supported on this system.
21080 : For now assume all are.
21081 nonxs_ext=''
21082 for xxx in $nonxs_extensions ; do
21083         case "$xxx" in
21084         *)      nonxs_ext="$nonxs_ext $xxx"
21085                 ;;
21086         esac
21087 done
21088
21089 set X $nonxs_ext
21090 shift
21091 nonxs_ext="$*"
21092
21093 case $usedl in
21094 $define)
21095         $cat <<EOM
21096 A number of extensions are supplied with $package.  You may choose to
21097 compile these extensions for dynamic loading (the default), compile
21098 them into the $package executable (static loading), or not include
21099 them at all.  Answer "none" to include no extensions.
21100 Note that DynaLoader is always built and need not be mentioned here.
21101
21102 EOM
21103         case "$dynamic_ext" in
21104         '')
21105                 : Exclude those listed in static_ext
21106                 dflt=''
21107                 for xxx in $avail_ext; do
21108                         case " $static_ext " in
21109                         *" $xxx "*) ;;
21110                         *) dflt="$dflt $xxx" ;;
21111                         esac
21112                 done
21113                 set X $dflt
21114                 shift
21115                 dflt="$*"
21116                 ;;
21117         *)      dflt="$dynamic_ext"
21118                 # Perhaps we are reusing an old out-of-date config.sh.
21119                 case "$hint" in
21120                 previous)
21121                         if test X"$dynamic_ext" != X"$avail_ext"; then
21122                                 $cat <<EOM
21123 NOTICE:  Your previous config.sh list may be incorrect. 
21124 The extensions now available to you are 
21125         ${avail_ext}
21126 but the default list from your previous config.sh is
21127         ${dynamic_ext} 
21128
21129 EOM
21130                         fi
21131                         ;;
21132                 esac
21133                 ;;
21134         esac
21135         case "$dflt" in
21136         '')     dflt=none;;
21137         esac
21138         rp="What extensions do you wish to load dynamically?"
21139         . ./myread
21140         case "$ans" in
21141         none) dynamic_ext=' ' ;;
21142         *) dynamic_ext="$ans" ;;
21143         esac
21144
21145         case "$static_ext" in
21146         '')
21147                 : Exclude those already listed in dynamic linking
21148                 dflt=''
21149                 for xxx in $avail_ext; do
21150                         case " $dynamic_ext " in
21151                         *" $xxx "*) ;;
21152                         *) dflt="$dflt $xxx" ;;
21153                         esac
21154                 done
21155                 set X $dflt
21156                 shift
21157                 dflt="$*"
21158                 ;;
21159         *)  dflt="$static_ext" 
21160                 ;;
21161         esac
21162
21163         case "$dflt" in
21164         '')     dflt=none;;
21165         esac
21166         rp="What extensions do you wish to load statically?"
21167         . ./myread
21168         case "$ans" in
21169         none) static_ext=' ' ;;
21170         *) static_ext="$ans" ;;
21171         esac
21172         ;;
21173 *)
21174         $cat <<EOM
21175 A number of extensions are supplied with $package.  Answer "none" 
21176 to include no extensions. 
21177 Note that DynaLoader is always built and need not be mentioned here.
21178
21179 EOM
21180         case "$static_ext" in
21181         '') dflt="$avail_ext" ;;
21182         *)      dflt="$static_ext"
21183                 # Perhaps we are reusing an old out-of-date config.sh.
21184                 case "$hint" in
21185                 previous)
21186                         if test X"$static_ext" != X"$avail_ext"; then
21187                                 $cat <<EOM
21188 NOTICE:  Your previous config.sh list may be incorrect. 
21189 The extensions now available to you are 
21190         ${avail_ext}
21191 but the default list from your previous config.sh is
21192         ${static_ext} 
21193
21194 EOM
21195                         fi
21196                         ;;
21197                 esac
21198                 ;;
21199         esac
21200         : Exclude those that are not xs extensions
21201         case "$dflt" in
21202         '')     dflt=none;;
21203         esac
21204         rp="What extensions do you wish to include?"
21205         . ./myread
21206         case "$ans" in
21207         none) static_ext=' ' ;;
21208         *) static_ext="$ans" ;;
21209         esac
21210         ;;
21211 esac
21212 #        
21213 # Encode is a special case.  If we are building Encode as a static
21214 # extension, we need to explicitly list its subextensions as well.
21215 # For other nested extensions, this is handled automatically by
21216 # the appropriate Makefile.PL.
21217 case " $static_ext " in
21218         *" Encode "*) # Add the subextensions of Encode
21219         cd "$rsrc/ext"
21220         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21221                 static_ext="$static_ext Encode/$xxx"
21222         done
21223         cd "$tdir"
21224         ;;
21225 esac
21226
21227 set X $dynamic_ext $static_ext $nonxs_ext
21228 shift
21229 extensions="$*"
21230
21231 # Sanity check:  We require an extension suitable for use with
21232 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21233 # should show up as failures in the test suite, but it's helpful to
21234 # catch them now.) The 'extensions' list is normally sorted
21235 # alphabetically, so we need to accept either
21236 #    DB_File ... Fcntl ... IO  ....
21237 # or something like
21238 #    Fcntl ... NDBM_File ... IO  ....
21239 case " $extensions"  in
21240 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21241 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21242 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21243 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21244    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21245    ;;
21246 esac
21247
21248 : Remove libraries needed only for extensions
21249 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21250 : The exception is SunOS 4.x, which needs them.
21251 case "${osname}X${osvers}" in
21252 sunos*X4*)
21253     perllibs="$libs"
21254     ;;
21255 *) case "$usedl" in
21256     $define|true|[yY]*)
21257             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21258             shift
21259             perllibs="$*"
21260             ;;
21261     *)  perllibs="$libs"
21262             ;;
21263     esac
21264     ;;
21265 esac
21266
21267 : Remove build directory name from cppstdin so it can be used from
21268 : either the present location or the final installed location.
21269 echo " "
21270 : Get out of the UU directory to get correct path name.
21271 cd ..
21272 case "$cppstdin" in
21273 `pwd`/cppstdin)
21274         echo "Stripping down cppstdin path name"
21275         cppstdin=cppstdin
21276         ;;
21277 esac
21278 cd UU
21279
21280 : end of configuration questions
21281 echo " "
21282 echo "End of configuration questions."
21283 echo " "
21284
21285 : back to where it started
21286 if test -d ../UU; then
21287         cd ..
21288 fi
21289
21290 : configuration may be patched via a 'config.arch' file
21291 if $test -f config.arch; then
21292         echo "I see a config.arch file, loading it."
21293         . ./config.arch
21294 fi
21295
21296 : configuration may be patched via a 'config.over' file
21297 if $test -f config.over; then
21298         echo " "
21299         dflt=y
21300         rp='I see a config.over file.  Do you wish to load it?'
21301         . UU/myread
21302         case "$ans" in
21303         n*) echo "OK, I'll ignore it.";;
21304         *)      . ./config.over
21305                 echo "Configuration override changes have been loaded."
21306                 ;;
21307         esac
21308 fi
21309
21310 : in case they want portability, strip down executable paths
21311 case "$d_portable" in
21312 "$define")
21313         echo " "
21314         echo "Stripping down executable paths..." >&4
21315         for file in $loclist $trylist; do
21316                 eval temp=\$$file
21317                 eval $file=`basename $temp`
21318         done
21319         ;;
21320 esac
21321
21322 : create config.sh file
21323 echo " "
21324 echo "Creating config.sh..." >&4
21325 $spitshell <<EOT >config.sh
21326 $startsh
21327 #
21328 # This file was produced by running the Configure script. It holds all the
21329 # definitions figured out by Configure. Should you modify one of these values,
21330 # do not forget to propagate your changes by running "Configure -der". You may
21331 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21332 #
21333
21334 # Package name      : $package
21335 # Source directory  : $src
21336 # Configuration time: $cf_time
21337 # Configured by     : $cf_by
21338 # Target system     : $myuname
21339
21340 Author='$Author'
21341 Date='$Date'
21342 Header='$Header'
21343 Id='$Id'
21344 Locker='$Locker'
21345 Log='$Log'
21346 Mcc='$Mcc'
21347 RCSfile='$RCSfile'
21348 Revision='$Revision'
21349 Source='$Source'
21350 State='$State'
21351 _a='$_a'
21352 _exe='$_exe'
21353 _o='$_o'
21354 afs='$afs'
21355 afsroot='$afsroot'
21356 alignbytes='$alignbytes'
21357 ansi2knr='$ansi2knr'
21358 aphostname='$aphostname'
21359 api_revision='$api_revision'
21360 api_subversion='$api_subversion'
21361 api_version='$api_version'
21362 api_versionstring='$api_versionstring'
21363 ar='$ar'
21364 archlib='$archlib'
21365 archlibexp='$archlibexp'
21366 archname64='$archname64'
21367 archname='$archname'
21368 archobjs='$archobjs'
21369 asctime_r_proto='$asctime_r_proto'
21370 awk='$awk'
21371 baserev='$baserev'
21372 bash='$bash'
21373 bin='$bin'
21374 binexp='$binexp'
21375 bison='$bison'
21376 byacc='$byacc'
21377 byteorder='$byteorder'
21378 c='$c'
21379 castflags='$castflags'
21380 cat='$cat'
21381 cc='$cc'
21382 cccdlflags='$cccdlflags'
21383 ccdlflags='$ccdlflags'
21384 ccflags='$ccflags'
21385 ccflags_uselargefiles='$ccflags_uselargefiles'
21386 ccname='$ccname'
21387 ccsymbols='$ccsymbols'
21388 ccversion='$ccversion'
21389 cf_by='$cf_by'
21390 cf_email='$cf_email'
21391 cf_time='$cf_time'
21392 charsize='$charsize'
21393 chgrp='$chgrp'
21394 chmod='$chmod'
21395 chown='$chown'
21396 clocktype='$clocktype'
21397 comm='$comm'
21398 compress='$compress'
21399 contains='$contains'
21400 cp='$cp'
21401 cpio='$cpio'
21402 cpp='$cpp'
21403 cpp_stuff='$cpp_stuff'
21404 cppccsymbols='$cppccsymbols'
21405 cppflags='$cppflags'
21406 cpplast='$cpplast'
21407 cppminus='$cppminus'
21408 cpprun='$cpprun'
21409 cppstdin='$cppstdin'
21410 cppsymbols='$cppsymbols'
21411 crypt_r_proto='$crypt_r_proto'
21412 cryptlib='$cryptlib'
21413 csh='$csh'
21414 ctermid_r_proto='$ctermid_r_proto'
21415 ctime_r_proto='$ctime_r_proto'
21416 d_Gconvert='$d_Gconvert'
21417 d_PRIEUldbl='$d_PRIEUldbl'
21418 d_PRIFUldbl='$d_PRIFUldbl'
21419 d_PRIGUldbl='$d_PRIGUldbl'
21420 d_PRIXU64='$d_PRIXU64'
21421 d_PRId64='$d_PRId64'
21422 d_PRIeldbl='$d_PRIeldbl'
21423 d_PRIfldbl='$d_PRIfldbl'
21424 d_PRIgldbl='$d_PRIgldbl'
21425 d_PRIi64='$d_PRIi64'
21426 d_PRIo64='$d_PRIo64'
21427 d_PRIu64='$d_PRIu64'
21428 d_PRIx64='$d_PRIx64'
21429 d_SCNfldbl='$d_SCNfldbl'
21430 d__fwalk='$d__fwalk'
21431 d_access='$d_access'
21432 d_accessx='$d_accessx'
21433 d_aintl='$d_aintl'
21434 d_alarm='$d_alarm'
21435 d_archlib='$d_archlib'
21436 d_asctime_r='$d_asctime_r'
21437 d_atolf='$d_atolf'
21438 d_atoll='$d_atoll'
21439 d_attribute_format='$d_attribute_format'
21440 d_attribute_malloc='$d_attribute_malloc'
21441 d_attribute_nonnull='$d_attribute_nonnull'
21442 d_attribute_noreturn='$d_attribute_noreturn'
21443 d_attribute_pure='$d_attribute_pure'
21444 d_attribute_unused='$d_attribute_unused'
21445 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21446 d_bcmp='$d_bcmp'
21447 d_bcopy='$d_bcopy'
21448 d_bsd='$d_bsd'
21449 d_bsdgetpgrp='$d_bsdgetpgrp'
21450 d_bsdsetpgrp='$d_bsdsetpgrp'
21451 d_builtin_choose_expr='$d_builtin_choose_expr'
21452 d_builtin_expect='$d_builtin_expect'
21453 d_bzero='$d_bzero'
21454 d_c99_variadic_macros='$d_c99_variadic_macros'
21455 d_casti32='$d_casti32'
21456 d_castneg='$d_castneg'
21457 d_charvspr='$d_charvspr'
21458 d_chown='$d_chown'
21459 d_chroot='$d_chroot'
21460 d_chsize='$d_chsize'
21461 d_class='$d_class'
21462 d_clearenv='$d_clearenv'
21463 d_closedir='$d_closedir'
21464 d_cmsghdr_s='$d_cmsghdr_s'
21465 d_const='$d_const'
21466 d_copysignl='$d_copysignl'
21467 d_cplusplus='$d_cplusplus'
21468 d_crypt='$d_crypt'
21469 d_crypt_r='$d_crypt_r'
21470 d_csh='$d_csh'
21471 d_ctermid='$d_ctermid'
21472 d_ctermid_r='$d_ctermid_r'
21473 d_ctime_r='$d_ctime_r'
21474 d_cuserid='$d_cuserid'
21475 d_dbl_dig='$d_dbl_dig'
21476 d_dbminitproto='$d_dbminitproto'
21477 d_difftime='$d_difftime'
21478 d_dir_dd_fd='$d_dir_dd_fd'
21479 d_dirfd='$d_dirfd'
21480 d_dirnamlen='$d_dirnamlen'
21481 d_dlerror='$d_dlerror'
21482 d_dlopen='$d_dlopen'
21483 d_dlsymun='$d_dlsymun'
21484 d_dosuid='$d_dosuid'
21485 d_drand48_r='$d_drand48_r'
21486 d_drand48proto='$d_drand48proto'
21487 d_dup2='$d_dup2'
21488 d_eaccess='$d_eaccess'
21489 d_endgrent='$d_endgrent'
21490 d_endgrent_r='$d_endgrent_r'
21491 d_endhent='$d_endhent'
21492 d_endhostent_r='$d_endhostent_r'
21493 d_endnent='$d_endnent'
21494 d_endnetent_r='$d_endnetent_r'
21495 d_endpent='$d_endpent'
21496 d_endprotoent_r='$d_endprotoent_r'
21497 d_endpwent='$d_endpwent'
21498 d_endpwent_r='$d_endpwent_r'
21499 d_endsent='$d_endsent'
21500 d_endservent_r='$d_endservent_r'
21501 d_eofnblk='$d_eofnblk'
21502 d_eunice='$d_eunice'
21503 d_faststdio='$d_faststdio'
21504 d_fchdir='$d_fchdir'
21505 d_fchmod='$d_fchmod'
21506 d_fchown='$d_fchown'
21507 d_fcntl='$d_fcntl'
21508 d_fcntl_can_lock='$d_fcntl_can_lock'
21509 d_fd_macros='$d_fd_macros'
21510 d_fd_set='$d_fd_set'
21511 d_fds_bits='$d_fds_bits'
21512 d_fgetpos='$d_fgetpos'
21513 d_finite='$d_finite'
21514 d_finitel='$d_finitel'
21515 d_flexfnam='$d_flexfnam'
21516 d_flock='$d_flock'
21517 d_flockproto='$d_flockproto'
21518 d_fork='$d_fork'
21519 d_fp_class='$d_fp_class'
21520 d_fpathconf='$d_fpathconf'
21521 d_fpclass='$d_fpclass'
21522 d_fpclassify='$d_fpclassify'
21523 d_fpclassl='$d_fpclassl'
21524 d_fpos64_t='$d_fpos64_t'
21525 d_frexpl='$d_frexpl'
21526 d_fs_data_s='$d_fs_data_s'
21527 d_fseeko='$d_fseeko'
21528 d_fsetpos='$d_fsetpos'
21529 d_fstatfs='$d_fstatfs'
21530 d_fstatvfs='$d_fstatvfs'
21531 d_fsync='$d_fsync'
21532 d_ftello='$d_ftello'
21533 d_ftime='$d_ftime'
21534 d_futimes='$d_futimes'
21535 d_getcwd='$d_getcwd'
21536 d_getespwnam='$d_getespwnam'
21537 d_getfsstat='$d_getfsstat'
21538 d_getgrent='$d_getgrent'
21539 d_getgrent_r='$d_getgrent_r'
21540 d_getgrgid_r='$d_getgrgid_r'
21541 d_getgrnam_r='$d_getgrnam_r'
21542 d_getgrps='$d_getgrps'
21543 d_gethbyaddr='$d_gethbyaddr'
21544 d_gethbyname='$d_gethbyname'
21545 d_gethent='$d_gethent'
21546 d_gethname='$d_gethname'
21547 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21548 d_gethostbyname_r='$d_gethostbyname_r'
21549 d_gethostent_r='$d_gethostent_r'
21550 d_gethostprotos='$d_gethostprotos'
21551 d_getitimer='$d_getitimer'
21552 d_getlogin='$d_getlogin'
21553 d_getlogin_r='$d_getlogin_r'
21554 d_getmnt='$d_getmnt'
21555 d_getmntent='$d_getmntent'
21556 d_getnbyaddr='$d_getnbyaddr'
21557 d_getnbyname='$d_getnbyname'
21558 d_getnent='$d_getnent'
21559 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21560 d_getnetbyname_r='$d_getnetbyname_r'
21561 d_getnetent_r='$d_getnetent_r'
21562 d_getnetprotos='$d_getnetprotos'
21563 d_getpagsz='$d_getpagsz'
21564 d_getpbyname='$d_getpbyname'
21565 d_getpbynumber='$d_getpbynumber'
21566 d_getpent='$d_getpent'
21567 d_getpgid='$d_getpgid'
21568 d_getpgrp2='$d_getpgrp2'
21569 d_getpgrp='$d_getpgrp'
21570 d_getppid='$d_getppid'
21571 d_getprior='$d_getprior'
21572 d_getprotobyname_r='$d_getprotobyname_r'
21573 d_getprotobynumber_r='$d_getprotobynumber_r'
21574 d_getprotoent_r='$d_getprotoent_r'
21575 d_getprotoprotos='$d_getprotoprotos'
21576 d_getprpwnam='$d_getprpwnam'
21577 d_getpwent='$d_getpwent'
21578 d_getpwent_r='$d_getpwent_r'
21579 d_getpwnam_r='$d_getpwnam_r'
21580 d_getpwuid_r='$d_getpwuid_r'
21581 d_getsbyname='$d_getsbyname'
21582 d_getsbyport='$d_getsbyport'
21583 d_getsent='$d_getsent'
21584 d_getservbyname_r='$d_getservbyname_r'
21585 d_getservbyport_r='$d_getservbyport_r'
21586 d_getservent_r='$d_getservent_r'
21587 d_getservprotos='$d_getservprotos'
21588 d_getspnam='$d_getspnam'
21589 d_getspnam_r='$d_getspnam_r'
21590 d_gettimeod='$d_gettimeod'
21591 d_gmtime_r='$d_gmtime_r'
21592 d_gnulibc='$d_gnulibc'
21593 d_grpasswd='$d_grpasswd'
21594 d_hasmntopt='$d_hasmntopt'
21595 d_htonl='$d_htonl'
21596 d_ilogbl='$d_ilogbl'
21597 d_inc_version_list='$d_inc_version_list'
21598 d_index='$d_index'
21599 d_inetaton='$d_inetaton'
21600 d_int64_t='$d_int64_t'
21601 d_isascii='$d_isascii'
21602 d_isfinite='$d_isfinite'
21603 d_isinf='$d_isinf'
21604 d_isnan='$d_isnan'
21605 d_isnanl='$d_isnanl'
21606 d_killpg='$d_killpg'
21607 d_lchown='$d_lchown'
21608 d_ldbl_dig='$d_ldbl_dig'
21609 d_libm_lib_version='$d_libm_lib_version'
21610 d_link='$d_link'
21611 d_localtime_r='$d_localtime_r'
21612 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21613 d_locconv='$d_locconv'
21614 d_lockf='$d_lockf'
21615 d_longdbl='$d_longdbl'
21616 d_longlong='$d_longlong'
21617 d_lseekproto='$d_lseekproto'
21618 d_lstat='$d_lstat'
21619 d_madvise='$d_madvise'
21620 d_malloc_good_size='$d_malloc_good_size'
21621 d_malloc_size='$d_malloc_size'
21622 d_mblen='$d_mblen'
21623 d_mbstowcs='$d_mbstowcs'
21624 d_mbtowc='$d_mbtowc'
21625 d_memchr='$d_memchr'
21626 d_memcmp='$d_memcmp'
21627 d_memcpy='$d_memcpy'
21628 d_memmove='$d_memmove'
21629 d_memset='$d_memset'
21630 d_mkdir='$d_mkdir'
21631 d_mkdtemp='$d_mkdtemp'
21632 d_mkfifo='$d_mkfifo'
21633 d_mkstemp='$d_mkstemp'
21634 d_mkstemps='$d_mkstemps'
21635 d_mktime='$d_mktime'
21636 d_mmap='$d_mmap'
21637 d_modfl='$d_modfl'
21638 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21639 d_modflproto='$d_modflproto'
21640 d_mprotect='$d_mprotect'
21641 d_msg='$d_msg'
21642 d_msg_ctrunc='$d_msg_ctrunc'
21643 d_msg_dontroute='$d_msg_dontroute'
21644 d_msg_oob='$d_msg_oob'
21645 d_msg_peek='$d_msg_peek'
21646 d_msg_proxy='$d_msg_proxy'
21647 d_msgctl='$d_msgctl'
21648 d_msgget='$d_msgget'
21649 d_msghdr_s='$d_msghdr_s'
21650 d_msgrcv='$d_msgrcv'
21651 d_msgsnd='$d_msgsnd'
21652 d_msync='$d_msync'
21653 d_munmap='$d_munmap'
21654 d_mymalloc='$d_mymalloc'
21655 d_nice='$d_nice'
21656 d_nl_langinfo='$d_nl_langinfo'
21657 d_nv_preserves_uv='$d_nv_preserves_uv'
21658 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21659 d_off64_t='$d_off64_t'
21660 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21661 d_oldpthreads='$d_oldpthreads'
21662 d_oldsock='$d_oldsock'
21663 d_open3='$d_open3'
21664 d_pathconf='$d_pathconf'
21665 d_pause='$d_pause'
21666 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21667 d_phostname='$d_phostname'
21668 d_pipe='$d_pipe'
21669 d_poll='$d_poll'
21670 d_portable='$d_portable'
21671 d_procselfexe='$d_procselfexe'
21672 d_pthread_atfork='$d_pthread_atfork'
21673 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21674 d_pthread_yield='$d_pthread_yield'
21675 d_pwage='$d_pwage'
21676 d_pwchange='$d_pwchange'
21677 d_pwclass='$d_pwclass'
21678 d_pwcomment='$d_pwcomment'
21679 d_pwexpire='$d_pwexpire'
21680 d_pwgecos='$d_pwgecos'
21681 d_pwpasswd='$d_pwpasswd'
21682 d_pwquota='$d_pwquota'
21683 d_qgcvt='$d_qgcvt'
21684 d_quad='$d_quad'
21685 d_random_r='$d_random_r'
21686 d_readdir64_r='$d_readdir64_r'
21687 d_readdir='$d_readdir'
21688 d_readdir_r='$d_readdir_r'
21689 d_readlink='$d_readlink'
21690 d_readv='$d_readv'
21691 d_recvmsg='$d_recvmsg'
21692 d_rename='$d_rename'
21693 d_rewinddir='$d_rewinddir'
21694 d_rmdir='$d_rmdir'
21695 d_safebcpy='$d_safebcpy'
21696 d_safemcpy='$d_safemcpy'
21697 d_sanemcmp='$d_sanemcmp'
21698 d_sbrkproto='$d_sbrkproto'
21699 d_scalbnl='$d_scalbnl'
21700 d_sched_yield='$d_sched_yield'
21701 d_scm_rights='$d_scm_rights'
21702 d_seekdir='$d_seekdir'
21703 d_select='$d_select'
21704 d_sem='$d_sem'
21705 d_semctl='$d_semctl'
21706 d_semctl_semid_ds='$d_semctl_semid_ds'
21707 d_semctl_semun='$d_semctl_semun'
21708 d_semget='$d_semget'
21709 d_semop='$d_semop'
21710 d_sendmsg='$d_sendmsg'
21711 d_setegid='$d_setegid'
21712 d_seteuid='$d_seteuid'
21713 d_setgrent='$d_setgrent'
21714 d_setgrent_r='$d_setgrent_r'
21715 d_setgrps='$d_setgrps'
21716 d_sethent='$d_sethent'
21717 d_sethostent_r='$d_sethostent_r'
21718 d_setitimer='$d_setitimer'
21719 d_setlinebuf='$d_setlinebuf'
21720 d_setlocale='$d_setlocale'
21721 d_setlocale_r='$d_setlocale_r'
21722 d_setnent='$d_setnent'
21723 d_setnetent_r='$d_setnetent_r'
21724 d_setpent='$d_setpent'
21725 d_setpgid='$d_setpgid'
21726 d_setpgrp2='$d_setpgrp2'
21727 d_setpgrp='$d_setpgrp'
21728 d_setprior='$d_setprior'
21729 d_setproctitle='$d_setproctitle'
21730 d_setprotoent_r='$d_setprotoent_r'
21731 d_setpwent='$d_setpwent'
21732 d_setpwent_r='$d_setpwent_r'
21733 d_setregid='$d_setregid'
21734 d_setresgid='$d_setresgid'
21735 d_setresuid='$d_setresuid'
21736 d_setreuid='$d_setreuid'
21737 d_setrgid='$d_setrgid'
21738 d_setruid='$d_setruid'
21739 d_setsent='$d_setsent'
21740 d_setservent_r='$d_setservent_r'
21741 d_setsid='$d_setsid'
21742 d_setvbuf='$d_setvbuf'
21743 d_sfio='$d_sfio'
21744 d_shm='$d_shm'
21745 d_shmat='$d_shmat'
21746 d_shmatprototype='$d_shmatprototype'
21747 d_shmctl='$d_shmctl'
21748 d_shmdt='$d_shmdt'
21749 d_shmget='$d_shmget'
21750 d_sigaction='$d_sigaction'
21751 d_sigprocmask='$d_sigprocmask'
21752 d_sigsetjmp='$d_sigsetjmp'
21753 d_sitearch='$d_sitearch'
21754 d_snprintf='$d_snprintf'
21755 d_sockatmark='$d_sockatmark'
21756 d_sockatmarkproto='$d_sockatmarkproto'
21757 d_socket='$d_socket'
21758 d_socklen_t='$d_socklen_t'
21759 d_sockpair='$d_sockpair'
21760 d_socks5_init='$d_socks5_init'
21761 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21762 d_sqrtl='$d_sqrtl'
21763 d_srand48_r='$d_srand48_r'
21764 d_srandom_r='$d_srandom_r'
21765 d_sresgproto='$d_sresgproto'
21766 d_sresuproto='$d_sresuproto'
21767 d_statblks='$d_statblks'
21768 d_statfs_f_flags='$d_statfs_f_flags'
21769 d_statfs_s='$d_statfs_s'
21770 d_statvfs='$d_statvfs'
21771 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21772 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21773 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21774 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21775 d_stdio_stream_array='$d_stdio_stream_array'
21776 d_stdiobase='$d_stdiobase'
21777 d_stdstdio='$d_stdstdio'
21778 d_strchr='$d_strchr'
21779 d_strcoll='$d_strcoll'
21780 d_strctcpy='$d_strctcpy'
21781 d_strerrm='$d_strerrm'
21782 d_strerror='$d_strerror'
21783 d_strerror_r='$d_strerror_r'
21784 d_strftime='$d_strftime'
21785 d_strlcat='$d_strlcat'
21786 d_strlcpy='$d_strlcpy'
21787 d_strtod='$d_strtod'
21788 d_strtol='$d_strtol'
21789 d_strtold='$d_strtold'
21790 d_strtoll='$d_strtoll'
21791 d_strtoq='$d_strtoq'
21792 d_strtoul='$d_strtoul'
21793 d_strtoull='$d_strtoull'
21794 d_strtouq='$d_strtouq'
21795 d_strxfrm='$d_strxfrm'
21796 d_suidsafe='$d_suidsafe'
21797 d_symlink='$d_symlink'
21798 d_syscall='$d_syscall'
21799 d_syscallproto='$d_syscallproto'
21800 d_sysconf='$d_sysconf'
21801 d_sysernlst='$d_sysernlst'
21802 d_syserrlst='$d_syserrlst'
21803 d_system='$d_system'
21804 d_tcgetpgrp='$d_tcgetpgrp'
21805 d_tcsetpgrp='$d_tcsetpgrp'
21806 d_telldir='$d_telldir'
21807 d_telldirproto='$d_telldirproto'
21808 d_time='$d_time'
21809 d_times='$d_times'
21810 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21811 d_tm_tm_zone='$d_tm_tm_zone'
21812 d_tmpnam_r='$d_tmpnam_r'
21813 d_truncate='$d_truncate'
21814 d_ttyname_r='$d_ttyname_r'
21815 d_tzname='$d_tzname'
21816 d_u32align='$d_u32align'
21817 d_ualarm='$d_ualarm'
21818 d_umask='$d_umask'
21819 d_uname='$d_uname'
21820 d_union_semun='$d_union_semun'
21821 d_unordered='$d_unordered'
21822 d_unsetenv='$d_unsetenv'
21823 d_usleep='$d_usleep'
21824 d_usleepproto='$d_usleepproto'
21825 d_ustat='$d_ustat'
21826 d_vendorarch='$d_vendorarch'
21827 d_vendorbin='$d_vendorbin'
21828 d_vendorlib='$d_vendorlib'
21829 d_vendorscript='$d_vendorscript'
21830 d_vfork='$d_vfork'
21831 d_void_closedir='$d_void_closedir'
21832 d_voidsig='$d_voidsig'
21833 d_voidtty='$d_voidtty'
21834 d_volatile='$d_volatile'
21835 d_vprintf='$d_vprintf'
21836 d_vsnprintf='$d_vsnprintf'
21837 d_wait4='$d_wait4'
21838 d_waitpid='$d_waitpid'
21839 d_wcstombs='$d_wcstombs'
21840 d_wctomb='$d_wctomb'
21841 d_writev='$d_writev'
21842 d_xenix='$d_xenix'
21843 date='$date'
21844 db_hashtype='$db_hashtype'
21845 db_prefixtype='$db_prefixtype'
21846 db_version_major='$db_version_major'
21847 db_version_minor='$db_version_minor'
21848 db_version_patch='$db_version_patch'
21849 defvoidused='$defvoidused'
21850 direntrytype='$direntrytype'
21851 dlext='$dlext'
21852 dlsrc='$dlsrc'
21853 doublesize='$doublesize'
21854 drand01='$drand01'
21855 drand48_r_proto='$drand48_r_proto'
21856 dynamic_ext='$dynamic_ext'
21857 eagain='$eagain'
21858 ebcdic='$ebcdic'
21859 echo='$echo'
21860 egrep='$egrep'
21861 emacs='$emacs'
21862 endgrent_r_proto='$endgrent_r_proto'
21863 endhostent_r_proto='$endhostent_r_proto'
21864 endnetent_r_proto='$endnetent_r_proto'
21865 endprotoent_r_proto='$endprotoent_r_proto'
21866 endpwent_r_proto='$endpwent_r_proto'
21867 endservent_r_proto='$endservent_r_proto'
21868 eunicefix='$eunicefix'
21869 exe_ext='$exe_ext'
21870 expr='$expr'
21871 extensions='$extensions'
21872 extras='$extras'
21873 fflushNULL='$fflushNULL'
21874 fflushall='$fflushall'
21875 find='$find'
21876 firstmakefile='$firstmakefile'
21877 flex='$flex'
21878 fpossize='$fpossize'
21879 fpostype='$fpostype'
21880 freetype='$freetype'
21881 from='$from'
21882 full_ar='$full_ar'
21883 full_csh='$full_csh'
21884 full_sed='$full_sed'
21885 gccansipedantic='$gccansipedantic'
21886 gccosandvers='$gccosandvers'
21887 gccversion='$gccversion'
21888 getgrent_r_proto='$getgrent_r_proto'
21889 getgrgid_r_proto='$getgrgid_r_proto'
21890 getgrnam_r_proto='$getgrnam_r_proto'
21891 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21892 gethostbyname_r_proto='$gethostbyname_r_proto'
21893 gethostent_r_proto='$gethostent_r_proto'
21894 getlogin_r_proto='$getlogin_r_proto'
21895 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21896 getnetbyname_r_proto='$getnetbyname_r_proto'
21897 getnetent_r_proto='$getnetent_r_proto'
21898 getprotobyname_r_proto='$getprotobyname_r_proto'
21899 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21900 getprotoent_r_proto='$getprotoent_r_proto'
21901 getpwent_r_proto='$getpwent_r_proto'
21902 getpwnam_r_proto='$getpwnam_r_proto'
21903 getpwuid_r_proto='$getpwuid_r_proto'
21904 getservbyname_r_proto='$getservbyname_r_proto'
21905 getservbyport_r_proto='$getservbyport_r_proto'
21906 getservent_r_proto='$getservent_r_proto'
21907 getspnam_r_proto='$getspnam_r_proto'
21908 gidformat='$gidformat'
21909 gidsign='$gidsign'
21910 gidsize='$gidsize'
21911 gidtype='$gidtype'
21912 glibpth='$glibpth'
21913 gmake='$gmake'
21914 gmtime_r_proto='$gmtime_r_proto'
21915 gnulibc_version='$gnulibc_version'
21916 grep='$grep'
21917 groupcat='$groupcat'
21918 groupstype='$groupstype'
21919 gzip='$gzip'
21920 h_fcntl='$h_fcntl'
21921 h_sysfile='$h_sysfile'
21922 hint='$hint'
21923 hostcat='$hostcat'
21924 html1dir='$html1dir'
21925 html1direxp='$html1direxp'
21926 html3dir='$html3dir'
21927 html3direxp='$html3direxp'
21928 i16size='$i16size'
21929 i16type='$i16type'
21930 i32size='$i32size'
21931 i32type='$i32type'
21932 i64size='$i64size'
21933 i64type='$i64type'
21934 i8size='$i8size'
21935 i8type='$i8type'
21936 i_arpainet='$i_arpainet'
21937 i_bsdioctl='$i_bsdioctl'
21938 i_crypt='$i_crypt'
21939 i_db='$i_db'
21940 i_dbm='$i_dbm'
21941 i_dirent='$i_dirent'
21942 i_dld='$i_dld'
21943 i_dlfcn='$i_dlfcn'
21944 i_fcntl='$i_fcntl'
21945 i_float='$i_float'
21946 i_fp='$i_fp'
21947 i_fp_class='$i_fp_class'
21948 i_gdbm='$i_gdbm'
21949 i_grp='$i_grp'
21950 i_ieeefp='$i_ieeefp'
21951 i_inttypes='$i_inttypes'
21952 i_langinfo='$i_langinfo'
21953 i_libutil='$i_libutil'
21954 i_limits='$i_limits'
21955 i_locale='$i_locale'
21956 i_machcthr='$i_machcthr'
21957 i_malloc='$i_malloc'
21958 i_math='$i_math'
21959 i_memory='$i_memory'
21960 i_mntent='$i_mntent'
21961 i_ndbm='$i_ndbm'
21962 i_netdb='$i_netdb'
21963 i_neterrno='$i_neterrno'
21964 i_netinettcp='$i_netinettcp'
21965 i_niin='$i_niin'
21966 i_poll='$i_poll'
21967 i_prot='$i_prot'
21968 i_pthread='$i_pthread'
21969 i_pwd='$i_pwd'
21970 i_rpcsvcdbm='$i_rpcsvcdbm'
21971 i_sfio='$i_sfio'
21972 i_sgtty='$i_sgtty'
21973 i_shadow='$i_shadow'
21974 i_socks='$i_socks'
21975 i_stdarg='$i_stdarg'
21976 i_stddef='$i_stddef'
21977 i_stdlib='$i_stdlib'
21978 i_string='$i_string'
21979 i_sunmath='$i_sunmath'
21980 i_sysaccess='$i_sysaccess'
21981 i_sysdir='$i_sysdir'
21982 i_sysfile='$i_sysfile'
21983 i_sysfilio='$i_sysfilio'
21984 i_sysin='$i_sysin'
21985 i_sysioctl='$i_sysioctl'
21986 i_syslog='$i_syslog'
21987 i_sysmman='$i_sysmman'
21988 i_sysmode='$i_sysmode'
21989 i_sysmount='$i_sysmount'
21990 i_sysndir='$i_sysndir'
21991 i_sysparam='$i_sysparam'
21992 i_sysresrc='$i_sysresrc'
21993 i_syssecrt='$i_syssecrt'
21994 i_sysselct='$i_sysselct'
21995 i_syssockio='$i_syssockio'
21996 i_sysstat='$i_sysstat'
21997 i_sysstatfs='$i_sysstatfs'
21998 i_sysstatvfs='$i_sysstatvfs'
21999 i_systime='$i_systime'
22000 i_systimek='$i_systimek'
22001 i_systimes='$i_systimes'
22002 i_systypes='$i_systypes'
22003 i_sysuio='$i_sysuio'
22004 i_sysun='$i_sysun'
22005 i_sysutsname='$i_sysutsname'
22006 i_sysvfs='$i_sysvfs'
22007 i_syswait='$i_syswait'
22008 i_termio='$i_termio'
22009 i_termios='$i_termios'
22010 i_time='$i_time'
22011 i_unistd='$i_unistd'
22012 i_ustat='$i_ustat'
22013 i_utime='$i_utime'
22014 i_values='$i_values'
22015 i_varargs='$i_varargs'
22016 i_varhdr='$i_varhdr'
22017 i_vfork='$i_vfork'
22018 ignore_versioned_solibs='$ignore_versioned_solibs'
22019 inc_version_list='$inc_version_list'
22020 inc_version_list_init='$inc_version_list_init'
22021 incpath='$incpath'
22022 inews='$inews'
22023 initialinstalllocation='$initialinstalllocation'
22024 installarchlib='$installarchlib'
22025 installbin='$installbin'
22026 installhtml1dir='$installhtml1dir'
22027 installhtml3dir='$installhtml3dir'
22028 installman1dir='$installman1dir'
22029 installman3dir='$installman3dir'
22030 installprefix='$installprefix'
22031 installprefixexp='$installprefixexp'
22032 installprivlib='$installprivlib'
22033 installscript='$installscript'
22034 installsitearch='$installsitearch'
22035 installsitebin='$installsitebin'
22036 installsitehtml1dir='$installsitehtml1dir'
22037 installsitehtml3dir='$installsitehtml3dir'
22038 installsitelib='$installsitelib'
22039 installsiteman1dir='$installsiteman1dir'
22040 installsiteman3dir='$installsiteman3dir'
22041 installsitescript='$installsitescript'
22042 installstyle='$installstyle'
22043 installusrbinperl='$installusrbinperl'
22044 installvendorarch='$installvendorarch'
22045 installvendorbin='$installvendorbin'
22046 installvendorhtml1dir='$installvendorhtml1dir'
22047 installvendorhtml3dir='$installvendorhtml3dir'
22048 installvendorlib='$installvendorlib'
22049 installvendorman1dir='$installvendorman1dir'
22050 installvendorman3dir='$installvendorman3dir'
22051 installvendorscript='$installvendorscript'
22052 intsize='$intsize'
22053 issymlink='$issymlink'
22054 ivdformat='$ivdformat'
22055 ivsize='$ivsize'
22056 ivtype='$ivtype'
22057 known_extensions='$known_extensions'
22058 ksh='$ksh'
22059 ld='$ld'
22060 lddlflags='$lddlflags'
22061 ldflags='$ldflags'
22062 ldflags_uselargefiles='$ldflags_uselargefiles'
22063 ldlibpthname='$ldlibpthname'
22064 less='$less'
22065 lib_ext='$lib_ext'
22066 libc='$libc'
22067 libperl='$libperl'
22068 libpth='$libpth'
22069 libs='$libs'
22070 libsdirs='$libsdirs'
22071 libsfiles='$libsfiles'
22072 libsfound='$libsfound'
22073 libspath='$libspath'
22074 libswanted='$libswanted'
22075 libswanted_uselargefiles='$libswanted_uselargefiles'
22076 line='$line'
22077 lint='$lint'
22078 lkflags='$lkflags'
22079 ln='$ln'
22080 lns='$lns'
22081 localtime_r_proto='$localtime_r_proto'
22082 locincpth='$locincpth'
22083 loclibpth='$loclibpth'
22084 longdblsize='$longdblsize'
22085 longlongsize='$longlongsize'
22086 longsize='$longsize'
22087 lp='$lp'
22088 lpr='$lpr'
22089 ls='$ls'
22090 lseeksize='$lseeksize'
22091 lseektype='$lseektype'
22092 mad='$mad'
22093 madlyh='$madlyh'
22094 madlyobj='$madlyobj'
22095 madlysrc='$madlysrc'
22096 mail='$mail'
22097 mailx='$mailx'
22098 make='$make'
22099 make_set_make='$make_set_make'
22100 mallocobj='$mallocobj'
22101 mallocsrc='$mallocsrc'
22102 malloctype='$malloctype'
22103 man1dir='$man1dir'
22104 man1direxp='$man1direxp'
22105 man1ext='$man1ext'
22106 man3dir='$man3dir'
22107 man3direxp='$man3direxp'
22108 man3ext='$man3ext'
22109 mips_type='$mips_type'
22110 mistrustnm='$mistrustnm'
22111 mkdir='$mkdir'
22112 mmaptype='$mmaptype'
22113 modetype='$modetype'
22114 more='$more'
22115 multiarch='$multiarch'
22116 mv='$mv'
22117 myarchname='$myarchname'
22118 mydomain='$mydomain'
22119 myhostname='$myhostname'
22120 myuname='$myuname'
22121 n='$n'
22122 need_va_copy='$need_va_copy'
22123 netdb_hlen_type='$netdb_hlen_type'
22124 netdb_host_type='$netdb_host_type'
22125 netdb_name_type='$netdb_name_type'
22126 netdb_net_type='$netdb_net_type'
22127 nm='$nm'
22128 nm_opt='$nm_opt'
22129 nm_so_opt='$nm_so_opt'
22130 nonxs_ext='$nonxs_ext'
22131 nroff='$nroff'
22132 nvEUformat='$nvEUformat'
22133 nvFUformat='$nvFUformat'
22134 nvGUformat='$nvGUformat'
22135 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22136 nveformat='$nveformat'
22137 nvfformat='$nvfformat'
22138 nvgformat='$nvgformat'
22139 nvsize='$nvsize'
22140 nvtype='$nvtype'
22141 o_nonblock='$o_nonblock'
22142 obj_ext='$obj_ext'
22143 old_pthread_create_joinable='$old_pthread_create_joinable'
22144 optimize='$optimize'
22145 orderlib='$orderlib'
22146 osname='$osname'
22147 osvers='$osvers'
22148 otherlibdirs='$otherlibdirs'
22149 package='$package'
22150 pager='$pager'
22151 passcat='$passcat'
22152 patchlevel='$patchlevel'
22153 path_sep='$path_sep'
22154 perl5='$perl5'
22155 perl='$perl'
22156 perl_patchlevel='$perl_patchlevel'
22157 perladmin='$perladmin'
22158 perllibs='$perllibs'
22159 perlpath='$perlpath'
22160 pg='$pg'
22161 phostname='$phostname'
22162 pidtype='$pidtype'
22163 plibpth='$plibpth'
22164 pmake='$pmake'
22165 pr='$pr'
22166 prefix='$prefix'
22167 prefixexp='$prefixexp'
22168 privlib='$privlib'
22169 privlibexp='$privlibexp'
22170 procselfexe='$procselfexe'
22171 prototype='$prototype'
22172 ptrsize='$ptrsize'
22173 quadkind='$quadkind'
22174 quadtype='$quadtype'
22175 randbits='$randbits'
22176 randfunc='$randfunc'
22177 random_r_proto='$random_r_proto'
22178 randseedtype='$randseedtype'
22179 ranlib='$ranlib'
22180 rd_nodata='$rd_nodata'
22181 readdir64_r_proto='$readdir64_r_proto'
22182 readdir_r_proto='$readdir_r_proto'
22183 revision='$revision'
22184 rm='$rm'
22185 rmail='$rmail'
22186 run='$run'
22187 runnm='$runnm'
22188 sPRIEUldbl='$sPRIEUldbl'
22189 sPRIFUldbl='$sPRIFUldbl'
22190 sPRIGUldbl='$sPRIGUldbl'
22191 sPRIXU64='$sPRIXU64'
22192 sPRId64='$sPRId64'
22193 sPRIeldbl='$sPRIeldbl'
22194 sPRIfldbl='$sPRIfldbl'
22195 sPRIgldbl='$sPRIgldbl'
22196 sPRIi64='$sPRIi64'
22197 sPRIo64='$sPRIo64'
22198 sPRIu64='$sPRIu64'
22199 sPRIx64='$sPRIx64'
22200 sSCNfldbl='$sSCNfldbl'
22201 sched_yield='$sched_yield'
22202 scriptdir='$scriptdir'
22203 scriptdirexp='$scriptdirexp'
22204 sed='$sed'
22205 seedfunc='$seedfunc'
22206 selectminbits='$selectminbits'
22207 selecttype='$selecttype'
22208 sendmail='$sendmail'
22209 setgrent_r_proto='$setgrent_r_proto'
22210 sethostent_r_proto='$sethostent_r_proto'
22211 setlocale_r_proto='$setlocale_r_proto'
22212 setnetent_r_proto='$setnetent_r_proto'
22213 setprotoent_r_proto='$setprotoent_r_proto'
22214 setpwent_r_proto='$setpwent_r_proto'
22215 setservent_r_proto='$setservent_r_proto'
22216 sh='$sh'
22217 shar='$shar'
22218 sharpbang='$sharpbang'
22219 shmattype='$shmattype'
22220 shortsize='$shortsize'
22221 shrpenv='$shrpenv'
22222 shsharp='$shsharp'
22223 sig_count='$sig_count'
22224 sig_name='$sig_name'
22225 sig_name_init='$sig_name_init'
22226 sig_num='$sig_num'
22227 sig_num_init='$sig_num_init'
22228 sig_size='$sig_size'
22229 signal_t='$signal_t'
22230 sitearch='$sitearch'
22231 sitearchexp='$sitearchexp'
22232 sitebin='$sitebin'
22233 sitebinexp='$sitebinexp'
22234 sitehtml1dir='$sitehtml1dir'
22235 sitehtml1direxp='$sitehtml1direxp'
22236 sitehtml3dir='$sitehtml3dir'
22237 sitehtml3direxp='$sitehtml3direxp'
22238 sitelib='$sitelib'
22239 sitelib_stem='$sitelib_stem'
22240 sitelibexp='$sitelibexp'
22241 siteman1dir='$siteman1dir'
22242 siteman1direxp='$siteman1direxp'
22243 siteman3dir='$siteman3dir'
22244 siteman3direxp='$siteman3direxp'
22245 siteprefix='$siteprefix'
22246 siteprefixexp='$siteprefixexp'
22247 sitescript='$sitescript'
22248 sitescriptexp='$sitescriptexp'
22249 sizesize='$sizesize'
22250 sizetype='$sizetype'
22251 sleep='$sleep'
22252 smail='$smail'
22253 so='$so'
22254 sockethdr='$sockethdr'
22255 socketlib='$socketlib'
22256 socksizetype='$socksizetype'
22257 sort='$sort'
22258 spackage='$spackage'
22259 spitshell='$spitshell'
22260 srand48_r_proto='$srand48_r_proto'
22261 srandom_r_proto='$srandom_r_proto'
22262 src='$src'
22263 ssizetype='$ssizetype'
22264 startperl='$startperl'
22265 startsh='$startsh'
22266 static_ext='$static_ext'
22267 stdchar='$stdchar'
22268 stdio_base='$stdio_base'
22269 stdio_bufsiz='$stdio_bufsiz'
22270 stdio_cnt='$stdio_cnt'
22271 stdio_filbuf='$stdio_filbuf'
22272 stdio_ptr='$stdio_ptr'
22273 stdio_stream_array='$stdio_stream_array'
22274 strerror_r_proto='$strerror_r_proto'
22275 strings='$strings'
22276 submit='$submit'
22277 subversion='$subversion'
22278 sysman='$sysman'
22279 tail='$tail'
22280 tar='$tar'
22281 targetarch='$targetarch'
22282 tbl='$tbl'
22283 tee='$tee'
22284 test='$test'
22285 timeincl='$timeincl'
22286 timetype='$timetype'
22287 tmpnam_r_proto='$tmpnam_r_proto'
22288 to='$to'
22289 touch='$touch'
22290 tr='$tr'
22291 trnl='$trnl'
22292 troff='$troff'
22293 ttyname_r_proto='$ttyname_r_proto'
22294 u16size='$u16size'
22295 u16type='$u16type'
22296 u32size='$u32size'
22297 u32type='$u32type'
22298 u64size='$u64size'
22299 u64type='$u64type'
22300 u8size='$u8size'
22301 u8type='$u8type'
22302 uidformat='$uidformat'
22303 uidsign='$uidsign'
22304 uidsize='$uidsize'
22305 uidtype='$uidtype'
22306 uname='$uname'
22307 uniq='$uniq'
22308 uquadtype='$uquadtype'
22309 use5005threads='$use5005threads'
22310 use64bitall='$use64bitall'
22311 use64bitint='$use64bitint'
22312 usecrosscompile='$usecrosscompile'
22313 usedl='$usedl'
22314 usefaststdio='$usefaststdio'
22315 useithreads='$useithreads'
22316 uselargefiles='$uselargefiles'
22317 uselongdouble='$uselongdouble'
22318 usemallocwrap='$usemallocwrap'
22319 usemorebits='$usemorebits'
22320 usemultiplicity='$usemultiplicity'
22321 usemymalloc='$usemymalloc'
22322 usenm='$usenm'
22323 useopcode='$useopcode'
22324 useperlio='$useperlio'
22325 useposix='$useposix'
22326 usereentrant='$usereentrant'
22327 userelocatableinc='$userelocatableinc'
22328 usesfio='$usesfio'
22329 useshrplib='$useshrplib'
22330 usesitecustomize='$usesitecustomize'
22331 usesocks='$usesocks'
22332 usethreads='$usethreads'
22333 usevendorprefix='$usevendorprefix'
22334 usevfork='$usevfork'
22335 usrinc='$usrinc'
22336 uuname='$uuname'
22337 uvXUformat='$uvXUformat'
22338 uvoformat='$uvoformat'
22339 uvsize='$uvsize'
22340 uvtype='$uvtype'
22341 uvuformat='$uvuformat'
22342 uvxformat='$uvxformat'
22343 vendorarch='$vendorarch'
22344 vendorarchexp='$vendorarchexp'
22345 vendorbin='$vendorbin'
22346 vendorbinexp='$vendorbinexp'
22347 vendorhtml1dir='$vendorhtml1dir'
22348 vendorhtml1direxp='$vendorhtml1direxp'
22349 vendorhtml3dir='$vendorhtml3dir'
22350 vendorhtml3direxp='$vendorhtml3direxp'
22351 vendorlib='$vendorlib'
22352 vendorlib_stem='$vendorlib_stem'
22353 vendorlibexp='$vendorlibexp'
22354 vendorman1dir='$vendorman1dir'
22355 vendorman1direxp='$vendorman1direxp'
22356 vendorman3dir='$vendorman3dir'
22357 vendorman3direxp='$vendorman3direxp'
22358 vendorprefix='$vendorprefix'
22359 vendorprefixexp='$vendorprefixexp'
22360 vendorscript='$vendorscript'
22361 vendorscriptexp='$vendorscriptexp'
22362 version='$version'
22363 version_patchlevel_string='$version_patchlevel_string'
22364 versiononly='$versiononly'
22365 vi='$vi'
22366 voidflags='$voidflags'
22367 xlibpth='$xlibpth'
22368 yacc='$yacc'
22369 yaccflags='$yaccflags'
22370 zcat='$zcat'
22371 zip='$zip'
22372 EOT
22373
22374 : Add in command line options if available
22375 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22376
22377 : add special variables
22378 $test -f $src/patchlevel.h && \
22379 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22380 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22381 echo "PERL_CONFIG_SH=true" >>config.sh
22382
22383 : propagate old symbols
22384 if $test -f UU/config.sh; then
22385         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22386         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22387         $sort | $uniq -u >UU/oldsyms
22388         set X `cat UU/oldsyms`
22389         shift
22390         case $# in
22391         0) ;;
22392         *)
22393                 cat <<EOM
22394 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22395 EOM
22396                 echo "# Variables propagated from previous config.sh file." >>config.sh
22397                 for sym in `cat UU/oldsyms`; do
22398                         echo "    Propagating $hint variable "'$'"$sym..."
22399                         eval 'tmp="$'"${sym}"'"'
22400                         echo "$tmp" | \
22401                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22402                 done
22403                 ;;
22404         esac
22405 fi
22406
22407 : Finish up by extracting the .SH files
22408 case "$alldone" in
22409 exit)
22410         $rm -rf UU
22411         echo "Extraction done."
22412         exit 0
22413         ;;
22414 cont)
22415         ;;
22416 '')
22417         dflt=''
22418         nostick=true
22419         $cat <<EOM
22420
22421 If you'd like to make any changes to the config.sh file before I begin
22422 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22423
22424 EOM
22425         rp="Press return or use a shell escape to edit config.sh:"
22426         . UU/myread
22427         nostick=''
22428         case "$ans" in
22429         '') ;;
22430         *) : in case they cannot read
22431                 sh 1>&4 -c "$ans";;
22432         esac
22433         ;;
22434 esac
22435
22436 : if this fails, just run all the .SH files by hand
22437 . ./config.sh
22438
22439 echo " "
22440 exec 1>&4
22441 pwd=`pwd`
22442 . ./UU/extract
22443 cd "$pwd"
22444
22445 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22446         dflt=y
22447         case "$silent" in
22448         true) ;;
22449         *)
22450                 $cat <<EOM
22451
22452 Now you need to generate make dependencies by running "$make depend".
22453 You might prefer to run it in background: "$make depend > makedepend.out &"
22454 It can take a while, so you might not want to run it right now.
22455
22456 EOM
22457                 ;;
22458         esac
22459         rp="Run $make depend now?"
22460         . UU/myread
22461         case "$ans" in
22462         y*)
22463                 $make depend && echo "Now you must run '$make'."
22464                 ;;
22465         *)
22466                 echo "You must run '$make depend' then '$make'."
22467                 ;;
22468         esac
22469 elif test -f [Mm]akefile; then
22470         echo " "
22471         echo "Now you must run a $make."
22472 else
22473         echo "Configure done."
22474 fi
22475
22476 if $test -f Policy.sh; then
22477     $cat <<EOM
22478
22479 If you compile $package on a different machine or from a different object
22480 directory, copy the Policy.sh file from this object directory to the
22481 new one before you run Configure -- this will help you with most of
22482 the policy defaults.
22483
22484 EOM
22485 fi
22486 if $test -f config.msg; then
22487     echo "Hmm.  I also noted the following information while running:"
22488     echo " "
22489     $cat config.msg >&4
22490     $rm -f config.msg
22491 fi
22492 $rm -f kit*isdone ark*isdone
22493 $rm -rf UU
22494
22495 : End of Configure
22496