This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
ss_dup: make new savestack have SS_MAXPUSH extra
[perl5.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 by the tool
15 # called "metaconfig". Rather than working with this copy of Configure,
16 # you may wish to get metaconfig. Perl uses a modified version of this
17 # tool, available in the "dist" folder in the checkout of the git repo
18 #    $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
19 # The original dist package (including metaconfig) is available via SVN:
20 #    $ svn co https://svn.code.sf.net/p/dist/code/trunk/dist
21 #
22 # Though this script was generated by metaconfig from metaunits, it is
23 # OK to send patches against Configure itself. It's up to the Configure
24 # pumpkin to backport the patch to the metaunits if it is accepted.
25 # For more information on patching Configure, see pod/perlhack.pod
26 #
27 # The metaunits are also available from the public git repository:
28 #     http://perl5.git.perl.org/metaconfig.git/ or
29 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
30 #
31 # See Porting/pumpkin.pod for more information on metaconfig.
32
33 # Generated using [metaconfig 3.5 PL0]
34 # (with additional metaconfig patches by perlbug@perl.org)
35
36 cat >c1$$ <<EOF
37 ARGGGHHHH!!!!!
38
39 SCO csh still thinks true is false.  Write to SCO today and tell them that next
40 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43 we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45 [End of diatribe. We now return you to your regularly scheduled programming...]
46 EOF
47 cat >c2$$ <<EOF
48
49 OOPS!  You naughty creature!  You didn't run Configure with sh!
50 I will attempt to remedy the situation by running sh for you...
51 EOF
52
53 true || cat c1$$ c2$$
54 true || exec sh $0 $argv:q
55
56 (exit $?0) || cat c2$$
57 (exit $?0) || exec sh $0 $argv:q
58 rm -f c1$$ c2$$
59
60 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61         cat <<EOF
62 ***
63 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65 *** Please read the README.plan9 for further instructions.
66 *** Cannot continue, aborting.
67 ***
68 EOF
69         exit 1
70 fi
71
72 if test -f /sys/utilities/MultiView ; then
73         # AmigaOS, test -c for /dev/null is not useful
74         :
75 elif test ! -c /dev/null ; then
76         cat <<EOF
77 ***
78 *** I'm sorry, but /dev/null appears to be a file rather than a device.
79 *** Please consult your operating sytem's notes for making a device
80 *** in /dev.
81 *** Cannot continue, aborting.
82 ***
83 EOF
84         exit 1
85 fi
86
87 : compute my invocation name
88 me=$0
89 case "$0" in
90 */*)
91         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
92         test "$me" || me=$0
93         ;;
94 esac
95
96 : Proper separator for the PATH environment variable
97 p_=:
98 : On OS/2 this directory should exist if this is not floppy only system ":-]"
99 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
100         if test -n "$OS2_SHELL"; then
101                 p_=\;
102                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
103                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
104                 is_os2=yes
105         elif test -n "$DJGPP"; then
106                 case "X${MACHTYPE:-nonesuchmach}" in
107                 *cygwin|*msys) ;;
108                 *) p_=\; ;;
109                 esac
110         fi
111 fi
112
113 : Proper PATH setting
114 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
115 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
116 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
117 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
118 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
119 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
120 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
121 paths="$paths /sbin /usr/sbin /usr/libexec"
122 paths="$paths /system/gnu_library/bin"
123
124 for p in $paths
125 do
126         case "$p_$PATH$p_" in
127         *$p_$p$p_*) ;;
128         *) test -d $p && PATH=$PATH$p_$p ;;
129         esac
130 done
131
132 PATH=.$p_$PATH
133 export PATH
134
135 : shall we be using ksh?
136 inksh=''
137 needksh=''
138 avoidksh=''
139 newsh=/bin/ksh
140 changesh=''
141 if (PATH=.; alias -x) >/dev/null 2>&1; then
142                 inksh=true
143 fi
144 if test -f /hp-ux -a -f /bin/ksh; then
145         needksh='to avoid sh bug in "here document" expansion'
146 fi
147 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
148         if test X`/usr/bin/uname -v` = X4; then
149                 avoidksh="to avoid AIX 4's /bin/sh"
150                 newsh=/usr/bin/bsh
151         fi
152 fi
153 if test -f /osf_boot -a -f /usr/sbin/setld; then
154         if test X`/usr/bin/uname -s` = XOSF1; then
155                 avoidksh="to avoid Digital UNIX' ksh"
156                 newsh=/bin/sh
157                 unset BIN_SH
158         fi
159 fi
160 case "$inksh/$needksh" in
161 /[a-z]*)
162                 ENV=''
163                 changesh=true
164                 reason="$needksh"
165         ;;
166 esac
167 case "$inksh/$avoidksh" in
168 true/[a-z]*)
169         changesh=true
170         reason="$avoidksh"
171         ;;
172 esac
173 case "$inksh/$needksh-$avoidksh-" in
174 true/--)
175                 cat <<EOM
176 (I see you are using the Korn shell.  Some ksh's blow up on $me,
177 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
178 EOM
179         ;;
180 esac
181 case "$changesh" in
182 true)
183         export newsh
184         echo "(Feeding myself to $newsh $reason.)"
185         case "$0" in
186         Configure|*/Configure) exec $newsh $0 "$@";;
187         *) exec $newsh Configure "$@";;
188         esac
189         ;;
190 esac
191 test -x "${newsh}" || unset newsh
192
193 : if needed, set CDPATH to a harmless value that is not chatty
194 : avoid bash 2.02 problems with empty CDPATH.
195 case "$CDPATH" in
196 '')     ;;
197 *)      case "$SHELL" in
198         *bash*) CDPATH='.' ;;
199         *) CDPATH='' ;;
200         esac
201         ;;
202 esac
203
204 : Configure runs within the UU subdirectory
205 test -d UU || mkdir UU
206 cd UU && rm -f ./*
207
208 ccname=''
209 ccversion=''
210 ccsymbols=''
211 cppccsymbols=''
212 cppsymbols=''
213 from=''
214 hostgenerate=''
215 hostosname=''
216 hostperl=''
217 run=''
218 targetarch=''
219 targetdir=''
220 targetenv=''
221 targethost=''
222 targetmkdir=''
223 targetport=''
224 to=''
225 usecrosscompile=''
226 extern_C=''
227 mistrustnm=''
228 usedevel=''
229 perllibs=''
230 dynamic_ext=''
231 extensions=''
232 known_extensions=''
233 nonxs_ext=''
234 static_ext=''
235 useopcode=''
236 useposix=''
237 extras=''
238 d_bsd=''
239 d_eunice=''
240 d_xenix=''
241 eunicefix=''
242 ar=''
243 awk=''
244 bash=''
245 bison=''
246 byacc=''
247 cat=''
248 chgrp=''
249 chmod=''
250 chown=''
251 comm=''
252 compress=''
253 cp=''
254 cpio=''
255 cpp=''
256 csh=''
257 date=''
258 echo=''
259 egrep=''
260 emacs=''
261 expr=''
262 find=''
263 flex=''
264 gmake=''
265 grep=''
266 gzip=''
267 inews=''
268 ksh=''
269 less=''
270 line=''
271 lint=''
272 ln=''
273 lp=''
274 lpr=''
275 ls=''
276 mail=''
277 mailx=''
278 make=''
279 mkdir=''
280 more=''
281 mv=''
282 nm=''
283 nroff=''
284 perl=''
285 pg=''
286 pmake=''
287 pr=''
288 rm=''
289 rmail=''
290 sed=''
291 sendmail=''
292 shar=''
293 sleep=''
294 smail=''
295 sort=''
296 submit=''
297 tail=''
298 tar=''
299 tbl=''
300 tee=''
301 test=''
302 touch=''
303 tr=''
304 troff=''
305 uname=''
306 uniq=''
307 uuname=''
308 vi=''
309 zcat=''
310 zip=''
311 full_ar=''
312 full_sed=''
313 libswanted=''
314 hint=''
315 myuname=''
316 osname=''
317 osvers=''
318 Author=''
319 Date=''
320 Header=''
321 Id=''
322 Locker=''
323 Log=''
324 RCSfile=''
325 Revision=''
326 Source=''
327 State=''
328 sysroot=''
329 _a=''
330 _exe=''
331 _o=''
332 archobjs=''
333 exe_ext=''
334 firstmakefile=''
335 lib_ext=''
336 obj_ext=''
337 path_sep=''
338 rm_try=''
339 afs=''
340 afsroot=''
341 alignbytes=''
342 ansi2knr=''
343 archlib=''
344 archlibexp=''
345 d_archlib=''
346 installarchlib=''
347 archname=''
348 myarchname=''
349 useversionedarchname=''
350 d_atolf=''
351 d_atoll=''
352 baserev=''
353 bin=''
354 binexp=''
355 initialinstalllocation=''
356 installbin=''
357 userelocatableinc=''
358 byteorder=''
359 cc=''
360 ccflags=''
361 cppflags=''
362 ldflags=''
363 lkflags=''
364 locincpth=''
365 optimize=''
366 cf_email=''
367 cf_by=''
368 cf_time=''
369 charbits=''
370 charsize=''
371 contains=''
372 cpp_stuff=''
373 cpplast=''
374 cppminus=''
375 cpprun=''
376 cppstdin=''
377 d__fwalk=''
378 d_access=''
379 d_accessx=''
380 d_acosh=''
381 d_aintl=''
382 d_alarm=''
383 asctime_r_proto=''
384 d_asctime_r=''
385 d_asinh=''
386 d_atanh=''
387 d_attribute_deprecated=''
388 d_attribute_format=''
389 d_attribute_malloc=''
390 d_attribute_nonnull=''
391 d_attribute_noreturn=''
392 d_attribute_pure=''
393 d_attribute_unused=''
394 d_attribute_warn_unused_result=''
395 d_printf_format_null=''
396 d_backtrace=''
397 d_bcmp=''
398 d_bcopy=''
399 d_builtin_choose_expr=''
400 d_builtin_expect=''
401 d_bzero=''
402 d_c99_variadic_macros=''
403 d_casti32=''
404 castflags=''
405 d_castneg=''
406 d_cbrt=''
407 d_chown=''
408 d_chroot=''
409 d_chsize=''
410 d_class=''
411 d_clearenv=''
412 d_closedir=''
413 d_void_closedir=''
414 d_cmsghdr_s=''
415 d_const=''
416 d_copysign=''
417 d_copysignl=''
418 d_cplusplus=''
419 cryptlib=''
420 d_crypt=''
421 crypt_r_proto=''
422 d_crypt_r=''
423 d_csh=''
424 full_csh=''
425 d_ctermid=''
426 ctermid_r_proto=''
427 d_ctermid_r=''
428 ctime_r_proto=''
429 d_ctime_r=''
430 d_cuserid=''
431 d_dbl_dig=''
432 d_dbminitproto=''
433 d_difftime=''
434 d_dir_dd_fd=''
435 d_dirfd=''
436 d_dladdr=''
437 d_dlerror=''
438 d_dlopen=''
439 d_dlsymun=''
440 d_dosuid=''
441 d_suidsafe=''
442 d_drand48_r=''
443 drand48_r_proto=''
444 d_drand48proto=''
445 d_dup2=''
446 d_eaccess=''
447 d_endgrent=''
448 d_endgrent_r=''
449 endgrent_r_proto=''
450 d_endhent=''
451 d_endhostent_r=''
452 endhostent_r_proto=''
453 d_endnent=''
454 d_endnetent_r=''
455 endnetent_r_proto=''
456 d_endpent=''
457 d_endprotoent_r=''
458 endprotoent_r_proto=''
459 d_endpwent=''
460 d_endpwent_r=''
461 endpwent_r_proto=''
462 d_endsent=''
463 d_endservent_r=''
464 endservent_r_proto=''
465 d_erf=''
466 d_erfc=''
467 d_exp2=''
468 d_expm1=''
469 d_faststdio=''
470 d_fchdir=''
471 d_fchmod=''
472 d_fchown=''
473 d_fcntl=''
474 d_fcntl_can_lock=''
475 d_fd_macros=''
476 d_fd_set=''
477 d_fds_bits=''
478 d_fdclose=''
479 d_fdim=''
480 d_fegetround=''
481 d_fgetpos=''
482 d_finite=''
483 d_finitel=''
484 d_flexfnam=''
485 d_flock=''
486 d_flockproto=''
487 d_fma=''
488 d_fmax=''
489 d_fmin=''
490 d_fork=''
491 d_fp_class=''
492 d_fp_classl=''
493 d_fpclass=''
494 d_fp_classify=''
495 d_fpclassify=''
496 d_fpclassl=''
497 d_fpgetround=''
498 d_fpos64_t=''
499 d_frexpl=''
500 d_fs_data_s=''
501 d_fseeko=''
502 d_fsetpos=''
503 d_fstatfs=''
504 d_fsync=''
505 d_ftello=''
506 d_ftime=''
507 d_gettimeod=''
508 d_futimes=''
509 d_Gconvert=''
510 d_getaddrinfo=''
511 d_getcwd=''
512 d_getespwnam=''
513 d_getfsstat=''
514 d_getgrent=''
515 d_getgrent_r=''
516 getgrent_r_proto=''
517 d_getgrgid_r=''
518 getgrgid_r_proto=''
519 d_getgrnam_r=''
520 getgrnam_r_proto=''
521 d_getgrps=''
522 d_gethbyaddr=''
523 d_gethbyname=''
524 d_gethent=''
525 aphostname=''
526 d_gethname=''
527 d_phostname=''
528 d_uname=''
529 d_gethostbyaddr_r=''
530 gethostbyaddr_r_proto=''
531 d_gethostbyname_r=''
532 gethostbyname_r_proto=''
533 d_gethostent_r=''
534 gethostent_r_proto=''
535 d_gethostprotos=''
536 d_getitimer=''
537 d_getlogin=''
538 d_getlogin_r=''
539 getlogin_r_proto=''
540 d_getmnt=''
541 d_getmntent=''
542 d_getnameinfo=''
543 d_getnbyaddr=''
544 d_getnbyname=''
545 d_getnent=''
546 d_getnetbyaddr_r=''
547 getnetbyaddr_r_proto=''
548 d_getnetbyname_r=''
549 getnetbyname_r_proto=''
550 d_getnetent_r=''
551 getnetent_r_proto=''
552 d_getnetprotos=''
553 d_getpagsz=''
554 d_getpent=''
555 d_getpgid=''
556 d_getpgrp2=''
557 d_bsdgetpgrp=''
558 d_getpgrp=''
559 d_getppid=''
560 d_getprior=''
561 d_getpbyname=''
562 d_getpbynumber=''
563 d_getprotobyname_r=''
564 getprotobyname_r_proto=''
565 d_getprotobynumber_r=''
566 getprotobynumber_r_proto=''
567 d_getprotoent_r=''
568 getprotoent_r_proto=''
569 d_getprotoprotos=''
570 d_getprpwnam=''
571 d_getpwent=''
572 d_getpwent_r=''
573 getpwent_r_proto=''
574 d_getpwnam_r=''
575 getpwnam_r_proto=''
576 d_getpwuid_r=''
577 getpwuid_r_proto=''
578 d_getsent=''
579 d_getservbyname_r=''
580 getservbyname_r_proto=''
581 d_getservbyport_r=''
582 getservbyport_r_proto=''
583 d_getservent_r=''
584 getservent_r_proto=''
585 d_getservprotos=''
586 d_getspnam=''
587 d_getspnam_r=''
588 getspnam_r_proto=''
589 d_getsbyname=''
590 d_getsbyport=''
591 d_gmtime_r=''
592 gmtime_r_proto=''
593 d_gnulibc=''
594 gnulibc_version=''
595 d_hasmntopt=''
596 d_htonl=''
597 d_hypot=''
598 d_ilogb=''
599 d_ilogbl=''
600 d_inetaton=''
601 d_inetntop=''
602 d_inetpton=''
603 d_int64_t=''
604 d_isascii=''
605 d_isblank=''
606 d_isfinite=''
607 d_isfinitel=''
608 d_isinf=''
609 d_isinfl=''
610 d_isless=''
611 d_isnan=''
612 d_isnanl=''
613 d_isnormal=''
614 d_j0=''
615 d_j0l=''
616 d_killpg=''
617 d_lc_monetary_2008=''
618 d_lchown=''
619 d_ldbl_dig=''
620 d_lgamma=''
621 d_lgamma_r=''
622 d_libm_lib_version=''
623 d_link=''
624 d_llrint=''
625 d_llrintl=''
626 d_llround=''
627 d_llroundl=''
628 d_localtime_r=''
629 d_localtime_r_needs_tzset=''
630 localtime_r_proto=''
631 d_locconv=''
632 d_lockf=''
633 d_log1p=''
634 d_log2=''
635 d_logb=''
636 d_ldexpl=''
637 d_longdbl=''
638 longdblkind=''
639 longdblsize=''
640 d_longlong=''
641 longlongsize=''
642 d_lrint=''
643 d_lrintl=''
644 d_lround=''
645 d_lroundl=''
646 d_lseekproto=''
647 d_lstat=''
648 d_madvise=''
649 d_malloc_good_size=''
650 d_malloc_size=''
651 d_mblen=''
652 d_mbstowcs=''
653 d_mbtowc=''
654 d_memchr=''
655 d_memcmp=''
656 d_memcpy=''
657 d_memmem=''
658 d_memmove=''
659 d_memset=''
660 d_mkdir=''
661 d_mkdtemp=''
662 d_mkfifo=''
663 d_mkstemp=''
664 d_mkstemps=''
665 d_mktime=''
666 d_mmap=''
667 mmaptype=''
668 d_modfl=''
669 d_modfl_pow32_bug=''
670 d_modflproto=''
671 d_mprotect=''
672 d_msg=''
673 d_msgctl=''
674 d_msgget=''
675 d_msghdr_s=''
676 d_msgrcv=''
677 d_msgsnd=''
678 d_msync=''
679 d_munmap=''
680 d_nan=''
681 d_nearbyint=''
682 d_freelocale=''
683 d_newlocale=''
684 d_uselocale=''
685 d_nextafter=''
686 d_nexttoward=''
687 d_nice=''
688 d_nl_langinfo=''
689 d_off64_t=''
690 d_open3=''
691 d_fpathconf=''
692 d_pathconf=''
693 d_pause=''
694 d_pipe=''
695 d_poll=''
696 d_portable=''
697 d_prctl=''
698 d_prctl_set_name=''
699 d_procselfexe=''
700 procselfexe=''
701 d_old_pthread_create_joinable=''
702 old_pthread_create_joinable=''
703 d_pthread_atfork=''
704 d_pthread_attr_setscope=''
705 d_pthread_yield=''
706 d_sched_yield=''
707 sched_yield=''
708 d_ptrdiff_t=''
709 d_qgcvt=''
710 d_random_r=''
711 random_r_proto=''
712 d_readdir64_r=''
713 readdir64_r_proto=''
714 d_readdir=''
715 d_rewinddir=''
716 d_seekdir=''
717 d_telldir=''
718 d_readdir_r=''
719 readdir_r_proto=''
720 d_readlink=''
721 d_readv=''
722 d_recvmsg=''
723 d_re_comp=''
724 d_regcmp=''
725 d_regcomp=''
726 d_remainder=''
727 d_remquo=''
728 d_rename=''
729 d_rint=''
730 d_rmdir=''
731 d_round=''
732 d_safebcpy=''
733 d_safemcpy=''
734 d_sanemcmp=''
735 d_sbrkproto=''
736 d_scalbn=''
737 d_scalbnl=''
738 d_select=''
739 d_sem=''
740 d_semctl=''
741 d_semget=''
742 d_semop=''
743 d_sendmsg=''
744 d_setegid=''
745 d_seteuid=''
746 d_setgrent=''
747 d_setgrent_r=''
748 setgrent_r_proto=''
749 d_setgrps=''
750 d_sethent=''
751 d_sethostent_r=''
752 sethostent_r_proto=''
753 d_setitimer=''
754 d_setlinebuf=''
755 d_setlocale=''
756 d_setlocale_r=''
757 setlocale_r_proto=''
758 d_setnent=''
759 d_setnetent_r=''
760 setnetent_r_proto=''
761 d_setpent=''
762 d_setpgid=''
763 d_setpgrp2=''
764 d_bsdsetpgrp=''
765 d_setpgrp=''
766 d_setprior=''
767 d_setproctitle=''
768 d_setprotoent_r=''
769 setprotoent_r_proto=''
770 d_setpwent=''
771 d_setpwent_r=''
772 setpwent_r_proto=''
773 d_setregid=''
774 d_setresgid=''
775 d_setresuid=''
776 d_setreuid=''
777 d_setrgid=''
778 d_setruid=''
779 d_setsent=''
780 d_setservent_r=''
781 setservent_r_proto=''
782 d_setsid=''
783 d_setvbuf=''
784 d_shm=''
785 d_shmat=''
786 d_shmatprototype=''
787 shmattype=''
788 d_shmctl=''
789 d_shmdt=''
790 d_shmget=''
791 d_sigaction=''
792 d_siginfo_si_errno=''
793 d_siginfo_si_pid=''
794 d_siginfo_si_uid=''
795 d_siginfo_si_addr=''
796 d_siginfo_si_status=''
797 d_siginfo_si_band=''
798 d_siginfo_si_value=''
799 d_signbit=''
800 d_sigprocmask=''
801 d_sigsetjmp=''
802 usesitecustomize=''
803 d_snprintf=''
804 d_vsnprintf=''
805 d_sockatmark=''
806 d_sockatmarkproto=''
807 d_ip_mreq=''
808 d_ip_mreq_source=''
809 d_ipv6_mreq=''
810 d_ipv6_mreq_source=''
811 d_msg_ctrunc=''
812 d_msg_dontroute=''
813 d_msg_oob=''
814 d_msg_peek=''
815 d_msg_proxy=''
816 d_oldsock=''
817 d_scm_rights=''
818 d_sin6_scope_id=''
819 d_sockaddr_in6=''
820 d_sockaddr_sa_len=''
821 d_socket=''
822 d_sockpair=''
823 sockethdr=''
824 socketlib=''
825 d_socklen_t=''
826 d_socks5_init=''
827 d_sprintf_returns_strlen=''
828 d_sqrtl=''
829 d_srand48_r=''
830 srand48_r_proto=''
831 d_srandom_r=''
832 srandom_r_proto=''
833 d_sresgproto=''
834 d_sresuproto=''
835 d_stat=''
836 d_statblks=''
837 d_statfs_f_flags=''
838 d_statfs_s=''
839 d_static_inline=''
840 perl_static_inline=''
841 d_fstatvfs=''
842 d_statvfs=''
843 d_stdio_cnt_lval=''
844 d_stdio_ptr_lval=''
845 d_stdio_ptr_lval_nochange_cnt=''
846 d_stdio_ptr_lval_sets_cnt=''
847 d_stdiobase=''
848 d_stdstdio=''
849 stdio_base=''
850 stdio_bufsiz=''
851 stdio_cnt=''
852 stdio_filbuf=''
853 stdio_ptr=''
854 d_index=''
855 d_strchr=''
856 d_strcoll=''
857 d_strctcpy=''
858 d_strerrm=''
859 d_strerror=''
860 d_sysernlst=''
861 d_syserrlst=''
862 d_strerror_r=''
863 strerror_r_proto=''
864 d_strftime=''
865 d_strlcat=''
866 d_strlcpy=''
867 d_strtod=''
868 d_strtol=''
869 d_strtold=''
870 d_strtoll=''
871 d_strtoq=''
872 d_strtoul=''
873 d_strtoull=''
874 d_strtouq=''
875 d_strxfrm=''
876 d_symlink=''
877 d_syscall=''
878 d_syscallproto=''
879 d_sysconf=''
880 d_system=''
881 d_tcgetpgrp=''
882 d_tcsetpgrp=''
883 d_telldirproto=''
884 d_tgamma=''
885 d_time=''
886 timetype=''
887 d_asctime64=''
888 d_ctime64=''
889 d_difftime64=''
890 d_gmtime64=''
891 d_localtime64=''
892 d_mktime64=''
893 d_timegm=''
894 clocktype=''
895 d_times=''
896 d_tmpnam_r=''
897 tmpnam_r_proto=''
898 d_trunc=''
899 d_truncate=''
900 d_truncl=''
901 d_ttyname_r=''
902 ttyname_r_proto=''
903 d_tzname=''
904 d_u32align=''
905 d_ualarm=''
906 d_umask=''
907 d_semctl_semid_ds=''
908 d_semctl_semun=''
909 d_union_semun=''
910 d_unordered=''
911 d_unsetenv=''
912 d_usleep=''
913 d_usleepproto=''
914 d_ustat=''
915 d_pseudofork=''
916 d_vfork=''
917 usevfork=''
918 d_voidsig=''
919 signal_t=''
920 d_volatile=''
921 d_charvspr=''
922 d_vprintf=''
923 d_wait4=''
924 d_waitpid=''
925 d_wcscmp=''
926 d_wcstombs=''
927 d_wcsxfrm=''
928 d_wctomb=''
929 d_writev=''
930 dlext=''
931 bin_ELF=''
932 cccdlflags=''
933 ccdlflags=''
934 dlsrc=''
935 ld=''
936 ld_can_script=''
937 lddlflags=''
938 usedl=''
939 doublesize=''
940 ebcdic=''
941 fflushNULL=''
942 fflushall=''
943 fpossize=''
944 fpostype=''
945 gccansipedantic=''
946 gccosandvers=''
947 gccversion=''
948 gidformat=''
949 gidsign=''
950 gidsize=''
951 gidtype=''
952 groupstype=''
953 h_fcntl=''
954 h_sysfile=''
955 html1dir=''
956 html1direxp=''
957 installhtml1dir=''
958 html3dir=''
959 html3direxp=''
960 installhtml3dir=''
961 i_arpainet=''
962 i_assert=''
963 i_bfd=''
964 i_crypt=''
965 db_hashtype=''
966 db_prefixtype=''
967 db_version_major=''
968 db_version_minor=''
969 db_version_patch=''
970 i_db=''
971 i_dbm=''
972 i_rpcsvcdbm=''
973 d_dirnamlen=''
974 direntrytype=''
975 i_dirent=''
976 i_dlfcn=''
977 i_execinfo=''
978 i_fcntl=''
979 i_fenv=''
980 i_float=''
981 i_fp=''
982 i_fp_class=''
983 i_gdbm=''
984 d_grpasswd=''
985 i_grp=''
986 i_ieeefp=''
987 i_inttypes=''
988 i_langinfo=''
989 i_libutil=''
990 i_limits=''
991 i_locale=''
992 i_machcthr=''
993 i_malloc=''
994 i_mallocmalloc=''
995 i_math=''
996 i_memory=''
997 i_mntent=''
998 d_gdbm_ndbm_h_uses_prototypes=''
999 d_gdbmndbm_h_uses_prototypes=''
1000 d_ndbm=''
1001 d_ndbm_h_uses_prototypes=''
1002 i_gdbm_ndbm=''
1003 i_gdbmndbm=''
1004 i_ndbm=''
1005 i_netdb=''
1006 i_neterrno=''
1007 i_netinettcp=''
1008 i_niin=''
1009 i_sysin=''
1010 i_poll=''
1011 i_prot=''
1012 i_pthread=''
1013 d_pwage=''
1014 d_pwchange=''
1015 d_pwclass=''
1016 d_pwcomment=''
1017 d_pwexpire=''
1018 d_pwgecos=''
1019 d_pwpasswd=''
1020 d_pwquota=''
1021 i_pwd=''
1022 i_quadmath=''
1023 i_shadow=''
1024 i_socks=''
1025 i_stdbool=''
1026 i_stddef=''
1027 i_stdint=''
1028 i_stdlib=''
1029 i_string=''
1030 strings=''
1031 i_sunmath=''
1032 i_sysaccess=''
1033 i_sysdir=''
1034 i_sysfile=''
1035 d_voidtty=''
1036 i_bsdioctl=''
1037 i_sysfilio=''
1038 i_sysioctl=''
1039 i_syssockio=''
1040 i_syslog=''
1041 i_sysmman=''
1042 i_sysmode=''
1043 i_sysmount=''
1044 i_sysndir=''
1045 i_sysparam=''
1046 i_syspoll=''
1047 i_sysresrc=''
1048 i_syssecrt=''
1049 i_sysselct=''
1050 i_sysstat=''
1051 i_sysstatfs=''
1052 i_sysstatvfs=''
1053 i_systimes=''
1054 i_systypes=''
1055 i_sysuio=''
1056 i_sysun=''
1057 i_sysutsname=''
1058 i_sysvfs=''
1059 i_syswait=''
1060 i_sgtty=''
1061 i_termio=''
1062 i_termios=''
1063 d_tm_tm_gmtoff=''
1064 d_tm_tm_zone=''
1065 i_systime=''
1066 i_systimek=''
1067 i_time=''
1068 timeincl=''
1069 i_unistd=''
1070 i_ustat=''
1071 i_utime=''
1072 i_values=''
1073 i_stdarg=''
1074 i_varargs=''
1075 i_varhdr=''
1076 i_vfork=''
1077 d_inc_version_list=''
1078 inc_version_list=''
1079 inc_version_list_init=''
1080 doubleinfbytes=''
1081 doublenanbytes=''
1082 longdblinfbytes=''
1083 longdblnanbytes=''
1084 installprefix=''
1085 installprefixexp=''
1086 installstyle=''
1087 installusrbinperl=''
1088 intsize=''
1089 longsize=''
1090 shortsize=''
1091 issymlink=''
1092 libc=''
1093 ldlibpthname=''
1094 libperl=''
1095 shrpenv=''
1096 useshrplib=''
1097 glibpth=''
1098 incpth=''
1099 libpth=''
1100 loclibpth=''
1101 plibpth=''
1102 xlibpth=''
1103 ignore_versioned_solibs=''
1104 libs=''
1105 libsdirs=''
1106 libsfiles=''
1107 libsfound=''
1108 libspath=''
1109 lns=''
1110 d_PRIEUldbl=''
1111 d_PRIFUldbl=''
1112 d_PRIGUldbl=''
1113 d_PRIeldbl=''
1114 d_PRIfldbl=''
1115 d_PRIgldbl=''
1116 d_SCNfldbl=''
1117 doublekind=''
1118 sPRIEUldbl=''
1119 sPRIFUldbl=''
1120 sPRIGUldbl=''
1121 sPRIeldbl=''
1122 sPRIfldbl=''
1123 sPRIgldbl=''
1124 sSCNfldbl=''
1125 lseeksize=''
1126 lseektype=''
1127 make_set_make=''
1128 d_mymalloc=''
1129 freetype=''
1130 mallocobj=''
1131 mallocsrc=''
1132 malloctype=''
1133 usemallocwrap=''
1134 usemymalloc=''
1135 installman1dir=''
1136 man1dir=''
1137 man1direxp=''
1138 man1ext=''
1139 installman3dir=''
1140 man3dir=''
1141 man3direxp=''
1142 man3ext=''
1143 doublemantbits=''
1144 longdblmantbits=''
1145 nvmantbits=''
1146 modetype=''
1147 multiarch=''
1148 mydomain=''
1149 myhostname=''
1150 phostname=''
1151 c=''
1152 n=''
1153 d_eofnblk=''
1154 eagain=''
1155 o_nonblock=''
1156 rd_nodata=''
1157 need_va_copy=''
1158 netdb_hlen_type=''
1159 netdb_host_type=''
1160 netdb_name_type=''
1161 netdb_net_type=''
1162 groupcat=''
1163 hostcat=''
1164 passcat=''
1165 orderlib=''
1166 ranlib=''
1167 d_perl_otherlibdirs=''
1168 otherlibdirs=''
1169 package=''
1170 spackage=''
1171 pager=''
1172 api_revision=''
1173 api_subversion=''
1174 api_version=''
1175 api_versionstring=''
1176 patchlevel=''
1177 perl_patchlevel=''
1178 revision=''
1179 subversion=''
1180 version=''
1181 version_patchlevel_string=''
1182 perl5=''
1183 perladmin=''
1184 perlpath=''
1185 d_nv_preserves_uv=''
1186 d_nv_zero_is_allbits_zero=''
1187 i16size=''
1188 i16type=''
1189 i32size=''
1190 i32type=''
1191 i64size=''
1192 i64type=''
1193 i8size=''
1194 i8type=''
1195 ivsize=''
1196 ivtype=''
1197 nv_overflows_integers_at=''
1198 nv_preserves_uv_bits=''
1199 nvsize=''
1200 nvtype=''
1201 u16size=''
1202 u16type=''
1203 u32size=''
1204 u32type=''
1205 u64size=''
1206 u64type=''
1207 u8size=''
1208 u8type=''
1209 uvsize=''
1210 uvtype=''
1211 ivdformat=''
1212 nvEUformat=''
1213 nvFUformat=''
1214 nvGUformat=''
1215 nveformat=''
1216 nvfformat=''
1217 nvgformat=''
1218 uvXUformat=''
1219 uvoformat=''
1220 uvuformat=''
1221 uvxformat=''
1222 pidtype=''
1223 prefix=''
1224 prefixexp=''
1225 installprivlib=''
1226 privlib=''
1227 privlibexp=''
1228 prototype=''
1229 ptrsize=''
1230 d_PRIXU64=''
1231 d_PRId64=''
1232 d_PRIi64=''
1233 d_PRIo64=''
1234 d_PRIu64=''
1235 d_PRIx64=''
1236 sPRIXU64=''
1237 sPRId64=''
1238 sPRIi64=''
1239 sPRIo64=''
1240 sPRIu64=''
1241 sPRIx64=''
1242 d_quad=''
1243 quadkind=''
1244 quadtype=''
1245 uquadtype=''
1246 drand01=''
1247 randbits=''
1248 randfunc=''
1249 randseedtype=''
1250 seedfunc=''
1251 installscript=''
1252 scriptdir=''
1253 scriptdirexp=''
1254 selectminbits=''
1255 selecttype=''
1256 sh=''
1257 targetsh=''
1258 sig_count=''
1259 sig_name=''
1260 sig_name_init=''
1261 sig_num=''
1262 sig_num_init=''
1263 sig_size=''
1264 d_sitearch=''
1265 installsitearch=''
1266 sitearch=''
1267 sitearchexp=''
1268 installsitebin=''
1269 sitebin=''
1270 sitebinexp=''
1271 installsitehtml1dir=''
1272 sitehtml1dir=''
1273 sitehtml1direxp=''
1274 installsitehtml3dir=''
1275 sitehtml3dir=''
1276 sitehtml3direxp=''
1277 installsitelib=''
1278 sitelib=''
1279 sitelib_stem=''
1280 sitelibexp=''
1281 installsiteman1dir=''
1282 siteman1dir=''
1283 siteman1direxp=''
1284 installsiteman3dir=''
1285 siteman3dir=''
1286 siteman3direxp=''
1287 siteprefix=''
1288 siteprefixexp=''
1289 installsitescript=''
1290 sitescript=''
1291 sitescriptexp=''
1292 sizesize=''
1293 sizetype=''
1294 d_libname_unique=''
1295 so=''
1296 socksizetype=''
1297 sharpbang=''
1298 shsharp=''
1299 spitshell=''
1300 src=''
1301 ssizetype=''
1302 st_ino_sign=''
1303 st_ino_size=''
1304 startperl=''
1305 startsh=''
1306 stdchar=''
1307 d_stdio_stream_array=''
1308 stdio_stream_array=''
1309 sysman=''
1310 sGMTIME_max=''
1311 sGMTIME_min=''
1312 sLOCALTIME_max=''
1313 sLOCALTIME_min=''
1314 trnl=''
1315 uidformat=''
1316 uidsign=''
1317 uidsize=''
1318 uidtype=''
1319 archname64=''
1320 use64bitall=''
1321 use64bitint=''
1322 usecbacktrace=''
1323 dtrace=''
1324 dtraceobject=''
1325 usedtrace=''
1326 usefaststdio=''
1327 usekernprocpathname=''
1328 ccflags_uselargefiles=''
1329 ldflags_uselargefiles=''
1330 libswanted_uselargefiles=''
1331 uselargefiles=''
1332 uselongdouble=''
1333 usemorebits=''
1334 usemultiplicity=''
1335 nm_opt=''
1336 nm_so_opt=''
1337 runnm=''
1338 usenm=''
1339 usensgetexecutablepath=''
1340 useperlio=''
1341 usequadmath=''
1342 usesocks=''
1343 d_oldpthreads=''
1344 use5005threads=''
1345 useithreads=''
1346 usereentrant=''
1347 usethreads=''
1348 incpath=''
1349 mips_type=''
1350 usrinc=''
1351 vaproto=''
1352 d_vendorarch=''
1353 installvendorarch=''
1354 vendorarch=''
1355 vendorarchexp=''
1356 d_vendorbin=''
1357 installvendorbin=''
1358 vendorbin=''
1359 vendorbinexp=''
1360 installvendorhtml1dir=''
1361 vendorhtml1dir=''
1362 vendorhtml1direxp=''
1363 installvendorhtml3dir=''
1364 vendorhtml3dir=''
1365 vendorhtml3direxp=''
1366 d_vendorlib=''
1367 installvendorlib=''
1368 vendorlib=''
1369 vendorlib_stem=''
1370 vendorlibexp=''
1371 installvendorman1dir=''
1372 vendorman1dir=''
1373 vendorman1direxp=''
1374 installvendorman3dir=''
1375 vendorman3dir=''
1376 vendorman3direxp=''
1377 usevendorprefix=''
1378 vendorprefix=''
1379 vendorprefixexp=''
1380 d_vendorscript=''
1381 installvendorscript=''
1382 vendorscript=''
1383 vendorscriptexp=''
1384 versiononly=''
1385 yacc=''
1386 yaccflags=''
1387 CONFIG=''
1388
1389 : Detect odd OSs
1390 define='define'
1391 undef='undef'
1392 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1393 rmlist=''
1394
1395 : We must find out about Eunice early
1396 eunicefix=':'
1397 if test -f /etc/unixtovms; then
1398         eunicefix=/etc/unixtovms
1399 fi
1400 if test -f /etc/unixtovms.exe; then
1401         eunicefix=/etc/unixtovms.exe
1402 fi
1403
1404 : Set executable suffix now -- needed before hints available
1405 if test -f "/libs/version.library"; then
1406 : Amiga OS
1407     _exe=""
1408 elif test -f "/system/gnu_library/bin/ar.pm"; then
1409 : Stratus VOS
1410     _exe=".pm"
1411 elif test -n "$DJGPP"; then
1412 : DOS DJGPP
1413     _exe=".exe"
1414 elif test -f /kern/cookiejar; then
1415 : MiNT
1416     _exe=""
1417 elif test -d c:/. -o -n "$is_os2" ; then
1418 : OS/2 or cygwin
1419     _exe=".exe"
1420 fi
1421
1422 groupstype=''
1423 i_whoami=''
1424 : Trailing extension.  Override this in a hint file, if needed.
1425 : Extra object files, if any, needed on this platform.
1426 archobjs=''
1427 archname=''
1428 : Possible local include directories to search.
1429 : Set locincpth to "" in a hint file to defeat local include searches.
1430 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1431 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1432 :
1433 : no include file wanted by default
1434 inclwanted=''
1435
1436 : Enable -DEBUGGING and -DDEBUGGING from the command line
1437 EBUGGING=''
1438 DEBUGGING=''
1439
1440 libnames=''
1441 : change the next line if compiling for Xenix/286 on Xenix/386
1442 xlibpth='/usr/lib/386 /lib/386'
1443 : Possible local library directories to search.
1444 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1445 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1446
1447 : general looking path for locating libraries
1448 glibpth="/lib /usr/lib $xlibpth"
1449 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1450 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1451 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1452 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1453
1454 : Private path used by Configure to find libraries.  Its value
1455 : is prepended to libpth. This variable takes care of special
1456 : machines, like the mips.  Usually, it should be empty.
1457 plibpth=''
1458
1459 : default library list
1460 libswanted=''
1461 : some systems want to use only the non-versioned libso:s
1462 ignore_versioned_solibs=''
1463 : set usethreads on the Configure command line to enable threads.
1464 usereentrant='undef'
1465 ccname=''
1466 ccversion=''
1467 perllibs=''
1468 : set useposix=false in your hint file to disable the POSIX extension.
1469 useposix=true
1470 : set useopcode=false in your hint file to disable the Opcode extension.
1471 useopcode=true
1472 archname64=''
1473 ccflags_uselargefiles=''
1474 ldflags_uselargefiles=''
1475 libswanted_uselargefiles=''
1476 : set usemultiplicity on the Configure command line to enable multiplicity.
1477 : set usesocks on the Configure command line to enable socks.
1478 : List of libraries we want.
1479 : If anyone needs extra -lxxx, put those in a hint file.
1480 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1481 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1482 : We probably want to search /usr/shlib before most other libraries.
1483 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1484 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1485 glibpth="/usr/shlib $glibpth"
1486 : Do not use vfork unless overridden by a hint file.
1487 usevfork=false
1488
1489 : Find the basic shell for Bourne shell scripts
1490 case "$sh" in
1491 '')
1492         case "$SYSTYPE" in
1493         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1494         *) xxx='/bin/sh';;
1495         esac
1496         if test -f "$xxx"; then
1497                 sh="$xxx"
1498         else
1499                 : Build up a list and do a single loop so we can 'break' out.
1500                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1501                 for xxx in sh bash ksh pdksh ash; do
1502                         for p in $pth; do
1503                                 try="$try ${p}/${xxx}"
1504                         done
1505                 done
1506                 for xxx in $try; do
1507                         if test -f "$xxx"; then
1508                                 sh="$xxx";
1509                                 break
1510                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1511                                 sh="$xxx";
1512                                 break
1513                         elif test -f "$xxx.exe"; then
1514                                 sh="$xxx";
1515                                 break
1516                         fi
1517                 done
1518         fi
1519         ;;
1520 esac
1521
1522 case "$sh" in
1523 '')     cat >&2 <<EOM
1524 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1525
1526 Usually it's in /bin/sh.  How did you even get this far?
1527 Please contact me (Perl Maintainers) at perlbug@perl.org and
1528 we'll try to straighten this all out.
1529 EOM
1530         exit 1
1531         ;;
1532 esac
1533
1534 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1535 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1536 targetsh=$sh
1537
1538 : see if sh knows # comments
1539 if `$sh -c '#' >/dev/null 2>&1`; then
1540         shsharp=true
1541         spitshell=cat
1542         xcat=/bin/cat
1543         test -f $xcat$_exe || xcat=/usr/bin/cat
1544         if test ! -f $xcat$_exe; then
1545                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1546                         if test -f $p/cat$_exe; then
1547                                 xcat=$p/cat
1548                                 break
1549                         fi
1550                 done
1551                 if test ! -f $xcat$_exe; then
1552                         echo "Can't find cat anywhere!"
1553                         exit 1
1554                 fi
1555         fi
1556         echo "#!$xcat" >sharp
1557         $eunicefix sharp
1558         chmod +x sharp
1559         ./sharp > today 2>/dev/null
1560         if test -s today; then
1561                 sharpbang='#!'
1562         else
1563                 echo "#! $xcat" > sharp
1564                 $eunicefix sharp
1565                 chmod +x sharp
1566                 ./sharp > today 2>/dev/null
1567                 if test -s today; then
1568                         sharpbang='#! '
1569                 else
1570                         sharpbang=': use '
1571                 fi
1572         fi
1573 else
1574         echo " "
1575         echo "Your $sh doesn't grok # comments--I will strip them later on."
1576         shsharp=false
1577         cd ..
1578         echo "exec grep -v '^[  ]*#'" >spitshell
1579         chmod +x spitshell
1580         $eunicefix spitshell
1581         spitshell=`pwd`/spitshell
1582         cd UU
1583         echo "I presume that if # doesn't work, #! won't work either!"
1584         sharpbang=': use '
1585 fi
1586 rm -f sharp today
1587
1588 : figure out how to guarantee sh startup
1589 case "$startsh" in
1590 '') startsh=${sharpbang}${sh} ;;
1591 *)
1592 esac
1593 cat >sharp <<EOSS
1594 $startsh
1595 set abc
1596 test "$?abc" != 1
1597 EOSS
1598
1599 chmod +x sharp
1600 $eunicefix sharp
1601 if ./sharp; then
1602         : echo "Yup, it does."
1603 else
1604         echo "Hmm... '$startsh' does not guarantee sh startup..."
1605         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1606 fi
1607 rm -f sharp
1608
1609 : Save command line options in file UU/cmdline.opt for later use in
1610 : generating config.sh.
1611 cat > cmdline.opt <<EOSH
1612 : Configure command line arguments.
1613 config_arg0='$0'
1614 config_args='$*'
1615 config_argc=$#
1616 EOSH
1617 argn=1
1618 args_exp=''
1619 args_sep=''
1620 for arg in "$@"; do
1621         cat >>cmdline.opt <<EOSH
1622 config_arg$argn='$arg'
1623 EOSH
1624         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1625 $arg
1626 EOC
1627         arg_exp=`cat cmdl.opt`
1628         args_exp="$args_exp$args_sep'$arg_exp'"
1629         argn=`expr $argn + 1`
1630         args_sep=' '
1631 done
1632 rm -f cmdl.opt
1633
1634 : produce awk script to parse command line options
1635 cat >options.awk <<'EOF'
1636 BEGIN {
1637         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1638
1639         len = length(optstr);
1640         for (i = 1; i <= len; i++) {
1641                 c = substr(optstr, i, 1);
1642                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1643                 if (a == ":") {
1644                         arg[c] = 1;
1645                         i++;
1646                 }
1647                 opt[c] = 1;
1648         }
1649 }
1650 {
1651         expect = 0;
1652         str = $0;
1653         if (substr(str, 1, 1) != "-") {
1654                 printf("'%s'\n", str);
1655                 next;
1656         }
1657         len = length($0);
1658         for (i = 2; i <= len; i++) {
1659                 c = substr(str, i, 1);
1660                 if (!opt[c]) {
1661                         printf("-%s\n", substr(str, i));
1662                         next;
1663                 }
1664                 printf("-%s\n", c);
1665                 if (arg[c]) {
1666                         if (i < len)
1667                                 printf("'%s'\n", substr(str, i + 1));
1668                         else
1669                                 expect = 1;
1670                         next;
1671                 }
1672         }
1673 }
1674 END {
1675         if (expect)
1676                 print "?";
1677 }
1678 EOF
1679
1680 : process the command line options
1681 set X `for arg in "$@"; do echo "X$arg"; done |
1682         sed -e s/X// | awk -f options.awk`
1683 eval "set $*"
1684 shift
1685 rm -f options.awk
1686
1687 : set up default values
1688 fastread=''
1689 reuseval=false
1690 config_sh=''
1691 alldone=''
1692 error=''
1693 silent=''
1694 extractsh=''
1695 knowitall=''
1696 rm -f optdef.sh posthint.sh
1697 cat >optdef.sh <<EOS
1698 $startsh
1699 EOS
1700
1701
1702 : option parsing
1703 while test $# -gt 0; do
1704         case "$1" in
1705         -d) shift; fastread=yes;;
1706         -e) shift; alldone=cont;;
1707         -f)
1708                 shift
1709                 cd ..
1710                 if test -r "$1"; then
1711                         config_sh="$1"
1712                 else
1713                         echo "$me: cannot read config file $1." >&2
1714                         error=true
1715                 fi
1716                 cd UU
1717                 shift;;
1718         --help|\
1719         -h) shift; error=true;;
1720         -r) shift; reuseval=true;;
1721         -s) shift; silent=true; realsilent=true;;
1722         -E) shift; alldone=exit;;
1723         -K) shift; knowitall=true;;
1724         -O) shift;;
1725         -S) shift; silent=true; extractsh=true;;
1726         -D)
1727                 shift
1728                 case "$1" in
1729                 *=)
1730                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1731                         echo "$me: ignoring -D $1" >&2
1732                         ;;
1733                 *=*) echo "$1" | \
1734                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1735                 *) echo "$1='define'" >> optdef.sh;;
1736                 esac
1737                 shift
1738                 ;;
1739         -U)
1740                 shift
1741                 case "$1" in
1742                 *=) echo "$1" >> optdef.sh;;
1743                 *=*)
1744                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1745                         echo "$me: ignoring -U $1" >&2
1746                         ;;
1747                 *) echo "$1='undef'" >> optdef.sh;;
1748                 esac
1749                 shift
1750                 ;;
1751         -A)
1752             shift
1753             xxx=''
1754             yyy="$1"
1755             zzz=''
1756             uuu=undef
1757             case "$yyy" in
1758             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1759                  case "$zzz" in
1760                  *:*) zzz='' ;;
1761                  *)   xxx=append
1762                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1763                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1764                  esac
1765                  ;;
1766             esac
1767             case "$xxx" in
1768             '')  case "$yyy" in
1769                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1770                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1771                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1772                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1773                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1774                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1775                  esac
1776                  ;;
1777             esac
1778             case "$xxx" in
1779             append)
1780                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1781             clear)
1782                 echo "$yyy=''"                  >> posthint.sh ;;
1783             define)
1784                 case "$zzz" in
1785                 '') zzz=define ;;
1786                 esac
1787                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1788             eval)
1789                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1790             prepend)
1791                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1792             undef)
1793                 case "$zzz" in
1794                 '') zzz="$uuu" ;;
1795                 esac
1796                 echo "$yyy=$zzz"                >> posthint.sh ;;
1797             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1798             esac
1799             shift
1800             ;;
1801         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1802             exit 0;;
1803         --) break;;
1804         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1805         *) break;;
1806         esac
1807 done
1808
1809 case "$error" in
1810 true)
1811         cat >&2 <<EOM
1812 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1813                  [-U symbol] [-U symbol=] [-A command:symbol...]
1814   -d : use defaults for all answers.
1815   -e : go on without questioning past the production of config.sh.
1816   -f : specify an alternate default configuration file.
1817   -h : print this help message and exit (with an error status).
1818   -r : reuse C symbols value if possible (skips costly nm extraction).
1819   -s : silent mode, only echoes questions and essential information.
1820   -D : define symbol to have some value:
1821          -D symbol         symbol gets the value 'define'
1822          -D symbol=value   symbol gets the value 'value'
1823        common used examples (see INSTALL for more info):
1824          -Duse64bitint            use 64bit integers
1825          -Duse64bitall            use 64bit integers and pointers
1826          -Dusethreads             use thread support
1827          -Dinc_version_list=none  do not include older perl trees in @INC
1828          -DEBUGGING=none          DEBUGGING options
1829          -Dcc=gcc                 choose your compiler
1830          -Dprefix=/opt/perl5      choose your destination
1831   -E : stop at the end of questions, after having produced config.sh.
1832   -K : do not use unless you know what you are doing.
1833   -O : ignored for backward compatibility
1834   -S : perform variable substitutions on all .SH files (can mix with -f)
1835   -U : undefine symbol:
1836          -U symbol    symbol gets the value 'undef'
1837          -U symbol=   symbol gets completely empty
1838        e.g.:  -Uversiononly
1839   -A : manipulate symbol after the platform specific hints have been applied:
1840          -A append:symbol=value   append value to symbol
1841          -A symbol=value          like append:, but with a separating space
1842          -A define:symbol=value   define symbol to have value
1843          -A clear:symbol          define symbol to be ''
1844          -A define:symbol         define symbol to be 'define'
1845          -A eval:symbol=value     define symbol to be eval of value
1846          -A prepend:symbol=value  prepend value to symbol
1847          -A undef:symbol          define symbol to be 'undef'
1848          -A undef:symbol=         define symbol to be ''
1849        e.g.:  -A prepend:libswanted='cl pthread '
1850               -A ccflags=-DSOME_MACRO
1851   -V : print version number and exit (with a zero status).
1852 EOM
1853         exit 1
1854         ;;
1855 esac
1856
1857 : Sanity checks
1858 case "$fastread$alldone" in
1859 yescont|yesexit) ;;
1860 *)
1861         case "$extractsh" in
1862         true) ;;
1863         *)
1864                 if test ! -t 0; then
1865                         echo "Say 'sh Configure', not 'sh <Configure'"
1866                         exit 1
1867                 fi
1868                 ;;
1869         esac
1870         ;;
1871 esac
1872
1873 exec 4>&1
1874 case "$silent" in
1875 true) exec 1>/dev/null;;
1876 esac
1877
1878 : run the defines and the undefines, if any, but leave the file out there...
1879 touch optdef.sh
1880 grep '\\' optdef.sh >/dev/null 2>&1
1881 if test $? = 0; then
1882     echo "Configure does not support \\ in -D arguments"
1883     exit 1
1884 fi
1885 . ./optdef.sh
1886 : create the posthint manipulation script and leave the file out there...
1887 touch posthint.sh
1888
1889 : set package name
1890 package='perl5'
1891 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1892 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1893 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1894 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1895 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1896 esac
1897
1898 : Some greps do not return status, grrr.
1899 echo "grimblepritz" >grimble
1900 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1901         contains=contains
1902 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1903         contains=grep
1904 else
1905         contains=contains
1906 fi
1907 rm -f grimble
1908 : the following should work in any shell
1909 case "$contains" in
1910 contains*)
1911         echo " "
1912         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1913         cat >contains <<'EOSS'
1914 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1915 EOSS
1916 chmod +x contains
1917 esac
1918
1919 : Find the path to the source tree
1920 case "$src" in
1921 '') case "$0" in
1922     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1923          case "$src" in
1924          /*)    ;;
1925          .)     ;;
1926          *)     src=`cd ../$src && pwd` ;;
1927          esac
1928          ;;
1929     *)   src='.';;
1930     esac;;
1931 esac
1932 case "$src" in
1933 '')     src=/
1934         rsrc=/
1935         ;;
1936 /*)     rsrc="$src";;
1937 *)      rsrc="../$src";;
1938 esac
1939 if test -f $rsrc/Configure && \
1940         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1941 then
1942    : found it, so we are ok.
1943 else
1944         rsrc=''
1945         for src in . .. ../.. ../../.. ../../../..; do
1946                 if test -f ../$src/Configure && \
1947                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1948                 then
1949                         rsrc=../$src
1950                         break
1951                 fi
1952         done
1953 fi
1954 case "$rsrc" in
1955 '')
1956         cat <<EOM >&4
1957
1958 Sorry, I can't seem to locate the source dir for $package.  Please start
1959 Configure with an explicit path -- i.e. /some/path/Configure.
1960
1961 EOM
1962         exit 1
1963         ;;
1964 ../.)   rsrc='..';;
1965 *)
1966         echo " "
1967         echo "Sources for $package found in \"$src\"." >&4
1968         ;;
1969 esac
1970
1971 : script used to extract .SH files with variable substitutions
1972 cat >extract <<'EOS'
1973 PERL_CONFIG_SH=true
1974 echo "Doing variable substitutions on .SH files..."
1975 if test -f MANIFEST; then
1976         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1977 else
1978         echo "(Looking for .SH files under the source directory.)"
1979         set x `(cd "$src"; find . -name "*.SH" -print)`
1980 fi
1981 shift
1982 case $# in
1983 0) set x `(cd "$src"; echo *.SH)`; shift;;
1984 esac
1985 if test ! -f "$src/$1"; then
1986         shift
1987 fi
1988 mkdir_p='
1989 name=$1;
1990 create="";
1991 while test $name; do
1992         if test ! -d "$name"; then
1993                 create="$name $create";
1994                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1995                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1996         else
1997                 name="";
1998         fi;
1999 done;
2000 for file in $create; do
2001         mkdir $file;
2002 done
2003 '
2004 for file in $*; do
2005         case "$src" in
2006         ".")
2007                 case "$file" in
2008                 */*)
2009                         dir=`expr X$file : 'X\(.*\)/'`
2010                         file=`expr X$file : 'X.*/\(.*\)'`
2011                         (cd "$dir" && . ./$file)
2012                         ;;
2013                 *)
2014                         . ./$file
2015                         ;;
2016                 esac
2017                 ;;
2018         *)
2019                 case "$file" in
2020                 */*)
2021                         dir=`expr X$file : 'X\(.*\)/'`
2022                         file=`expr X$file : 'X.*/\(.*\)'`
2023                         (set x $dir; shift; eval $mkdir_p)
2024                         sh <"$src/$dir/$file"
2025                         ;;
2026                 *)
2027                         sh <"$src/$file"
2028                         ;;
2029                 esac
2030                 ;;
2031         esac
2032 done
2033 if test -f "$src/config_h.SH"; then
2034         if test ! -f config.h; then
2035         : oops, they left it out of MANIFEST, probably, so do it anyway.
2036         . "$src/config_h.SH"
2037         fi
2038 fi
2039 EOS
2040
2041 : extract files and exit if asked to do so
2042 case "$extractsh" in
2043 true)
2044         case "$realsilent" in
2045         true) ;;
2046         *) exec 1>&4;;
2047         esac
2048         case "$config_sh" in
2049         '') config_sh='config.sh';;
2050         esac
2051         echo " "
2052         echo "Fetching answers from $config_sh..."
2053         cd ..
2054         . $config_sh
2055         . UU/optdef.sh
2056         echo " "
2057         . UU/extract
2058         rm -rf UU
2059         echo "Extraction done."
2060         exit 0
2061         ;;
2062 esac
2063
2064 : Eunice requires " " instead of "", can you believe it
2065 echo " "
2066 : Here we go...
2067 echo "Beginning of configuration questions for $package."
2068
2069 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2070
2071 : first determine how to suppress newline on echo command
2072 echo " "
2073 echo "Checking echo to see how to suppress newlines..."
2074 (echo "hi there\c" ; echo " ") >.echotmp
2075 if $contains c .echotmp >/dev/null 2>&1 ; then
2076         echo "...using -n."
2077         n='-n'
2078         c=''
2079 else
2080         cat <<'EOM'
2081 ...using \c
2082 EOM
2083         n=''
2084         c='\c'
2085 fi
2086 echo $n "The star should be here-->$c"
2087 echo '*'
2088 rm -f .echotmp
2089
2090 : Now test for existence of everything in MANIFEST
2091 echo " "
2092 if test -f "$rsrc/MANIFEST"; then
2093         echo "First let's make sure your kit is complete.  Checking..." >&4
2094         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2095                 (split -l 50 2>/dev/null || split -50)
2096         rm -f missing
2097         tmppwd=`pwd`
2098         for filelist in x??; do
2099                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2100                         >/dev/null 2>>"$tmppwd/missing")
2101         done
2102         if test -s missing; then
2103                 cat missing >&4
2104                 cat >&4 <<'EOM'
2105
2106 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2107
2108 You have the option of continuing the configuration process, despite the
2109 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2110 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2111 and contact the author (perlbug@perl.org).
2112
2113 EOM
2114                 echo $n "Continue? [n] $c" >&4
2115                 read ans
2116                 case "$ans" in
2117                 y*)
2118                         echo "Continuing..." >&4
2119                         rm -f missing
2120                         ;;
2121                 *)
2122                         echo "ABORTING..." >&4
2123                         kill $$
2124                         ;;
2125                 esac
2126         else
2127                 echo "Looks good..."
2128         fi
2129 else
2130         echo "There is no MANIFEST file.  I hope your kit is complete !"
2131 fi
2132 rm -f missing x??
2133
2134 : Find the appropriate value for a newline for tr
2135 echo " "
2136 if test -n "$DJGPP"; then
2137        trnl='\012'
2138 fi
2139 if test X"$trnl" = X; then
2140         case "`echo foo|tr '\n' x 2>/dev/null`" in
2141         foox) trnl='\n' ;;
2142         esac
2143 fi
2144 if test X"$trnl" = X; then
2145         case "`echo foo|tr '\012' x 2>/dev/null`" in
2146         foox) trnl='\012' ;;
2147         esac
2148 fi
2149 if test X"$trnl" = X; then
2150        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2151        fooxy) trnl='\n\r' ;;
2152        esac
2153 fi
2154 if test X"$trnl" = X; then
2155         cat <<EOM >&2
2156
2157 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2158
2159 EOM
2160         exit 1
2161 fi
2162
2163 : compute the number of columns on the terminal for proper question formatting
2164 case "$COLUMNS" in
2165 '') COLUMNS='80';;
2166 esac
2167
2168 : set up the echo used in my read
2169 myecho="case \"\$xxxm\" in
2170 '') echo $n \"\$rp $c\" >&4;;
2171 *) case \"\$rp\" in
2172         '') echo $n \"[\$xxxm] $c\";;
2173         *)
2174                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2175                         echo \"\$rp\" >&4
2176                         echo $n \"[\$xxxm] $c\" >&4
2177                 else
2178                         echo $n \"\$rp [\$xxxm] $c\" >&4
2179                 fi
2180                 ;;
2181         esac;;
2182 esac"
2183
2184 : now set up to do reads with possible shell escape and default assignment
2185 cat <<EOSC >myread
2186 $startsh
2187 xxxm=\$dflt
2188 $myecho
2189 ans='!'
2190 case "\$fastread" in
2191 yes) case "\$dflt" in
2192         '') ;;
2193         *) ans='';
2194                 case "\$silent-\$rp" in
2195                 true-) ;;
2196                 *) echo " " >&4;;
2197                 esac;;
2198         esac;;
2199 *) case "\$silent" in
2200         true) case "\$rp" in
2201                 '') ans='';;
2202                 esac;;
2203         esac;;
2204 esac
2205 while expr "X\$ans" : "X!" >/dev/null; do
2206         read answ
2207         set x \$xxxm
2208         shift
2209         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2210         case  "\$answ" in
2211         "!")
2212                 sh 1>&4
2213                 echo " "
2214                 $myecho
2215                 ;;
2216         !*)
2217                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2218                 shift
2219                 sh 1>&4 -c "\$*"
2220                 echo " "
2221                 $myecho
2222                 ;;
2223         "\$ans")
2224                 case "\$ans" in
2225                 \\&*)
2226                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2227                         shift
2228                         case "\$1" in
2229                         -d)
2230                                 fastread=yes
2231                                 echo "(OK, I'll run with -d after this question.)" >&4
2232                                 ;;
2233                         -*)
2234                                 echo "*** Sorry, \$1 not supported yet." >&4
2235                                 ;;
2236                         esac
2237                         $myecho
2238                         ans=!
2239                         ;;
2240                 esac;;
2241         *)
2242                 case "\$aok" in
2243                 y)
2244                         echo "*** Substitution done -- please confirm."
2245                         xxxm="\$ans"
2246                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2247                         xxxm="\$ans"
2248                         ans=!
2249                         ;;
2250                 *)
2251                         echo "*** Error -- try again."
2252                         ans=!
2253                         ;;
2254                 esac
2255                 $myecho
2256                 ;;
2257         esac
2258         case "\$ans\$xxxm\$nostick" in
2259         '')
2260                 ans=!
2261                 $myecho
2262                 ;;
2263         esac
2264 done
2265 case "\$ans" in
2266 '') ans="\$xxxm";;
2267 esac
2268 EOSC
2269
2270 : create .config dir to save info across Configure sessions
2271 test -d ../.config || mkdir ../.config
2272 cat >../.config/README <<EOF
2273 This directory created by Configure to save information that should
2274 persist across sessions for $package.
2275
2276 You may safely delete it if you wish.
2277 EOF
2278
2279 : See if we are using a devel version and want that
2280 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2281 case "$usedevel" in
2282 $define|true|[yY]*)
2283     usedevel="$define" ;;
2284 *) case "$xversion" in
2285    *[13579])
2286         cat >&4 <<EOH
2287 *** WHOA THERE!!! ***
2288
2289     This is an UNSTABLE DEVELOPMENT release.
2290     The version of this $package distribution is $xversion, that is, odd,
2291     (as opposed to even) and that signifies a development release.
2292     If you want a maintenance release, you want an even-numbered version.
2293
2294     Do ***NOT*** install this into production use.
2295     Data corruption and crashes are possible.
2296
2297     It is most seriously suggested that you do not continue any further
2298     unless you want to help in developing and debugging Perl.
2299
2300     If you *still* want to build perl, you can answer 'y' now,
2301     or pass -Dusedevel to Configure.
2302
2303 EOH
2304         rp='Do you really want to continue?'
2305         dflt='n'
2306         . ./myread
2307         case "$ans" in
2308         [yY]) echo >&4 "Okay, continuing."
2309               usedevel="$define" ;;
2310         *) echo >&4 "Okay, bye."
2311            exit 1
2312            ;;
2313         esac
2314         ;;
2315     esac
2316     usedevel="$undef"
2317     ;;
2318 esac
2319 case "$usedevel" in
2320 $define|true|[yY]*)
2321         case "$versiononly" in
2322         '') versiononly="$define" ;;
2323         esac
2324         case "$installusrbinperl" in
2325         '') installusrbinperl="$undef" ;;
2326         esac
2327         ;;
2328 esac
2329
2330 : general instructions
2331 needman=true
2332 firsttime=true
2333 user=`(logname) 2>/dev/null`
2334 case "$user" in
2335 '') user=`whoami 2>&1`;;
2336 esac
2337 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2338         firsttime=false
2339         echo " "
2340         rp='Would you like to see the instructions?'
2341         dflt=n
2342         . ./myread
2343         case "$ans" in
2344         [yY]*) ;;
2345         *) needman=false;;
2346         esac
2347 fi
2348 if $needman; then
2349         cat <<EOH
2350
2351 This installation shell script will examine your system and ask you questions
2352 to determine how the perl5 package should be installed. If you get
2353 stuck on a question, you may use a ! shell escape to start a subshell or
2354 execute a command.  Many of the questions will have default answers in square
2355 brackets; typing carriage return will give you the default.
2356
2357 On some of the questions which ask for file or directory names you are allowed
2358 to use the ~name construct to specify the login directory belonging to "name",
2359 even if you don't have a shell which knows about that.  Questions where this is
2360 allowed will be marked "(~name ok)".
2361
2362 EOH
2363         rp=''
2364         dflt='Type carriage return to continue'
2365         . ./myread
2366         cat <<'EOH'
2367
2368 The prompter used in this script allows you to use shell variables and
2369 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2370 in the default answer, as if the default line was a set of arguments given to a
2371 script shell.  This means you may also use $* to repeat the whole default line,
2372 so you do not have to re-type everything to add something to the default.
2373
2374 Every time there is a substitution, you will have to confirm.  If there is an
2375 error (e.g. an unmatched backtick), the default answer will remain unchanged
2376 and you will be prompted again.
2377
2378 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2379 the questions and use the computed defaults (or the previous answers if there
2380 was already a config.sh file). Type 'Configure -h' for a list of options.
2381 You may also start interactively and then answer '& -d' at any prompt to turn
2382 on the non-interactive behaviour for the remainder of the execution.
2383
2384 EOH
2385         . ./myread
2386         cat <<EOH
2387
2388 Much effort has been expended to ensure that this shell script will run on any
2389 Unix system.  If despite that it blows up on yours, your best bet is to edit
2390 Configure and run it again.  If you can't run Configure for some reason,
2391 you'll have to generate a config.sh file by hand.  Whatever problems you
2392 have, let me (perlbug@perl.org) know how I blew it.
2393
2394 This installation script affects things in two ways:
2395
2396 1) it may do direct variable substitutions on some of the files included
2397    in this kit.
2398 2) it builds a config.h file for inclusion in C programs.  You may edit
2399    any of these files as the need arises after running this script.
2400
2401 If you make a mistake on a question, there is no easy way to back up to it
2402 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2403 files.  Configure will offer to let you do this before it runs the SH files.
2404
2405 EOH
2406         dflt='Type carriage return to continue'
2407         . ./myread
2408         case "$firsttime" in
2409         true) echo $user >>../.config/instruct;;
2410         esac
2411 fi
2412
2413 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2414 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2415 if test "X$sysroot" = X; then
2416     sysroot=""
2417 else
2418     case "$cc" in
2419         *gcc*|*g++*)
2420             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2421             # _sysroot is used in places where we need --sysroot=foo
2422             # but using the rest of the flags could cause issues.
2423             _sysroot="--sysroot=$sysroot";
2424             case "$ccflags" in
2425                 *sysroot*) ;;
2426                 'undef'|*)
2427                 ccflags="$ccflags $_sysroot"
2428             esac
2429             case "$ldflags" in
2430                 *sysroot*) ;;
2431                 'undef'|*)
2432                 ldflags="$ldflags $_sysroot"
2433             esac
2434             case "$cppflags" in
2435                 *sysroot*) ;;
2436                 'undef'|*)
2437                 cppflags="$cppflags $_sysroot"
2438             esac
2439             # lddlflags updated below in lddlflags section;
2440             # same with cccdlflags
2441             ;;
2442     esac
2443
2444     # Adjust some defaults to also use $sysroot
2445     for var in xlibpth loclibpth locincpth glibpth; do
2446         eval xxx=\$$var
2447         eval $var=''
2448         for path in $xxx; do
2449             eval $var=\"\$$var $sysroot$path\"
2450         done
2451     done
2452
2453 fi
2454
2455 : find out where common programs are
2456 echo " "
2457 echo "Locating common programs..." >&4
2458 cat <<EOSC >loc
2459 $startsh
2460 case \$# in
2461 0) exit 1;;
2462 esac
2463 thing=\$1
2464 shift
2465 dflt=\$1
2466 shift
2467 for dir in \$*; do
2468         case "\$thing" in
2469         .)
2470         if test -d \$dir/\$thing; then
2471                 echo \$dir
2472                 exit 0
2473         fi
2474         ;;
2475         *)
2476         for thisthing in \$dir/\$thing; do
2477                 : just loop through to pick last item
2478         done
2479         if test -f \$thisthing; then
2480                 echo \$thisthing
2481                 exit 0
2482         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2483                 echo \$thisthing
2484                 exit 0
2485         elif test -f \$dir/\$thing.exe; then
2486                 if test -n "$DJGPP"; then
2487                         echo \$dir/\$thing.exe
2488                 elif test "$eunicefix" != ":"; then
2489                         : on Eunice apparently
2490                         echo \$dir/\$thing
2491                 fi
2492                 exit 0
2493         fi
2494         ;;
2495         esac
2496 done
2497 echo \$dflt
2498 exit 1
2499 EOSC
2500 chmod +x loc
2501 $eunicefix loc
2502 loclist="
2503 awk
2504 cat
2505 chmod
2506 comm
2507 cp
2508 echo
2509 expr
2510 grep
2511 ls
2512 mkdir
2513 rm
2514 sed
2515 sort
2516 touch
2517 tr
2518 uniq
2519 "
2520 trylist="
2521 ar
2522 bison
2523 byacc
2524 cpp
2525 csh
2526 date
2527 egrep
2528 gmake
2529 gzip
2530 less
2531 ln
2532 make
2533 more
2534 nm
2535 nroff
2536 perl
2537 pg
2538 test
2539 uname
2540 zip
2541 "
2542 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2543 pth="$pth $sysroot/lib $sysroot/usr/lib"
2544 for file in $loclist; do
2545         eval xxx=\$$file
2546         case "$xxx" in
2547         /*|?:[\\/]*)
2548                 if test -f "$xxx"; then
2549                         : ok
2550                 else
2551                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2552                         xxx=`./loc $file $file $pth`
2553                 fi
2554                 ;;
2555         '') xxx=`./loc $file $file $pth`;;
2556         *) xxx=`./loc $xxx $xxx $pth`;;
2557         esac
2558         eval $file=$xxx$_exe
2559         eval _$file=$xxx
2560         case "$xxx" in
2561         /*)
2562                 echo $file is in $xxx.
2563                 ;;
2564         ?:[\\/]*)
2565                 echo $file is in $xxx.
2566                 ;;
2567         *)
2568                 echo "I don't know where '$file' is, and my life depends on it." >&4
2569                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2570                 exit 1
2571                 ;;
2572         esac
2573 done
2574 echo " "
2575 echo "Don't worry if any of the following aren't found..."
2576 say=offhand
2577 for file in $trylist; do
2578         eval xxx=\$$file
2579         case "$xxx" in
2580         /*|?:[\\/]*)
2581                 if test -f "$xxx"; then
2582                         : ok
2583                 else
2584                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2585                         xxx=`./loc $file $file $pth`
2586                 fi
2587                 ;;
2588         '') xxx=`./loc $file $file $pth`;;
2589         *) xxx=`./loc $xxx $xxx $pth`;;
2590         esac
2591         eval $file=$xxx$_exe
2592         eval _$file=$xxx
2593         case "$xxx" in
2594         /*)
2595                 echo $file is in $xxx.
2596                 ;;
2597         ?:[\\/]*)
2598                 echo $file is in $xxx.
2599                 ;;
2600         *)
2601                 echo "I don't see $file out there, $say."
2602                 say=either
2603                 ;;
2604         esac
2605 done
2606 case "$egrep" in
2607 egrep)
2608         echo "Substituting grep for egrep."
2609         egrep=$grep
2610         _egrep=$grep
2611         ;;
2612 esac
2613 case "$less" in
2614 '')     ;;
2615 *)      if $less -R </dev/null >/dev/null 2>&1; then
2616                echo "Substituting less -R for less."
2617                less="$less -R"
2618                _less=$less
2619         fi
2620         ;;
2621 esac
2622 case "$ln" in
2623 ln)
2624         echo "Substituting cp for ln."
2625         ln=$cp
2626         _ln=$cp
2627         ;;
2628 esac
2629 case "$make" in
2630 make)
2631         case "$gmake" in
2632         gmake)
2633         echo "I can't find make or gmake, and my life depends on it." >&4
2634         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2635         exit 1
2636         ;;
2637         esac
2638         ;;
2639 esac
2640 case "$gmake" in
2641 gmake)  ;;
2642 *)      # We can't have osname yet.
2643         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2644                 # Assume that gmake, if found, is definitely GNU make
2645                 # and prefer it over the system make.
2646                 echo "Substituting gmake for make."
2647                 make=$gmake
2648                 _make=$gmake
2649         fi
2650         ;;
2651 esac
2652 case "$test" in
2653 test)
2654         echo "Hopefully test is built into your sh."
2655         ;;
2656 *)
2657         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2658                 echo "Using the test built into your sh."
2659                 test=test
2660                 _test=test
2661         fi
2662         ;;
2663 esac
2664 case "$echo" in
2665 echo)
2666         echo "Hopefully echo is built into your sh."
2667         ;;
2668 '') ;;
2669 *)
2670         echo " "
2671 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2672         $echo $n "hi there$c" >foo1
2673         echo $n "hi there$c" >foo2
2674         if cmp foo1 foo2 >/dev/null 2>&1; then
2675                 echo "They are compatible.  In fact, they may be identical."
2676         else
2677                 case "$n" in
2678                 '-n') n='' c='\c';;
2679                 *) n='-n' c='';;
2680                 esac
2681                 cat <<FOO
2682 They are not compatible!  You are probably running ksh on a non-USG system.
2683 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2684 have echo built in and we may have to run some Bourne shell scripts.  That
2685 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2686
2687 FOO
2688                 $echo $n "The star should be here-->$c"
2689                 $echo "*"
2690         fi
2691         $rm -f foo1 foo2
2692         ;;
2693 esac
2694
2695 # This question was auctioned at YAPC::Europe-2007 in Vienna
2696 # I never promised you could answer it. I only auctioned the question.
2697 cat <<FOO
2698 The following message is sponsored by
2699
2700   Dresden.pm<--The stars should be here.
2701
2702 Dear Perl user, system administrator or package
2703 maintainer, the Perl community sends greetings to
2704 you. Do you (emblematical) greet back [Y/n]? n
2705
2706 FOO
2707
2708 : Check what type of C compiler we use
2709 cat <<EOS >trygcc
2710 $startsh
2711 EOS
2712 cat <<'EOSC' >>trygcc
2713 case "$cc" in
2714 '') ;;
2715 *)  $rm -f try try.*
2716     $cat >try.c <<EOM
2717 int main(int argc, char *argv[]) {
2718   return 0;
2719 }
2720 EOM
2721     if $cc -o try $ccflags $ldflags try.c; then
2722        :
2723     else
2724         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2725         despair=yes
2726         trygcc=yes
2727         case "$cc" in
2728         *gcc*) trygcc=no ;;
2729         esac
2730         # Skip this test because it gives a false match on output like:
2731         #    ./trygcc: line 23: cc: command not found
2732         # case "`$cc -v -c try.c 2>&1`" in
2733         # *gcc*) trygcc=no ;;
2734         # esac
2735         if $test X"$trygcc" = Xyes; then
2736             if gcc -o try -c try.c; then
2737                 echo " "
2738                 echo "You seem to have a working gcc, though." >&4
2739                 # Switching compilers may undo the work of hints files.
2740                 # The most common problem is -D_REENTRANT for threads.
2741                 # This heuristic catches that case, but gets false positives
2742                 # if -Dusethreads was not actually specified.  Better to
2743                 # bail out here with a useful message than fail
2744                 # mysteriously later. Should we perhaps just try to
2745                 # re-invoke Configure -Dcc=gcc config_args ?
2746                 if $test -f usethreads.cbu; then
2747                         $cat >&4 <<EOM
2748
2749 *** However, any setting of the C compiler flags (e.g. for thread support)
2750 *** will be lost.  It may be necessary for you to restart Configure and
2751 *** add -Dcc=gcc to your Configure command line.
2752
2753 EOM
2754                         rp="Would you like to go ahead and try gcc anyway?"
2755                         dflt=n
2756                 else
2757                         rp="Would you like to use it?"
2758                         dflt=y
2759                 fi
2760                 if $test -f myread; then
2761                     . ./myread
2762                 else
2763                     if $test -f UU/myread; then
2764                         . ./UU/myread
2765                     else
2766                         echo "Cannot find myread, sorry.  Aborting." >&2
2767                         exit 1
2768                     fi
2769                 fi
2770                 case "$ans" in
2771                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2772                 esac
2773             fi
2774         fi
2775     fi
2776     $rm -f try try.*
2777     ;;
2778 esac
2779 EOSC
2780
2781 cat <<EOS >checkcc
2782 $startsh
2783 EOS
2784 cat <<'EOSC' >>checkcc
2785 case "$cc" in
2786 '') ;;
2787 *)  $rm -f try try.*
2788     $cat >try.c <<EOM
2789 int main(int argc, char *argv[]) {
2790   return 0;
2791 }
2792 EOM
2793     if $cc -o try $ccflags $ldflags try.c; then
2794        :
2795     else
2796         if $test X"$despair" = Xyes; then
2797            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2798         fi
2799         $cat >&4 <<EOM
2800 You need to find a working C compiler.
2801 Either (purchase and) install the C compiler supplied by your OS vendor,
2802 or for a free C compiler try http://gcc.gnu.org/
2803 I cannot continue any further, aborting.
2804 EOM
2805         exit 1
2806     fi
2807     $rm -f try try.*
2808     ;;
2809 esac
2810 EOSC
2811
2812 : determine whether symbolic links are supported
2813 echo " "
2814 $touch blurfl
2815 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2816         echo "Symbolic links are supported." >&4
2817         lns="$ln -s"
2818 else
2819         echo "Symbolic links are NOT supported." >&4
2820         lns="$ln"
2821 fi
2822 $rm -f blurfl sym
2823
2824 : determine whether symbolic links are supported
2825 echo " "
2826 case "$lns" in
2827 *"ln"*" -s")
2828         echo "Checking how to test for symbolic links..." >&4
2829         $lns blurfl sym
2830         if $test "X$issymlink" = X; then
2831                 case "$newsh" in
2832                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2833                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2834                 esac
2835                 if test $? = 0; then
2836                         issymlink="test -h"
2837                 else
2838                         echo "Your builtin 'test -h' may be broken." >&4
2839                         case "$test" in
2840                         /*)     ;;
2841                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2842                                 for p in $pth
2843                                 do
2844                                         if test -f "$p/$test"; then
2845                                                 test="$p/$test"
2846                                                 break
2847                                         fi
2848                                 done
2849                                 ;;
2850                         esac
2851                         case "$test" in
2852                         /*)
2853                                 echo "Trying external '$test -h'." >&4
2854                                 issymlink="$test -h"
2855                                 if $test ! -h sym >/dev/null 2>&1; then
2856                                         echo "External '$test -h' is broken, too." >&4
2857                                         issymlink=''
2858                                 fi
2859                                 ;;
2860                         *)      issymlink='' ;;
2861                         esac
2862                 fi
2863         fi
2864         if $test "X$issymlink" = X; then
2865                 if $test -L sym 2>/dev/null; then
2866                         issymlink="$test -L"
2867                         echo "The builtin '$test -L' worked." >&4
2868                 fi
2869         fi
2870         if $test "X$issymlink" != X; then
2871                 echo "You can test for symbolic links with '$issymlink'." >&4
2872         else
2873                 echo "I do not know how you can test for symbolic links." >&4
2874         fi
2875         $rm -f blurfl sym
2876         ;;
2877 *)      echo "No symbolic links, so not testing for their testing..." >&4
2878         ;;
2879 esac
2880 echo " "
2881
2882 : Make symlinks util
2883 case "$mksymlinks" in
2884 $define|true|[yY]*)
2885         case "$src" in
2886         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2887                 exit 1
2888                 ;;
2889         *)      case "$lns:$issymlink" in
2890                 *"ln"*" -s:"*"test -"?)
2891                         echo "Creating the symbolic links..." >&4
2892                         cd ..
2893                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2894                         awk 'NF == 1 {
2895                                 dir=".";
2896                                 file=$1 "";
2897                              }
2898                              NF == 2 {
2899                                 dir=$1 "";
2900                                 file=$2 "";
2901                              }
2902                              {
2903                                  print "# dir = ", dir, "file = ", file
2904                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2905                              } END {
2906                                  for (d in mf) {
2907                                      if (d != ".") { print("mkdir -p "d) }
2908                                      print("ln -sf "mf[d]" "d);
2909                                  }
2910                              }' source="$src" > UU/mksymlinks.$$
2911                         sh UU/mksymlinks.$$
2912                         rm UU/mksymlinks.$$
2913                         # Sanity check 1.
2914                         if test ! -d t/base; then
2915                                 echo "Failed to create the subdirectories.  Aborting." >&4
2916                                 exit 1
2917                         fi
2918                         # Sanity check 2.
2919                         if test ! -f t/base/lex.t; then
2920                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2921                                 exit 1
2922                         fi
2923                         if test ! -f win32/win32.c; then
2924                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2925                                 exit 1
2926                         fi
2927                         cd UU
2928                         ;;
2929                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2930                         ;;
2931                 esac
2932                 ;;
2933         esac
2934         ;;
2935 esac
2936
2937 : Check for Cross-Compilation
2938 if $test "X$targethost" = "X"; then
2939     targethost=""
2940 fi
2941 if $test "X$targetenv" = "X"; then
2942     targetenv=""
2943 fi
2944 case "$usecrosscompile" in
2945 $define|true|[yY]*)
2946         $echo "Cross-compiling..."
2947         croak=''
2948         case "$cc" in
2949         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2950             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2951             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2952             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2953             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2954             # leave out ld, choosing it is more complex
2955             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2956             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2957             # We are in a weird spot. Just before us, some values
2958             # were 'saved', to be restored after the hints are
2959             # run.  This means that the changes we made to ar,
2960             # nm and ranlib will get reverted.
2961             # To avoid that, we hijack the saving mechanism and
2962             # have it save our new values.
2963             for file in ar nm ranlib; do
2964                 eval xxx=\$$file
2965                 eval $file=$xxx$_exe
2966                 eval _$file=$xxx
2967             done
2968         ;;
2969         esac
2970         case "$targetarch" in
2971         '') echo "Targetarch not defined." >&4; croak=y ;;
2972         *)  echo "Using targetarch $targetarch." >&4 ;;
2973         esac
2974         case "$targethost" in
2975         '') echo "Targethost not defined." >&4; croak=y ;;
2976         *)  echo "Using targethost $targethost." >&4
2977         esac
2978         locincpth=' '
2979         loclibpth=' '
2980         case "$croak" in
2981         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2982         esac
2983     : compile a host miniperl and generate_uudmap, unless we got passed them
2984     if $test "X$hostperl" = X; then
2985       echo "Building host miniperl and generate_uudmap binaries" >&4
2986       before_host=`pwd`
2987       cd ..
2988       cd $src
2989       src=`pwd`
2990       rm -rf $src/host
2991       mkdir $src/host
2992       cd $src/host
2993       $src/Configure -des -Dusedevel -Dmksymlinks
2994       $make miniperl
2995       case "$hostgenerate" in
2996       '') $make generate_uudmap
2997           hostgenerate=$src/host/generate_uudmap
2998           ;;
2999        "$undef") hostgenerate=''
3000           ;;
3001       esac
3002       hostperl=$src/host/miniperl
3003       cd $before_host
3004     fi
3005     hostosname=`$hostperl -le 'print $^O'`
3006     ;;
3007 *)
3008     usecrosscompile="$undef"
3009     ;;
3010 esac
3011
3012 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3013 case "$targethost" in
3014     '') echo "Checking for cross-compile" >&4
3015     case "$usecrosscompile$multiarch" in
3016        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3017          if [ -f Makefile ]; then
3018            echo " "
3019            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3020          else
3021            echo "Configure done."
3022          fi
3023        exit 0
3024        ;;
3025      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3026         run=''
3027         to=:
3028         from=:
3029         ;;
3030     esac
3031     ;;
3032     *) echo "Using targethost $targethost." >&4
3033         case "$src" in
3034         /*) run=$src/Cross/run
3035             targetmkdir=$src/Cross/mkdir
3036             to=$src/Cross/to
3037             from=$src/Cross/from
3038             ;;
3039         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3040             run=$pwd/Cross/run
3041             targetmkdir=$pwd/Cross/mkdir
3042             to=$pwd/Cross/to
3043             from=$pwd/Cross/from
3044             ;;
3045         esac
3046         case "$targetrun" in
3047         '') targetrun=ssh ;;
3048         esac
3049         case "$targetto" in
3050         '') targetto=scp ;;
3051         esac
3052         case "$targetfrom" in
3053         '') targetfrom=scp ;;
3054         esac
3055         run=$run-$targetrun
3056         to=$to-$targetto
3057         from=$from-$targetfrom
3058         case "$targetdir" in
3059         '')  targetdir=/tmp
3060              echo "Guessing targetdir $targetdir." >&4
3061              ;;
3062         esac
3063         case "$targetuser" in
3064         '')  targetuser=root
3065              echo "Guessing targetuser $targetuser." >&4
3066              ;;
3067         esac
3068         case "$targetport" in
3069         '')  targetport=22
3070              echo "Guessing targetport $targetport." >&4
3071              ;;
3072         esac
3073         case "$targetfrom" in
3074         scp)    q=-q ;;
3075         *)      q='' ;;
3076         esac
3077         case "$targetrun" in
3078         ssh|rsh)
3079             cat >$run <<EOF
3080 #!/bin/sh
3081 env=''
3082 case "\$1" in
3083 -cwd)
3084   shift
3085   cwd=\$1
3086   shift
3087   ;;
3088 esac
3089 case "\$1" in
3090 -env)
3091   shift
3092   env=\$1
3093   shift
3094   ;;
3095 esac
3096 case "\$cwd" in
3097 '') cwd=$targetdir ;;
3098 esac
3099 exe=\$1
3100 shift
3101 $to \$exe
3102 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3103 EOF
3104             ;;
3105         adb)
3106             $touch $run
3107             ;;
3108         *)  echo "Unknown targetrun '$targetrun'" >&4
3109             exit 1
3110             ;;
3111         esac
3112         case "$targetmkdir" in
3113         */Cross/mkdir)
3114             cat >$targetmkdir <<EOF
3115 #!/bin/sh
3116 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3117 EOF
3118             $chmod a+rx $targetmkdir
3119             ;;
3120         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3121             exit 1
3122             ;;
3123         esac
3124         case "$targetto" in
3125         scp|rcp)
3126             cat >$to <<EOF
3127 #!/bin/sh
3128 for f in \$@
3129 do
3130   case "\$f" in
3131   /*)
3132     $targetmkdir \`dirname \$f\`
3133     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3134     ;;
3135   *)
3136     $targetmkdir $targetdir/\`dirname \$f\`
3137     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3138     ;;
3139   esac
3140 done
3141 exit 0
3142 EOF
3143             ;;
3144         cp) cat >$to <<EOF
3145 #!/bin/sh
3146 for f in \$@
3147 do
3148   case "\$f" in
3149   /*)
3150     $mkdir -p $targetdir/\`dirname \$f\`
3151     $cp \$f $targetdir/\$f || exit 1
3152     ;;
3153   *)
3154     $targetmkdir $targetdir/\`dirname \$f\`
3155     $cp \$f $targetdir/\$f || exit 1
3156     ;;
3157   esac
3158 done
3159 exit 0
3160 EOF
3161             ;;
3162         *)  echo "Unknown targetto '$targetto'" >&4
3163             exit 1
3164             ;;
3165         esac
3166         case "$targetfrom" in
3167         scp|rcp)
3168           cat >$from <<EOF
3169 #!/bin/sh
3170 for f in \$@
3171 do
3172   $rm -f \$f
3173   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3174 done
3175 exit 0
3176 EOF
3177             ;;
3178         cp) cat >$from <<EOF
3179 #!/bin/sh
3180 for f in \$@
3181 do
3182   $rm -f \$f
3183   cp $targetdir/\$f . || exit 1
3184 done
3185 exit 0
3186 EOF
3187             ;;
3188         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3189             exit 1
3190             ;;
3191         esac
3192         if $test ! -f $run; then
3193             echo "Target 'run' script '$run' not found." >&4
3194         else
3195             $chmod a+rx $run
3196         fi
3197         if $test ! -f $to; then
3198             echo "Target 'to' script '$to' not found." >&4
3199         else
3200             $chmod a+rx $to
3201         fi
3202         if $test ! -f $from; then
3203             echo "Target 'from' script '$from' not found." >&4
3204         else
3205             $chmod a+rx $from
3206         fi
3207         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3208             exit 1
3209         fi
3210         cat >&4 <<EOF
3211 Using '$run' for remote execution,
3212 and '$from' and '$to'
3213 for remote file transfer.
3214 EOF
3215         ;;
3216 *)      run=''
3217         to=:
3218         from=:
3219         usecrosscompile="$undef"
3220         targetarch=''
3221         ;;
3222 esac
3223
3224 : see whether [:lower:] and [:upper:] are supported character classes
3225 echo " "
3226 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3227 ABYZ-abyz)
3228         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3229         up='[:upper:]'
3230         low='[:lower:]'
3231         ;;
3232 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3233         # (0xd9 and 0xe2), therefore that is a nice testing point.
3234         if test "X$up" = X -o "X$low" = X; then
3235             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3236             rs) up='[A-Z]'
3237                 low='[a-z]'
3238                 ;;
3239             esac
3240         fi
3241         if test "X$up" = X -o "X$low" = X; then
3242             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3243             rs) up='A-Z'
3244                 low='a-z'
3245                 ;;
3246             esac
3247         fi
3248         if test "X$up" = X -o "X$low" = X; then
3249             case "`echo RS | od -x 2>/dev/null`" in
3250             *D9E2*|*d9e2*)
3251                 echo "Hey, this might be EBCDIC." >&4
3252                 if test "X$up" = X -o "X$low" = X; then
3253                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3254                     rs) up='[A-IJ-RS-Z]'
3255                         low='[a-ij-rs-z]'
3256                         ;;
3257                     esac
3258                 fi
3259                 if test "X$up" = X -o "X$low" = X; then
3260                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3261                     rs) up='A-IJ-RS-Z'
3262                         low='a-ij-rs-z'
3263                         ;;
3264                     esac
3265                 fi
3266                 ;;
3267             esac
3268         fi
3269 esac
3270 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3271 rs)
3272     echo "Using $up and $low to convert case." >&4
3273     ;;
3274 *)
3275     echo "I don't know how to translate letters from upper to lower case." >&4
3276     echo "Your tr is not acting any way I know of." >&4
3277     exit 1
3278     ;;
3279 esac
3280 : set up the translation script tr, must be called with ./tr of course
3281 cat >tr <<EOSC
3282 $startsh
3283 case "\$1\$2" in
3284 '[A-Z][a-z]') exec $tr '$up' '$low';;
3285 '[a-z][A-Z]') exec $tr '$low' '$up';;
3286 esac
3287 exec $tr "\$@"
3288 EOSC
3289 chmod +x tr
3290 $eunicefix tr
3291
3292 : Try to determine whether config.sh was made on this system
3293 case "$config_sh" in
3294 '')
3295 myuname=`$uname -a 2>/dev/null`
3296 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3297 # Downcase everything to avoid ambiguity.
3298 # Remove slashes and single quotes so we can use parts of this in
3299 # directory and file names.
3300 # Remove newlines so myuname is sane to use elsewhere.
3301 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3302 # because the A-Z/a-z are not consecutive.
3303 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3304         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3305 newmyuname="$myuname"
3306 dflt=n
3307 case "$knowitall" in
3308 '')
3309         if test -f ../config.sh; then
3310                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3311                         eval "`grep myuname= ../config.sh`"
3312                 fi
3313                 if test "X$myuname" = "X$newmyuname"; then
3314                         dflt=y
3315                 fi
3316         fi
3317         ;;
3318 *) dflt=y;;
3319 esac
3320
3321 : Get old answers from old config file if Configure was run on the
3322 : same system, otherwise use the hints.
3323 hint=default
3324 cd ..
3325 if test -f config.sh; then
3326         echo " "
3327         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3328         . UU/myread
3329         case "$ans" in
3330         n*|N*) echo "OK, I'll ignore it."
3331                 mv config.sh config.sh.old
3332                 myuname="$newmyuname"
3333                 ;;
3334         *)  echo "Fetching default answers from your old config.sh file..." >&4
3335                 tmp_n="$n"
3336                 tmp_c="$c"
3337                 tmp_sh="$sh"
3338                 . ./config.sh
3339                 cp config.sh UU
3340                 n="$tmp_n"
3341                 c="$tmp_c"
3342                 : Older versions did not always set $sh.  Catch re-use of such
3343                 : an old config.sh.
3344                 case "$sh" in
3345                 '') sh="$tmp_sh" ;;
3346                 esac
3347                 hint=previous
3348                 ;;
3349         esac
3350 fi
3351 . ./UU/checkcc
3352 if test ! -f config.sh; then
3353         $cat <<EOM
3354
3355 First time through, eh?  I have some defaults handy for some systems
3356 that need some extra help getting the Configure answers right:
3357
3358 EOM
3359         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3360         dflt=''
3361         : Half the following guesses are probably wrong... If you have better
3362         : tests or hints, please send them to perlbug@perl.org
3363         : The metaconfig authors would also appreciate a copy...
3364         $test -f /irix && osname=irix
3365         $test -f /xenix && osname=sco_xenix
3366         $test -f /dynix && osname=dynix
3367         $test -f /dnix && osname=dnix
3368         $test -f /lynx.os && osname=lynxos
3369         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3370         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3371         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3372         $test -f /bin/mips && /bin/mips && osname=mips
3373         $test -d /usr/apollo/bin && osname=apollo
3374         $test -f /etc/saf/_sactab && osname=svr4
3375         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3376         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3377         $test -f /sys/utilities/MultiView && osname=amigaos
3378         if $test -d /MachTen -o -d /MachTen_Folder; then
3379                 osname=machten
3380                 if $test -x /sbin/version; then
3381                         osvers=`/sbin/version | $awk '{print $2}' |
3382                         $sed -e 's/[A-Za-z]$//'`
3383                 elif $test -x /usr/etc/version; then
3384                         osvers=`/usr/etc/version | $awk '{print $2}' |
3385                         $sed -e 's/[A-Za-z]$//'`
3386                 else
3387                         osvers="$2.$3"
3388                 fi
3389         fi
3390
3391         $test -f /sys/posix.dll &&
3392                 $test -f /usr/bin/what &&
3393                 set X `/usr/bin/what /sys/posix.dll` &&
3394                 $test "$3" = UWIN &&
3395                 osname=uwin &&
3396                 osvers="$5"
3397
3398         if $test -f $uname; then
3399                 set X $myuname
3400                 shift
3401
3402                 case "$5" in
3403                 fps*) osname=fps ;;
3404                 mips*)
3405                         case "$4" in
3406                         umips) osname=umips ;;
3407                         *) osname=mips ;;
3408                         esac;;
3409                 [23]100) osname=mips ;;
3410                 i386*)
3411                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3412                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3413                                 osname='sco'
3414                                 osvers=$tmp
3415                         elif $test -f /etc/kconfig; then
3416                                 osname=isc
3417                                 if test "$lns" = "$ln -s"; then
3418                                         osvers=4
3419                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3420                                         osvers=3
3421                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3422                                         osvers=2
3423                                 fi
3424                         fi
3425                         tmp=''
3426                         ;;
3427                 pc*)
3428                         if test -n "$DJGPP"; then
3429                                 osname=dos
3430                                 osvers=djgpp
3431                         fi
3432                         ;;
3433                 esac
3434
3435                 case "$1" in
3436                 aix) osname=aix
3437                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3438                         case "$tmp" in
3439                         # oslevel can fail with:
3440                         # oslevel: Unable to acquire lock.
3441                         *not\ found) osvers="$4"."$3" ;;
3442                         '<3240'|'<>3240') osvers=3.2.0 ;;
3443                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3444                         '=3250'|'>3250') osvers=3.2.5 ;;
3445                         *) osvers=$tmp;;
3446                         esac
3447                         ;;
3448                 bitrig) osname=bitrig
3449                         osvers="$3"
3450                         ;;
3451                 bsd386) osname=bsd386
3452                         osvers=`$uname -r`
3453                         ;;
3454                 cygwin*) osname=cygwin
3455                         osvers="$3"
3456                         ;;
3457                 *dc.osx) osname=dcosx
3458                         osvers="$3"
3459                         ;;
3460                 dnix) osname=dnix
3461                         osvers="$3"
3462                         ;;
3463                 domainos) osname=apollo
3464                         osvers="$3"
3465                         ;;
3466                 dgux)   osname=dgux
3467                         osvers="$3"
3468                         ;;
3469                 dragonfly) osname=dragonfly
3470                         osvers="$3"
3471                         ;;
3472                 dynixptx*) osname=dynixptx
3473                         osvers=`echo "$4"|sed 's/^v//'`
3474                         ;;
3475                 freebsd) osname=freebsd
3476                         osvers="$3" ;;
3477                 genix)  osname=genix ;;
3478                 gnu)    osname=gnu
3479                         osvers="$3" ;;
3480                 hp*)    osname=hpux
3481                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3482                         ;;
3483                 irix*)  osname=irix
3484                         case "$3" in
3485                         4*) osvers=4 ;;
3486                         5*) osvers=5 ;;
3487                         *)      osvers="$3" ;;
3488                         esac
3489                         ;;
3490                 linux)  osname=linux
3491                         case "$3" in
3492                         *)      osvers="$3" ;;
3493                         esac
3494                         $test -f /system/lib/libandroid.so && osname=linux-android
3495                         ;;
3496                 MiNT)   osname=mint
3497                         ;;
3498                 netbsd*) osname=netbsd
3499                         osvers="$3"
3500                         ;;
3501                 news-os) osvers="$3"
3502                         case "$3" in
3503                         4*) osname=newsos4 ;;
3504                         *) osname=newsos ;;
3505                         esac
3506                         ;;
3507                 nonstop-ux) osname=nonstopux ;;
3508                 openbsd) osname=openbsd
3509                         osvers="$3"
3510                         ;;
3511                 os2)    osname=os2
3512                         osvers="$4"
3513                         ;;
3514                 POSIX-BC | posix-bc ) osname=posix-bc
3515                         osvers="$3"
3516                         ;;
3517                 powerux | power_ux | powermax_os | powermaxos | \
3518                 powerunix | power_unix) osname=powerux
3519                         osvers="$3"
3520                         ;;
3521                 qnx) osname=qnx
3522                         osvers="$4"
3523                         ;;
3524                 solaris) osname=solaris
3525                         case "$3" in
3526                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3527                         *)      osvers="$3" ;;
3528                         esac
3529                         ;;
3530                 sunos) osname=sunos
3531                         case "$3" in
3532                         5*) osname=solaris
3533                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3534                         *)      osvers="$3" ;;
3535                         esac
3536                         ;;
3537                 titanos) osname=titanos
3538                         case "$3" in
3539                         1*) osvers=1 ;;
3540                         2*) osvers=2 ;;
3541                         3*) osvers=3 ;;
3542                         4*) osvers=4 ;;
3543                         *)      osvers="$3" ;;
3544                         esac
3545                         ;;
3546                 ultrix) osname=ultrix
3547                         osvers="$3"
3548                         ;;
3549                 osf1|mls+)      case "$5" in
3550                                 alpha)
3551                                         osname=dec_osf
3552                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3553                                         case "$osvers" in
3554                                         [1-9].[0-9]*) ;;
3555                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3556                                         esac
3557                                         ;;
3558                         hp*)    osname=hp_osf1  ;;
3559                         mips)   osname=mips_osf1 ;;
3560                         esac
3561                         ;;
3562                 # UnixWare 7.1.2 is known as Open UNIX 8
3563                 openunix|unixware) osname=svr5
3564                         osvers="$4"
3565                         ;;
3566                 uts)    osname=uts
3567                         osvers="$3"
3568                         ;;
3569                 vos) osvers="$3"
3570                         ;;
3571                 $2) case "$osname" in
3572                         *isc*) ;;
3573                         *freebsd*) ;;
3574                         svr*)
3575                                 : svr4.x or possibly later
3576                                 case "svr$3" in
3577                                 ${osname}*)
3578                                         osname=svr$3
3579                                         osvers=$4
3580                                         ;;
3581                                 esac
3582                                 case "$osname" in
3583                                 svr4.0)
3584                                         : Check for ESIX
3585                                         if test -f /stand/boot ; then
3586                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3587                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3588                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3589                                                         if test -n "$isesix"; then
3590                                                                 osname=esix4
3591                                                         fi
3592                                                 fi
3593                                         fi
3594                                         ;;
3595                                 esac
3596                                 ;;
3597                         *)      if test -f /etc/systemid; then
3598                                         osname=sco
3599                                         set `echo $3 | $sed 's/\./ /g'` $4
3600                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3601                                                 osvers=$1.$2.$3
3602                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3603                                                 osvers=$1.$2
3604                                         elif $test -f $src/hints/sco_$1.sh; then
3605                                                 osvers=$1
3606                                         fi
3607                                 else
3608                                         case "$osname" in
3609                                         '') : Still unknown.  Probably a generic Sys V.
3610                                                 osname="sysv"
3611                                                 osvers="$3"
3612                                                 ;;
3613                                         esac
3614                                 fi
3615                                 ;;
3616                         esac
3617                         ;;
3618                 *)      case "$osname" in
3619                         '') : Still unknown.  Probably a generic BSD.
3620                                 osname="$1"
3621                                 osvers="$3"
3622                                 ;;
3623                         esac
3624                         ;;
3625                 esac
3626         else
3627                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3628                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3629                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3630                                 osname=news_os
3631                         fi
3632                         $rm -f UU/kernel.what
3633                 elif test -d c:/. -o -n "$is_os2" ; then
3634                         set X $myuname
3635                         osname=os2
3636                         osvers="$5"
3637                 fi
3638         fi
3639
3640         case "$targetarch" in
3641         '') ;;
3642         *)  hostarch=$osname
3643             case "$targetarch" in
3644                 nto*|*-nto-*)
3645                     # Will load qnx.sh, which should change osname to nto
3646                     osname=qnx
3647                     osvers=''
3648                     ;;
3649                 *linux-android*)
3650                     # Catch arm-linux-androideabi, mipsel-linux-android,
3651                     # and i686-linux-android
3652                     osname=linux-android
3653                     osvers=''
3654                     ;;
3655                 *linux*)
3656                     # Something like arm-linux-gnueabihf is really just
3657                     # plain linux.
3658                     osname=linux
3659                     osvers=''
3660                     ;;
3661                 *solaris*|*sunos*)
3662                     osname=solaris
3663                     # XXX perhaps we should just assume
3664                     # osvers to be 2, or maybe take the value
3665                     # from targetarch. Using $run before the
3666                     # hints are run is somewhat icky.
3667                     set X `$run $uname -a 2>/dev/null`
3668                     shift
3669                     case "$3" in
3670                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3671                         *)  osvers="$3" ;;
3672                     esac
3673                     ;;
3674                 *)
3675                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3676                     osvers=''
3677                 ;;
3678             esac
3679             ;;
3680         esac
3681
3682         : Now look for a hint file osname_osvers, unless one has been
3683         : specified already.
3684         case "$hintfile" in
3685         ''|' ')
3686                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3687                 : Also try without trailing minor version numbers.
3688                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3689                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3690                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3691                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3692                 case "$file" in
3693                 '') dflt=none ;;
3694                 *)  case "$osvers" in
3695                         '') dflt=$file
3696                                 ;;
3697                         *)  if $test -f $src/hints/$file.sh ; then
3698                                         dflt=$file
3699                                 elif $test -f $src/hints/$xfile.sh ; then
3700                                         dflt=$xfile
3701                                 elif $test -f $src/hints/$xxfile.sh ; then
3702                                         dflt=$xxfile
3703                                 elif $test -f $src/hints/$xxxfile.sh ; then
3704                                         dflt=$xxxfile
3705                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3706                                         dflt=$xxxxfile
3707                                 elif $test -f "$src/hints/${osname}.sh" ; then
3708                                         dflt="${osname}"
3709                                 else
3710                                         dflt=none
3711                                 fi
3712                                 ;;
3713                         esac
3714                         ;;
3715                 esac
3716                 if $test -f Policy.sh ; then
3717                         case "$dflt" in
3718                         *Policy*) ;;
3719                         none) dflt="Policy" ;;
3720                         *) dflt="Policy $dflt" ;;
3721                         esac
3722                 fi
3723                 ;;
3724         *)
3725                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3726                 ;;
3727         esac
3728
3729         if $test -f Policy.sh ; then
3730                 $cat <<EOM
3731
3732 There's also a Policy hint file available, which should make the
3733 site-specific (policy) questions easier to answer.
3734 EOM
3735
3736         fi
3737
3738         $cat <<EOM
3739
3740 You may give one or more space-separated answers, or "none" if appropriate.
3741 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3742 previous run of Configure, you may specify it as well as or instead of
3743 OS-specific hints.  If hints are provided for your OS, you should use them:
3744 although Perl can probably be built without hints on many platforms, using
3745 hints often improve performance and may enable features that Configure can't
3746 set up on its own. If there are no hints that match your OS, specify "none";
3747 DO NOT give a wrong version or a wrong OS.
3748
3749 EOM
3750
3751         rp="Which of these apply, if any?"
3752         . UU/myread
3753         tans=$ans
3754         for file in $tans; do
3755                 if $test X$file = XPolicy -a -f Policy.sh; then
3756                         . Policy.sh
3757                         $cat Policy.sh >> UU/config.sh
3758                 elif $test -f $src/hints/$file.sh; then
3759                         . $src/hints/$file.sh
3760                         $cat $src/hints/$file.sh >> UU/config.sh
3761                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3762                         : nothing
3763                 else
3764                         : Give one chance to correct a possible typo.
3765                         echo "$file.sh does not exist"
3766                         dflt=$file
3767                         rp="hint to use instead?"
3768                         . UU/myread
3769                         for file in $ans; do
3770                                 if $test -f "$src/hints/$file.sh"; then
3771                                         . $src/hints/$file.sh
3772                                         $cat $src/hints/$file.sh >> UU/config.sh
3773                                 elif $test X$ans = X -o X$ans = Xnone ; then
3774                                         : nothing
3775                                 else
3776                                         echo "$file.sh does not exist -- ignored."
3777                                 fi
3778                         done
3779                 fi
3780         done
3781
3782         hint=recommended
3783         : Remember our hint file for later.
3784         if $test -f "$src/hints/$file.sh" ; then
3785                 hintfile="$file"
3786         else
3787                 hintfile=''
3788         fi
3789 fi
3790 cd UU
3791 ;;
3792 *)
3793         echo " "
3794         echo "Fetching default answers from $config_sh..." >&4
3795         tmp_n="$n"
3796         tmp_c="$c"
3797         cd ..
3798         cp $config_sh config.sh 2>/dev/null
3799         chmod +w config.sh
3800         . ./config.sh
3801         cd UU
3802         cp ../config.sh .
3803         n="$tmp_n"
3804         c="$tmp_c"
3805         hint=previous
3806         ;;
3807 esac
3808 . ./optdef.sh
3809
3810 : Restore computed paths
3811 for file in $loclist $trylist; do
3812         eval $file="\$_$file"
3813 done
3814
3815 cat << EOM
3816
3817 Configure uses the operating system name and version to set some defaults.
3818 The default value is probably right if the name rings a bell. Otherwise,
3819 since spelling matters for me, either accept the default or answer "none"
3820 to leave it blank.
3821
3822 EOM
3823 case "$osname" in
3824         ''|' ')
3825                 case "$hintfile" in
3826                 ''|' '|none) dflt=none ;;
3827                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3828                 esac
3829                 ;;
3830         *) dflt="$osname" ;;
3831 esac
3832 rp="Operating system name?"
3833 . ./myread
3834 case "$ans" in
3835 none)  osname='' ;;
3836 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3837 esac
3838 echo " "
3839 case "$osvers" in
3840         ''|' ')
3841                 case "$hintfile" in
3842                 ''|' '|none) dflt=none ;;
3843                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3844                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3845                         case "$dflt" in
3846                         ''|' ') dflt=none ;;
3847                         esac
3848                         ;;
3849                 esac
3850                 ;;
3851         *) dflt="$osvers" ;;
3852 esac
3853 rp="Operating system version?"
3854 . ./myread
3855 case "$ans" in
3856 none)  osvers='' ;;
3857 *) osvers="$ans" ;;
3858 esac
3859
3860
3861 . ./posthint.sh
3862
3863 : who configured the system
3864 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3865 case "$cf_by" in
3866 "")
3867         cf_by=`(logname) 2>/dev/null`
3868         case "$cf_by" in
3869         "")
3870                 cf_by=`(whoami) 2>/dev/null`
3871                 case "$cf_by" in
3872                 "") cf_by=unknown ;;
3873                 esac ;;
3874         esac ;;
3875 esac
3876
3877 : decide how portable to be.  Allow command line overrides.
3878 case "$d_portable" in
3879 "$undef") ;;
3880 *)      d_portable="$define" ;;
3881 esac
3882
3883 : set up shell script to do ~ expansion
3884 cat >filexp <<EOSS
3885 $startsh
3886 : expand filename
3887 case "\$1" in
3888  \~/*|\~)
3889         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3890         ;;
3891  \~*)
3892         if $test -f /bin/csh; then
3893                 /bin/csh -f -c "glob \$1"
3894                 failed=\$?
3895                 echo ""
3896                 exit \$failed
3897         else
3898                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3899                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3900                 if $test ! -d "\$dir"; then
3901                         me=\`basename \$0\`
3902                         echo "\$me: can't locate home directory for: \$name" >&2
3903                         exit 1
3904                 fi
3905                 case "\$1" in
3906                 */*)
3907                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3908                         ;;
3909                 *)
3910                         echo \$dir
3911                         ;;
3912                 esac
3913         fi
3914         ;;
3915 *)
3916         echo \$1
3917         ;;
3918 esac
3919 EOSS
3920 chmod +x filexp
3921 $eunicefix filexp
3922
3923 : now set up to get a file name
3924 cat <<EOS >getfile
3925 $startsh
3926 EOS
3927 cat <<'EOSC' >>getfile
3928 tilde=''
3929 fullpath=''
3930 already=''
3931 skip=''
3932 none_ok=''
3933 exp_file=''
3934 nopath_ok=''
3935 orig_rp="$rp"
3936 orig_dflt="$dflt"
3937 case "$gfpth" in
3938 '') gfpth='.' ;;
3939 esac
3940
3941 case "$fn" in
3942 *\(*)
3943         : getfile will accept an answer from the comma-separated list
3944         : enclosed in parentheses even if it does not meet other criteria.
3945         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3946         fn=`echo $fn | sed 's/(.*)//'`
3947         ;;
3948 esac
3949
3950 case "$fn" in
3951 *:*)
3952         loc_file=`expr $fn : '.*:\(.*\)'`
3953         fn=`expr $fn : '\(.*\):.*'`
3954         ;;
3955 esac
3956
3957 case "$fn" in
3958 *~*) tilde=true;;
3959 esac
3960 case "$fn" in
3961 */*) fullpath=true;;
3962 esac
3963 case "$fn" in
3964 *+*) skip=true;;
3965 esac
3966 case "$fn" in
3967 *n*) none_ok=true;;
3968 esac
3969 case "$fn" in
3970 *e*) exp_file=true;;
3971 esac
3972 case "$fn" in
3973 *p*) nopath_ok=true;;
3974 esac
3975
3976 case "$fn" in
3977 *f*) type='File';;
3978 *d*) type='Directory';;
3979 *l*) type='Locate';;
3980 esac
3981
3982 what="$type"
3983 case "$what" in
3984 Locate) what='File';;
3985 esac
3986
3987 case "$exp_file" in
3988 '')
3989         case "$d_portable" in
3990         "$define") ;;
3991         *) exp_file=true;;
3992         esac
3993         ;;
3994 esac
3995
3996 cd ..
3997 while test "$type"; do
3998         redo=''
3999         rp="$orig_rp"
4000         dflt="$orig_dflt"
4001         case "$tilde" in
4002         true) rp="$rp (~name ok)";;
4003         esac
4004         . UU/myread
4005         if test -f UU/getfile.ok && \
4006                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4007         then
4008                 value="$ans"
4009                 ansexp="$ans"
4010                 break
4011         fi
4012         case "$ans" in
4013         none)
4014                 value=''
4015                 ansexp=''
4016                 case "$none_ok" in
4017                 true) type='';;
4018                 esac
4019                 ;;
4020         *)
4021                 case "$tilde" in
4022                 '') value="$ans"
4023                         ansexp="$ans";;
4024                 *)
4025                         value=`UU/filexp $ans`
4026                         case $? in
4027                         0)
4028                                 if test "$ans" != "$value"; then
4029                                         echo "(That expands to $value on this system.)"
4030                                 fi
4031                                 ;;
4032                         *) value="$ans";;
4033                         esac
4034                         ansexp="$value"
4035                         case "$exp_file" in
4036                         '') value="$ans";;
4037                         esac
4038                         ;;
4039                 esac
4040                 case "$fullpath" in
4041                 true)
4042                         case "$ansexp" in
4043                         /*) value="$ansexp" ;;
4044                         [a-zA-Z]:/*) value="$ansexp" ;;
4045                         *)
4046                                 redo=true
4047                                 case "$already" in
4048                                 true)
4049                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4050                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4051                                         ;;
4052                                 *)
4053                                 echo "Please give a full path name, starting with slash." >&4
4054                                         case "$tilde" in
4055                                         true)
4056                                 echo "Note that using ~name is ok provided it expands well." >&4
4057                                                 already=true
4058                                                 ;;
4059                                         esac
4060                                 esac
4061                                 ;;
4062                         esac
4063                         ;;
4064                 esac
4065                 case "$redo" in
4066                 '')
4067                         case "$type" in
4068                         File)
4069                                 for fp in $gfpth; do
4070                                         if test "X$fp" = X.; then
4071                                             pf="$ansexp"
4072                                         else    
4073                                             pf="$fp/$ansexp"
4074                                         fi
4075                                         if test -f "$pf"; then
4076                                                 type=''
4077                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4078                                         then
4079                                                 echo "($value is not a plain file, but that's ok.)"
4080                                                 type=''
4081                                         fi
4082                                         if test X"$type" = X; then
4083                                             value="$pf"
4084                                             break
4085                                         fi
4086                                 done
4087                                 ;;
4088                         Directory)
4089                                 for fp in $gfpth; do
4090                                         if test "X$fp" = X.; then
4091                                             dir="$ans"
4092                                             direxp="$ansexp"
4093                                         else    
4094                                             dir="$fp/$ansexp"
4095                                             direxp="$fp/$ansexp"
4096                                         fi
4097                                         if test -d "$direxp"; then
4098                                                 type=''
4099                                                 value="$dir"
4100                                                 break
4101                                         fi
4102                                 done
4103                                 ;;
4104                         Locate)
4105                                 if test -d "$ansexp"; then
4106                                         echo "(Looking for $loc_file in directory $value.)"
4107                                         value="$value/$loc_file"
4108                                         ansexp="$ansexp/$loc_file"
4109                                 fi
4110                                 if test -f "$ansexp"; then
4111                                         type=''
4112                                 fi
4113                                 case "$nopath_ok" in
4114                                 true)   case "$value" in
4115                                         */*) ;;
4116                                         *)      echo "Assuming $value will be in people's path."
4117                                                 type=''
4118                                                 ;;
4119                                         esac
4120                                         ;;
4121                                 esac
4122                                 ;;
4123                         esac
4124
4125                         case "$skip" in
4126                         true) type='';
4127                         esac
4128
4129                         case "$type" in
4130                         '') ;;
4131                         *)
4132                                 if test "$fastread" = yes; then
4133                                         dflt=y
4134                                 else
4135                                         dflt=n
4136                                 fi
4137                                 rp="$what $value doesn't exist.  Use that name anyway?"
4138                                 . UU/myread
4139                                 dflt=''
4140                                 case "$ans" in
4141                                 y*) type='';;
4142                                 *) echo " ";;
4143                                 esac
4144                                 ;;
4145                         esac
4146                         ;;
4147                 esac
4148                 ;;
4149         esac
4150 done
4151 cd UU
4152 ans="$value"
4153 rp="$orig_rp"
4154 dflt="$orig_dflt"
4155 rm -f getfile.ok
4156 test "X$gfpthkeep" != Xy && gfpth=""
4157 EOSC
4158
4159 : determine root of directory hierarchy where package will be installed.
4160 case "$prefix" in
4161 '')
4162         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4163         ;;
4164 *?/)
4165         dflt=`echo "$prefix" | sed 's/.$//'`
4166         ;;
4167 *)
4168         dflt="$prefix"
4169         ;;
4170 esac
4171 $cat <<EOM
4172
4173 By default, $package will be installed in $dflt/bin, manual pages
4174 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4175 installation directories. Typically this is something like /usr/local.
4176 If you wish to have binaries under /usr/bin but other parts of the
4177 installation under /usr/local, that's ok: you will be prompted
4178 separately for each of the installation directories, the prefix being
4179 only used to set the defaults.
4180
4181 EOM
4182 fn=d~
4183 rp='Installation prefix to use?'
4184 . ./getfile
4185 oldprefix=''
4186 case "$prefix" in
4187 '') ;;
4188 *)
4189         case "$ans" in
4190         "$prefix") ;;
4191         *) oldprefix="$prefix";;
4192         esac
4193         ;;
4194 esac
4195 prefix="$ans"
4196 prefixexp="$ansexp"
4197
4198 : allow them to override the AFS root
4199 case "$afsroot" in
4200 '')     afsroot=/afs ;;
4201 *)      afsroot=$afsroot ;;
4202 esac
4203
4204 : is AFS running?
4205 echo " "
4206 case "$afs" in
4207 $define|true)   afs=true ;;
4208 $undef|false)   afs=false ;;
4209 *)      if $test -d $afsroot; then
4210                 afs=true
4211         else
4212                 afs=false
4213         fi
4214         ;;
4215 esac
4216 if $afs; then
4217         echo "AFS may be running... I'll be extra cautious then..." >&4
4218 else
4219         echo "AFS does not seem to be running..." >&4
4220 fi
4221
4222 : determine installation prefix for where package is to be installed.
4223 if $afs; then
4224 $cat <<EOM
4225
4226 Since you are running AFS, I need to distinguish the directory in which
4227 files will reside from the directory in which they are installed (and from
4228 which they are presumably copied to the former directory by occult means).
4229
4230 EOM
4231         case "$installprefix" in
4232         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4233         *) dflt="$installprefix";;
4234         esac
4235 else
4236 $cat <<EOM
4237
4238 In some special cases, particularly when building $package for distribution,
4239 it is convenient to distinguish the directory in which files should be
4240 installed from the directory ($prefix) in which they will
4241 eventually reside.  For most users, these two directories are the same.
4242
4243 EOM
4244         case "$installprefix" in
4245         '') dflt=$prefix ;;
4246         *) dflt=$installprefix;;
4247         esac
4248 fi
4249 fn=d~
4250 rp='What installation prefix should I use for installing files?'
4251 . ./getfile
4252 installprefix="$ans"
4253 installprefixexp="$ansexp"
4254
4255 : Perform the prefixexp/installprefixexp correction if necessary
4256 cat <<EOS >installprefix
4257 $startsh
4258 EOS
4259 cat <<'EOSC' >>installprefix
4260 : Change installation prefix, if necessary.
4261 if $test X"$prefix" != X"$installprefix"; then
4262     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4263 else
4264     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4265 fi
4266 EOSC
4267 chmod +x installprefix
4268 $eunicefix installprefix
4269
4270 : Set variables such as privlib and privlibexp from the output of ./getfile
4271 : performing the prefixexp/installprefixexp correction if necessary.
4272 cat <<EOS >setprefixvar
4273 $startsh
4274 EOS
4275 cat <<'EOSC' >>setprefixvar
4276 eval "${prefixvar}=\"\$ans\""
4277 eval "${prefixvar}exp=\"\$ansexp\""
4278 . ./installprefix
4279 EOSC
4280 chmod +x setprefixvar
4281 $eunicefix setprefixvar
4282
4283 : set up the script used to warn in case of inconsistency
4284 cat <<EOS >whoa
4285 $startsh
4286 EOS
4287 cat <<'EOSC' >>whoa
4288 dflt=y
4289 case "$hint" in
4290     recommended)
4291         case "$hintfile" in
4292         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4293                 ;;
4294         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4295                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4296                 ;;
4297         esac
4298         ;;
4299     *)  echo " "
4300         echo "*** WHOA THERE!!! ***" >&4
4301         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4302         ;;
4303 esac
4304 rp="    Keep the $hint value?"
4305 . ./myread
4306 case "$ans" in
4307 y) td=$was; tu=$was;;
4308 esac
4309 EOSC
4310
4311 : function used to set '$1' to '$val'
4312 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4313 case "$val$was" in
4314 $define$undef) . ./whoa; eval "$var=\$td";;
4315 $undef$define) . ./whoa; eval "$var=\$tu";;
4316 *) eval "$var=$val";;
4317 esac'
4318
4319 : get the patchlevel
4320 echo " "
4321 echo "Getting the current patchlevel..." >&4
4322 if $test -r $rsrc/patchlevel.h;then
4323         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4324         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4325         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4326         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4327         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4328         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4329         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4330 else
4331         revision=0
4332         patchlevel=0
4333         subversion=0
4334         api_revision=0
4335         api_version=0
4336         api_subversion=0
4337         perl_patchlevel=0
4338         $echo "(You do not have patchlevel.h.  Eek.)"
4339 fi
4340 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4341 version_patchlevel_string="version $patchlevel subversion $subversion"
4342 case "$perl_patchlevel" in
4343 0|'') ;;
4344 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4345     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4346     ;;
4347 esac
4348
4349 $echo "(You have $package $version_patchlevel_string.)"
4350
4351 case "$osname" in
4352 dos|vms)
4353         : XXX Should be a Configure test for double-dots in filenames.
4354         version=`echo $revision $patchlevel $subversion | \
4355                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4356         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4357                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4358         ;;
4359 *)
4360         version=`echo $revision $patchlevel $subversion | \
4361                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4362         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4363                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4364         ;;
4365 esac
4366 : Special case the 5.005_xx maintenance series, which used 5.005
4367 : without any subversion label as a subdirectory in $sitelib
4368 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4369         api_versionstring='5.005'
4370 fi
4371
4372 : Do we want threads support and if so, what type
4373 case "$usethreads" in
4374 $define|true|[yY]*)     dflt='y';;
4375 *)     # Catch case where user specified ithreads or 5005threads but
4376        # forgot -Dusethreads (A.D. 4/2002)
4377        case "$useithreads$use5005threads" in
4378        *$define*)       dflt='y';;
4379        *)               dflt='n';;
4380        esac
4381        ;;
4382 esac
4383 cat <<EOM
4384
4385 Perl can be built to offer a form of threading support on some systems
4386 To do so, Configure can be run with -Dusethreads.
4387
4388 Note that Perl built with threading support runs slightly slower
4389 and uses slightly more memory than plain Perl.
4390
4391 If this doesn't make any sense to you, just accept the default '$dflt'.
4392 EOM
4393 rp='Build a threading Perl?'
4394 . ./myread
4395 case "$ans" in
4396 y|Y)    val="$define" ;;
4397 *)      val="$undef" ;;
4398 esac
4399 set usethreads
4400 eval $setvar
4401
4402 if $test $patchlevel -lt 9; then
4403     case "$usethreads" in
4404     $define)
4405         : Default to ithreads unless overridden on command line or with
4406         : old config.sh
4407         dflt='y'
4408         case "$use5005threads" in
4409                 $define|true|[yY]*)
4410                         echo "5.005 threads are no longer supported"
4411                         exit 1
4412                 ;;
4413         esac
4414         case "$useithreads" in
4415                 $undef|false|[nN]*) dflt='n';;
4416         esac
4417         rp='Use the newer interpreter-based ithreads?'
4418         . ./myread
4419         case "$ans" in
4420         y|Y)    val="$define" ;;
4421         *)      val="$undef" ;;
4422         esac
4423         set useithreads
4424         eval $setvar
4425         : Now set use5005threads to the opposite value.
4426         case "$useithreads" in
4427         $define) val="$undef" ;;
4428         *) val="$define" ;;
4429         esac
4430         set use5005threads
4431         eval $setvar
4432         ;;
4433     *)
4434         useithreads="$undef"
4435         use5005threads="$undef"
4436         ;;
4437     esac
4438
4439     case "$useithreads$use5005threads" in
4440     "$define$define")
4441         $cat >&4 <<EOM
4442
4443 You cannot have both the ithreads and the 5.005 threads enabled
4444 at the same time.  Disabling the 5.005 threads since they are
4445 much less stable than the ithreads.
4446
4447 EOM
4448         use5005threads="$undef"
4449         ;;
4450     esac
4451
4452 else
4453 : perl-5.9.x and later
4454
4455     if test X"$usethreads" = "X$define"; then
4456         case "$use5005threads" in
4457             $define|true|[yY]*)
4458                 $cat >&4 <<EOM
4459
4460 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4461
4462 EOM
4463             ;;
4464         esac
4465     fi
4466
4467     use5005threads="$undef"
4468     useithreads="$usethreads"
4469 fi
4470
4471 case "$d_oldpthreads" in
4472 '')     : Configure tests would be welcome here.  For now, assume undef.
4473         val="$undef" ;;
4474 *)      val="$d_oldpthreads" ;;
4475 esac
4476 set d_oldpthreads
4477 eval $setvar
4478
4479
4480 : Look for a hint-file generated 'call-back-unit'.  If the
4481 : user has specified that a threading perl is to be built,
4482 : we may need to set or change some other defaults.
4483 if $test -f usethreads.cbu; then
4484     echo "Your platform has some specific hints regarding threaded builds, using them..."
4485     . ./usethreads.cbu
4486 else
4487     case "$usethreads" in
4488         "$define"|true|[yY]*)
4489                 $cat <<EOM
4490 (Your platform does not have any specific hints for threaded builds.
4491  Assuming POSIX threads, then.)
4492 EOM
4493         ;;
4494     esac
4495 fi
4496
4497 : Check if multiplicity is required
4498 cat <<EOM
4499
4500 Perl can be built so that multiple Perl interpreters can coexist
4501 within the same Perl executable.
4502 EOM
4503
4504 case "$useithreads" in
4505 $define)
4506         cat <<EOM
4507 This multiple interpreter support is required for interpreter-based threads.
4508 EOM
4509         val="$define"
4510         ;;
4511 *)      case "$usemultiplicity" in
4512         $define|true|[yY]*)     dflt='y';;
4513         *) dflt='n';;
4514         esac
4515         echo " "
4516         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4517         rp='Build Perl for multiplicity?'
4518         . ./myread
4519         case "$ans" in
4520         y|Y)    val="$define" ;;
4521         *)      val="$undef" ;;
4522         esac
4523         ;;
4524 esac
4525 set usemultiplicity
4526 eval $setvar
4527
4528 : Check if morebits is requested
4529 case "$usemorebits" in
4530 "$define"|true|[yY]*)
4531         use64bitint="$define"
4532         uselongdouble="$define"
4533         usemorebits="$define"
4534         ;;
4535 *)      usemorebits="$undef"
4536         ;;
4537 esac
4538
4539 : Determine the C compiler to be used
4540 echo " "
4541 case "$cc" in
4542 '') dflt=cc;;
4543 *) dflt="$cc";;
4544 esac
4545 rp="Use which C compiler?"
4546 . ./myread
4547 cc="$ans"
4548
4549 : See whether they have no cc but they do have gcc
4550 . ./trygcc
4551 if $test -f cc.cbu; then
4552     . ./cc.cbu
4553 fi
4554 . ./checkcc
4555
4556 : make some quick guesses about what we are up against
4557 echo " "
4558 $echo $n "Hmm...  $c"
4559 echo exit 1 >bsd
4560 echo exit 1 >usg
4561 echo exit 1 >v7
4562 echo exit 1 >osf1
4563 echo exit 1 >eunice
4564 echo exit 1 >xenix
4565 echo exit 1 >venix
4566 echo exit 1 >os2
4567 d_bsd="$undef"
4568 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4569 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4570 then
4571         echo "Looks kind of like an OSF/1 system, but we'll see..."
4572         echo exit 0 >osf1
4573 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4574         xxx=`./loc addbib blurfl $pth`
4575         if $test -f $xxx; then
4576         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4577                 echo exit 0 >bsd
4578                 echo exit 0 >usg
4579         else
4580                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4581                         echo "Looks kind of like an extended USG system, but we'll see..."
4582                 else
4583                         echo "Looks kind of like a USG system, but we'll see..."
4584                 fi
4585                 echo exit 0 >usg
4586         fi
4587 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4588         echo "Looks kind of like a BSD system, but we'll see..."
4589         d_bsd="$define"
4590         echo exit 0 >bsd
4591 else
4592         echo "Looks kind of like a Version 7 system, but we'll see..."
4593         echo exit 0 >v7
4594 fi
4595 case "$eunicefix" in
4596 *unixtovms*)
4597         $cat <<'EOI'
4598 There is, however, a strange, musty smell in the air that reminds me of
4599 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4600 EOI
4601         echo exit 0 >eunice
4602         d_eunice="$define"
4603 : it so happens the Eunice I know will not run shell scripts in Unix format
4604         ;;
4605 *)
4606         echo " "
4607         echo "Congratulations.  You aren't running Eunice."
4608         d_eunice="$undef"
4609         ;;
4610 esac
4611 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4612 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4613 : semicolon as a patch separator
4614 case "$p_" in
4615 :) ;;
4616 *)
4617         $cat <<'EOI'
4618 I have the feeling something is not exactly right, however...don't tell me...
4619 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4620 (Or you may be running DOS with DJGPP.)
4621 EOI
4622         echo exit 0 >os2
4623         ;;
4624 esac
4625 if test -f /xenix; then
4626         echo "Actually, this looks more like a XENIX system..."
4627         echo exit 0 >xenix
4628         d_xenix="$define"
4629 else
4630         echo " "
4631         echo "It's not Xenix..."
4632         d_xenix="$undef"
4633 fi
4634 chmod +x xenix
4635 $eunicefix xenix
4636 if test -f /venix; then
4637         echo "Actually, this looks more like a VENIX system..."
4638         echo exit 0 >venix
4639 else
4640         echo " "
4641         if ./xenix; then
4642                 : null
4643         else
4644                 echo "Nor is it Venix..."
4645         fi
4646 fi
4647 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4648 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4649 $rm -f foo
4650
4651 : Check if we are using GNU gcc and what its version is
4652 echo " "
4653 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4654 $cat >try.c <<EOM
4655 #include <stdio.h>
4656 int main() {
4657 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4658 #ifdef __VERSION__
4659         printf("%s\n", __VERSION__);
4660 #else
4661         printf("%s\n", "1");
4662 #endif
4663 #endif
4664         return(0);
4665 }
4666 EOM
4667 if $cc -o try $ccflags $ldflags try.c; then
4668         gccversion=`$run ./try`
4669         case "$gccversion" in
4670         '') echo "You are not using GNU cc." ;;
4671         *)  echo "You are using GNU cc $gccversion."
4672             ccname=gcc
4673             ;;
4674         esac
4675 else
4676         echo " "
4677         echo "*** WHOA THERE!!! ***" >&4
4678         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4679         case "$knowitall" in
4680         '')
4681         echo "    You'd better start hunting for one and let me know about it." >&4
4682                 exit 1
4683                 ;;
4684         esac
4685 fi
4686 $rm -f try try.*
4687 case "$gccversion" in
4688 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4689 esac
4690 case "$gccversion" in
4691 '') gccosandvers='' ;;
4692 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4693    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4694    gccshortvers=''
4695    case "$gccosandvers" in
4696    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4697    $osname$osvers) ;; # looking good
4698    $osname*) cat <<EOM >&4
4699
4700 *** WHOA THERE!!! ***
4701
4702     Your gcc has not been compiled for the exact release of
4703     your operating system ($gccosandvers versus $osname$osvers).
4704
4705     In general it is a good idea to keep gcc synchronized with
4706     the operating system because otherwise serious problems
4707     may ensue when trying to compile software, like Perl.
4708
4709     I'm trying to be optimistic here, though, and will continue.
4710     If later during the configuration and build icky compilation
4711     problems appear (headerfile conflicts being the most common
4712     manifestation), I suggest reinstalling the gcc to match
4713     your operating system release.
4714
4715 EOM
4716       ;;
4717    *) gccosandvers='' ;; # failed to parse, better be silent
4718    esac
4719    ;;
4720 esac
4721 case "$ccname" in
4722 '') ccname="$cc" ;;
4723 esac
4724
4725 # gcc 3.* complain about adding -Idirectories that they already know about,
4726 # so we will take those off from locincpth.
4727 case "$gccversion" in
4728 3*)
4729     echo "main(){}">try.c
4730     for incdir in $locincpth; do
4731        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4732              grep '^c[cp]p*[01]: warning: changing search order '`
4733        if test "X$warn" != X; then
4734            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4735        fi
4736     done
4737     $rm -f try try.*
4738 esac
4739
4740 # gcc 4.9 by default does some optimizations that break perl.
4741 # see ticket 121505.
4742 #
4743 # The -fwrapv disables those optimizations (and probably others,) so
4744 # for gcc 4.9 (and later, since the optimizations probably won't go
4745 # away), add -fwrapv unless the user requests -fno-wrapv, which
4746 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4747 # which turns the overflows -fwrapv ignores into runtime errors.
4748 case "$gccversion" in
4749 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4750     case "$ccflags" in
4751     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4752     *) ccflags="$ccflags -fwrapv" ;;
4753     esac
4754 esac
4755
4756 : What should the include directory be ?
4757 : Use sysroot if set, so findhdr looks in the right place.
4758 echo " "
4759 $echo $n "Hmm...  $c"
4760 dflt="$sysroot/usr/include"
4761 incpath=''
4762 mips_type=''
4763 if $test -f /bin/mips && /bin/mips; then
4764         echo "Looks like a MIPS system..."
4765         $cat >usr.c <<'EOCP'
4766 #ifdef SYSTYPE_BSD43
4767 /bsd43
4768 #endif
4769 EOCP
4770         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4771                 dflt='/bsd43/usr/include'
4772                 incpath='/bsd43'
4773                 mips_type='BSD 4.3'
4774         else
4775                 mips_type='System V'
4776         fi
4777         $rm -f usr.c usr.out
4778         echo "and you're compiling with the $mips_type compiler and libraries."
4779         xxx_prompt=y
4780         echo "exit 0" >mips
4781 else
4782         echo "Doesn't look like a MIPS system."
4783         xxx_prompt=n
4784         echo "exit 1" >mips
4785 fi
4786 chmod +x mips
4787 $eunicefix mips
4788 case "$usrinc" in
4789 '') ;;
4790 *) dflt="$usrinc";;
4791 esac
4792 case "$xxx_prompt" in
4793 y)      fn=d/
4794         echo " "
4795         rp='Where are the include files you want to use?'
4796         . ./getfile
4797         usrinc="$ans"
4798         ;;
4799 *)      usrinc="$dflt"
4800         ;;
4801 esac
4802
4803 : see how we invoke the C preprocessor
4804 echo " "
4805 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4806 cat <<'EOT' >testcpp.c
4807 #define ABC abc
4808 #define XYZ xyz
4809 ABC.XYZ
4810 EOT
4811 cd ..
4812 if test ! -f cppstdin; then
4813         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4814                 # AIX cc -E doesn't show the absolute headerfile
4815                 # locations but we'll cheat by using the -M flag.
4816                 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
4817         else
4818                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4819         fi
4820 else
4821         echo "Keeping your $hint cppstdin wrapper."
4822 fi
4823 chmod 755 cppstdin
4824 wrapper=`pwd`/cppstdin
4825 ok='false'
4826 cd UU
4827
4828 if $test "X$cppstdin" != "X" && \
4829         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4830         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4831 then
4832         echo "You used to use $cppstdin $cppminus so we'll use that again."
4833         case "$cpprun" in
4834         '') echo "But let's see if we can live without a wrapper..." ;;
4835         *)
4836                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4837                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4838                 then
4839                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4840                         ok='true'
4841                 else
4842                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4843                 fi
4844                 ;;
4845         esac
4846 else
4847         case "$cppstdin" in
4848         '') ;;
4849         *)
4850                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4851                 ;;
4852         esac
4853 fi
4854
4855 if $ok; then
4856         : nothing
4857 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4858         $cc -E <testcpp.c >testcpp.out 2>&1; \
4859         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4860         echo "Yup, it does."
4861         x_cpp="$cc $cppflags -E"
4862         x_minus='';
4863 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4864         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4865         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4866         echo "Yup, it does."
4867         x_cpp="$cc $cppflags -E"
4868         x_minus='-';
4869 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4870         $cc -P <testcpp.c >testcpp.out 2>&1; \
4871         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4872         echo "Yipee, that works!"
4873         x_cpp="$cc $cppflags -P"
4874         x_minus='';
4875 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4876         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4877         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4878         echo "At long last!"
4879         x_cpp="$cc $cppflags -P"
4880         x_minus='-';
4881 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4882         $cpp <testcpp.c >testcpp.out 2>&1; \
4883         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4884         echo "It works!"
4885         x_cpp="$cpp $cppflags"
4886         x_minus='';
4887 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4888         $cpp - <testcpp.c >testcpp.out 2>&1; \
4889         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4890         echo "Hooray, it works!  I was beginning to wonder."
4891         x_cpp="$cpp $cppflags"
4892         x_minus='-';
4893 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4894         $wrapper <testcpp.c >testcpp.out 2>&1; \
4895         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4896         x_cpp="$wrapper"
4897         x_minus=''
4898         echo "Eureka!"
4899 else
4900         dflt=''
4901         rp="No dice.  I can't find a C preprocessor.  Name one:"
4902         . ./myread
4903         x_cpp="$ans"
4904         x_minus=''
4905         $x_cpp <testcpp.c >testcpp.out 2>&1
4906         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4907                 echo "OK, that will do." >&4
4908         else
4909 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4910                 exit 1
4911         fi
4912 fi
4913
4914 case "$ok" in
4915 false)
4916         cppstdin="$x_cpp"
4917         cppminus="$x_minus"
4918         cpprun="$x_cpp"
4919         cpplast="$x_minus"
4920         set X $x_cpp
4921         shift
4922         case "$1" in
4923         "$cpp")
4924                 echo "Perhaps can we force $cc -E using a wrapper..."
4925                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4926                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4927                 then
4928                         echo "Yup, we can."
4929                         cppstdin="$wrapper"
4930                         cppminus='';
4931                 else
4932                         echo "Nope, we'll have to live without it..."
4933                 fi
4934                 ;;
4935         esac
4936         case "$cpprun" in
4937         "$wrapper")
4938                 cpprun=''
4939                 cpplast=''
4940                 ;;
4941         esac
4942         ;;
4943 esac
4944
4945 case "$cppstdin" in
4946 "$wrapper"|'cppstdin') ;;
4947 *) $rm -f $wrapper;;
4948 esac
4949 $rm -f testcpp.c testcpp.out
4950
4951 : Adjust cppfilter for path component separator
4952 case "$osname" in
4953 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4954 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4955 *)   cppfilter='' ;;
4956 esac
4957
4958 : Use gcc to determine libpth and incpth
4959 # If using gcc or clang, we can get better values for libpth, incpth
4960 # and usrinc directly from the compiler.
4961 # Note that ccname for clang is also gcc.
4962 case "$ccname" in
4963     gcc)
4964         $echo 'extern int foo;' > try.c
4965         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4966         shift
4967         if $test $# -gt 0; then
4968             incpth="$incpth $*"
4969             incpth="`$echo $incpth|$sed 's/^ //'`"
4970             for i in $*; do
4971                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4972                 if $test -d $j; then
4973                     libpth="$libpth $j"
4974                 fi
4975             done
4976             libpth="`$echo $libpth|$sed 's/^ //'`"
4977             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4978                 if $test -d $xxx; then
4979                     case " $libpth " in
4980                     *" $xxx "*) ;;
4981                     *) libpth="$libpth $xxx";;
4982                     esac
4983                 fi
4984             done
4985         fi
4986         $rm -f try.c
4987         case "$usrinc" in
4988         '') for i in $incpth; do
4989                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4990                     usrinc="$i"
4991                     break
4992                 fi
4993             done
4994             ;;
4995         esac
4996
4997         case "$usecrosscompile" in
4998         $define|true|[yY]*)
4999             case "$incpth" in
5000                 '') echo "Incpth not defined." >&4; croak=y ;;
5001                 *)  echo "Using incpth '$incpth'." >&4 ;;
5002             esac
5003             case "$libpth" in
5004                 '') echo "Libpth not defined." >&4; croak=y ;;
5005                 *)  echo "Using libpth '$libpth'." >&4 ;;
5006             esac
5007             case "$usrinc" in
5008                 '') echo "Usrinc not defined." >&4; croak=y ;;
5009                 *)  echo "Using usrinc $usrinc." >&4 ;;
5010             esac
5011             case "$croak" in
5012                 y)
5013                 if test "X$sysroot" = X; then
5014                     echo "Cannot continue, aborting." >&4; exit 1
5015                 else
5016                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5017                 fi
5018                 ;;
5019             esac
5020             ;;
5021         esac
5022     ;;
5023 esac
5024
5025 : Default value for incpth is just usrinc
5026 case "$incpth" in
5027 '') incpth="$usrinc";;
5028 esac
5029
5030 : Set private lib path
5031 case "$plibpth" in
5032 '') if ./mips; then
5033         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5034     fi;;
5035 esac
5036 case "$libpth" in
5037 ' ') dlist='';;
5038 '') dlist="$loclibpth $plibpth $glibpth";;
5039 *) dlist="$libpth";;
5040 esac
5041
5042 : Now check and see which directories actually exist, avoiding duplicates
5043 for xxx in $dlist
5044 do
5045     if $test -d $xxx; then
5046                 case " $libpth " in
5047                 *" $xxx "*) ;;
5048                 *) libpth="$libpth $xxx";;
5049                 esac
5050     fi
5051 done
5052 $cat <<'EOM'
5053
5054 Some systems have incompatible or broken versions of libraries.  Among
5055 the directories listed in the question below, please remove any you
5056 know not to be holding relevant libraries, and add any that are needed.
5057 Say "none" for none.
5058
5059 EOM
5060
5061 if test "X$sysroot" != X; then
5062     $cat <<EOM
5063 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5064
5065 EOM
5066 fi
5067
5068 case "$libpth" in
5069 '') dflt='none';;
5070 *)
5071         set X $libpth
5072         shift
5073         dflt=${1+"$@"}
5074         ;;
5075 esac
5076 rp="Directories to use for library searches?"
5077 . ./myread
5078 case "$ans" in
5079 none) libpth=' ';;
5080 *) libpth="$ans";;
5081 esac
5082
5083 : compute shared library extension
5084 case "$so" in
5085 '')
5086         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5087                 dflt='sl'
5088         else
5089                 dflt='so'
5090         fi
5091         ;;
5092 *) dflt="$so";;
5093 esac
5094 $cat <<EOM
5095
5096 On some systems, shared libraries may be available.  Answer 'none' if
5097 you want to suppress searching of shared libraries for the remainder
5098 of this configuration.
5099
5100 EOM
5101 rp='What is the file extension used for shared libraries?'
5102 . ./myread
5103 so="$ans"
5104
5105 : Does target system insist that shared library basenames are unique
5106 $cat << EOM
5107
5108 Some dynamic loaders assume that the *basename* of shared library filenames
5109 are globally unique.  We'll default this to undef as we assume your system
5110 is not this weird. Set to defined if you're on one of them.
5111
5112 EOM
5113
5114 dflt='n'
5115 rp='Make shared library basenames unique?'
5116 . ./myread
5117 case "$ans" in
5118 y|Y) val="$define" ;;
5119 *)   val="$undef"  ;;
5120 esac
5121 set d_libname_unique
5122 eval $setvar
5123
5124 : Define several unixisms.
5125 : Hints files or command line option can be used to override them.
5126 : The convoluted testing is in case hints files set either the old
5127 : or the new name.
5128 case "$_exe" in
5129 '')     case "$exe_ext" in
5130         '')     ;;
5131         *)      _exe="$exe_ext" ;;
5132         esac
5133         ;;
5134 esac
5135 case "$_a" in
5136 '')     case "$lib_ext" in
5137     '') _a='.a';;
5138         *)      _a="$lib_ext" ;;
5139         esac
5140         ;;
5141 esac
5142 case "$_o" in
5143 '') case "$obj_ext" in
5144         '')     _o='.o';;
5145         *)      _o="$obj_ext";;
5146         esac
5147         ;;
5148 esac
5149 case "$p_" in
5150 '') case "$path_sep" in
5151         '')     p_=':';;
5152         *)      p_="$path_sep";;
5153         esac
5154         ;;
5155 esac
5156 exe_ext=$_exe
5157 lib_ext=$_a
5158 obj_ext=$_o
5159 path_sep=$p_
5160
5161 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5162
5163 : Which makefile gets called first.  This is used by make depend.
5164 case "$firstmakefile" in
5165 '') firstmakefile='makefile';;
5166 esac
5167
5168 : Check is we will use socks
5169 case "$usesocks" in
5170 $define|true|[yY]*)     dflt='y';;
5171 *) dflt='n';;
5172 esac
5173 cat <<EOM
5174
5175 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5176 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5177 to use the PerlIO abstraction layer, this will be implicitly selected.
5178
5179 If this doesn't make any sense to you, just accept the default '$dflt'.
5180 EOM
5181 rp='Build Perl for SOCKS?'
5182 . ./myread
5183 case "$ans" in
5184 y|Y)    val="$define" ;;
5185 *)      val="$undef" ;;
5186 esac
5187 set usesocks
5188 eval $setvar
5189
5190 : Check for uselongdouble support
5191 case "$ccflags" in
5192 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5193 esac
5194
5195 case "$uselongdouble" in
5196 $define|true|[yY]*)     dflt='y';;
5197 *) dflt='n';;
5198 esac
5199 cat <<EOM
5200
5201 Perl can be built to take advantage of long doubles which
5202 (if available) may give more accuracy and range for floating point numbers.
5203
5204 If this doesn't make any sense to you, just accept the default '$dflt'.
5205 EOM
5206 rp='Try to use long doubles if available?'
5207 . ./myread
5208 case "$ans" in
5209 y|Y)    val="$define"   ;;
5210 *)      val="$undef"    ;;
5211 esac
5212 set uselongdouble
5213 eval $setvar
5214
5215 case "$uselongdouble" in
5216 true|[yY]*) uselongdouble="$define" ;;
5217 esac
5218
5219 : Look for a hint-file generated 'call-back-unit'.  If the
5220 : user has specified that long doubles should be used,
5221 : we may need to set or change some other defaults.
5222 if $test -f uselongdouble.cbu; then
5223     echo "Your platform has some specific hints regarding long doubles, using them..."
5224     . ./uselongdouble.cbu
5225 else
5226     case "$uselongdouble" in
5227         $define)
5228                 $cat <<EOM
5229 (Your platform does not have any specific hints for long doubles.)
5230 EOM
5231         ;;
5232     esac
5233 fi
5234
5235 : Check if quadmath is requested
5236 case "$usequadmath" in
5237 "$define"|true|[yY]*) usequadmath="$define" ;;
5238 *)                    usequadmath="$undef"  ;;
5239 esac
5240
5241 : Looking for optional libraries
5242 echo " "
5243 echo "Checking for optional libraries..." >&4
5244 case "$libs" in
5245 ' '|'') dflt='';;
5246 *) dflt="$libs";;
5247 esac
5248 case "$libswanted" in
5249 '') libswanted='c_s';;
5250 esac
5251 case "$usesocks" in
5252 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5253 esac
5254 case "$usecbacktrace" in
5255 "$define") libswanted="$libswanted bfd" ;;
5256 esac
5257 case "$usequadmath" in
5258 "$define") libswanted="$libswanted quadmath" ;;
5259 esac
5260 libsfound=''
5261 libsfiles=''
5262 libsdirs=''
5263 libspath=''
5264 for thisdir in $libpth $xlibpth; do
5265   test -d $thisdir && libspath="$libspath $thisdir"
5266 done
5267 for thislib in $libswanted; do
5268         for thisdir in $libspath; do
5269             xxx=''
5270             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5271                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5272                 $test -f "$xxx" && eval $libscheck
5273                 $test -f "$xxx" && libstyle=shared
5274                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5275                 $test -f "$xxx" && eval $libscheck
5276                 $test -f "$xxx" && libstyle=shared
5277             fi
5278             if test ! -f "$xxx"; then
5279                 xxx=$thisdir/lib$thislib.$so
5280                 $test -f "$xxx" && eval $libscheck
5281                 $test -f "$xxx" && libstyle=shared
5282             fi
5283             if test ! -f "$xxx"; then
5284                 xxx=$thisdir/lib$thislib$_a
5285                 $test -f "$xxx" && eval $libscheck
5286                 $test -f "$xxx" && libstyle=static
5287             fi
5288             if test ! -f "$xxx"; then
5289                 xxx=$thisdir/$thislib$_a
5290                 $test -f "$xxx" && eval $libscheck
5291                 $test -f "$xxx" && libstyle=static
5292             fi
5293             if test ! -f "$xxx"; then
5294                 xxx=$thisdir/lib${thislib}_s$_a
5295                 $test -f "$xxx" && eval $libscheck
5296                 $test -f "$xxx" && libstyle=static
5297                 $test -f "$xxx" && thislib=${thislib}_s
5298             fi
5299             if test ! -f "$xxx"; then
5300                 xxx=$thisdir/Slib$thislib$_a
5301                 $test -f "$xxx" && eval $libscheck
5302                 $test -f "$xxx" && libstyle=static
5303             fi
5304             if $test -f "$xxx"; then
5305                 case "$libstyle" in
5306                 shared) echo "Found -l$thislib (shared)." ;;
5307                 static) echo "Found -l$thislib." ;;
5308                 *)      echo "Found -l$thislib ($libstyle)." ;;
5309                 esac
5310                 case " $dflt " in
5311                 *"-l$thislib "*);;
5312                 *) dflt="$dflt -l$thislib"
5313                    libsfound="$libsfound $xxx"
5314                    yyy=`basename $xxx`
5315                    libsfiles="$libsfiles $yyy"
5316                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5317                    case " $libsdirs " in
5318                    *" $yyy "*) ;;
5319                    *) libsdirs="$libsdirs $yyy" ;;
5320                    esac
5321                    ;;
5322                 esac
5323                 break
5324             fi
5325         done
5326         if $test ! -f "$xxx"; then
5327             echo "No -l$thislib."
5328         fi
5329 done
5330 set X $dflt
5331 shift
5332 dflt="$*"
5333 case "$libs" in
5334 '') dflt="$dflt";;
5335 *) dflt="$libs";;
5336 esac
5337 case "$dflt" in
5338 ' '|'') dflt='none';;
5339 esac
5340
5341 $cat <<EOM
5342
5343 In order to compile $package on your machine, a number of libraries
5344 are usually needed.  Include any other special libraries here as well.
5345 Say "none" for none.  The default list is almost always right.
5346 EOM
5347
5348 echo " "
5349 rp="What libraries to use?"
5350 . ./myread
5351 case "$ans" in
5352 none) libs=' ';;
5353 *) libs="$ans";;
5354 esac
5355
5356 : determine optimization, if desired, or use for debug flag also
5357 case "$optimize" in
5358 ' '|$undef) dflt='none';;
5359 '') dflt='-O';;
5360 *) dflt="$optimize";;
5361 esac
5362 $cat <<EOH
5363
5364 By default, $package compiles with the -O flag to use the optimizer.
5365 Alternately, you might want to use the symbolic debugger, which uses
5366 the -g flag (on traditional Unix systems).  Either flag can be
5367 specified here.  To use neither flag, specify the word "none".
5368
5369 EOH
5370 rp="What optimizer/debugger flag should be used?"
5371 . ./myread
5372 optimize="$ans"
5373 case "$optimize" in
5374 'none') optimize=" ";;
5375 esac
5376
5377 : Check what DEBUGGING is required from the command line
5378 : -DEBUGGING      or -DDEBUGGING or
5379 : -DEBUGGING=both                       = -g + -DDEBUGGING
5380 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5381 : -DEBUGGING=none or -UDEBUGGING        =
5382 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5383 case "$EBUGGING" in
5384 '')     ;;
5385 *)      DEBUGGING=$EBUGGING ;;
5386 esac
5387
5388 case "$DEBUGGING" in
5389 -g|both|$define)
5390     case "$optimize" in
5391         *-g*) ;;
5392         *)    optimize="$optimize -g" ;;
5393     esac ;;
5394 none|$undef)
5395     case "$optimize" in
5396         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5397                 shift
5398                 optimize="$*"
5399                 ;;
5400     esac ;;
5401 esac
5402
5403 dflt=''
5404 case "$DEBUGGING" in
5405 both|$define) dflt='-DDEBUGGING'
5406 esac
5407
5408 : argument order is deliberate, as the flag will start with - which set could
5409 : think is an option
5410 checkccflag='check=$1; flag=$2; callback=$3;
5411 echo " ";
5412 echo "Checking if your compiler accepts $flag" 2>&1;
5413 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5414 echo "int main(void) { return 0; }" > gcctest.c;
5415 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5416     echo "Yes, it does." 2>&1;
5417     if $test -s gcctest.out ; then
5418         echo "But your platform does not like it:";
5419         cat gcctest.out;
5420     else
5421         case "$ccflags" in
5422         *$check*)
5423             echo "Leaving current flags $ccflags alone." 2>&1
5424             ;;
5425         *) dflt="$dflt $flag";
5426             eval $callback
5427             ;;
5428         esac
5429     fi
5430 else
5431     echo "Nope, it does not, but that is ok." 2>&1;
5432 fi
5433 '
5434
5435 : We will not override a previous value, but we might want to
5436 : augment a hint file
5437 case "$hint" in
5438 default|recommended)
5439         case "$gccversion" in
5440         1*) dflt="$dflt -fpcc-struct-return" ;;
5441         esac
5442         case "$optimize:$DEBUGGING" in
5443         *-g*:old) dflt="$dflt -DDEBUGGING";;
5444         esac
5445         case "$gccversion" in
5446         2*) if $test -d /etc/conf/kconfig.d &&
5447                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5448                 then
5449                         # Interactive Systems (ISC) POSIX mode.
5450                         dflt="$dflt -posix"
5451                 fi
5452                 ;;
5453         esac
5454         case "$gccversion" in
5455         1*) ;;
5456         2.[0-8]*) ;;
5457         ?*)     set strict-aliasing -fno-strict-aliasing
5458                 eval $checkccflag
5459                 ;;
5460         esac
5461         # For gcc, adding -pipe speeds up compilations for some, but apparently
5462         # some assemblers can't read from stdin.  (It also slows down compilations
5463         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5464         case "$gccversion" in
5465         ?*)     set pipe -pipe
5466                 eval $checkccflag
5467                 ;;
5468         esac
5469
5470         # on x86_64 (at least) we require an extra library (libssp) in the
5471         # link command line. This library is not named, so I infer that it is
5472         # an implementation detail that may change. Hence the safest approach
5473         # is to add the flag to the flags passed to the compiler at link time,
5474         # as that way the compiler can do the right implementation dependant
5475         # thing. (NWC)
5476         case "$osname" in
5477         amigaos) ;; # -fstack-protector builds but doesn't work
5478         *)      case "$gccversion" in
5479                 ?*)     set stack-protector-strong -fstack-protector-strong
5480                         eval $checkccflag
5481                         case "$dflt" in
5482                         *-fstack-protector-strong*) ;; # It got added.
5483                         *) # Try the plain/older -fstack-protector.
5484                            set stack-protector -fstack-protector
5485                            eval $checkccflag
5486                            ;;
5487                         esac
5488                         ;;
5489                 esac
5490                 ;;
5491         esac
5492         ;;
5493 esac
5494
5495 case "$mips_type" in
5496 *BSD*|'') inclwanted="$locincpth $usrinc";;
5497 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5498 esac
5499 for thisincl in $inclwanted; do
5500         if $test -d $thisincl; then
5501                 if $test x$thisincl != x$usrinc; then
5502                         case "$dflt" in
5503                         *" -I$thisincl "*);;
5504                         *) dflt="$dflt -I$thisincl ";;
5505                         esac
5506                 fi
5507         fi
5508 done
5509
5510 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5511         xxx=true;
5512 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5513         xxx=true;
5514 else
5515         xxx=false;
5516 fi;
5517 if $xxx; then
5518         case "$dflt" in
5519         *$2*);;
5520         *) dflt="$dflt -D$2";;
5521         esac;
5522 fi'
5523
5524 set signal.h LANGUAGE_C; eval $inctest
5525
5526 case "$usesocks" in
5527 $define)
5528         ccflags="$ccflags -DSOCKS"
5529         ;;
5530 esac
5531
5532 case "$hint" in
5533 default|recommended) dflt="$ccflags $dflt" ;;
5534 *) dflt="$ccflags";;
5535 esac
5536
5537 case "$dflt" in
5538 ''|' ') dflt=none;;
5539 esac
5540
5541 $cat <<EOH
5542
5543 Your C compiler may want other flags.  For this question you should include
5544 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5545 but you should NOT include libraries or ld flags like -lwhatever.  If you
5546 want $package to honor its debug switch, you should include -DDEBUGGING here.
5547 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5548
5549 To use no flags, specify the word "none".
5550
5551 EOH
5552 set X $dflt
5553 shift
5554 dflt=${1+"$@"}
5555 rp="Any additional cc flags?"
5556 . ./myread
5557 case "$ans" in
5558 none) ccflags='';;
5559 *) ccflags="$ans";;
5560 esac
5561
5562 : the following weeds options from ccflags that are of no interest to cpp
5563 case "$cppflags" in
5564 '') cppflags="$ccflags" ;;
5565 *)  set X $ccflags; shift
5566     case " $cppflags " in
5567     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5568     *) cppflags="$cppflags $ccflags" ;;
5569     esac
5570     ;;
5571 esac
5572 case "$gccversion" in
5573 1*) cppflags="$cppflags -D__GNUC__"
5574 esac
5575 case "$mips_type" in
5576 '');;
5577 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5578 esac
5579 case "$cppflags" in
5580 '');;
5581 *)
5582         echo " "
5583         echo "Let me guess what the preprocessor flags are..." >&4
5584         set X $cppflags
5585         shift
5586         cppflags=''
5587         $cat >cpp.c <<'EOM'
5588 #define BLURFL foo
5589
5590 BLURFL xx LFRULB
5591 EOM
5592         previous=''
5593         for flag in $*
5594         do
5595                 case "$flag" in
5596                 -*) ftry="$flag";;
5597                 *) ftry="$previous $flag";;
5598                 esac
5599                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5600                         >cpp1.out 2>/dev/null && \
5601                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5602                         >cpp2.out 2>/dev/null && \
5603                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5604                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5605                 then
5606                         cppflags="$cppflags $ftry"
5607                         previous=''
5608                 else
5609                         previous="$flag"
5610                 fi
5611         done
5612         set X $cppflags
5613         shift
5614         cppflags=${1+"$@"}
5615         case "$cppflags" in
5616         *-*)  echo "They appear to be: $cppflags";;
5617         esac
5618         $rm -f cpp.c cpp?.out
5619         ;;
5620 esac
5621
5622 : flags used in final linking phase
5623 case "$ldflags" in
5624 '') if ./venix; then
5625                 dflt='-i -z'
5626         else
5627                 dflt=''
5628         fi
5629         case "$ccflags" in
5630         *-posix*) dflt="$dflt -posix" ;;
5631         esac
5632         ;;
5633 *) dflt="$ldflags";;
5634 esac
5635 # See note above about -fstack-protector
5636 case "$ccflags" in
5637 *-fstack-protector-strong*)
5638         case "$dflt" in
5639         *-fstack-protector-strong*) ;; # Don't add it again
5640         *) dflt="$dflt -fstack-protector-strong" ;;
5641         esac
5642         ;;
5643 *-fstack-protector*)
5644         case "$dflt" in
5645         *-fstack-protector*) ;; # Don't add it again
5646         *) dflt="$dflt -fstack-protector" ;;
5647         esac
5648         ;;
5649 esac
5650
5651 : Try to guess additional flags to pick up local libraries.
5652 for thislibdir in $libpth; do
5653         case " $loclibpth " in
5654         *" $thislibdir "*)
5655                 case "$dflt " in
5656                 *"-L$thislibdir "*) ;;
5657                 *)  dflt="$dflt -L$thislibdir" ;;
5658                 esac
5659                 ;;
5660         esac
5661 done
5662
5663 case "$dflt" in
5664 '') dflt='none' ;;
5665 esac
5666
5667 $cat <<EOH
5668
5669 Your C linker may need flags.  For this question you should
5670 include -L/whatever and any other flags used by the C linker, but you
5671 should NOT include libraries like -lwhatever.
5672
5673 Make sure you include the appropriate -L/path flags if your C linker
5674 does not normally search all of the directories you specified above,
5675 namely
5676         $libpth
5677 To use no flags, specify the word "none".
5678
5679 EOH
5680
5681 rp="Any additional ld flags (NOT including libraries)?"
5682 . ./myread
5683 case "$ans" in
5684 none) ldflags='';;
5685 *) ldflags="$ans";;
5686 esac
5687 rmlist="$rmlist pdp11"
5688
5689 : coherency check
5690 echo " "
5691 echo "Checking your choice of C compiler and flags for coherency..." >&4
5692 $cat > try.c <<'EOF'
5693 #include <stdio.h>
5694 int main() { printf("Ok\n"); return(0); }
5695 EOF
5696 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5697 shift
5698 $cat >try.msg <<'EOM'
5699 I've tried to compile and run the following simple program:
5700
5701 EOM
5702 $cat try.c >> try.msg
5703
5704 $cat >> try.msg <<EOM
5705
5706 I used the command:
5707
5708         $*
5709         $run ./try
5710
5711 and I got the following output:
5712
5713 EOM
5714 dflt=y
5715 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5716         if $sh -c "$run ./try " >>try.msg 2>&1; then
5717                 xxx=`$run ./try`
5718                 case "$xxx" in
5719                 "Ok") dflt=n ;;
5720                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5721                 esac
5722         else
5723                 echo "The program compiled OK, but exited with status $?." >>try.msg
5724                 rp="You have a problem.  Shall I abort Configure"
5725                 dflt=y
5726         fi
5727 else
5728         echo "I can't compile the test program." >>try.msg
5729         rp="You have a BIG problem.  Shall I abort Configure"
5730         dflt=y
5731 fi
5732 case "$dflt" in
5733 y)
5734         $cat try.msg >&4
5735         case "$knowitall" in
5736         '')
5737                 echo "(The supplied flags or libraries might be incorrect.)"
5738                 ;;
5739         *) dflt=n;;
5740         esac
5741         echo " "
5742         . ./myread
5743         case "$ans" in
5744         n*|N*) ;;
5745         *)      echo "Ok.  Stopping Configure." >&4
5746                 exit 1
5747                 ;;
5748         esac
5749         ;;
5750 n) echo "OK, that should do.";;
5751 esac
5752 $rm_try gcctest gcctest.out
5753
5754 : define a shorthand compile call
5755 compile='
5756 mc_file=$1;
5757 shift;
5758 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5759 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5760 exit 1;
5761 fi;
5762 esac;
5763 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5764 : define a shorthand compile call for compilations that should be ok.
5765 compile_ok='
5766 mc_file=$1;
5767 shift;
5768 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5769
5770 : determine filename position in cpp output
5771 echo " "
5772 echo "Computing filename position in cpp output for #include directives..." >&4
5773 case "$osname" in
5774 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5775 esac
5776 case "$fieldn" in
5777 '')
5778 case "$osname" in
5779 vos) testaccess=-e ;;
5780 *)   testaccess=-r ;;
5781 esac
5782 echo '#include <stdio.h>' > foo.c
5783 $cat >fieldn <<EOF
5784 $startsh
5785 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5786 $grep '^[       ]*#.*stdio\.h' | \
5787 while read cline; do
5788         pos=1
5789         set \$cline
5790         while $test \$# -gt 0; do
5791                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5792                         echo "\$pos"
5793                         exit 0
5794                 fi
5795                 shift
5796                 pos=\`expr \$pos + 1\`
5797         done
5798 done
5799 EOF
5800 chmod +x fieldn
5801 fieldn=`./fieldn`
5802 $rm -f foo.c fieldn
5803 ;;
5804 esac
5805 case $fieldn in
5806 '') pos='???';;
5807 1) pos=first;;
5808 2) pos=second;;
5809 3) pos=third;;
5810 *) pos="${fieldn}th";;
5811 esac
5812 echo "Your cpp writes the filename in the $pos field of the line."
5813
5814 : locate header file
5815 $cat >findhdr <<EOF
5816 $startsh
5817 wanted=\$1
5818 name=''
5819 for usrincdir in $incpth
5820 do
5821         if test -f \$usrincdir/\$wanted; then
5822                 echo "\$usrincdir/\$wanted"
5823                 exit 0
5824         fi
5825 done
5826 awkprg='{ print \$$fieldn }'
5827 echo "#include <\$wanted>" > foo\$\$.c
5828 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5829 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5830 while read cline; do
5831         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5832         case "\$name" in
5833         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5834         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5835         *) exit 2;;
5836         esac;
5837 done;
5838 #
5839 # status = 0: grep returned 0 lines, case statement not executed
5840 # status = 1: headerfile found
5841 # status = 2: while loop executed, no headerfile found
5842 #
5843 status=\$?
5844 $rm -f foo\$\$.c;
5845 if test \$status -eq 1; then
5846         exit 0;
5847 fi
5848 exit 1
5849 EOF
5850 chmod +x findhdr
5851
5852 : define an alternate in-header-list? function
5853 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5854 cont=true; xxf="echo \"<\$1> found.\" >&4";
5855 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5856 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5857 esac;
5858 case $# in 4) instead=instead;; *) instead="at last";; esac;
5859 while $test "$cont"; do
5860         xxx=`./findhdr $1`
5861         var=$2; eval "was=\$$2";
5862         if $test "$xxx" && $test -r "$xxx";
5863         then eval $xxf;
5864         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5865                 cont="";
5866         else eval $xxnf;
5867         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5868         set $yyy; shift; shift; yyy=$@;
5869         case $# in 0) cont="";;
5870         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5871                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5872         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5873                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5874         esac;
5875 done;
5876 while $test "$yyy";
5877 do set $yyy; var=$2; eval "was=\$$2";
5878         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5879         set $yyy; shift; shift; yyy=$@;
5880 done'
5881
5882 : see if stdlib is available
5883 set stdlib.h i_stdlib
5884 eval $inhdr
5885
5886 : check for lengths of integral types
5887 echo " "
5888 case "$intsize" in
5889 '')
5890         echo "Checking to see how big your integers are..." >&4
5891         $cat >try.c <<EOCP
5892 #include <stdio.h>
5893 #$i_stdlib I_STDLIB
5894 #ifdef I_STDLIB
5895 #include <stdlib.h>
5896 #endif
5897 int main()
5898 {
5899         printf("intsize=%d;\n", (int)sizeof(int));
5900         printf("longsize=%d;\n", (int)sizeof(long));
5901         printf("shortsize=%d;\n", (int)sizeof(short));
5902         exit(0);
5903 }
5904 EOCP
5905         set try
5906         if eval $compile_ok && $run ./try > /dev/null; then
5907                 eval `$run ./try`
5908                 echo "Your integers are $intsize bytes long."
5909                 echo "Your long integers are $longsize bytes long."
5910                 echo "Your short integers are $shortsize bytes long."
5911         else
5912                 $cat >&4 <<EOM
5913 !
5914 Help! I can't compile and run the intsize test program: please enlighten me!
5915 (This is probably a misconfiguration in your system or libraries, and
5916 you really ought to fix it.  Still, I'll try anyway.)
5917 !
5918 EOM
5919                 dflt=4
5920                 rp="What is the size of an integer (in bytes)?"
5921                 . ./myread
5922                 intsize="$ans"
5923                 dflt=$intsize
5924                 rp="What is the size of a long integer (in bytes)?"
5925                 . ./myread
5926                 longsize="$ans"
5927                 dflt=2
5928                 rp="What is the size of a short integer (in bytes)?"
5929                 . ./myread
5930                 shortsize="$ans"
5931         fi
5932         ;;
5933 esac
5934 $rm_try
5935
5936 : check for long long
5937 echo " "
5938 echo "Checking to see if you have long long..." >&4
5939 echo 'int main() { long long x = 7; return 0; }' > try.c
5940 set try
5941 if eval $compile; then
5942         val="$define"
5943         echo "You have long long."
5944 else
5945         val="$undef"
5946         echo "You do not have long long."
5947 fi
5948 $rm_try
5949 set d_longlong
5950 eval $setvar
5951
5952 : check for length of long long
5953 case "${d_longlong}${longlongsize}" in
5954 $define)
5955         echo " "
5956         echo "Checking to see how big your long longs are..." >&4
5957         $cat >try.c <<'EOCP'
5958 #include <stdio.h>
5959 int main()
5960 {
5961     printf("%d\n", (int)sizeof(long long));
5962     return(0);
5963 }
5964 EOCP
5965         set try
5966         if eval $compile_ok; then
5967                 longlongsize=`$run ./try`
5968                 echo "Your long longs are $longlongsize bytes long."
5969         else
5970                 dflt='8'
5971                 echo " "
5972                 echo "(I can't seem to compile the test program.  Guessing...)"
5973                 rp="What is the size of a long long (in bytes)?"
5974                 . ./myread
5975                 longlongsize="$ans"
5976         fi
5977         if $test "X$longsize" = "X$longlongsize"; then
5978                 echo "(That isn't any different from an ordinary long.)"
5979         fi
5980         ;;
5981 esac
5982 $rm_try
5983
5984 : see if inttypes.h is available
5985 : we want a real compile instead of Inhdr because some systems
5986 : have an inttypes.h which includes non-existent headers
5987 echo " "
5988 $cat >try.c <<EOCP
5989 #include <inttypes.h>
5990 int main() {
5991         static int32_t foo32 = 0x12345678;
5992 }
5993 EOCP
5994 set try
5995 if eval $compile; then
5996         echo "<inttypes.h> found." >&4
5997         val="$define"
5998 else
5999         echo "<inttypes.h> NOT found." >&4
6000         val="$undef"
6001 fi
6002 $rm_try
6003 set i_inttypes
6004 eval $setvar
6005
6006 : check for int64_t
6007 echo " "
6008 echo "Checking to see if you have int64_t..." >&4
6009 $cat >try.c <<EOCP
6010 #include <sys/types.h>
6011 #$i_inttypes I_INTTYPES
6012 #ifdef I_INTTYPES
6013 #include <inttypes.h>
6014 #endif
6015 int main() { int64_t x = 7; }
6016 EOCP
6017 set try
6018 if eval $compile; then
6019         val="$define"
6020         echo "You have int64_t."
6021 else
6022         val="$undef"
6023         echo "You do not have int64_t."
6024 fi
6025 $rm_try
6026 set d_int64_t
6027 eval $setvar
6028
6029 : Check if 64bit ints have a quad type
6030 echo " "
6031 echo "Checking which 64-bit integer type we could use..." >&4
6032
6033 case "$intsize" in
6034 8) val=int
6035    set quadtype
6036    eval $setvar
6037    val='"unsigned int"'
6038    set uquadtype
6039    eval $setvar
6040    quadkind=1
6041    ;;
6042 *) case "$longsize" in
6043    8) val=long
6044       set quadtype
6045       eval $setvar
6046       val='"unsigned long"'
6047       set uquadtype
6048       eval $setvar
6049       quadkind=2
6050       ;;
6051    *) case "$d_longlong:$longlongsize" in
6052       define:8)
6053         val='"long long"'
6054         set quadtype
6055         eval $setvar
6056         val='"unsigned long long"'
6057         set uquadtype
6058         eval $setvar
6059         quadkind=3
6060         ;;
6061       *) case "$d_int64_t" in
6062          define)
6063            val=int64_t
6064            set quadtype
6065            eval $setvar
6066            val=uint64_t
6067            set uquadtype
6068            eval $setvar
6069            quadkind=4
6070            ;;
6071          esac
6072          ;;
6073       esac
6074       ;;
6075    esac
6076    ;;
6077 esac
6078
6079 case "$quadtype" in
6080 '')     echo "Alas, no 64-bit integer types in sight." >&4
6081         d_quad="$undef"
6082         ;;
6083 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6084         d_quad="$define"
6085         ;;
6086 esac
6087
6088 : Do we want 64bit support
6089 case "$uselonglong" in
6090 "$define"|true|[yY]*)
6091         cat <<EOM >&4
6092
6093 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6094 EOM
6095         use64bitint="$define"
6096         ;;
6097 esac
6098 case "$use64bits" in
6099 "$define"|true|[yY]*)
6100         cat <<EOM >&4
6101
6102 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6103 EOM
6104         use64bitint="$define"
6105         ;;
6106 esac
6107 case "$use64bitints" in
6108 "$define"|true|[yY]*)
6109         cat <<EOM >&4
6110
6111 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6112 EOM
6113         use64bitint="$define"
6114         ;;
6115 esac
6116 case "$use64bitsint" in
6117 "$define"|true|[yY]*)
6118         cat <<EOM >&4
6119
6120 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6121 EOM
6122         use64bitint="$define"
6123         ;;
6124 esac
6125 case "$uselonglongs" in
6126 "$define"|true|[yY]*)
6127         cat <<EOM >&4
6128
6129 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6130 EOM
6131         use64bitint="$define"
6132         ;;
6133 esac
6134 case "$use64bitsall" in
6135 "$define"|true|[yY]*)
6136         cat <<EOM >&4
6137
6138 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6139 EOM
6140         use64bitall="$define"
6141         ;;
6142 esac
6143
6144 case "$ccflags" in
6145 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6146 esac
6147 case "$use64bitall" in
6148 "$define"|true|[yY]*) use64bitint="$define" ;;
6149 esac
6150
6151 case "$longsize" in
6152 8) cat <<EOM
6153
6154 You have natively 64-bit long integers.
6155 EOM
6156    val="$define"
6157    ;;
6158 *) case "$use64bitint" in
6159    "$define"|true|[yY]*) dflt='y';;
6160    *) dflt='n';;
6161    esac
6162    case "$d_quad" in
6163    "$define") ;;
6164    *) dflt='n' ;;
6165    esac
6166    cat <<EOM
6167
6168 Perl can be built to take advantage of 64-bit integer types
6169 on some systems.  To do so, Configure can be run with -Duse64bitint.
6170 Choosing this option will most probably introduce binary incompatibilities.
6171
6172 If this doesn't make any sense to you, just accept the default '$dflt'.
6173 (The default has been chosen based on your configuration.)
6174 EOM
6175    rp='Try to use 64-bit integers, if available?'
6176    . ./myread
6177    case "$ans" in
6178    [yY]*) val="$define" ;;
6179    *)     val="$undef"  ;;
6180    esac
6181    ;;
6182 esac
6183 set use64bitint
6184 eval $setvar
6185
6186 case "$use64bitall" in
6187 "$define"|true|[yY]*) dflt='y' ;;
6188 *) case "$longsize" in
6189    8) dflt='y' ;;
6190    *) dflt='n' ;;
6191    esac
6192    ;;
6193 esac
6194 cat <<EOM
6195
6196 You may also choose to try maximal 64-bitness.  It means using as much
6197 64-bitness as possible on the platform.  This in turn means even more
6198 binary incompatibilities.  On the other hand, your platform may not
6199 have any more 64-bitness available than what you already have chosen.
6200
6201 If this doesn't make any sense to you, just accept the default '$dflt'.
6202 (The default has been chosen based on your configuration.)
6203 EOM
6204 rp='Try to use maximal 64-bit support, if available?'
6205 . ./myread
6206 case "$ans" in
6207 [yY]*) val="$define" ;;
6208 *)     val="$undef"  ;;
6209 esac
6210 set use64bitall
6211 eval $setvar
6212 case "$use64bitall" in
6213 "$define")
6214         case "$use64bitint" in
6215         "$undef")
6216                 cat <<EOM
6217
6218 Since you have chosen a maximally 64-bit build, I'm also turning on
6219 the use of 64-bit integers.
6220 EOM
6221                 use64bitint="$define" ;;
6222         esac
6223         ;;
6224 esac
6225
6226 : Look for a hint-file generated 'call-back-unit'.  If the
6227 : user has specified that a 64-bit perl is to be built,
6228 : we may need to set or change some other defaults.
6229 if $test -f use64bitint.cbu; then
6230         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6231         . ./use64bitint.cbu
6232 fi
6233 case "$use64bitint" in
6234 "$define"|true|[yY]*)
6235         : This test was common to all the OpenBSD forks, and seems harmless for
6236         : other platforms:
6237         echo " "
6238         echo "Checking if your C library has broken 64-bit functions..." >&4
6239         cat >try.c <<EOCP
6240 #include <stdio.h>
6241 typedef $uquadtype myULL;
6242 int main (void)
6243 {
6244     struct {
6245         double d;
6246         myULL  u;
6247     } *p, test[] = {
6248         {4294967303.15, 4294967303ULL},
6249         {4294967294.2,  4294967294ULL},
6250         {4294967295.7,  4294967295ULL},
6251         {0.0, 0ULL}
6252     };
6253     for (p = test; p->u; p++) {
6254         myULL x = (myULL)p->d;
6255         if (x != p->u) {
6256             printf("buggy\n");
6257             return 0;
6258         }
6259     }
6260     printf("ok\n");
6261     return 0;
6262 }
6263 EOCP
6264         set try
6265         if eval $compile_ok; then
6266             libcquad=`$run ./try`
6267             echo "Your C library's 64-bit functions are $libcquad."
6268         else
6269             echo "(I can't seem to compile the test program.)"
6270             echo "Assuming that your C library's 64-bit functions are ok."
6271             libcquad="ok"
6272         fi
6273         $rm_try
6274
6275         case "$libcquad" in
6276             buggy*)
6277                 cat >&4 <<EOM
6278
6279 *** You have a C library with broken 64-bit functions.
6280 *** 64-bit support does not work reliably in this configuration.
6281 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6282 *** Cannot continue, aborting.
6283
6284 EOM
6285                 exit 1
6286                 ;;
6287         esac
6288         case "$longsize" in
6289         4) case "$archname64" in
6290            '') archname64=64int ;;
6291            esac
6292            ;;
6293         esac
6294         ;;
6295 esac
6296
6297 : Look for a hint-file generated 'call-back-unit'.  If the
6298 : user has specified that a maximally 64-bit perl is to be built,
6299 : we may need to set or change some other defaults.
6300 if $test -f use64bitall.cbu; then
6301         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6302         . ./use64bitall.cbu
6303 fi
6304 case "$use64bitall" in
6305 "$define"|true|[yY]*)
6306         case "$longsize" in
6307         4) case "$archname64" in
6308            ''|64int) archname64=64all ;;
6309            esac
6310            ;;
6311         esac
6312         ;;
6313 esac
6314
6315 case "$d_quad:$use64bitint" in
6316 $undef:$define)
6317         cat >&4 <<EOF
6318
6319 *** You have chosen to use 64-bit integers,
6320 *** but none can be found.
6321 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6322 *** Cannot continue, aborting.
6323
6324 EOF
6325         exit 1
6326         ;;
6327 esac
6328
6329 : Check if we are using the GNU C library
6330 echo " "
6331 echo "Checking for GNU C Library..." >&4
6332 cat >try.c <<'EOCP'
6333 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6334    alone are insufficient to distinguish different versions, such as
6335    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6336    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6337 */
6338 #include <stdio.h>
6339 int main(void)
6340 {
6341 #ifdef __GLIBC__
6342 #   ifdef __GLIBC_MINOR__
6343 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6344 #           include <gnu/libc-version.h>
6345             printf("%s\n",  gnu_get_libc_version());
6346 #       else
6347             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6348 #       endif
6349 #   else
6350         printf("%d\n",  __GLIBC__);
6351 #   endif
6352     return 0;
6353 #else
6354     return 1;
6355 #endif
6356 }
6357 EOCP
6358 set try
6359 if eval $compile_ok && $run ./try > glibc.ver; then
6360         val="$define"
6361         gnulibc_version=`$cat glibc.ver`
6362         echo "You are using the GNU C Library version $gnulibc_version"
6363 else
6364         val="$undef"
6365         gnulibc_version=''
6366         echo "You are not using the GNU C Library"
6367 fi
6368 $rm_try glibc.ver
6369 set d_gnulibc
6370 eval $setvar
6371
6372 : see if nm is to be used to determine whether a symbol is defined or not
6373 case "$usenm" in
6374 '')
6375         dflt=''
6376         case "$d_gnulibc" in
6377         "$define")
6378                 echo " "
6379                 echo "nm probably won't work on the GNU C Library." >&4
6380                 dflt=n
6381                 ;;
6382         esac
6383         case "$dflt" in
6384         '')
6385                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6386                         echo " "
6387                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6388                         echo "'nm' won't be sufficient on this system." >&4
6389                         dflt=n
6390                 fi
6391                 ;;
6392         esac
6393         case "$dflt" in
6394         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6395                 if $test $dflt -gt 20; then
6396                         dflt=y
6397                 else
6398                         dflt=n
6399                 fi
6400                 ;;
6401         esac
6402         ;;
6403 *)
6404         case "$usenm" in
6405         true|$define) dflt=y;;
6406         *) dflt=n;;
6407         esac
6408         ;;
6409 esac
6410 $cat <<EOM
6411
6412 I can use $nm to extract the symbols from your C libraries. This
6413 is a time consuming task which may generate huge output on the disk (up
6414 to 3 megabytes) but that should make the symbols extraction faster. The
6415 alternative is to skip the 'nm' extraction part and to compile a small
6416 test program instead to determine whether each symbol is present. If
6417 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6418 this may be the best solution.
6419
6420 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6421
6422 EOM
6423 rp="Shall I use $nm to extract C symbols from the libraries?"
6424 . ./myread
6425 case "$ans" in
6426 [Nn]*) usenm=false;;
6427 *) usenm=true;;
6428 esac
6429
6430 runnm=$usenm
6431 case "$reuseval" in
6432 true) runnm=false;;
6433 esac
6434
6435 : nm options which may be necessary
6436 case "$nm_opt" in
6437 '') if $test -f /mach_boot; then
6438                 nm_opt=''       # Mach
6439         elif $test -d /usr/ccs/lib; then
6440                 nm_opt='-p'     # Solaris (and SunOS?)
6441         elif $test -f /dgux; then
6442                 nm_opt='-p'     # DG-UX
6443         elif $test -f /lib64/rld; then
6444                 nm_opt='-p'     # 64-bit Irix
6445         else
6446                 nm_opt=''
6447         fi;;
6448 esac
6449
6450 : nm options which may be necessary for shared libraries but illegal
6451 : for archive libraries.  Thank you, Linux.
6452 case "$nm_so_opt" in
6453 '')     case "$myuname" in
6454         *linux*|gnu*)
6455                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6456                         nm_so_opt='--dynamic'
6457                 fi
6458                 ;;
6459         esac
6460         ;;
6461 esac
6462
6463 : Figure out where the libc is located
6464 case "$runnm" in
6465 true)
6466 : get list of predefined functions in a handy place
6467 echo " "
6468 case "$libc" in
6469 '') libc=unknown
6470         case "$libs" in
6471         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6472         esac
6473         ;;
6474 esac
6475 case "$libs" in
6476 '') ;;
6477 *)  for thislib in $libs; do
6478         case "$thislib" in
6479         -lc|-lc_s)
6480                 : Handle C library specially below.
6481                 ;;
6482         -l*)
6483                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6484                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6485                         :
6486                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6487                         :
6488                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6489                         :
6490                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6491                         :
6492                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6493                         :
6494                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6495                         :
6496                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6497                         :
6498                 else
6499                         try=''
6500                 fi
6501                 libnames="$libnames $try"
6502                 ;;
6503         *) libnames="$libnames $thislib" ;;
6504         esac
6505         done
6506         ;;
6507 esac
6508 xxx=normal
6509 case "$libc" in
6510 unknown)
6511         set /lib/libc.$so
6512         for xxx in $libpth; do
6513                 $test -r $1 || set $xxx/libc.$so
6514                 : The messy sed command sorts on library version numbers.
6515                 $test -r $1 || \
6516                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6517                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6518                                 h
6519                                 s/[0-9][0-9]*/0000&/g
6520                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6521                                 G
6522                                 s/\n/ /' | \
6523                          $sort | $sed -e 's/^.* //'`
6524                 eval set \$$#
6525         done
6526         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6527         $test -r $1 || set $sysroot/lib/libsys_s$_a
6528         ;;
6529 *)
6530         set blurfl
6531         ;;
6532 esac
6533 if $test -r "$1"; then
6534         echo "Your (shared) C library seems to be in $1."
6535         libc="$1"
6536 elif $test -r /lib/libc && $test -r /lib/clib; then
6537         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6538         xxx=apollo
6539         libc='/lib/clib /lib/libc'
6540         if $test -r /lib/syslib; then
6541                 echo "(Your math library is in /lib/syslib.)"
6542                 libc="$libc /lib/syslib"
6543         fi
6544 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6545         echo "Your C library seems to be in $libc, as you said before."
6546 elif $test -r $incpath/usr/lib/libc$_a; then
6547         libc=$incpath/usr/lib/libc$_a;
6548         echo "Your C library seems to be in $libc.  That's fine."
6549 elif $test -r /lib/libc$_a; then
6550         libc=/lib/libc$_a;
6551         echo "Your C library seems to be in $libc.  You're normal."
6552 else
6553         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6554                 :
6555         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6556                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6557         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6558                 :
6559         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6560                 :
6561         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6562                 :
6563         else
6564                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6565         fi
6566         if $test -r "$tans"; then
6567                 echo "Your C library seems to be in $tans, of all places."
6568                 libc=$tans
6569         else
6570                 libc='blurfl'
6571         fi
6572 fi
6573 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6574         dflt="$libc"
6575         cat <<EOM
6576
6577 If the guess above is wrong (which it might be if you're using a strange
6578 compiler, or your machine supports multiple models), you can override it here.
6579
6580 EOM
6581 else
6582         dflt=''
6583         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6584         cat >&4 <<EOM
6585 I can't seem to find your C library.  I've looked in the following places:
6586
6587 EOM
6588         $sed 's/^/      /' libpath
6589         cat <<EOM
6590
6591 None of these seems to contain your C library. I need to get its name...
6592
6593 EOM
6594 fi
6595 fn=f
6596 rp='Where is your C library?'
6597 . ./getfile
6598 libc="$ans"
6599
6600 echo " "
6601 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6602 set X `cat libnames`
6603 shift
6604 xxx=files
6605 case $# in 1) xxx=file; esac
6606 echo "Extracting names from the following $xxx for later perusal:" >&4
6607 echo " "
6608 $sed 's/^/      /' libnames >&4
6609 echo " "
6610 $echo $n "This may take a while...$c" >&4
6611
6612 for file in $*; do
6613         case $file in
6614         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6615         *) $nm $nm_opt $file 2>/dev/null;;
6616         esac
6617 done >libc.tmp
6618
6619 $echo $n ".$c"
6620 $grep fprintf libc.tmp > libc.ptf
6621 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6622 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6623 xxx='[ADTSIWi]'
6624 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6625         eval $xscan;\
6626         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6627                 eval $xrun
6628 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6629         eval $xscan;\
6630         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6631                 eval $xrun
6632 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6633         eval $xscan;\
6634         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6635                 eval $xrun
6636 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6637         eval $xscan;\
6638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6639                 eval $xrun
6640 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6641         eval $xscan;\
6642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6643                 eval $xrun
6644 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6645         eval $xscan;\
6646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6647                 eval $xrun
6648 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6649                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6650         eval $xscan;\
6651         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6652                 eval $xrun
6653 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6654         eval $xscan;\
6655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6656                 eval $xrun
6657 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6658         eval $xscan;\
6659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6660                 eval $xrun
6661 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6662         eval $xscan;\
6663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6664                 eval $xrun
6665 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6666         eval $xscan;\
6667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6668                 eval $xrun
6669 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6670         eval $xscan;\
6671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6672                 eval $xrun
6673 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6674         eval $xscan;\
6675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6676                 eval $xrun
6677 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6678         eval $xscan;\
6679         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6680                 eval $xrun
6681 else
6682         $nm -p $* 2>/dev/null >libc.tmp
6683         $grep fprintf libc.tmp > libc.ptf
6684         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6685                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6686         then
6687                 nm_opt='-p'
6688                 eval $xrun
6689         else
6690                 echo " "
6691                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6692                 com=''
6693                 if $ar t $libc > libc.tmp && \
6694                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6695                 then
6696                         for thisname in $libnames $libc; do
6697                                 $ar t $thisname >>libc.tmp
6698                         done
6699                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6700                         echo "Ok." >&4
6701                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6702                         for thisname in $libnames $libc; do
6703                                 $ar tv $thisname >>libc.tmp
6704                                 emximp -o tmp.imp $thisname \
6705                                     2>/dev/null && \
6706                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6707                                     < tmp.imp >>libc.tmp
6708                                 $rm -f tmp.imp
6709                         done
6710                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6711                         echo "Ok." >&4
6712                 else
6713                         echo "$ar didn't seem to work right." >&4
6714                         echo "Maybe this is a Cray...trying bld instead..." >&4
6715                         if  bld t $libc | \
6716                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6717                                 $test -s libc.list
6718                         then
6719                                 for thisname in $libnames; do
6720                                         bld t $libnames | \
6721                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6722                                         $ar t $thisname >>libc.tmp
6723                                 done
6724                                 echo "Ok." >&4
6725                         else
6726                                 echo "That didn't work either.  Giving up." >&4
6727                                 exit 1
6728                         fi
6729                 fi
6730         fi
6731 fi
6732 nm_extract="$com"
6733 case "$PASE" in
6734 define)
6735     echo " "
6736     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6737     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6738     ;;
6739 *)  if $test -f /lib/syscalls.exp; then
6740         echo " "
6741         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6742         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6743                 /lib/syscalls.exp >>libc.list
6744     fi
6745     ;;
6746 esac
6747 ;;
6748 esac
6749 $rm -f libnames libpath
6750
6751 : Check if we are using C++
6752 echo " "
6753 echo "Checking for C++..." >&4
6754 $cat >try.c <<'EOCP'
6755 #include <stdio.h>
6756 int main(void)
6757 {
6758 #ifdef __cplusplus
6759     return 0;
6760 #else
6761     return 1;
6762 #endif
6763 }
6764 EOCP
6765 set try
6766 if eval $compile_ok && $run ./try; then
6767         val="$define"
6768         echo "You are using a C++ compiler."
6769 else
6770         val="$undef"
6771         echo "You are not using a C++ compiler."
6772 fi
6773 $rm_try cplusplus$$
6774 set d_cplusplus
6775 eval $setvar
6776
6777 : is a C symbol defined?
6778 csym='tlook=$1;
6779 case "$3" in
6780 -v) tf=libc.tmp; tdc="";;
6781 -a) tf=libc.tmp; tdc="[]";;
6782 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6783 esac;
6784 case "$d_cplusplus" in
6785     $define)    extern_C="extern \"C\"" ;;
6786     *)          extern_C="extern"       ;;
6787 esac;
6788 tx=yes;
6789 case "$reuseval-$4" in
6790 true-) ;;
6791 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6792 esac;
6793 case "$tx" in
6794 yes)
6795         tval=false;
6796         if $test "$runnm" = true; then
6797                 if $contains $tlook $tf >/dev/null 2>&1; then
6798                         tval=true;
6799                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6800                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6801                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6802                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6803                         $rm_try;
6804                 fi;
6805         else
6806                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6807                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6808                 $rm_try;
6809         fi;
6810         ;;
6811 *)
6812         case "$tval" in
6813         $define) tval=true;;
6814         *) tval=false;;
6815         esac;
6816         ;;
6817 esac;
6818 eval "$2=$tval"'
6819
6820 : define an is-in-libc? function
6821 inlibc='echo " "; td=$define; tu=$undef;
6822 sym=$1; var=$2; eval "was=\$$2";
6823 tx=yes;
6824 case "$reuseval$was" in
6825 true) ;;
6826 true*) tx=no;;
6827 esac;
6828 case "$tx" in
6829 yes)
6830         set $sym tres -f;
6831         eval $csym;
6832         case "$tres" in
6833         true)
6834                 echo "$sym() found." >&4;
6835                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6836         *)
6837                 echo "$sym() NOT found." >&4;
6838                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6839         esac;;
6840 *)
6841         case "$was" in
6842         $define) echo "$sym() found." >&4;;
6843         *) echo "$sym() NOT found." >&4;;
6844         esac;;
6845 esac'
6846
6847 : check for length of double
6848 echo " "
6849 case "$doublesize" in
6850 '')
6851         echo "Checking to see how big your double precision numbers are..." >&4
6852         $cat >try.c <<EOCP
6853 #include <stdio.h>
6854 #$i_stdlib I_STDLIB
6855 #ifdef I_STDLIB
6856 #include <stdlib.h>
6857 #endif
6858 int main()
6859 {
6860     printf("%d\n", (int)sizeof(double));
6861     exit(0);
6862 }
6863 EOCP
6864         set try
6865         if eval $compile_ok; then
6866                 doublesize=`$run ./try`
6867                 echo "Your double is $doublesize bytes long."
6868         else
6869                 dflt='8'
6870                 echo "(I can't seem to compile the test program.  Guessing...)"
6871                 rp="What is the size of a double precision number (in bytes)?"
6872                 . ./myread
6873                 doublesize="$ans"
6874         fi
6875         ;;
6876 esac
6877 $rm_try
6878
6879 : see if this is a float.h system
6880 set float.h i_float
6881 eval $inhdr
6882
6883 : check for long doubles
6884 echo " "
6885 echo "Checking to see if you have long double..." >&4
6886 echo 'int main() { long double x = 7.0; }' > try.c
6887 set try
6888 if eval $compile; then
6889         val="$define"
6890         echo "You have long double."
6891 else
6892         val="$undef"
6893         echo "You do not have long double."
6894 fi
6895 $rm_try
6896 set d_longdbl
6897 eval $setvar
6898
6899 : see if ldexpl exists
6900 set ldexpl d_ldexpl
6901 eval $inlibc
6902
6903 : check for length of long double
6904 case "${d_longdbl}${longdblsize}" in
6905 $define)
6906         echo " "
6907         echo "Checking to see how big your long doubles are..." >&4
6908         $cat >try.c <<'EOCP'
6909 #include <stdio.h>
6910 int main()
6911 {
6912         printf("%d\n", sizeof(long double));
6913 }
6914 EOCP
6915         set try
6916         set try
6917         if eval $compile; then
6918                 longdblsize=`$run ./try`
6919                 echo "Your long doubles are $longdblsize bytes long."
6920         else
6921                 dflt='8'
6922                 echo " "
6923                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6924                 rp="What is the size of a long double (in bytes)?"
6925                 . ./myread
6926                 longdblsize="$ans"
6927         fi
6928         if $test "X$doublesize" = "X$longdblsize"; then
6929                 echo "That isn't any different from an ordinary double."
6930                 echo "I'll keep your setting anyway, but you may see some"
6931                 echo "harmless compilation warnings."
6932         fi
6933         ;;
6934 esac
6935 $rm_try
6936
6937 $echo "Checking the kind of long doubles you have..." >&4
6938 case "$d_longdbl" in
6939 define)
6940 $cat <<EOP >try.c
6941 #$i_float I_FLOAT
6942 #$i_stdlib I_STDLIB
6943 #define LONGDBLSIZE $longdblsize
6944 #define DOUBLESIZE $doublesize
6945 #ifdef I_FLOAT
6946 #include <float.h>
6947 #endif
6948 #ifdef I_STDLIB
6949 #include <stdlib.h>
6950 #endif
6951 #include <stdio.h>
6952 static const long double d = -0.1L;
6953 int main() {
6954   unsigned const char* b = (unsigned const char*)(&d);
6955 #if DOUBLESIZE == LONGDBLSIZE
6956   printf("0\n"); /* if it floats like double */
6957   exit(0);
6958 #endif
6959 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6960   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6961     /* IEEE 754 128-bit little-endian */
6962     printf("1\n");
6963     exit(0);
6964   }
6965   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6966     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6967     printf("2\n");
6968     exit(0);
6969   }
6970 #endif
6971 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6972  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6973  * cannot be trusted. */
6974 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6975   if (b[0] == 0xCD && b[9] == 0xBF) {
6976     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6977      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6978      * Also known as "extended precision". */
6979     printf("3\n");
6980     exit(0);
6981   }
6982   if (b[0] == 0xBF && b[9] == 0xCD) {
6983     /* Is there ever big-endian 80-bit, really?
6984      *
6985      * The Motorola 68881 had another "extended precision" format:
6986      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6987      * for total of 96 bits of bytes.  The zero bits were unused.
6988      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
6989      * If it ever becomes relevant, this format should be allocated
6990      * a new doublekind code since it's quite different from the Intel x87.
6991      */
6992     printf("4\n");
6993     exit(0);
6994   }
6995 #endif
6996 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6997   /* software "double double", the 106 is 53+53.
6998    * but irix thinks it is 107. */
6999   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7000     /* double double 128-bit fully little-endian,
7001      * little-endian doubles in little-endian order,
7002      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7003     printf("5\n");
7004     exit(0);
7005   }
7006   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7007     /* double double 128-bit fully big-endian,
7008      * big-endian doubles in big-endian order,
7009      * e.g. PPC/Power and MIPS:
7010      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7011     printf("6\n");
7012     exit(0);
7013   }
7014   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7015     /* double double 128-bit mixed endian.
7016      * little-endian doubles in big-endian order,
7017      * e.g. ppc64el,
7018      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7019     printf("7\n");
7020     exit(0);
7021   }
7022   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7023     /* double double 128-bit mixed endian,
7024      * big-endian doubles in little-endian order,
7025      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7026     printf("8\n");
7027     exit(0);
7028   }
7029 #endif
7030   printf("-1\n"); /* unknown */
7031   exit(0);
7032 }
7033 EOP
7034 set try
7035 if eval $compile; then
7036     longdblkind=`$run ./try`
7037 else
7038     longdblkind=-1
7039 fi
7040 ;;
7041 *) longdblkind=0 ;;
7042 esac
7043 case "$longdblkind" in
7044 0) echo "Your long doubles are doubles." >&4 ;;
7045 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7046 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7047 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7048 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7049 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7050 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7051 7) echo "You have 128-bit mixed double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7052 8) echo "You have 128-bit mixed double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7053 *) echo "Cannot figure out your long double." >&4 ;;
7054 esac
7055 $rm_try
7056
7057 : determine the architecture name
7058 echo " "
7059 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7060         tarch=`arch`"-$osname"
7061 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7062         if uname -m > tmparch 2>&1 ; then
7063                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7064                         -e 's/$/'"-$osname/" tmparch`
7065         else
7066                 tarch="$osname"
7067         fi
7068         $rm -f tmparch
7069 else
7070         tarch="$osname"
7071 fi
7072 case "$myarchname" in
7073 ''|"$tarch") ;;
7074 *)
7075         echo "(Your architecture name used to be $myarchname.)"
7076         archname=''
7077         ;;
7078 esac
7079 case "$targetarch" in
7080 '') ;;
7081 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7082 esac
7083 myarchname="$tarch"
7084 case "$archname" in
7085 '') dflt="$tarch";;
7086 *) dflt="$archname";;
7087 esac
7088 rp='What is your architecture name'
7089 . ./myread
7090 archname="$ans"
7091
7092 : optionally add API version to the architecture for versioned archlibs
7093 case "$useversionedarchname" in
7094 $define|true|[yY]*) dflt='y';;
7095 *)                  dflt='n';;
7096 esac
7097 rp='Add the Perl API version to your archname?'
7098 . ./myread
7099 case "$ans" in
7100 y|Y)    useversionedarchname="$define" ;;
7101 *)      useversionedarchname="$undef" ;;
7102 esac
7103 case "$useversionedarchname" in
7104 $define)
7105         case "$archname" in
7106         *-$api_versionstring)
7107                 echo "...and architecture name already has -$api_versionstring" >&4
7108                 ;;
7109         *)
7110                 archname="$archname-$api_versionstring"
7111                 echo "...setting architecture name to $archname." >&4
7112                 ;;
7113         esac
7114         ;;
7115 esac
7116
7117 case "$usethreads" in
7118 $define)
7119         echo "Threads selected." >&4
7120         case "$archname" in
7121         *-thread*) echo "...and architecture name already has -thread." >&4
7122                 ;;
7123         *)      archname="$archname-thread"
7124                 echo "...setting architecture name to $archname." >&4
7125                 ;;
7126         esac
7127         ;;
7128 esac
7129 case "$usemultiplicity" in
7130 $define)
7131         echo "Multiplicity selected." >&4
7132         case "$archname" in
7133         *-multi*) echo "...and architecture name already has -multi." >&4
7134                 ;;
7135         *)      archname="$archname-multi"
7136                 echo "...setting architecture name to $archname." >&4
7137                 ;;
7138         esac
7139         ;;
7140 esac
7141 case "$use64bitint$use64bitall" in
7142 *"$define"*)
7143         case "$archname64" in
7144         '')
7145                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7146                 ;;
7147         *)
7148                 case "$use64bitint" in
7149                 "$define") echo "64 bit integers selected." >&4 ;;
7150                 esac
7151                 case "$use64bitall" in
7152                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7153                 esac
7154                 case "$archname" in
7155                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7156                         ;;
7157                 *)      archname="$archname-$archname64"
7158                         echo "...setting architecture name to $archname." >&4
7159                         ;;
7160                 esac
7161                 ;;
7162         esac
7163 esac
7164 case "$uselongdouble" in
7165 $define)
7166         echo "Long doubles selected." >&4
7167         case "$longdblsize" in
7168         $doublesize)
7169                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7170                 ;;
7171         *)
7172                 case "$archname" in
7173                 *-ld*) echo "...and architecture name already has -ld." >&4
7174                         ;;
7175                 *)      archname="$archname-ld"
7176                         echo "...setting architecture name to $archname." >&4
7177                         ;;
7178                 esac
7179                 ;;
7180         esac
7181         ;;
7182 esac
7183 case "$usequadmath" in
7184 $define)
7185         echo "quadmath selected." >&4
7186         case "$archname" in
7187         *-ld*) echo "...and architecture name already has -quadmath." >&4
7188                 ;;
7189         *)      archname="$archname-quadmath"
7190                 echo "...setting architecture name to $archname." >&4
7191                 ;;
7192         esac
7193         ;;
7194 esac
7195 if $test -f archname.cbu; then
7196         echo "Your platform has some specific hints for architecture name, using them..."
7197         . ./archname.cbu
7198 fi
7199
7200 : set the prefixit variable, to compute a suitable default value
7201 prefixit='case "$3" in
7202 ""|none)
7203         case "$oldprefix" in
7204         "") eval "$1=\"\$$2\"";;
7205         *)
7206                 case "$3" in
7207                 "") eval "$1=";;
7208                 none)
7209                         eval "tp=\"\$$2\"";
7210                         case "$tp" in
7211                         ""|" ") eval "$1=\"\$$2\"";;
7212                         *) eval "$1=";;
7213                         esac;;
7214                 esac;;
7215         esac;;
7216 *)
7217         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7218         case "$tp" in
7219         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7220         /*-$oldprefix/*|\~*-$oldprefix/*)
7221                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7222         *) eval "$1=\"\$$2\"";;
7223         esac;;
7224 esac'
7225
7226 : determine installation style
7227 : For now, try to deduce it from prefix unless it is already set.
7228 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7229 case "$installstyle" in
7230 '')     case "$prefix" in
7231                 *perl*) dflt='lib';;
7232                 *) dflt='lib/perl5' ;;
7233         esac
7234         ;;
7235 *)      dflt="$installstyle" ;;
7236 esac
7237 : Probably not worth prompting for this since we prompt for all
7238 : the directories individually, and the prompt would be too long and
7239 : confusing anyway.
7240 installstyle=$dflt
7241
7242 : determine where public executables go
7243 echo " "
7244 set dflt bin bin
7245 eval $prefixit
7246 fn=d~
7247 rp='Pathname where the public executables will reside?'
7248 . ./getfile
7249 if $test "X$ansexp" != "X$binexp"; then
7250         installbin=''
7251 fi
7252 prefixvar=bin
7253 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7254 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7255 :     this via initialinstalllocation
7256 . ./setprefixvar
7257
7258 case "$userelocatableinc" in
7259 $define|true|[yY]*)     dflt='y' ;;
7260 *)                      dflt='n' ;;
7261 esac
7262 cat <<EOM
7263
7264 Would you like to build Perl so that the installation is relocatable, so that
7265 library paths in @INC are determined relative to the path of the perl binary?
7266 This is not advised for system Perl installs, or if you need to run setid
7267 scripts or scripts under taint mode.
7268
7269 If this doesn't make any sense to you, just accept the default '$dflt'.
7270 EOM
7271 rp='Use relocatable @INC?'
7272 . ./myread
7273 case "$ans" in
7274 y|Y)    val="$define" ;;
7275 *)      val="$undef"  ;;
7276 esac
7277 set userelocatableinc
7278 eval $setvar
7279
7280 initialinstalllocation="$binexp"
7281 : Default prefix is now "up one level from where the binaries are"
7282 case "$userelocatableinc" in
7283 $define|true|[yY]*)
7284     bin=".../"
7285     binexp=".../"
7286     prefix=".../.."
7287     prefixexp=".../.."
7288     installprefixexp=".../.."
7289     ;;
7290 esac
7291
7292 : determine where private library files go
7293 : Usual default is /usr/local/lib/perl5/$version.
7294 : Also allow things like /opt/perl/lib/$version, since
7295 : /opt/perl/lib/perl5... would be redundant.
7296 : The default "style" setting is made in installstyle.U
7297 case "$installstyle" in
7298 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7299 *)       set dflt privlib lib/$version ;;
7300 esac
7301 eval $prefixit
7302 $cat <<EOM
7303
7304 There are some auxiliary files for $package that need to be put into a
7305 private library directory that is accessible by everyone.
7306
7307 EOM
7308 fn=$binexp
7309 fn=d~+
7310 rp='Pathname where the private library files will reside?'
7311 . ./getfile
7312 prefixvar=privlib
7313 . ./setprefixvar
7314
7315 : set the prefixup variable, to restore leading tilda escape
7316 prefixup='case "$prefixexp" in
7317 "$prefix") ;;
7318 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7319 esac'
7320
7321 : determine where public architecture dependent libraries go
7322 set archlib archlib
7323 eval $prefixit
7324 : privlib default is /usr/local/lib/$package/$version
7325 : archlib default is /usr/local/lib/$package/$version/$archname
7326 : privlib may have an optional trailing /share.
7327 tdflt=`echo $privlib | $sed 's,/share$,,'`
7328 tdflt=$tdflt/$archname
7329 case "$archlib" in
7330 '')     dflt=$tdflt
7331         ;;
7332 *)      dflt="$archlib"
7333     ;;
7334 esac
7335 $cat <<EOM
7336
7337 $spackage contains architecture-dependent library files.  If you are
7338 sharing libraries in a heterogeneous environment, you might store
7339 these files in a separate location.  Otherwise, you can just include
7340 them with the rest of the public library files.
7341
7342 EOM
7343 fn=$binexp
7344 fn=d+~
7345 rp='Where do you want to put the public architecture-dependent libraries?'
7346 . ./getfile
7347 prefixvar=archlib
7348 . ./setprefixvar
7349 if $test X"$archlib" = X"$privlib"; then
7350         d_archlib="$undef"
7351 else
7352         d_archlib="$define"
7353 fi
7354
7355 : see if setuid scripts can be secure
7356 $cat <<EOM
7357
7358 Some kernels have a bug that prevents setuid #! scripts from being
7359 secure.  Some sites have disabled setuid #! scripts because of this.
7360
7361 First let's decide if your kernel supports secure setuid #! scripts.
7362 (If setuid #! scripts would be secure but have been disabled anyway,
7363 don't say that they are secure if asked.)
7364
7365 EOM
7366
7367 val="$undef"
7368 if $test -d /dev/fd; then
7369         echo "#!$ls" >reflect
7370         chmod +x,u+s reflect
7371         ./reflect >flect 2>&1
7372         if $contains "/dev/fd" flect >/dev/null; then
7373                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7374                 val="$define"
7375         else
7376                 $cat <<EOM
7377 If you are not sure if they are secure, I can check but I'll need a
7378 username and password different from the one you are using right now.
7379 If you don't have such a username or don't want me to test, simply
7380 enter 'none'.
7381
7382 EOM
7383                 rp='Other username to test security of setuid scripts with?'
7384                 dflt='none'
7385                 . ./myread
7386                 case "$ans" in
7387                 n|none)
7388                         case "$d_suidsafe" in
7389                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7390                                 dflt=n;;
7391                         "$undef")
7392                                 echo "Well, the $hint value is *not* secure." >&4
7393                                 dflt=n;;
7394                         *)      echo "Well, the $hint value *is* secure." >&4
7395                                 dflt=y;;
7396                         esac
7397                         ;;
7398                 *)
7399                         $rm -f reflect flect
7400                         echo "#!$ls" >reflect
7401                         chmod +x,u+s reflect
7402                         echo >flect
7403                         chmod a+w flect
7404                         echo '"su" will (probably) prompt you for '"$ans's password."
7405                         su $ans -c './reflect >flect'
7406                         if $contains "/dev/fd" flect >/dev/null; then
7407                                 echo "Okay, it looks like setuid scripts are secure." >&4
7408                                 dflt=y
7409                         else
7410                                 echo "I don't think setuid scripts are secure." >&4
7411                                 dflt=n
7412                         fi
7413                         ;;
7414                 esac
7415                 rp='Does your kernel have *secure* setuid scripts?'
7416                 . ./myread
7417                 case "$ans" in
7418                 [yY]*)  val="$define";;
7419                 *)      val="$undef";;
7420                 esac
7421         fi
7422 else
7423         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7424         echo "(That's for file descriptors, not floppy disks.)"
7425         val="$undef"
7426 fi
7427 set d_suidsafe
7428 eval $setvar
7429
7430 $rm -f reflect flect
7431
7432 : now see if they want to do setuid emulation
7433 if $test $patchlevel -lt 11; then
7434 echo " "
7435 val="$undef"
7436 case "$d_suidsafe" in
7437 "$define")
7438         val="$undef"
7439         echo "No need to emulate SUID scripts since they are secure here." >&4
7440         ;;
7441 *)
7442         $cat <<EOM
7443 Some systems have disabled setuid scripts, especially systems where
7444 setuid scripts cannot be secure.  On systems where setuid scripts have
7445 been disabled, the setuid/setgid bits on scripts are currently
7446 useless.  It is possible for $package to detect those bits and emulate
7447 setuid/setgid in a secure fashion.  This emulation will only work if
7448 setuid scripts have been disabled in your kernel.
7449
7450 EOM
7451         case "$d_dosuid" in
7452         "$define") dflt=y ;;
7453         *) dflt=n ;;
7454         esac
7455         rp="Do you want to do setuid/setgid emulation?"
7456         . ./myread
7457         case "$ans" in
7458         [yY]*)  val="$define";;
7459         *)      val="$undef";;
7460         esac
7461         ;;
7462 esac
7463 set d_dosuid
7464 eval $setvar
7465 else
7466     case "$d_dosuid" in
7467         "$define")
7468         cat >&4 <<EOH
7469
7470 SUID emulation has been removed for 5.12
7471 Please re-run Configure without -Dd_dosuid
7472
7473 EOH
7474         exit 1;
7475         ;;
7476     esac
7477     d_dosuid=undef
7478 fi
7479
7480 : Find perl5.005 or later.
7481 echo "Looking for a previously installed perl5.005 or later... "
7482 case "$perl5" in
7483 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7484                 : Check if this perl is recent and can load a simple module
7485                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7486                         perl5=$tdir/perl
7487                         break;
7488                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7489                         perl5=$tdir/perl5
7490                         break;
7491                 fi
7492         done
7493         ;;
7494 *)      perl5="$perl5"
7495         ;;
7496 esac
7497 case "$perl5" in
7498 '')     echo "None found.  That's ok.";;
7499 *)      echo "Using $perl5." ;;
7500 esac
7501
7502 : Set the siteprefix variables
7503 $cat <<EOM
7504
7505 After $package is installed, you may wish to install various
7506 add-on modules and utilities.  Typically, these add-ons will
7507 be installed under $prefix with the rest
7508 of this package.  However, you may wish to install such add-ons
7509 elsewhere under a different prefix.
7510
7511 If you do not wish to put everything under a single prefix, that's
7512 ok.  You will be prompted for the individual locations; this siteprefix
7513 is only used to suggest the defaults.
7514
7515 The default should be fine for most people.
7516
7517 EOM
7518 fn=d~+
7519 rp='Installation prefix to use for add-on modules and utilities?'
7520 : XXX Here might be another good place for an installstyle setting.
7521 case "$siteprefix" in
7522 '') dflt=$prefix ;;
7523 *)  dflt=$siteprefix ;;
7524 esac
7525 . ./getfile
7526 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7527 oldsiteprefix=''
7528 case "$siteprefix" in
7529 '') ;;
7530 *)      case "$ans" in
7531         "$prefix") ;;
7532         *) oldsiteprefix="$prefix";;
7533         esac
7534         ;;
7535 esac
7536 siteprefix="$ans"
7537 siteprefixexp="$ansexp"
7538
7539 : determine where site specific libraries go.
7540 : Usual default is /usr/local/lib/perl5/site_perl/$version
7541 : The default "style" setting is made in installstyle.U
7542 : XXX No longer works with Prefixit stuff.
7543 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7544 case "$sitelib" in
7545 '') case "$installstyle" in
7546         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7547         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7548         esac
7549         ;;
7550 *)      dflt="$sitelib"
7551         ;;
7552 esac
7553 $cat <<EOM
7554
7555 The installation process will create a directory for
7556 site-specific extensions and modules.  Most users find it convenient
7557 to place all site-specific files in this directory rather than in the
7558 main distribution directory.
7559
7560 EOM
7561 fn=d~+
7562 rp='Pathname for the site-specific library files?'
7563 . ./getfile
7564 prefixvar=sitelib
7565 . ./setprefixvar
7566 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7567
7568 : Determine list of previous versions to include in @INC
7569 $cat > getverlist <<EOPL
7570 #!$perl5 -w
7571 use File::Basename;
7572 \$api_versionstring = "$api_versionstring";
7573 \$version = "$version";
7574 \$stem = "$sitelib_stem";
7575 \$archname = "$archname";
7576 EOPL
7577         $cat >> getverlist <<'EOPL'
7578 # The list found is store twice for each entry: the original name, and
7579 # the binary broken down version as pack "sss", so sorting is easy and
7580 # unambiguous. This will work for all versions that have a maximum of
7581 # three digit groups, separate by '.'s or '_'s. Names are extended with
7582 # ".0.0" to ensure at least three elements for the pack.
7583 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7584
7585 # Can't have leading @ because metaconfig interprets it as a command!
7586 ;@inc_version_list=();
7587 # XXX Redo to do opendir/readdir?
7588 if (-d $stem) {
7589     chdir($stem);
7590     ;@candidates = map {
7591         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7592     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7593 }
7594 else {
7595     ;@candidates = ();
7596 }
7597
7598 ($pversion, $aversion, $vsn5005) = map {
7599     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7600 foreach $d (@candidates) {
7601     if ($d->[1] lt $pversion) {
7602         if ($d->[1] ge $aversion) {
7603             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7604         }
7605         elsif ($d->[1] ge $vsn5005) {
7606             unshift(@inc_version_list, grep { -d } $d->[0]);
7607         }
7608     }
7609     else {
7610         # Skip newer version.  I.e. don't look in
7611         # 5.7.0 if we're installing 5.6.1.
7612     }
7613 }
7614
7615 if (@inc_version_list) {
7616     print join(' ', @inc_version_list);
7617 }
7618 else {
7619     # Blank space to preserve value for next Configure run.
7620     print " ";
7621 }
7622 EOPL
7623 chmod +x getverlist
7624 case "$inc_version_list" in
7625 '')     if test -x "$perl5$exe_ext"; then
7626                 dflt=`$perl5 getverlist`
7627         else
7628                 dflt='none'
7629         fi
7630         ;;
7631 $undef) dflt='none' ;;
7632 *)  eval dflt=\"$inc_version_list\" ;;
7633 esac
7634 case "$dflt" in
7635 ''|' ') dflt=none ;;
7636 esac
7637 case "$dflt" in
7638 5.005) dflt=none ;;
7639 esac
7640 $cat <<EOM
7641
7642 In order to ease the process of upgrading, this version of perl
7643 can be configured to use modules built and installed with earlier
7644 versions of perl that were installed under $prefix.  Specify here
7645 the list of earlier versions that this version of perl should check.
7646 If Configure detected no earlier versions of perl installed under
7647 $prefix, then the list will be empty.  Answer 'none' to tell perl
7648 to not search earlier versions.
7649
7650 The default should almost always be sensible, so if you're not sure,
7651 just accept the default.
7652 EOM
7653
7654 rp='List of earlier versions to include in @INC?'
7655 . ./myread
7656 case "$ans" in
7657 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7658 *) inc_version_list="$ans" ;;
7659 esac
7660 case "$inc_version_list" in
7661 ''|' ')
7662         inc_version_list_init='0'
7663         d_inc_version_list="$undef"
7664         ;;
7665 *)      inc_version_list_init=`echo $inc_version_list |
7666                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7667         d_inc_version_list="$define"
7668         ;;
7669 esac
7670 $rm -f getverlist
7671
7672 : see if malloc/malloc.h has to be included
7673 set malloc/malloc.h i_mallocmalloc
7674 eval $inhdr
7675
7676 : see if this is a malloc.h system
7677 : we want a real compile instead of Inhdr because some systems have a
7678 : malloc.h that just gives a compile error saying to use stdlib.h instead
7679 echo " "
7680 $cat >try.c <<EOCP
7681 #include <stdlib.h>
7682 #include <malloc.h>
7683 #$i_mallocmalloc I_MALLOCMALLOC
7684 #ifdef I_MALLOCMALLOC
7685 # include <malloc/malloc.h>
7686 #endif
7687
7688 int main () { return 0; }
7689 EOCP
7690 set try
7691 if eval $compile; then
7692     echo "<malloc.h> found." >&4
7693     val="$define"
7694 else
7695     echo "<malloc.h> NOT found." >&4
7696     val="$undef"
7697 fi
7698 $rm_try
7699 set i_malloc
7700 eval $setvar
7701
7702 : check for length of pointer
7703 echo " "
7704 case "$ptrsize" in
7705 '')
7706         echo "Checking to see how big your pointers are..." >&4
7707         $cat >try.c <<EOCP
7708 #include <stdio.h>
7709 #$i_stdlib I_STDLIB
7710 #ifdef I_STDLIB
7711 #include <stdlib.h>
7712 #endif
7713 int main()
7714 {
7715     printf("%d\n", (int)sizeof(void *));
7716     exit(0);
7717 }
7718 EOCP
7719         set try
7720         if eval $compile_ok; then
7721                 ptrsize=`$run ./try`
7722                 echo "Your pointers are $ptrsize bytes long."
7723         else
7724                 dflt='4'
7725                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7726                 rp="What is the size of a pointer (in bytes)?"
7727                 . ./myread
7728                 ptrsize="$ans"
7729         fi
7730         ;;
7731 esac
7732 $rm_try
7733 case "$use64bitall" in
7734 "$define"|true|[yY]*)
7735         case "$ptrsize" in
7736         4)      cat <<EOM >&4
7737
7738 *** You have chosen a maximally 64-bit build,
7739 *** but your pointers are only 4 bytes wide.
7740 *** Please rerun Configure without -Duse64bitall.
7741 EOM
7742                 case "$d_quad" in
7743                 define)
7744                         cat <<EOM >&4
7745 *** Since you have quads, you could possibly try with -Duse64bitint.
7746 EOM
7747                         ;;
7748                 esac
7749                 cat <<EOM >&4
7750 *** Cannot continue, aborting.
7751
7752 EOM
7753
7754                 exit 1
7755                 ;;
7756         esac
7757         ;;
7758 esac
7759
7760
7761 : determine whether to use malloc wrapping
7762 echo " "
7763 case "$usemallocwrap" in
7764 [yY]*|true|$define)     dflt='y' ;;
7765 [nN]*|false|$undef)     dflt='n' ;;
7766 *)      case "$usedevel" in
7767         [yY]*|true|$define)     dflt='y' ;;
7768         *) dflt='n' ;;
7769         esac
7770         ;;
7771 esac
7772 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7773 . ./myread
7774 usemallocwrap="$ans"
7775 case "$ans" in
7776 y*|true)
7777         usemallocwrap="$define" ;;
7778 *)
7779         usemallocwrap="$undef" ;;
7780 esac
7781
7782 : determine which malloc to compile in
7783 echo " "
7784 case "$usemymalloc" in
7785 [yY]*|true|$define)     dflt='y' ;;
7786 [nN]*|false|$undef)     dflt='n' ;;
7787 *)      case "$ptrsize" in
7788         4) dflt='y' ;;
7789         *) dflt='n' ;;
7790         esac
7791         if test "$useithreads" = "$define"; then dflt='n'; fi
7792         ;;
7793 esac
7794 rp="Do you wish to attempt to use the malloc that comes with $package?"
7795 . ./myread
7796 usemymalloc="$ans"
7797 case "$ans" in
7798 y*|true)
7799         usemymalloc='y'
7800         mallocsrc='malloc.c'
7801         mallocobj="malloc$_o"
7802         d_mymalloc="$define"
7803         case "$libs" in
7804         *-lmalloc*)
7805                 : Remove malloc from list of libraries to use
7806                 echo "Removing unneeded -lmalloc from library list" >&4
7807                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7808                 shift
7809                 libs="$*"
7810                 echo "libs = $libs" >&4
7811                 ;;
7812         esac
7813         ;;
7814 *)
7815         usemymalloc='n'
7816         mallocsrc=''
7817         mallocobj=''
7818         d_mymalloc="$undef"
7819         ;;
7820 esac
7821
7822 : compute the return types of malloc and free
7823 echo " "
7824 $cat >malloc.c <<END
7825 #$i_malloc I_MALLOC
7826 #$i_stdlib I_STDLIB
7827 #include <stdio.h>
7828 #include <sys/types.h>
7829 #ifdef I_MALLOC
7830 #include <malloc.h>
7831 #endif
7832 #ifdef I_STDLIB
7833 #include <stdlib.h>
7834 #endif
7835 #ifdef TRY_MALLOC
7836 void *malloc();
7837 #endif
7838 #ifdef TRY_FREE
7839 void free();
7840 #endif
7841 END
7842 case "$malloctype" in
7843 '')
7844         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7845                 malloctype='void *'
7846         else
7847                 malloctype='char *'
7848         fi
7849         ;;
7850 esac
7851 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7852
7853 case "$freetype" in
7854 '')
7855         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7856                 freetype='void'
7857         else
7858                 freetype='int'
7859         fi
7860         ;;
7861 esac
7862 echo "Your system uses $freetype free(), it would seem." >&4
7863 $rm -f malloc.[co]
7864 : determine where site specific architecture-dependent libraries go.
7865 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7866 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7867 : sitelib may have an optional trailing /share.
7868 case "$sitearch" in
7869 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7870         dflt="$dflt/$archname"
7871         ;;
7872 *)      dflt="$sitearch"
7873         ;;
7874 esac
7875 set sitearch sitearch none
7876 eval $prefixit
7877 $cat <<EOM
7878
7879 The installation process will also create a directory for
7880 architecture-dependent site-specific extensions and modules.
7881
7882 EOM
7883 fn=d~+
7884 rp='Pathname for the site-specific architecture-dependent library files?'
7885 . ./getfile
7886 prefixvar=sitearch
7887 . ./setprefixvar
7888 if $test X"$sitearch" = X"$sitelib"; then
7889         d_sitearch="$undef"
7890 else
7891         d_sitearch="$define"
7892 fi
7893
7894 : Set the vendorprefix variables
7895 $cat <<EOM
7896
7897 The installation process will also create a directory for
7898 vendor-supplied add-ons.  Vendors who supply perl with their system
7899 may find it convenient to place all vendor-supplied files in this
7900 directory rather than in the main distribution directory.  This will
7901 ease upgrades between binary-compatible maintenance versions of perl.
7902
7903 Of course you may also use these directories in whatever way you see
7904 fit.  For example, you might use them to access modules shared over a
7905 company-wide network.
7906
7907 The default answer should be fine for most people.
7908 This causes further questions about vendor add-ons to be skipped
7909 and no vendor-specific directories will be configured for perl.
7910
7911 EOM
7912 rp='Do you want to configure vendor-specific add-on directories?'
7913 case "$usevendorprefix" in
7914 define|true|[yY]*) dflt=y ;;
7915 *)      : User may have set vendorprefix directly on Configure command line.
7916         case "$vendorprefix" in
7917         ''|' ') dflt=n ;;
7918         *)      dflt=y ;;
7919         esac
7920         ;;
7921 esac
7922 . ./myread
7923 case "$ans" in
7924 [yY]*)  fn=d~+
7925         rp='Installation prefix to use for vendor-supplied add-ons?'
7926         case "$vendorprefix" in
7927         '') dflt="$prefix" ;;
7928         *)  dflt=$vendorprefix ;;
7929         esac
7930         . ./getfile
7931         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7932         oldvendorprefix=''
7933         case "$vendorprefix" in
7934         '') ;;
7935         *)      case "$ans" in
7936                 "$prefix") ;;
7937                 *) oldvendorprefix="$prefix";;
7938                 esac
7939                 ;;
7940         esac
7941         usevendorprefix="$define"
7942         vendorprefix="$ans"
7943         vendorprefixexp="$ansexp"
7944         ;;
7945 *)      usevendorprefix="$undef"
7946         vendorprefix=''
7947         vendorprefixexp=''
7948         ;;
7949 esac
7950
7951 : Set the vendorlib variables
7952 case "$vendorprefix" in
7953 '')     d_vendorlib="$undef"
7954         vendorlib=''
7955         vendorlibexp=''
7956         ;;
7957 *)      d_vendorlib="$define"
7958         : determine where vendor-supplied modules go.
7959         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7960         case "$vendorlib" in
7961         '')
7962                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7963                 case "$installstyle" in
7964                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7965                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7966                 esac
7967                 ;;
7968         *)      dflt="$vendorlib"
7969                 ;;
7970         esac
7971         fn=d~+
7972         rp='Pathname for the vendor-supplied library files?'
7973         . ./getfile
7974         vendorlib="$ans"
7975         vendorlibexp="$ansexp"
7976         ;;
7977 esac
7978 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7979 prefixvar=vendorlib
7980 . ./installprefix
7981
7982 : Set the vendorarch variables
7983 case "$vendorprefix" in
7984 '')     d_vendorarch="$undef"
7985         vendorarch=''
7986         vendorarchexp=''
7987         ;;
7988 *)      d_vendorarch="$define"
7989         : determine where vendor-supplied architecture-dependent libraries go.
7990         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7991         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7992         : vendorlib may have an optional trailing /share.
7993         case "$vendorarch" in
7994         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7995                 dflt="$dflt/$archname"
7996                 ;;
7997         *)      dflt="$vendorarch" ;;
7998         esac
7999         fn=d~+
8000         rp='Pathname for vendor-supplied architecture-dependent files?'
8001         . ./getfile
8002         vendorarch="$ans"
8003         vendorarchexp="$ansexp"
8004         ;;
8005 esac
8006 prefixvar=vendorarch
8007 . ./installprefix
8008 if $test X"$vendorarch" = X"$vendorlib"; then
8009         d_vendorarch="$undef"
8010 else
8011         d_vendorarch="$define"
8012 fi
8013
8014 : Final catch-all directories to search
8015 $cat <<EOM
8016
8017 Lastly, you can have perl look in other directories for extensions and
8018 modules in addition to those already specified.
8019 These directories will be searched after
8020         $sitearch
8021         $sitelib
8022 EOM
8023 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8024 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8025 echo ' '
8026 case "$otherlibdirs" in
8027 ''|' ') dflt='none' ;;
8028 *)      dflt="$otherlibdirs" ;;
8029 esac
8030 $cat <<EOM
8031 Enter a colon-separated set of extra paths to include in perl's @INC
8032 search path, or enter 'none' for no extra paths.
8033
8034 EOM
8035
8036 rp='Colon-separated list of additional directories for perl to search?'
8037 . ./myread
8038 case "$ans" in
8039 ' '|''|none)    otherlibdirs=' ' ;;
8040 *)      otherlibdirs="$ans" ;;
8041 esac
8042 case "$otherlibdirs" in
8043 ' ') val=$undef ;;
8044 *)      val=$define ;;
8045 esac
8046 set d_perl_otherlibdirs
8047 eval $setvar
8048
8049 : Cruising for prototypes
8050 echo " "
8051 echo "Checking out function prototypes..." >&4
8052 $cat >prototype.c <<EOCP
8053 #$i_stdlib I_STDLIB
8054 #ifdef I_STDLIB
8055 #include <stdlib.h>
8056 #endif
8057 int main(int argc, char *argv[]) {
8058         exit(0);}
8059 EOCP
8060 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8061         echo "Your C compiler appears to support function prototypes."
8062         val="$define"
8063 else
8064         echo "Your C compiler doesn't seem to understand function prototypes."
8065         val="$undef"
8066 fi
8067 set prototype
8068 eval $setvar
8069 $rm -f prototype*
8070
8071 : Check if ansi2knr is required
8072 case "$prototype" in
8073 "$define") ;;
8074 *)      ansi2knr='ansi2knr'
8075         echo " "
8076         cat <<EOM >&4
8077
8078 $me:  FATAL ERROR:
8079 This version of $package can only be compiled by a compiler that
8080 understands function prototypes.  Unfortunately, your C compiler
8081         $cc $ccflags
8082 doesn't seem to understand them.  Sorry about that.
8083
8084 If GNU cc is available for your system, perhaps you could try that instead.
8085
8086 Eventually, we hope to support building Perl with pre-ANSI compilers.
8087 If you would like to help in that effort, please contact <perlbug@perl.org>.
8088
8089 Aborting Configure now.
8090 EOM
8091         exit 2
8092         ;;
8093 esac
8094
8095 : DTrace support
8096 dflt_dtrace='/usr/sbin/dtrace'
8097 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8098
8099 cat <<EOM
8100
8101 Perl can be built to support DTrace on platforms that support it.
8102 DTrace is a diagnosis and performance analysis tool from Sun.
8103
8104 If this doesn't make any sense to you, just accept the default.
8105 EOM
8106
8107 while $test 1 ; do
8108         case "$usedtrace" in
8109         $define|true|[yY]*)
8110                 dflt='y'
8111                 ;;
8112         ?*)
8113                 dflt='y'
8114                 dflt_dtrace=$usedtrace
8115                 ;;
8116         *)
8117                 dflt='n'
8118                 ;;
8119         esac
8120
8121         rp='Support DTrace if available?'
8122         . ./myread
8123         case "$ans" in
8124         y|Y)    val="$define" ;;
8125         *)      val="$undef" ;;
8126         esac
8127         set usedtrace
8128         eval $setvar
8129
8130         test "X$usedtrace" != "X$define" && break
8131
8132         echo " "
8133         rp='Where is the dtrace executable?'
8134         dflt=$dflt_dtrace
8135         . ./getfile
8136         val="$ans"
8137         set dtrace
8138         eval $setvar
8139
8140         if $test -f $dtrace
8141         then
8142                 if $dtrace -h -s ../perldtrace.d \
8143                         -o perldtrace.tmp >/dev/null 2>&1 \
8144                         && rm -f perldtrace.tmp
8145                 then
8146                         echo " "
8147                         echo "Good: your $dtrace knows about the -h flag."
8148                 else
8149                         cat >&2 <<EOM
8150
8151 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8152 ***
8153 *** Your installed dtrace doesn't support the -h switch to compile a D
8154 *** program into a C header. Can't continue.
8155
8156 EOM
8157                         exit 1
8158                 fi
8159                 break;
8160         fi
8161
8162         case "$fastread" in
8163         yes)
8164                 cat >&2 <<EOM
8165
8166 *** $me:  Fatal Error:  $dtrace not found.
8167 *** Can't continue.
8168
8169 EOM
8170                 exit 1
8171                 ;;
8172         *)
8173                 echo "*** $dtrace was not found."
8174                 echo " "
8175                 ;;
8176         esac
8177 done
8178
8179 case "$usedtrace" in
8180 $define)
8181         case "$dtraceobject" in
8182         $define|true|[yY]*)
8183                 dtraceobject=$define
8184                 ;;
8185         ' '|'')
8186                 $dtrace -h -s ../perldtrace.d -o perldtrace.h
8187                 $cat >try.c <<EOM
8188 #include "perldtrace.h"
8189 int main(void) {
8190     PERL_LOADED_FILE("dummy");
8191     return 0;
8192 }
8193 EOM
8194                 dtraceobject=$undef
8195                 if $cc -c -o try.o $optimize $ccflags try.c \
8196                     && $dtrace -G -s ../perldtrace.d try.o >/dev/null 2>&1; then
8197                         dtraceobject=$define
8198                         echo "Your dtrace builds an object file"
8199                 fi
8200                 $rm -f try.c try.o perldtrace.o
8201                 ;;
8202         *) dtraceobject=$undef ;;
8203         esac
8204 esac
8205
8206 : See if we want extra modules installed
8207 echo " "
8208 case "$extras" in
8209 '') dflt='n';;
8210 *) dflt='y';;
8211 esac
8212 cat <<EOM
8213 Perl can be built with extra modules or bundles of modules which
8214 will be fetched from the CPAN and installed alongside Perl.
8215
8216 Notice that you will need access to the CPAN; either via the Internet,
8217 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8218 be asked later to configure the CPAN.pm module which will in turn do
8219 the installation of the rest of the extra modules or bundles.)
8220
8221 Notice also that if the modules require any external software such as
8222 libraries and headers (the libz library and the zlib.h header for the
8223 Compress::Zlib module, for example) you MUST have any such software
8224 already installed, this configuration process will NOT install such
8225 things for you.
8226
8227 If this doesn't make any sense to you, just accept the default '$dflt'.
8228 EOM
8229 rp='Install any extra modules (y or n)?'
8230 . ./myread
8231 case "$ans" in
8232 y|Y)
8233         cat <<EOM
8234
8235 Please list any extra modules or bundles to be installed from CPAN,
8236 with spaces between the names.  The names can be in any format the
8237 'install' command of CPAN.pm will understand.  (Answer 'none',
8238 without the quotes, to install no extra modules or bundles.)
8239 EOM
8240         rp='Extras?'
8241         dflt="$extras"
8242         . ./myread
8243         extras="$ans"
8244 esac
8245 case "$extras" in
8246 ''|'none')
8247         val=''
8248         $rm -f ../extras.lst
8249         ;;
8250 *)      echo "(Saving the list of extras for later...)"
8251         echo "$extras" > ../extras.lst
8252         val="'$extras'"
8253         ;;
8254 esac
8255 set extras
8256 eval $setvar
8257 echo " "
8258
8259 : determine where html pages for programs go
8260 set html1dir html1dir none
8261 eval $prefixit
8262 $cat <<EOM
8263
8264 If you wish to install html files for programs in $spackage, indicate
8265 the appropriate directory here.  To skip installing html files,
8266 answer "none".
8267 EOM
8268 case "$html1dir" in
8269 ''|none|$undef|' ') dflt=none ;;
8270 *) dflt=$html1dir ;;
8271 esac
8272 fn=dn+~
8273 rp="Directory for the main $spackage html pages?"
8274 . ./getfile
8275 prefixvar=html1dir
8276 . ./setprefixvar
8277 : Use ' ' for none so value is preserved next time through Configure
8278 $test X"$html1dir" = "X" && html1dir=' '
8279
8280 : determine where html pages for libraries and modules go
8281 set html3dir html3dir none
8282 eval $prefixit
8283 $cat <<EOM
8284
8285 If you wish to install html files for modules associated with $spackage,
8286 indicate the appropriate directory here.  To skip installing html files,
8287 answer "none".
8288 EOM
8289 : There is no obvious default.  If they have specified html1dir, then
8290 : try to key off that, possibly changing .../html1 into .../html3.
8291 case "$html3dir" in
8292 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8293 *) dflt=$html3dir ;;
8294 esac
8295 fn=dn+~
8296 rp="Directory for the $spackage module html pages?"
8297 . ./getfile
8298 prefixvar=html3dir
8299 . ./setprefixvar
8300 : Use ' ' for none so value is preserved next time through Configure
8301 $test X"$html3dir" = "X" && html3dir=' '
8302
8303 : determine whether to install perl also as /usr/bin/perl
8304
8305 echo " "
8306 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8307         $cat <<EOM
8308 Many scripts expect perl to be installed as /usr/bin/perl.
8309
8310 If you want to, I can install the perl you are about to compile
8311 as /usr/bin/perl (in addition to $bin/perl).
8312 EOM
8313         if test -f /usr/bin/perl; then
8314             $cat <<EOM
8315
8316 However, please note that because you already have a /usr/bin/perl,
8317 overwriting that with a new Perl would very probably cause problems.
8318 Therefore I'm assuming you don't want to do that (unless you insist).
8319
8320 EOM
8321             case "$installusrbinperl" in
8322             "$define"|[yY]*)    dflt='y';;
8323             *)                  dflt='n';;
8324             esac
8325         else
8326             $cat <<EOM
8327
8328 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8329
8330 EOM
8331             case "$installusrbinperl" in
8332             "$undef"|[nN]*)     dflt='n';;
8333             *)                  dflt='y';;
8334             esac
8335         fi
8336         rp="Do you want to install perl as /usr/bin/perl?"
8337         . ./myread
8338         case "$ans" in
8339         [yY]*)  val="$define";;
8340         *)      val="$undef" ;;
8341         esac
8342 else
8343         val="$undef"
8344 fi
8345 set installusrbinperl
8346 eval $setvar
8347
8348 : see if dlopen exists
8349 xxx_runnm="$runnm"
8350 xxx_ccflags="$ccflags"
8351 runnm=false
8352 : with g++ one needs -shared to get is-in-libc to work for dlopen
8353 case "$gccversion" in
8354 '')     ;;
8355 *Clang*)        ;;
8356 *)      case "$d_cplusplus" in
8357         "$define") ccflags="$ccflags -shared" ;;
8358         esac
8359         ;;
8360 esac
8361 set dlopen d_dlopen
8362 eval $inlibc
8363 runnm="$xxx_runnm"
8364 ccflags="$xxx_ccflags"
8365
8366 : see if this is a unistd.h system
8367 set unistd.h i_unistd
8368 eval $inhdr
8369
8370 : determine which dynamic loading, if any, to compile in
8371 echo " "
8372 dldir="ext/DynaLoader"
8373 case "$usedl" in
8374     $define|y|true)
8375         dflt='y'
8376         usedl="$define"
8377         ;;
8378     $undef|n|false)
8379         dflt='n'
8380         usedl="$undef"
8381         ;;
8382     *)
8383         dflt='n'
8384         case "$d_dlopen" in
8385             $define) dflt='y' ;;
8386         esac
8387         : Does a dl_xxx.xs file exist for this operating system
8388         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8389         ;;
8390 esac
8391 rp="Do you wish to use dynamic loading?"
8392 . ./myread
8393 usedl="$ans"
8394 bin_ELF="$undef"
8395 case "$ans" in
8396     y*) usedl="$define"
8397         case "$dlsrc" in
8398             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8399                     dflt="$dldir/dl_${osname}.xs"
8400                 elif $test "$d_dlopen" = "$define" ; then
8401                     dflt="$dldir/dl_dlopen.xs"
8402                 else
8403                     dflt=''
8404                 fi
8405                 ;;
8406             *)  dflt="$dldir/$dlsrc"
8407                 ;;
8408         esac
8409         echo "The following dynamic loading files are available:"
8410         : Can not go over to $dldir because getfile has path hard-coded in.
8411         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8412         rp="Source file to use for dynamic loading"
8413         fn="fne"
8414         gfpth="$src"
8415         . ./getfile
8416         usedl="$define"
8417         : emulate basename
8418         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8419
8420         $cat << EOM
8421
8422 Some systems may require passing special flags to $cc -c to
8423 compile modules that will be used to create a shared library.
8424 To use no flags, say "none".
8425
8426 EOM
8427         case "$cccdlflags" in
8428             '') case "$gccversion" in
8429                 '') case "$osname" in
8430                         hpux)   dflt='+z' ;;
8431                         irix*)  dflt='-KPIC' ;;
8432                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8433                         sunos)  dflt='-pic' ;;
8434                         *)      dflt='none' ;;
8435                     esac
8436                     ;;
8437                 *)  case "$osname" in
8438                         darwin) dflt='none' ;;
8439                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8440                         *)      dflt='-fpic' ;;
8441                     esac ;;
8442                 esac ;;
8443             ' ') dflt='none' ;;
8444             *)   dflt="$cccdlflags" ;;
8445         esac
8446
8447         case "$dflt" in
8448             none) dflt='' ;;
8449         esac
8450
8451         # If -Dsysroot was specified, now's the time to add it
8452         # to cccdlflags
8453         if test "X$sysroot" != X; then
8454             case "$gccversion" in
8455                 '') ;;
8456                 *)  case "$dflt" in
8457                         *sysroot*) ;;
8458                         'undef'|*)
8459                             dflt="$dflt --sysroot=$sysroot" ;;
8460                     esac
8461                     ;;
8462             esac
8463         fi
8464
8465         case "$dflt" in
8466             '') dflt='none';;
8467         esac
8468
8469         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8470         . ./myread
8471         case "$ans" in
8472             none) cccdlflags=' ' ;;
8473             *)    cccdlflags="$ans" ;;
8474         esac
8475
8476         cat << EOM
8477
8478 Some systems use ld to create libraries that can be dynamically loaded,
8479 while other systems (such as those using ELF) use $cc.
8480
8481 EOM
8482
8483 : Determine if this is ELF
8484         $cat >try.c <<EOM
8485 /* Test for whether ELF binaries are produced */
8486 #include <fcntl.h>
8487 #$i_stdlib I_STDLIB
8488 #ifdef I_STDLIB
8489 #include <stdlib.h>
8490 #endif
8491 #$i_unistd I_UNISTD
8492 #ifdef I_UNISTD
8493 #include <unistd.h>
8494 #endif
8495 int main() {
8496     char b[4];
8497     int i = open("a.out",O_RDONLY);
8498     if(i == -1)
8499         exit(1); /* fail */
8500     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8501         exit(0); /* succeed (yes, it is ELF) */
8502     exit(1); /* fail */
8503 }
8504 EOM
8505         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8506             bin_ELF="$define"
8507         fi
8508         $rm_try
8509
8510         case "$ld" in
8511             '') if $test $bin_ELF = "$define"; then
8512                     cat <<EOM
8513 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8514 EOM
8515                     dflt="$cc"
8516                 else
8517                     echo "I'll use ld to build dynamic libraries."
8518                     dflt='ld'
8519                 fi
8520                 ;;
8521             *)  dflt="$ld"
8522                 ;;
8523         esac
8524
8525         rp="What command should be used to create dynamic libraries?"
8526         . ./myread
8527         ld="$ans"
8528
8529         cat << EOM
8530
8531 Some systems may require passing special flags to $ld to create a
8532 library that can be dynamically loaded.  If your ld flags include
8533 -L/other/path options to locate libraries outside your loader's normal
8534 search path, you may need to specify those -L options here as well.  To
8535 use no flags, say "none".
8536
8537 EOM
8538         case "$lddlflags" in
8539             '') case "$osname" in
8540                     haiku) dflt='-shared' ;;
8541                     hpux) dflt='-b';
8542                           case "$gccversion" in
8543                               '') dflt="$dflt +vnocompatwarnings" ;;
8544                           esac
8545                           ;;
8546                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8547                     solaris) # See [perl #66604].
8548                             # On Solaris 11, gcc -m64 on amd64
8549                             # appears not to understand -G.  gcc versions at
8550                             # least as old as 3.4.3 support -shared, so just
8551                             # use that with Solaris 11 and later, but keep
8552                             # the old behavior for older Solaris versions.
8553                             case "$gccversion" in
8554                                 '') dflt='-G' ;;
8555                                 *)  case "$osvers" in
8556                                         2.?|2.10) dflt='-G' ;;
8557                                         *) dflt='-shared' ;;
8558                                     esac
8559                                     ;;
8560                             esac
8561                             ;;
8562                     sunos) dflt='-assert nodefinitions' ;;
8563                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8564                     *)     dflt='none' ;;
8565                 esac
8566                 ;;
8567             *) dflt="$lddlflags" ;;
8568         esac
8569
8570         : Only do this for gcc, since, for example, qcc has no concept
8571         : of --sysroot.
8572         if $test "X$sysroot" != X; then
8573             case "$gccversion" in
8574                 '') ;;
8575                 *)  dflt="$dflt --sysroot $sysroot" ;;
8576             esac
8577         fi
8578
8579         : Try to guess additional flags to pick up local libraries.
8580         : Be careful not to append to a plain 'none'
8581         case "$dflt" in
8582             none) dflt='' ;;
8583         esac
8584         for thisflag in $ldflags; do
8585             case "$thisflag" in
8586                 -L*|-R*|-Wl,-R*)
8587                     case " $dflt " in
8588                         *" $thisflag "*) ;;
8589                         *) dflt="$dflt $thisflag" ;;
8590                     esac
8591                     ;;
8592             esac
8593         done
8594
8595         case "$dflt" in
8596             ''|' ') dflt='none' ;;
8597         esac
8598
8599         case "$ldflags" in
8600             *-fstack-protector-strong*)
8601                 case "$dflt" in
8602                     *-fstack-protector-strong*) ;; # Don't add it again
8603                     *) dflt="$dflt -fstack-protector-strong" ;;
8604                 esac
8605                 ;;
8606             *-fstack-protector*)
8607                 case "$dflt" in
8608                     *-fstack-protector*) ;; # Don't add it again
8609                     *) dflt="$dflt -fstack-protector" ;;
8610                 esac
8611                 ;;
8612         esac
8613
8614         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8615         . ./myread
8616         case "$ans" in
8617             none) lddlflags=' ' ;;
8618             *) lddlflags="$ans" ;;
8619         esac
8620
8621         cat <<EOM
8622
8623 Some systems may require passing special flags to $cc to indicate that
8624 the resulting executable will use dynamic linking.  To use no flags,
8625 say "none".
8626
8627 EOM
8628         case "$ccdlflags" in
8629             '') case "$osname" in
8630                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8631                     sunos)             dflt='none'   ;;
8632                     *)                 dflt='none'   ;;
8633                 esac ;;
8634             ' ') dflt='none' ;;
8635             *)   dflt="$ccdlflags" ;;
8636         esac
8637         rp="Any special flags to pass to $cc to use dynamic linking?"
8638         . ./myread
8639         case "$ans" in
8640             none) ccdlflags=' ' ;;
8641             *)    ccdlflags="$ans" ;;
8642         esac
8643         ;;
8644
8645     *)  usedl="$undef"
8646         ld='ld'
8647         dlsrc='dl_none.xs'
8648         lddlflags=''
8649         ccdlflags=''
8650         ;;
8651 esac
8652
8653 ld_can_script="$undef"
8654 case "$bin_ELF$usedl" in
8655     $define$define)
8656         # Abuse try.h and a.out names for neat cleanup
8657         $cat >try.c <<EOM
8658 void foo() {}
8659 void bar() {}
8660 EOM
8661         $cat >try.h <<EOM
8662 LIBTEST_42 {
8663  global:
8664   foo;
8665  local: *;
8666  };
8667 EOM
8668         if $cc $cccdlflags $ccdlflags $ccflags \
8669                $ldflags $lddlflags -o a.out try.c \
8670                -Wl,--version-script=try.h >/dev/null 2>&1 \
8671            &&  $test -s a.out ; then
8672             echo "ld supports scripting" >&4
8673             ld_can_script="$define"
8674         else
8675             echo "ld does not support scripting" >&4
8676         fi
8677         $rm_try
8678         ;;
8679 esac
8680
8681 : Do we want a shared libperl?
8682 also=''
8683 case "$usedl" in
8684 $undef)
8685         # No dynamic loading being used, so don't bother even to prompt.
8686         useshrplib='false'
8687         ;;
8688 *)      case "$useshrplib" in
8689         '')     case "$osname" in
8690                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8691                         dflt=y
8692                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8693                         ;;
8694                 *)      dflt=n
8695                         ;;
8696                 esac
8697                 ;;
8698         $define|true|[Yy]*)
8699                 dflt=y
8700                 ;;
8701         *)      dflt=n
8702                 ;;
8703         esac
8704         $cat << EOM
8705
8706 The perl executable is normally obtained by linking perlmain.c with
8707 libperl${_a}, any static extensions (usually just DynaLoader), and
8708 any other libraries needed on this system (such as -lm, etc.).  Since
8709 your system supports dynamic loading, it is probably possible to build
8710 a shared libperl.$so.  If you will have more than one executable linked
8711 to libperl.$so, this will significantly reduce the size of each
8712 executable, but it may have a noticeable effect on performance.  The
8713 default is probably sensible for your system.
8714 $also
8715
8716 EOM
8717         rp="Build a shared libperl.$so (y/n)"
8718         . ./myread
8719         case "$ans" in
8720         true|$define|[Yy]*)
8721                 useshrplib='true'  ;;
8722         *)      useshrplib='false' ;;
8723         esac
8724         ;;
8725 esac
8726
8727 case "$useshrplib" in
8728 true)
8729         case "$userelocatableinc" in
8730         true|define)
8731                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8732                 echo "See INSTALL for an explanation why that won't work." >&4
8733                 exit 4
8734                 ;;
8735         esac
8736         case "$libperl" in
8737         '')
8738                 # Figure out a good name for libperl.so.  Since it gets stored in
8739                 # a version-specific architecture-dependent library, the version
8740                 # number isn't really that important, except for making cc/ld happy.
8741                 #
8742                 # A name such as libperl.so.10.1
8743                 majmin="libperl.$so.$patchlevel.$subversion"
8744                 # A name such as libperl.so.100
8745                 majonly=`echo $patchlevel $subversion |
8746                         $awk '{printf "%d%02d", $1, $2}'`
8747                 majonly=libperl.$so.$majonly
8748                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8749                 # rely on figuring it out from the naming of libc.
8750                 case "${osname}${osvers}" in
8751                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8752                         dflt=libperl.$so
8753                         ;;
8754                 cygwin*) # ld links now against the dll directly
8755                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8756                         majonly=`echo $patchlevel $subversion |
8757                                 $awk '{printf "%03d%03d", $1, $2}'`
8758                         majonly=cygperl5.$majonly.$so
8759                         dflt=$majmin
8760                         ;;
8761                 *)      # Try to guess based on whether libc has major.minor.
8762                         case "$libc" in
8763                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8764                         *libc.$so.[0-9]*) dflt=$majonly ;;
8765                         *)      dflt=libperl.$so ;;
8766                         esac
8767                         ;;
8768                 esac
8769                 ;;
8770         *)      dflt=$libperl
8771                 ;;
8772         esac
8773         cat << EOM
8774
8775 I need to select a good name for the shared libperl.  If your system uses
8776 library names with major and minor numbers, then you might want something
8777 like $majmin.  Alternatively, if your system uses a single version
8778 number for shared libraries, then you might want to use $majonly.
8779 Or, your system might be quite happy with a simple libperl.$so.
8780
8781 Since the shared libperl will get installed into a version-specific
8782 architecture-dependent directory, the version number of the shared perl
8783 library probably isn't important, so the default should be o.k.
8784
8785 EOM
8786         rp='What name do you want to give to the shared libperl?'
8787         . ./myread
8788         libperl=$ans
8789         echo "Ok, I'll use $libperl"
8790         ;;
8791 *)
8792         libperl="libperl${_a}"
8793         ;;
8794 esac
8795
8796 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8797 case "$shrpdir" in
8798 '') ;;
8799 *)      $cat >&4 <<EOM
8800 WARNING:  Use of the shrpdir variable for the installation location of
8801 the shared $libperl is not supported.  It was never documented and
8802 will not work in this version.  Let me (perlbug@perl.org)
8803 know of any problems this may cause.
8804
8805 EOM
8806         case "$shrpdir" in
8807         "$archlibexp/CORE")
8808                 $cat >&4 <<EOM
8809 But your current setting of $shrpdir is
8810 the default anyway, so it's harmless.
8811 EOM
8812                 ;;
8813         *)
8814                 $cat >&4 <<EOM
8815 Further, your current attempted setting of $shrpdir
8816 conflicts with the value of $archlibexp/CORE
8817 that installperl will use.
8818 EOM
8819                 ;;
8820         esac
8821         ;;
8822 esac
8823
8824 # How will the perl executable find the installed shared $libperl?
8825 # Add $xxx to ccdlflags.
8826 # If we can't figure out a command-line option, use $shrpenv to
8827 # set env LD_RUN_PATH.  The main perl makefile uses this.
8828 shrpdir=$archlibexp/CORE
8829 xxx=''
8830 tmp_shrpenv=''
8831 if "$useshrplib"; then
8832     case "$osname" in
8833         aix)
8834                 # We'll set it in Makefile.SH...
8835                 ;;
8836         solaris)
8837                 xxx="-R $shrpdir"
8838                 ;;
8839         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8840                 xxx="-Wl,-R$shrpdir"
8841                 ;;
8842         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8843                 xxx="-Wl,-rpath,$shrpdir"
8844                 ;;
8845         hpux*)
8846                 # hpux doesn't like the default, either.
8847                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8848                 ;;
8849         cygwin)
8850                 # cygwin needs only ldlibpth
8851                 ;;
8852         *)
8853                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8854                 ;;
8855         esac
8856         case "$xxx" in
8857         '') ;;
8858         *)
8859                 # Only add $xxx if it isn't already in ccdlflags.
8860                 case " $ccdlflags " in
8861                 *" $xxx "*)     ;;
8862                 *)      ccdlflags="$ccdlflags $xxx"
8863                         cat <<EOM >&4
8864
8865 Adding $xxx to the flags
8866 passed to $ld so that the perl executable will find the
8867 installed shared $libperl.
8868
8869 EOM
8870                         ;;
8871                 esac
8872                 ;;
8873         esac
8874 fi
8875 # Fix ccdlflags in AIX for building external extensions.
8876 # (For building Perl itself bare -bE:perl.exp is needed,
8877 #  Makefile.SH takes care of this.)
8878 case "$osname" in
8879 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8880 esac
8881 # Respect a hint or command-line value.
8882 case "$shrpenv" in
8883 '') shrpenv="$tmp_shrpenv" ;;
8884 esac
8885 case "$ldlibpthname" in
8886 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8887 none)   ldlibpthname='' ;;
8888 esac
8889
8890 : determine where manual pages are on this system
8891 echo " "
8892 case "$sysman" in
8893 '')
8894         syspath='/usr/share/man/man1 /usr/man/man1'
8895         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8896         syspath="$syspath /usr/man/u_man/man1"
8897         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8898         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8899         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8900         sysman=`./loc . /usr/man/man1 $syspath`
8901         ;;
8902 esac
8903 if $test -d "$sysman"; then
8904         echo "System manual is in $sysman." >&4
8905 else
8906         echo "Could not find manual pages in source form." >&4
8907 fi
8908
8909 : determine where manual pages go
8910 set man1dir man1dir none
8911 eval $prefixit
8912 $cat <<EOM
8913
8914 $spackage has manual pages available in source form.
8915 EOM
8916 case "$nroff" in
8917 nroff)
8918         echo "However, you don't have nroff, so they're probably useless to you."
8919         case "$man1dir" in
8920         '') man1dir="none";;
8921         esac;;
8922 esac
8923 echo "If you don't want the manual sources installed, answer 'none'."
8924 case "$man1dir" in
8925 ' ') dflt=none
8926         ;;
8927 '')
8928         lookpath="$prefixexp/share/man/man1"
8929         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8930         lookpath="$lookpath $prefixexp/man/p_man/man1"
8931         lookpath="$lookpath $prefixexp/man/u_man/man1"
8932         lookpath="$lookpath $prefixexp/man/man.1"
8933         case "$sysman" in
8934         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8935         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8936         esac
8937         set dflt
8938         eval $prefixup
8939         ;;
8940 *)  dflt="$man1dir"
8941         ;;
8942 esac
8943 echo " "
8944 fn=dn+~
8945 rp="Where do the main $spackage manual pages (source) go?"
8946 . ./getfile
8947 if $test "X$man1direxp" != "X$ansexp"; then
8948         installman1dir=''
8949 fi
8950 prefixvar=man1dir
8951 . ./setprefixvar
8952
8953 case "$man1dir" in
8954 '')     man1dir=' '
8955         installman1dir='';;
8956 esac
8957
8958 : What suffix to use on installed man pages
8959
8960 case "$man1dir" in
8961 ' ')
8962         man1ext='0'
8963         ;;
8964 *)
8965         rp="What suffix should be used for the main $spackage man pages?"
8966         case "$man1ext" in
8967         '')     case "$man1dir" in
8968                 *1)  dflt=1 ;;
8969                 *1p) dflt=1p ;;
8970                 *1pm) dflt=1pm ;;
8971                 *l) dflt=l;;
8972                 *n) dflt=n;;
8973                 *o) dflt=o;;
8974                 *p) dflt=p;;
8975                 *C) dflt=C;;
8976                 *L) dflt=L;;
8977                 *L1) dflt=L1;;
8978                 *) dflt=1;;
8979                 esac
8980                 ;;
8981         *)      dflt="$man1ext";;
8982         esac
8983         . ./myread
8984         man1ext="$ans"
8985         ;;
8986 esac
8987
8988 : see if we can have long filenames
8989 echo " "
8990 first=123456789abcdef
8991 $rm -f $first
8992 if (echo hi >$first) 2>/dev/null; then
8993         if $test -f 123456789abcde; then
8994                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8995                 val="$undef"
8996         else
8997                 echo 'You can have filenames longer than 14 characters.'>&4
8998                 val="$define"
8999         fi
9000 else
9001         $cat <<'EOM'
9002 You can't have filenames longer than 14 chars.
9003 You can't even think about them!
9004 EOM
9005         val="$undef"
9006 fi
9007 set d_flexfnam
9008 eval $setvar
9009 $rm -rf 123456789abcde*
9010
9011 : determine where library module manual pages go
9012 set man3dir man3dir none
9013 eval $prefixit
9014 $cat <<EOM
9015
9016 $spackage has manual pages for many of the library modules.
9017 EOM
9018
9019 case "$nroff" in
9020 nroff)
9021         $cat <<'EOM'
9022 However, you don't have nroff, so they're probably useless to you.
9023 EOM
9024         case "$man3dir" in
9025         '') man3dir="none";;
9026         esac;;
9027 esac
9028
9029 case "$d_flexfnam" in
9030 undef)
9031         $cat <<'EOM'
9032 However, your system can't handle the long file names like File::Basename.3.
9033 EOM
9034         case "$man3dir" in
9035         '') man3dir="none";;
9036         esac;;
9037 esac
9038
9039 echo "If you don't want the manual sources installed, answer 'none'."
9040 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9041 case "$man3dir" in
9042 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9043         if $test -d "$privlib/man/man3"; then
9044                 cat <<EOM >&4
9045
9046 WARNING:  Previous versions of perl installed man3 pages into
9047 $privlib/man/man3.  This version will suggest a
9048 new default of $dflt.
9049 EOM
9050                 tdflt=$dflt
9051                 dflt='n'
9052                 rp='Do you wish to preserve the old behavior?(y/n)'
9053                 . ./myread
9054                 case "$ans" in
9055                 y*) dflt="$privlib/man/man3" ;;
9056                 *)  dflt=$tdflt ;;
9057                 esac
9058     fi
9059         ;;
9060 *)      dflt="$man3dir" ;;
9061 esac
9062 case "$dflt" in
9063 ' ') dflt=none ;;
9064 esac
9065 echo " "
9066 fn=dn+~
9067 rp="Where do the $package library man pages (source) go?"
9068 . ./getfile
9069 prefixvar=man3dir
9070 . ./setprefixvar
9071
9072 case "$man3dir" in
9073 '')     man3dir=' '
9074         installman3dir='';;
9075 esac
9076
9077 : What suffix to use on installed man pages
9078 case "$man3dir" in
9079 ' ')
9080         man3ext='0'
9081         ;;
9082 *)
9083         rp="What suffix should be used for the $package library man pages?"
9084         case "$man3ext" in
9085         '')     case "$man3dir" in
9086                 *3)  dflt=3 ;;
9087                 *3p) dflt=3p ;;
9088                 *3pm) dflt=3pm ;;
9089                 *l) dflt=l;;
9090                 *n) dflt=n;;
9091                 *o) dflt=o;;
9092                 *p) dflt=p;;
9093                 *C) dflt=C;;
9094                 *L) dflt=L;;
9095                 *L3) dflt=L3;;
9096                 *) dflt=3;;
9097                 esac
9098                 ;;
9099         *)      dflt="$man3ext";;
9100         esac
9101         . ./myread
9102         man3ext="$ans"
9103         ;;
9104 esac
9105
9106 : see if we have to deal with yellow pages, now NIS.
9107 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9108         case "$hostcat" in
9109         nidump*) ;;
9110         *)
9111                 case "$hostcat" in
9112                 *ypcat*) dflt=y;;
9113                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9114                                 dflt=y
9115                         else
9116                                 dflt=n
9117                         fi;;
9118                 *) dflt=n;;
9119                 esac
9120                 echo " "
9121                 rp='Are you getting the hosts file via yellow pages?'
9122                 . ./myread
9123                 case "$ans" in
9124                 y*) hostcat='ypcat hosts';;
9125                 *) hostcat='cat /etc/hosts';;
9126                 esac
9127                 ;;
9128         esac
9129 fi
9130 case "$hostcat" in
9131 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9132 esac
9133 case "$groupcat" in
9134 '') test -f /etc/group && groupcat='cat /etc/group';;
9135 esac
9136 case "$passcat" in
9137 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9138 esac
9139
9140 : now get the host name
9141 echo " "
9142 echo "Figuring out host name..." >&4
9143 case "$myhostname" in
9144 '') cont=true
9145         echo 'Maybe "hostname" will work...'
9146         if tans=`sh -c hostname 2>&1` ; then
9147                 myhostname=$tans
9148                 phostname=hostname
9149                 cont=''
9150         fi
9151         ;;
9152 *) cont='';;
9153 esac
9154 if $test "$cont"; then
9155         if ./xenix; then
9156                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9157                 if tans=`cat /etc/systemid 2>&1` ; then
9158                         myhostname=$tans
9159                         phostname='cat /etc/systemid'
9160                         echo "Whadyaknow.  Xenix always was a bit strange..."
9161                         cont=''
9162                 fi
9163         elif $test -r /etc/systemid; then
9164                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9165         fi
9166 fi
9167 if $test "$cont"; then
9168         echo 'No, maybe "uuname -l" will work...'
9169         if tans=`sh -c 'uuname -l' 2>&1` ; then
9170                 myhostname=$tans
9171                 phostname='uuname -l'
9172         else
9173                 echo 'Strange.  Maybe "uname -n" will work...'
9174                 if tans=`sh -c 'uname -n' 2>&1` ; then
9175                         myhostname=$tans
9176                         phostname='uname -n'
9177                 else
9178                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9179                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9180                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9181                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9182                         else
9183                                 case "$myhostname" in
9184                                 '') echo "Does this machine have an identity crisis or something?"
9185                                         phostname='';;
9186                                 *)
9187                                         echo "Well, you said $myhostname before..."
9188                                         phostname='echo $myhostname';;
9189                                 esac
9190                         fi
9191                 fi
9192         fi
9193 fi
9194 case "$myhostname" in
9195 '') myhostname=noname ;;
9196 esac
9197 : you do not want to know about this
9198 set $myhostname
9199 myhostname=$1
9200
9201 : verify guess
9202 if $test "$myhostname" ; then
9203         dflt=y
9204         rp='Your host name appears to be "'$myhostname'".'" Right?"
9205         . ./myread
9206         case "$ans" in
9207         y*) ;;
9208         *) myhostname='';;
9209         esac
9210 fi
9211
9212 : bad guess or no guess
9213 while $test "X$myhostname" = X ; do
9214         dflt=''
9215         rp="Please type the (one word) name of your host:"
9216         . ./myread
9217         myhostname="$ans"
9218 done
9219
9220 : translate upper to lower if necessary
9221 case "$myhostname" in
9222 *[A-Z]*)
9223         echo "(Normalizing case in your host name)"
9224         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9225         ;;
9226 esac
9227
9228 case "$myhostname" in
9229 *.*)
9230         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9231         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9232         echo "(Trimming domain name from host name--host name is now $myhostname)"
9233         ;;
9234 *) case "$mydomain" in
9235         '')
9236                 {
9237                         test "X$hostcat" = "Xypcat hosts" &&
9238                         ypmatch "$myhostname" hosts 2>/dev/null |\
9239                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9240                         $test -s hosts
9241                 } || {
9242                         test "X$hostcat" != "X" &&
9243                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9244                                         /[       ]$myhostname[  . ]/p" > hosts
9245                 }
9246                 tmp_re="[       . ]"
9247                 if $test -f hosts; then
9248                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9249                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9250                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9251                                 hosts | $sort | $uniq | \
9252                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9253                         case `$echo X$dflt` in
9254                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9255                                 dflt=.
9256                                 ;;
9257                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9258                                 ;;
9259                         esac
9260                 else
9261                         echo "(I cannot locate a hosts database anywhere)"
9262                         dflt=.
9263                 fi
9264                 case "$dflt" in
9265                 .)
9266                         tans=`./loc resolv.conf X /etc /usr/etc`
9267                         if $test -f "$tans"; then
9268                                 echo "(Attempting domain name extraction from $tans)"
9269                                 dflt=.`$sed -n -e 's/   / /g' \
9270                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9271                                   -e 1q 2>/dev/null`
9272                                 case "$dflt" in
9273                                 .) dflt=.`$sed -n -e 's/        / /g' \
9274                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9275                                      -e 1q 2>/dev/null`
9276                                         ;;
9277                                 esac
9278                         fi
9279                         ;;
9280                 esac
9281                 case "$dflt" in
9282                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9283                         dflt=.`sh -c domainname 2>/dev/null`
9284                         case "$dflt" in
9285                         '') dflt='.';;
9286                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9287                         esac
9288                         ;;
9289                 esac
9290                 case "$dflt$osname" in
9291                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9292                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9293                         ;;
9294                 esac
9295                 case "$dflt" in
9296                 .) echo "(Lost all hope -- silly guess then)"
9297                         dflt='.nonet'
9298                         ;;
9299                 esac
9300                 $rm -f hosts
9301                 ;;
9302         *) dflt="$mydomain";;
9303         esac;;
9304 esac
9305 echo " "
9306 rp="What is your domain name?"
9307 . ./myread
9308 tans="$ans"
9309 case "$ans" in
9310 '') ;;
9311 .*) ;;
9312 *) tans=".$tans";;
9313 esac
9314 mydomain="$tans"
9315
9316 : translate upper to lower if necessary
9317 case "$mydomain" in
9318 *[A-Z]*)
9319         echo "(Normalizing case in your domain name)"
9320         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9321         ;;
9322 esac
9323
9324 : a little sanity check here
9325 case "$phostname" in
9326 '') ;;
9327 *)
9328         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9329         $myhostname$mydomain|$myhostname) ;;
9330         *)
9331                 case "$phostname" in
9332                 sed*)
9333                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9334                         ;;
9335                 *)
9336                         echo "(That doesn't agree with your $phostname command, by the way.)"
9337                         ;;
9338                 esac
9339         ;;
9340         esac
9341         ;;
9342 esac
9343
9344 : determine the e-mail address of the user who is running us
9345 $cat <<EOM
9346
9347 I need to get your e-mail address in Internet format if possible, i.e.
9348 something like user@host.domain. Please answer accurately since I have
9349 no easy means to double check it. The default value provided below
9350 is most probably close to reality but may not be valid from outside
9351 your organization...
9352
9353 EOM
9354 cont=x
9355 while test "$cont"; do
9356         case "$MAILDOMAIN" in
9357         '')
9358                 if $test -s /etc/mailname; then
9359                         maildomain=`$cat /etc/mailname`
9360                 else
9361                         maildomain="$myhostname$mydomain"
9362                 fi
9363                 ;;
9364         *)  maildomain="$MAILDOMAIN";;
9365         esac
9366         case "$cf_email" in
9367         '') dflt="$cf_by@$maildomain";;
9368         *)  dflt="$cf_email";;
9369         esac
9370         rp='What is your e-mail address?'
9371         . ./myread
9372         cf_email="$ans"
9373         case "$cf_email" in
9374         *@*.*) cont='' ;;
9375         *)
9376                 rp='Address does not look like an Internet one.  Use it anyway?'
9377                 case "$fastread" in
9378                 yes) dflt=y ;;
9379                 *) dflt=n ;;
9380                 esac
9381                 . ./myread
9382                 case "$ans" in
9383                 y*) cont='' ;;
9384                 *) echo " " ;;
9385                 esac
9386                 ;;
9387         esac
9388 done
9389
9390 : Ask e-mail of administrator
9391 $cat <<EOM
9392
9393 If you or somebody else will be maintaining perl at your site, please
9394 fill in the correct e-mail address here so that they may be contacted
9395 if necessary. Currently, the "perlbug" program included with perl
9396 will send mail to this address in addition to perlbug@perl.org. You may
9397 enter "none" for no administrator.
9398
9399 EOM
9400 case "$perladmin" in
9401 '') dflt="$cf_email";;
9402 *) dflt="$perladmin";;
9403 esac
9404 rp='Perl administrator e-mail address'
9405 . ./myread
9406 perladmin="$ans"
9407
9408 : determine whether to only install version-specific parts.
9409 echo " "
9410 $cat <<EOM
9411 Do you want to install only the version-specific parts of the perl
9412 distribution?  Usually you do *not* want to do this.
9413 EOM
9414 case "$versiononly" in
9415 "$define"|[Yy]*|true) dflt='y' ;;
9416 *) dflt='n';
9417 esac
9418 rp="Do you want to install only the version-specific parts of perl?"
9419 . ./myread
9420 case "$ans" in
9421 [yY]*)  val="$define";;
9422 *)      val="$undef" ;;
9423 esac
9424 set versiononly
9425 eval $setvar
9426
9427 case "$versiononly" in
9428 "$define") inc_version_list=''
9429            inc_version_list_init=0
9430            ;;
9431 esac
9432
9433 : figure out how to guarantee perl startup
9434 : XXX Note that this currently takes advantage of the bug that binexp ignores
9435 :     the Configure -Dinstallprefix setting, which in turn means that under
9436 :     relocatable @INC, initialinstalllocation is what binexp started as.
9437 case "$startperl" in
9438 '')
9439         case "$sharpbang" in
9440         *!)
9441                 $cat <<EOH
9442
9443 I can use the #! construct to start perl on your system. This will
9444 make startup of perl scripts faster, but may cause problems if you
9445 want to share those scripts and perl is not in a standard place
9446 ($initialinstalllocation/perl) on all your platforms. The alternative
9447 is to force a shell by starting the script with a single ':' character.
9448
9449 EOH
9450                 case "$versiononly" in
9451                 "$define")      dflt="$initialinstalllocation/perl$version";;
9452                 *)              dflt="$initialinstalllocation/perl";;
9453                 esac
9454                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9455                 . ./myread
9456                 case "$ans" in
9457                 none)   startperl=": # use perl";;
9458                 *)      startperl="#!$ans"
9459                         if $test 30 -lt `echo "$ans" | wc -c`; then
9460                                 $cat >&4 <<EOM
9461
9462 WARNING:  Some systems limit the #! command to 32 characters.
9463 If you experience difficulty running Perl scripts with #!, try
9464 installing Perl in a directory with a shorter pathname.
9465
9466 EOM
9467                         fi ;;
9468                 esac
9469                 ;;
9470         *) startperl=": # use perl"
9471                 ;;
9472         esac
9473         ;;
9474 esac
9475 echo "I'll use $startperl to start perl scripts."
9476
9477 : figure best path for perl in scripts
9478 case "$perlpath" in
9479 '')
9480         case "$versiononly" in
9481         "$define")      perlpath="$initialinstalllocation/perl$version";;
9482         *)              perlpath="$initialinstalllocation/perl";;
9483         esac
9484         case "$startperl" in
9485         *!*) ;;
9486         *)
9487                 $cat <<EOH
9488
9489 I will use the "eval 'exec'" idiom to start Perl on your system.
9490 I can use the full path of your Perl binary for this purpose, but
9491 doing so may cause problems if you want to share those scripts and
9492 Perl is not always in a standard place ($initialinstalllocation/perl).
9493
9494 EOH
9495                 dflt="$initialinstalllocation/perl"
9496                 rp="What path shall I use in \"eval 'exec'\"?"
9497                 . ./myread
9498                 perlpath="$ans"
9499                 ;;
9500         esac
9501         ;;
9502 esac
9503 case "$startperl" in
9504 *!*)    ;;
9505 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9506 esac
9507
9508 : determine where public executable scripts go
9509 set scriptdir scriptdir
9510 eval $prefixit
9511 case "$scriptdir" in
9512 '')
9513         dflt="$bin"
9514         : guess some guesses
9515         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9516         $test -d /usr/share/bin     && dflt=/usr/share/bin
9517         $test -d /usr/local/script  && dflt=/usr/local/script
9518         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9519         $test -d $prefixexp/script  && dflt=$prefixexp/script
9520         set dflt
9521         eval $prefixup
9522         ;;
9523 *)  dflt="$scriptdir"
9524         ;;
9525 esac
9526 $cat <<EOM
9527
9528 Some installations have a separate directory just for executable scripts so
9529 that they can mount it across multiple architectures but keep the scripts in
9530 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9531 Or you might just lump your scripts in with all your other executables.
9532
9533 EOM
9534 fn=d~
9535 rp='Where do you keep publicly executable scripts?'
9536 . ./getfile
9537 if $test "X$ansexp" != "X$scriptdirexp"; then
9538         installscript=''
9539 fi
9540 installscriptdir=''
9541 prefixvar=scriptdir
9542 . ./setprefixvar
9543 : A little fix up for an irregularly named variable.
9544 installscript="$installscriptdir"
9545
9546 : determine where add-on public executables go
9547 case "$sitebin" in
9548 '')     dflt=$siteprefix/bin ;;
9549 *)      dflt=$sitebin ;;
9550 esac
9551 fn=d~
9552 rp='Pathname where the add-on public executables should be installed?'
9553 . ./getfile
9554 prefixvar=sitebin
9555 . ./setprefixvar
9556
9557 : determine where add-on html pages go
9558 : There is no standard location, so try to copy the previously-selected
9559 : directory structure for the core html pages.
9560 case "$sitehtml1dir" in
9561 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9562 *)     dflt=$sitehtml1dir ;;
9563 esac
9564 case "$dflt" in
9565 ''|' ') dflt=none ;;
9566 esac
9567 fn=dn+~
9568 rp='Pathname where the site-specific html pages should be installed?'
9569 . ./getfile
9570 prefixvar=sitehtml1dir
9571 . ./setprefixvar
9572
9573 : determine where add-on library html pages go
9574 : There is no standard location, so try to copy the previously-selected
9575 : directory structure for the core html pages.
9576 case "$sitehtml3dir" in
9577 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9578 *)     dflt=$sitehtml3dir ;;
9579 esac
9580 case "$dflt" in
9581 ''|' ') dflt=none ;;
9582 esac
9583 fn=dn+~
9584 rp='Pathname where the site-specific library html pages should be installed?'
9585 . ./getfile
9586 prefixvar=sitehtml3dir
9587 . ./setprefixvar
9588
9589 : determine where add-on manual pages go
9590 case "$siteman1dir" in
9591 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9592 *)      dflt=$siteman1dir ;;
9593 esac
9594 case "$dflt" in
9595 ''|' ') dflt=none ;;
9596 esac
9597 fn=dn+~
9598 rp='Pathname where the site-specific manual pages should be installed?'
9599 . ./getfile
9600 prefixvar=siteman1dir
9601 . ./setprefixvar
9602
9603 : determine where add-on library man pages go
9604 case "$siteman3dir" in
9605 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9606 *)      dflt=$siteman3dir ;;
9607 esac
9608 case "$dflt" in
9609 ''|' ') dflt=none ;;
9610 esac
9611 fn=dn+~
9612 rp='Pathname where the site-specific library manual pages should be installed?'
9613 . ./getfile
9614 prefixvar=siteman3dir
9615 . ./setprefixvar
9616
9617 : determine where add-on public executable scripts go
9618 case "$sitescript" in
9619 '')     dflt=$siteprefix/script
9620         $test -d $dflt || dflt=$sitebin ;;
9621 *)  dflt="$sitescript" ;;
9622 esac
9623 fn=d~+
9624 rp='Pathname where add-on public executable scripts should be installed?'
9625 . ./getfile
9626 prefixvar=sitescript
9627 . ./setprefixvar
9628
9629 : see if backtrace exists
9630 set backtrace d_backtrace
9631 eval $inlibc
9632
9633 : add flags if using c backtrace
9634 case "$usecbacktrace" in
9635   "") usecbacktrace=$undef ;;
9636   [yY]*|true|$define)
9637     case "$d_backtrace" in
9638       [yY]*|true|$define)
9639         case " $ccflags " in
9640           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9641           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9642           esac
9643         ;;
9644       *)
9645         echo "This system does not support backtrace" >&4
9646         usecbacktrace=$undef
9647         ;;
9648       esac
9649     ;;
9650   esac
9651
9652 : Check if faststdio is requested and available
9653 case "$usefaststdio" in
9654 $define|true|[yY]*|'')
9655         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9656         case "$xversion" in
9657         [68])   dflt='y' ;;
9658         *)      dflt='n' ;;
9659         esac
9660         ;;
9661 *) dflt='n';;
9662 esac
9663 cat <<EOM
9664
9665 Perl can be built to use 'fast stdio', which means using the stdio
9666 library but also directly manipulating the stdio buffers to enable
9667 faster I/O.  Using stdio is better for backward compatibility (especially
9668 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9669 interface has been preferred instead of stdio.
9670
9671 If this doesn't make any sense to you, just accept the default '$dflt'.
9672 EOM
9673 rp='Use the "fast stdio" if available?'
9674 . ./myread
9675 case "$ans" in
9676 y|Y)    val="$define" ;;
9677 *)      val="$undef" ;;
9678 esac
9679 set usefaststdio
9680 eval $setvar
9681
9682
9683 : define an is-a-typedef? function
9684 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9685 case "$inclist" in
9686 "") inclist="sys/types.h";;
9687 esac;
9688 eval "varval=\$$var";
9689 case "$varval" in
9690 "")
9691         $rm -f temp.c;
9692         for inc in $inclist; do
9693                 echo "#include <$inc>" >>temp.c;
9694         done;
9695         echo "#ifdef $type" >> temp.c;
9696         echo "printf(\"We have $type\");" >> temp.c;
9697         echo "#endif" >> temp.c;
9698         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9699         if $contains $type temp.E >/dev/null 2>&1; then
9700                 eval "$var=\$type";
9701         else
9702                 eval "$var=\$def";
9703         fi;
9704         $rm -f temp.?;;
9705 *) eval "$var=\$varval";;
9706 esac'
9707
9708 : define an is-a-typedef? function that prompts if the type is not available.
9709 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9710 case "$inclist" in
9711 "") inclist="sys/types.h";;
9712 esac;
9713 eval "varval=\$$var";
9714 case "$varval" in
9715 "")
9716         $rm -f temp.c;
9717         for inc in $inclist; do
9718                 echo "#include <$inc>" >>temp.c;
9719         done;
9720         echo "#ifdef $type" >> temp.c;
9721         echo "printf(\"We have $type\");" >> temp.c;
9722         echo "#endif" >> temp.c;
9723         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9724         echo " " ;
9725         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9726         if $contains $type temp.E >/dev/null 2>&1; then
9727                 echo "$type found." >&4;
9728                 eval "$var=\$type";
9729         else
9730                 echo "$type NOT found." >&4;
9731                 dflt="$def";
9732                 . ./myread ;
9733                 eval "$var=\$ans";
9734         fi;
9735         $rm -f temp.?;;
9736 *) eval "$var=\$varval";;
9737 esac'
9738
9739 : see what type lseek is declared as in the kernel
9740 rp="What is the type used for lseek's offset on this system?"
9741 set off_t lseektype long stdio.h sys/types.h
9742 eval $typedef_ask
9743
9744 echo " "
9745 echo "Checking to see how big your file offsets are..." >&4
9746 $cat >try.c <<EOCP
9747 #include <sys/types.h>
9748 #include <stdio.h>
9749 int main()
9750 {
9751     printf("%d\n", (int)sizeof($lseektype));
9752     return(0);
9753 }
9754 EOCP
9755 set try
9756 if eval $compile_ok; then
9757         lseeksize=`$run ./try`
9758         echo "Your file offsets are $lseeksize bytes long."
9759 else
9760         dflt=$longsize
9761         echo " "
9762         echo "(I can't seem to compile the test program.  Guessing...)"
9763         rp="What is the size of your file offsets (in bytes)?"
9764         . ./myread
9765         lseeksize="$ans"
9766 fi
9767 $rm_try
9768
9769 : see what type file positions are declared as in the library
9770 rp="What is the type for file position used by fsetpos()?"
9771 set fpos_t fpostype long stdio.h sys/types.h
9772 eval $typedef_ask
9773
9774 : Check size for Fpos_t
9775 echo " "
9776 case "$fpostype" in
9777 *_t) zzz="$fpostype"    ;;
9778 *)   zzz="fpos_t"       ;;
9779 esac
9780 echo "Checking the size of $zzz..." >&4
9781 cat > try.c <<EOCP
9782 #include <sys/types.h>
9783 #include <stdio.h>
9784 #$i_stdlib I_STDLIB
9785 #ifdef I_STDLIB
9786 #include <stdlib.h>
9787 #endif
9788 int main() {
9789     printf("%d\n", (int)sizeof($fpostype));
9790     exit(0);
9791 }
9792 EOCP
9793 set try
9794 if eval $compile_ok; then
9795         yyy=`$run ./try`
9796         case "$yyy" in
9797         '')     fpossize=4
9798                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9799                 ;;
9800         *)      fpossize=$yyy
9801                 echo "Your $zzz is $fpossize bytes long."
9802                 ;;
9803         esac
9804 else
9805         dflt="$longsize"
9806         echo " " >&4
9807         echo "(I can't compile the test program.  Guessing...)" >&4
9808         rp="What is the size of your file positions (in bytes)?"
9809         . ./myread
9810         fpossize="$ans"
9811 fi
9812
9813 : Check for large file support
9814 # Backward compatibility (uselfs is deprecated).
9815 case "$uselfs" in
9816 "$define"|true|[yY]*)
9817         cat <<EOM >&4
9818
9819 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9820 EOM
9821         uselargefiles="$define"
9822         ;;
9823 esac
9824
9825 case "$lseeksize:$fpossize" in
9826 8:8) cat <<EOM
9827
9828 You can have files larger than 2 gigabytes.
9829 EOM
9830    val="$define" ;;
9831 *)    case "$uselargefiles" in
9832    "$undef"|false|[nN]*) dflt='n' ;;
9833    *)   dflt='y' ;;
9834    esac
9835    cat <<EOM
9836
9837 Perl can be built to understand large files (files larger than 2 gigabytes)
9838 on some systems.  To do so, Configure can be run with -Duselargefiles.
9839
9840 If this doesn't make any sense to you, just accept the default '$dflt'.
9841 EOM
9842    rp='Try to understand large files, if available?'
9843    . ./myread
9844    case "$ans" in
9845    y|Y)         val="$define" ;;
9846    *)           val="$undef"  ;;
9847    esac
9848    ;;
9849 esac
9850 set uselargefiles
9851 eval $setvar
9852 : Look for a hint-file generated 'call-back-unit'.  If the
9853 : user has specified that a large files perl is to be built,
9854 : we may need to set or change some other defaults.
9855 if $test -f uselargefiles.cbu; then
9856         echo "Your platform has some specific hints regarding large file builds, using them..."
9857         . ./uselargefiles.cbu
9858 fi
9859 case "$uselargefiles" in
9860 "$define")
9861         if $test -f uselargefiles.cbu; then
9862                 echo " "
9863                 echo "Rechecking to see how big your file offsets are..." >&4
9864                 $cat >try.c <<EOCP
9865 #include <sys/types.h>
9866 #include <stdio.h>
9867 int main()
9868 {
9869     printf("%d\n", (int)sizeof($lseektype));
9870     return(0);
9871 }
9872 EOCP
9873                 set try
9874                 if eval $compile_ok; then
9875                         lseeksize=`$run ./try`
9876                         $echo "Your file offsets are now $lseeksize bytes long."
9877                 else
9878                         dflt="$lseeksize"
9879                         echo " "
9880                         echo "(I can't seem to compile the test program.  Guessing...)"
9881                         rp="What is the size of your file offsets (in bytes)?"
9882                         . ./myread
9883                         lseeksize="$ans"
9884                 fi
9885                 case "$fpostype" in
9886                 *_t) zzz="$fpostype"    ;;
9887                 *)   zzz="fpos_t"       ;;
9888                 esac
9889                 $echo $n "Rechecking the size of $zzz...$c" >&4
9890                 $cat > try.c <<EOCP
9891 #include <sys/types.h>
9892 #include <stdio.h>
9893 #$i_stdlib I_STDLIB
9894 #ifdef I_STDLIB
9895 #include <stdlib.h>
9896 #endif
9897 int main() {
9898     printf("%d\n", (int)sizeof($fpostype));
9899     return(0);
9900 }
9901 EOCP
9902                 set try
9903                 if eval $compile_ok; then
9904                         yyy=`$run ./try`
9905                         dflt="$lseeksize"
9906                         case "$yyy" in
9907                         '')     echo " "
9908                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9909                                 ;;
9910                         *)      fpossize=$yyy
9911                                 echo " $fpossize bytes." >&4
9912                                 ;;
9913                         esac
9914                 else
9915                         dflt="$fpossize"
9916                         echo " "
9917                         echo "(I can't compile the test program.  Guessing...)" >&4
9918                         rp="What is the size of your file positions (in bytes)?"
9919                         . ./myread
9920                         fpossize="$ans"
9921                 fi
9922                 $rm_try
9923         fi
9924         ;;
9925 esac
9926
9927 : Check if we want perlio
9928 useperlio="$define"
9929
9930 : Set the vendorbin variables
9931 case "$vendorprefix" in
9932 '')     d_vendorbin="$undef"
9933         vendorbin=''
9934         vendorbinexp=''
9935         ;;
9936 *)      d_vendorbin="$define"
9937         : determine where vendor-supplied executables go.
9938         case "$vendorbin" in
9939         '') dflt=$vendorprefix/bin ;;
9940         *)      dflt="$vendorbin" ;;
9941         esac
9942         fn=d~+
9943         rp='Pathname for the vendor-supplied executables directory?'
9944         . ./getfile
9945         vendorbin="$ans"
9946         vendorbinexp="$ansexp"
9947         ;;
9948 esac
9949 prefixvar=vendorbin
9950 . ./installprefix
9951
9952 : Set the vendorhtml1dir variables
9953 case "$vendorprefix" in
9954 '')     vendorhtml1dir=''
9955         vendorhtml1direxp=''
9956         ;;
9957 *)      : determine where vendor-supplied html pages go.
9958         : There is no standard location, so try to copy the previously-selected
9959         : directory structure for the core html pages.
9960         : XXX Better default suggestions would be welcome.
9961         case "$vendorhtml1dir" in
9962         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9963         *)      dflt=$vendorhtml1dir ;;
9964         esac
9965         case "$dflt" in
9966         ''|' ') dflt=none ;;
9967         esac
9968         fn=dn+~
9969         rp='Pathname for the vendor-supplied html pages?'
9970         . ./getfile
9971         vendorhtml1dir="$ans"
9972         vendorhtml1direxp="$ansexp"
9973         ;;
9974 esac
9975 : Use ' ' for none so value is preserved next time through Configure
9976 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9977 prefixvar=vendorhtml1dir
9978 . ./installprefix
9979
9980 : Set the vendorhtml3dir variables
9981 case "$vendorprefix" in
9982 '')     vendorhtml3dir=''
9983         vendorhtml3direxp=''
9984         ;;
9985 *)      : determine where vendor-supplied module html pages go.
9986         : There is no standard location, so try to copy the previously-selected
9987         : directory structure for the core html pages.
9988         : XXX Better default suggestions would be welcome.
9989         case "$vendorhtml3dir" in
9990         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9991         *)      dflt=$vendorhtml3dir ;;
9992         esac
9993         case "$dflt" in
9994         ''|' ') dflt=none ;;
9995         esac
9996         fn=dn+~
9997         rp='Pathname for the vendor-supplied html pages?'
9998         . ./getfile
9999         vendorhtml3dir="$ans"
10000         vendorhtml3direxp="$ansexp"
10001         ;;
10002 esac
10003 : Use ' ' for none so value is preserved next time through Configure
10004 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
10005 prefixvar=vendorhtml3dir
10006 . ./installprefix
10007
10008 : Set the vendorman1dir variables
10009 case "$vendorprefix" in
10010 '')     vendorman1dir=''
10011         vendorman1direxp=''
10012         ;;
10013 *)      : determine where vendor-supplied manual pages go.
10014         case "$vendorman1dir" in
10015         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10016         *)      dflt=$vendorman1dir ;;
10017         esac
10018         case "$dflt" in
10019         ''|' ') dflt=none ;;
10020         esac
10021         fn=nd~+
10022         rp='Pathname for the vendor-supplied manual section 1 pages?'
10023         . ./getfile
10024         vendorman1dir="$ans"
10025         vendorman1direxp="$ansexp"
10026         ;;
10027 esac
10028 : Use ' ' for none so value is preserved next time through Configure
10029 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10030 prefixvar=vendorman1dir
10031 . ./installprefix
10032
10033 : Set the vendorman3dir variables
10034 case "$vendorprefix" in
10035 '')     vendorman3dir=''
10036         vendorman3direxp=''
10037         ;;
10038 *)      : determine where vendor-supplied module manual pages go.
10039         case "$vendorman3dir" in
10040         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10041         *)      dflt=$vendorman3dir ;;
10042         esac
10043         case "$dflt" in
10044         ''|' ') dflt=none ;;
10045         esac
10046         fn=nd~+
10047         rp='Pathname for the vendor-supplied manual section 3 pages?'
10048         . ./getfile
10049         vendorman3dir="$ans"
10050         vendorman3direxp="$ansexp"
10051         ;;
10052 esac
10053 : Use ' ' for none so value is preserved next time through Configure
10054 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10055 prefixvar=vendorman3dir
10056 . ./installprefix
10057
10058 : Set the vendorscript variables
10059 case "$vendorprefix" in
10060 '')     d_vendorscript="$undef"
10061         vendorscript=''
10062         vendorscriptexp=''
10063         ;;
10064 *)      d_vendorscript="$define"
10065         : determine where vendor-supplied scripts go.
10066         case "$vendorscript" in
10067         '')     dflt=$vendorprefix/script
10068                 $test -d $dflt || dflt=$vendorbin ;;
10069         *)  dflt="$vendorscript" ;;
10070         esac
10071         $cat <<EOM
10072
10073 The installation process will create a directory for
10074 vendor-supplied scripts.
10075
10076 EOM
10077         fn=d~+
10078         rp='Pathname for the vendor-supplied scripts directory?'
10079         . ./getfile
10080         vendorscript="$ans"
10081         vendorscriptexp="$ansexp"
10082         ;;
10083 esac
10084 prefixvar=vendorscript
10085 . ./installprefix
10086
10087 : script used to emit important warnings
10088 cat >warn <<EOS
10089 $startsh
10090 if test \$# -gt 0; then
10091         echo "\$@" >msg
10092 else
10093         cat >msg
10094 fi
10095 echo "*** WARNING:" >&4
10096 sed -e 's/^/*** /' <msg >&4
10097 echo "*** " >&4
10098 cat msg >>config.msg
10099 echo " " >>config.msg
10100 rm -f msg
10101 EOS
10102 chmod +x warn
10103 $eunicefix warn
10104
10105 : see which of string.h or strings.h is needed
10106 echo " "
10107 strings=`./findhdr string.h`
10108 if $test "$strings" && $test -r "$strings"; then
10109         echo "Using <string.h> instead of <strings.h>." >&4
10110         val="$define"
10111 else
10112         val="$undef"
10113         strings=`./findhdr strings.h`
10114         if $test "$strings" && $test -r "$strings"; then
10115                 echo "Using <strings.h> instead of <string.h>." >&4
10116         else
10117                 ./warn "No string header found -- You'll surely have problems."
10118         fi
10119 fi
10120 set i_string
10121 eval $setvar
10122 case "$i_string" in
10123 "$undef") strings=`./findhdr strings.h`;;
10124 *)        strings=`./findhdr string.h`;;
10125 esac
10126
10127 : see if qgcvt exists
10128 set qgcvt d_qgcvt
10129 eval $inlibc
10130
10131 : Check what kind of doubles your system has
10132 $echo "Checking the kind of doubles you have..." >&4
10133 $cat >try.c <<EOP
10134 #$i_stdlib I_STDLIB
10135 #define DOUBLESIZE $doublesize
10136 #ifdef I_STDLIB
10137 #include <stdlib.h>
10138 #endif
10139 #include <stdio.h>
10140 static const double d = -0.1;
10141 int main() {
10142   unsigned const char* b = (unsigned const char*)(&d);
10143 #if DOUBLESIZE == 4
10144   if (b[0] == 0xCD && b[3] == 0xBD) {
10145     /* IEEE 754 32-bit little-endian */
10146     printf("1\n");
10147     exit(0);
10148   }
10149   if (b[0] == 0xBD && b[3] == 0xCD) {
10150     /* IEEE 754 32-bit big-endian */
10151     printf("2\n");
10152     exit(0);
10153   }
10154 #endif
10155 #if DOUBLESIZE == 8
10156   if (b[0] == 0x9A && b[7] == 0xBF) {
10157     /* IEEE 754 64-bit little-endian */
10158     printf("3\n");
10159     exit(0);
10160   }
10161   if (b[0] == 0xBF && b[7] == 0x9A) {
10162     /* IEEE 754 64-bit big-endian */
10163     printf("4\n");
10164     exit(0);
10165   }
10166   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10167    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10168     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10169     * 99 99 b9 bf 9a 99 99 99 */
10170     printf("7\n");
10171     exit(0);
10172   }
10173   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10174    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10175     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10176     * 99 99 99 9a bf b9 99 99 */
10177     printf("8\n");
10178     exit(0);
10179   }
10180 #endif
10181 #if DOUBLESIZE == 16
10182   if (b[0] == 0x9A && b[15] == 0xBF) {
10183     /* IEEE 754 128-bit little-endian */
10184     printf("5\n");
10185     exit(0);
10186   }
10187   if (b[0] == 0xBF && b[15] == 0x9A) {
10188     /* IEEE 754 128-bit big-endian */
10189     printf("6\n");
10190     exit(0);
10191   }
10192 #endif
10193   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
10194    * Whether those environments can still build Perl is debatable. */
10195   printf("-1\n"); /* unknown */
10196   exit(0);
10197 }
10198 EOP
10199 set try
10200 if eval $compile; then
10201     doublekind=`$run ./try`
10202 else
10203     doublekind=-1
10204 fi
10205 case "$doublekind" in
10206 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10207 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10208 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10209 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10210 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10211 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10212 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10213 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10214 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
10215 esac
10216 $rm_try
10217
10218 : Check print/scan long double stuff
10219 echo " "
10220
10221 if $test X"$d_longdbl" = X"$define"; then
10222
10223 echo "Checking how to print long doubles..." >&4
10224
10225 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10226         $cat >try.c <<'EOCP'
10227 #include <sys/types.h>
10228 #include <stdio.h>
10229 int main() {
10230   double d = 123.456;
10231   printf("%.3f\n", d);
10232 }
10233 EOCP
10234         set try
10235         if eval $compile; then
10236                 yyy=`$run ./try`
10237                 case "$yyy" in
10238                 123.456)
10239                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10240                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10241                         echo "We will use %f."
10242                         ;;
10243                 esac
10244         fi
10245 fi
10246
10247 if $test X"$sPRIfldbl" = X; then
10248         $cat >try.c <<'EOCP'
10249 #include <sys/types.h>
10250 #include <stdio.h>
10251 int main() {
10252   long double d = 123.456;
10253   printf("%.3Lf\n", d);
10254 }
10255 EOCP
10256         set try
10257         if eval $compile; then
10258                 yyy=`$run ./try`
10259                 case "$yyy" in
10260                 123.456)
10261                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10262                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10263                         echo "We will use %Lf."
10264                         ;;
10265                 esac
10266         fi
10267 fi
10268
10269 if $test X"$sPRIfldbl" = X; then
10270         $cat >try.c <<'EOCP'
10271 #include <sys/types.h>
10272 #include <stdio.h>
10273 int main() {
10274   long double d = 123.456;
10275   printf("%.3llf\n", d);
10276 }
10277 EOCP
10278         set try
10279         if eval $compile; then
10280                 yyy=`$run ./try`
10281                 case "$yyy" in
10282                 123.456)
10283                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10284                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10285                         echo "We will use %llf."
10286                         ;;
10287                 esac
10288         fi
10289 fi
10290
10291 if $test X"$sPRIfldbl" = X; then
10292         $cat >try.c <<'EOCP'
10293 #include <sys/types.h>
10294 #include <stdio.h>
10295 int main() {
10296   long double d = 123.456;
10297   printf("%.3lf\n", d);
10298 }
10299 EOCP
10300         set try
10301         if eval $compile; then
10302                 yyy=`$run ./try`
10303                 case "$yyy" in
10304                 123.456)
10305                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10306                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10307                         echo "We will use %lf."
10308                         ;;
10309                 esac
10310         fi
10311 fi
10312
10313 if $test X"$sPRIfldbl" = X; then
10314         echo "Cannot figure out how to print long doubles." >&4
10315 else
10316         sSCNfldbl=$sPRIfldbl    # expect consistency
10317 fi
10318
10319 $rm_try
10320
10321 fi # d_longdbl
10322
10323 case "$sPRIfldbl" in
10324 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10325         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10326         d_SCNfldbl="$undef";
10327         ;;
10328 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10329         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10330         d_SCNfldbl="$define";
10331         ;;
10332 esac
10333
10334 : Before committing on uselongdouble, see whether that looks sane.
10335 if $test "$uselongdouble" = "$define"; then
10336     message=""
10337     echo " "
10338     echo "Checking if your long double math functions work right..." >&4
10339     $cat > try.c <<EOF
10340 #include <math.h>
10341 #include <stdio.h>
10342 int main() {
10343   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10344 }
10345 EOF
10346     case "$osname:$gccversion" in
10347     aix:)       saveccflags="$ccflags"
10348                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10349     esac
10350     set try
10351     if eval $compile_ok; then
10352       yyy=`$run ./try`
10353     fi
10354     case "$yyy" in
10355     3) echo "Your long double math functions are working correctly." >&4 ;;
10356     *) echo "Your long double math functions are broken, not using long doubles." >&4
10357        uselongdouble=$undef
10358        ;;
10359     esac
10360     $rm_try
10361     case "$osname:$gccversion" in
10362     aix:)       ccflags="$saveccflags" ;; # restore
10363     esac
10364 fi
10365
10366 : Check how to convert floats to strings.
10367
10368 if test "X$d_Gconvert" = X; then
10369
10370 echo " "
10371 echo "Checking for an efficient way to convert floats to strings."
10372 echo " " > try.c
10373 case "$uselongdouble" in
10374 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10375 esac
10376 case "$d_longdbl" in
10377 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10378 esac
10379 case "$d_PRIgldbl" in
10380 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10381 esac
10382 $cat >>try.c <<EOP
10383 #ifdef TRY_gconvert
10384 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10385 char *myname = "gconvert";
10386 #endif
10387 #ifdef TRY_gcvt
10388 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10389 char *myname = "gcvt";
10390 #endif
10391 #ifdef TRY_qgcvt
10392 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10393 char *myname = "qgcvt";
10394 #define DOUBLETYPE long double
10395 #endif
10396 #ifdef TRY_sprintf
10397 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10398 #ifdef HAS_PRIgldbl
10399 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10400 #else
10401 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10402 #endif
10403 #else
10404 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10405 #endif
10406 char *myname = "sprintf";
10407 #endif
10408
10409 #ifndef DOUBLETYPE
10410 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10411 #define DOUBLETYPE long double
10412 #else
10413 #define DOUBLETYPE double
10414 #endif
10415 #endif
10416
10417 #include <stdio.h>
10418
10419 #$i_stdlib I_STDLIB
10420 #ifdef I_STDLIB
10421 #include <stdlib.h>
10422 #endif
10423 #$i_string I_STRING
10424 #ifdef I_STRING
10425 #  include <string.h>
10426 #else
10427 #  include <strings.h>
10428 #endif
10429
10430 int checkit(char *expect, char *got)
10431 {
10432     if (strcmp(expect, got)) {
10433                 printf("%s oddity:  Expected %s, got %s\n",
10434                         myname, expect, got);
10435                 exit(1);
10436         }
10437 }
10438
10439 int main()
10440 {
10441         char buf[64];
10442         buf[63] = '\0';
10443
10444         /* This must be 1st test on (which?) platform */
10445         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10446         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10447         checkit("0.1", buf);
10448
10449         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10450         checkit("0.01", buf);
10451
10452         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10453         checkit("0.001", buf);
10454
10455         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10456         checkit("0.0001", buf);
10457
10458         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10459         if (strlen(buf) > 5)
10460             checkit("9e-005", buf); /* for Microsoft ?? */
10461         else
10462             checkit("9e-05", buf);
10463
10464         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10465         checkit("1", buf);
10466
10467         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10468         checkit("1.1", buf);
10469
10470         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10471         checkit("1.01", buf);
10472
10473         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10474         checkit("1.001", buf);
10475
10476         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10477         checkit("1.0001", buf);
10478
10479         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10480         checkit("1.00001", buf);
10481
10482         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10483         checkit("1.000001", buf);
10484
10485         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10486         checkit("0", buf);
10487
10488         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10489         checkit("-1", buf);
10490
10491         /* Some Linux gcvt's give 1.e+5 here. */
10492         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10493         checkit("100000", buf);
10494
10495         /* Some Linux gcvt's give -1.e+5 here. */
10496         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10497         checkit("-100000", buf);
10498
10499         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10500         checkit("123.456", buf);
10501
10502         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10503         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10504         /* 34 should be enough to scare even long double
10505          * places into using the e notation. */
10506         if (strlen(buf) > 5)
10507             checkit("1e+034", buf); /* for Microsoft */
10508         else
10509             checkit("1e+34", buf);
10510
10511         /* For Perl, if you add additional tests here, also add them to
10512          * t/base/num.t for benefit of platforms not using Configure or
10513          * overriding d_Gconvert */
10514
10515         exit(0);
10516 }
10517 EOP
10518 : first add preferred functions to our list
10519 xxx_list=""
10520 for xxx_convert in $gconvert_preference; do
10521     case $xxx_convert in
10522     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10523     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10524     esac
10525 done
10526 : then add any others
10527 for xxx_convert in gconvert gcvt sprintf; do
10528     case "$xxx_list" in
10529     *$xxx_convert*) ;;
10530     *) xxx_list="$xxx_list $xxx_convert" ;;
10531     esac
10532 done
10533
10534 case "$d_longdbl$uselongdouble" in
10535 "$define$define")
10536     : again, add preferred functions to our list first
10537     xxx_ld_list=""
10538     for xxx_convert in $gconvert_ld_preference; do
10539         case $xxx_convert in
10540         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10541         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10542         esac
10543     done
10544     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10545     for xxx_convert in qgcvt sprintf $xxx_list; do
10546         case "$xxx_ld_list" in
10547         $xxx_convert*|*" $xxx_convert"*) ;;
10548         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10549         esac
10550     done
10551     : if sprintf cannot do long doubles, move it to the end
10552     if test "$d_PRIgldbl" != "$define"; then
10553         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10554     fi
10555     : if no qgcvt, remove it
10556     if test "$d_qgcvt" != "$define"; then
10557         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10558     fi
10559     : use the ld_list
10560     xxx_list="$xxx_ld_list"
10561     ;;
10562 esac
10563
10564 for xxx_convert in $xxx_list; do
10565         echo "Trying $xxx_convert..."
10566         $rm -f try try$_o core
10567         set try -DTRY_$xxx_convert
10568         if eval $compile; then
10569                 echo "$xxx_convert() found." >&4
10570                 if $run ./try; then
10571                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10572                         break;
10573                 else
10574                         echo "...But $xxx_convert didn't work as I expected."
10575                         xxx_convert=''
10576                 fi
10577         else
10578                 echo "$xxx_convert NOT found." >&4
10579         fi
10580 done
10581
10582 if test X$xxx_convert = X; then
10583     echo "*** WHOA THERE!!! ***" >&4
10584     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10585     xxx_convert=sprintf
10586 fi
10587
10588 case "$xxx_convert" in
10589 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10590 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10591 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10592 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10593    "$define$define$define")
10594       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10595    "$define$define$undef")
10596       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10597    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10598    esac
10599    ;;
10600 esac
10601
10602 fi
10603 $rm_try
10604
10605 : see if _fwalk exists
10606 set fwalk d__fwalk
10607 eval $inlibc
10608
10609 : Initialize h_fcntl
10610 h_fcntl=false
10611
10612 : Initialize h_sysfile
10613 h_sysfile=false
10614
10615 : access call always available on UNIX
10616 set access d_access
10617 eval $inlibc
10618
10619 : locate the flags for 'access()'
10620 case "$d_access" in
10621 "$define")
10622         echo " "
10623         $cat >access.c <<EOCP
10624 #include <sys/types.h>
10625 #ifdef I_FCNTL
10626 #include <fcntl.h>
10627 #endif
10628 #ifdef I_SYS_FILE
10629 #include <sys/file.h>
10630 #endif
10631 #ifdef I_UNISTD
10632 #include <unistd.h>
10633 #endif
10634 #$i_stdlib I_STDLIB
10635 #ifdef I_STDLIB
10636 #include <stdlib.h>
10637 #endif
10638 int main() {
10639         exit(R_OK);
10640 }
10641 EOCP
10642         : check sys/file.h first, no particular reason here
10643         if $test `./findhdr sys/file.h` && \
10644                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10645                 h_sysfile=true;
10646                 echo "<sys/file.h> defines the *_OK access constants." >&4
10647         elif $test `./findhdr fcntl.h` && \
10648                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10649                 h_fcntl=true;
10650                 echo "<fcntl.h> defines the *_OK access constants." >&4
10651         elif $test `./findhdr unistd.h` && \
10652                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10653                 echo "<unistd.h> defines the *_OK access constants." >&4
10654         else
10655                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10656         fi
10657         ;;
10658 esac
10659 $rm -f access*
10660
10661 : see if accessx exists
10662 set accessx d_accessx
10663 eval $inlibc
10664
10665 : see if acosh exists
10666 set acosh d_acosh
10667 eval $inlibc
10668
10669 : see if aintl exists
10670 set aintl d_aintl
10671 eval $inlibc
10672
10673 : see if alarm exists
10674 set alarm d_alarm
10675 eval $inlibc
10676
10677 : see if 64bit time functions exists
10678
10679 set ctime64 d_ctime64
10680 eval $inlibc
10681
10682 set localtime64 d_localtime64
10683 eval $inlibc
10684
10685 set gmtime64 d_gmtime64
10686 eval $inlibc
10687
10688 set mktime64 d_mktime64
10689 eval $inlibc
10690
10691 set difftime64 d_difftime64
10692 eval $inlibc
10693
10694 set asctime64 d_asctime64
10695 eval $inlibc
10696
10697 : see if POSIX threads are available
10698 set pthread.h i_pthread
10699 eval $inhdr
10700
10701 : define a function to check prototypes
10702 $cat > protochk <<EOSH
10703 $startsh
10704 cc="$cc"
10705 optimize="$optimize"
10706 ccflags="$ccflags"
10707 prototype="$prototype"
10708 define="$define"
10709 rm_try="$rm_try"
10710 usethreads=$usethreads
10711 i_pthread=$i_pthread
10712 pthread_h_first=$pthread_h_first
10713 EOSH
10714
10715 $cat >> protochk <<'EOSH'
10716
10717 $rm_try
10718 foo="$1"
10719 shift
10720 while test $# -ge 2; do
10721         case "$1" in
10722                 $define) echo "#include <$2>" >> try.c ;;
10723                 literal) echo "$2" >> try.c ;;
10724         esac
10725     # Extra magic for the benefit of systems that need pthread.h
10726     # to be included early to correctly detect threadsafe functions.
10727     # Such functions must guarantee themselves, though, that the usethreads
10728     # and i_pthread have been defined, before calling protochk.
10729     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10730         echo "#include <pthread.h>" >> try.c
10731         pthread_h_done=yes
10732     fi
10733     shift 2
10734 done
10735 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10736 cat >> try.c <<'EOCP'
10737 #ifdef CAN_PROTOTYPE
10738 #define _(args) args
10739 #else
10740 #define _(args) ()
10741 #endif
10742 EOCP
10743 echo "$foo" >> try.c
10744 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10745 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10746 status=$?
10747 $rm_try
10748 exit $status
10749 EOSH
10750 chmod +x protochk
10751 $eunicefix protochk
10752
10753 : Define hasproto macro for Configure internal use
10754 hasproto='varname=$1; func=$2; shift; shift;
10755 while $test $# -ge 2; do
10756         case "$1" in
10757         $define) echo "#include <$2>";;
10758         esac ;
10759     shift 2;
10760 done > try.c;
10761 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10762 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10763         echo "$func() prototype found.";
10764         val="$define";
10765 else
10766         echo "$func() prototype NOT found.";
10767         val="$undef";
10768 fi;
10769 set $varname;
10770 eval $setvar;
10771 $rm_try tryout.c'
10772
10773 : see if sys/types.h has to be included
10774 set sys/types.h i_systypes
10775 eval $inhdr
10776
10777 : see if sys/select.h has to be included
10778 set sys/select.h i_sysselct
10779 eval $inhdr
10780
10781 : Define hasfield macro for Configure internal use
10782 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10783 while $test $# -ge 2; do
10784         case "$1" in
10785         $define) echo "#include <$2>";;
10786         esac ;
10787     shift 2;
10788 done > try.c;
10789 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10790 set try;
10791 if eval $compile; then
10792         val="$define";
10793 else
10794         val="$undef";
10795 fi;
10796 set $varname;
10797 eval $setvar;
10798 $rm_try'
10799
10800 : Define hasfield_t macro for Configure internal use
10801 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
10802 while $test $# -ge 2; do
10803         case "$1" in
10804         $define) echo "#include <$2>";;
10805         esac ;
10806     shift 2;
10807 done > try.c;
10808 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
10809 set try;
10810 if eval $compile; then
10811         val="$define";
10812 else
10813         val="$undef";
10814 fi;
10815 set $varname;
10816 eval $setvar;
10817 $rm_try'
10818
10819 : see if we should include time.h, sys/time.h, or both
10820 echo " "
10821 if test "X$timeincl" = X; then
10822         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10823         $echo $n "I'm now running the test program...$c"
10824         $cat >try.c <<EOCP
10825 #include <sys/types.h>
10826 #ifdef I_TIME
10827 #include <time.h>
10828 #endif
10829 #ifdef I_SYSTIME
10830 #ifdef SYSTIMEKERNEL
10831 #define KERNEL
10832 #endif
10833 #include <sys/time.h>
10834 #endif
10835 #ifdef I_SYSSELECT
10836 #include <sys/select.h>
10837 #endif
10838 #$i_stdlib I_STDLIB
10839 #ifdef I_STDLIB
10840 #include <stdlib.h>
10841 #endif
10842 int main()
10843 {
10844         struct tm foo;
10845 #ifdef S_TIMEVAL
10846         struct timeval bar;
10847 #endif
10848 #ifdef S_TIMEZONE
10849         struct timezone tzp;
10850 #endif
10851         if (foo.tm_sec == foo.tm_sec)
10852                 exit(0);
10853 #ifdef S_TIMEVAL
10854         if (bar.tv_sec == bar.tv_sec)
10855                 exit(0);
10856 #endif
10857         exit(1);
10858 }
10859 EOCP
10860         flags=''
10861         for s_timezone in '-DS_TIMEZONE' ''; do
10862         sysselect=''
10863         for s_timeval in '-DS_TIMEVAL' ''; do
10864         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10865         for i_time in '' '-DI_TIME'; do
10866         for i_systime in '-DI_SYSTIME' ''; do
10867                 case "$flags" in
10868                 '') $echo $n ".$c"
10869                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10870                         if eval $compile; then
10871                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10872                                 shift
10873                                 flags="$*"
10874                                 echo " "
10875                                 $echo $n "Succeeded with $flags$c"
10876                         fi
10877                         ;;
10878                 esac
10879         done
10880         done
10881         done
10882         done
10883         done
10884         timeincl=''
10885         echo " "
10886         case "$flags" in
10887         *SYSTIMEKERNEL*) i_systimek="$define"
10888                 timeincl=`./findhdr sys/time.h`
10889                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10890         *) i_systimek="$undef";;
10891         esac
10892         case "$flags" in
10893         *I_TIME*) i_time="$define"
10894                 timeincl=`./findhdr time.h`" $timeincl"
10895                 echo "We'll include <time.h>." >&4;;
10896         *) i_time="$undef";;
10897         esac
10898         case "$flags" in
10899         *I_SYSTIME*) i_systime="$define"
10900                 timeincl=`./findhdr sys/time.h`" $timeincl"
10901                 echo "We'll include <sys/time.h>." >&4;;
10902         *) i_systime="$undef";;
10903         esac
10904         $rm_try
10905 fi
10906 : see if struct tm knows about tm_zone
10907 case "$i_systime$i_time" in
10908 *$define*)
10909         echo " "
10910         echo "Checking to see if your struct tm has tm_zone field..." >&4
10911         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10912         eval $hasfield
10913         ;;
10914 *)      val="$undef"
10915         set d_tm_tm_zone
10916         eval $setvar
10917         ;;
10918 esac
10919 case "$d_tm_tm_zone" in
10920 "$define")      echo "Yes, it does."   ;;
10921 *)              echo "No, it doesn't." ;;
10922 esac
10923 : see if struct tm knows about tm_gmtoff
10924 case "$i_systime$i_time" in
10925 *$define*)
10926         echo " "
10927         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10928         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10929         eval $hasfield
10930         ;;
10931 *)      val="$undef"
10932         set d_tm_tm_gmtoff
10933         eval $setvar
10934         ;;
10935 esac
10936 case "$d_tm_tm_gmtoff" in
10937 "$define")      echo "Yes, it does."   ;;
10938 *)              echo "No, it doesn't." ;;
10939 esac
10940
10941 : see if asctime_r exists
10942 set asctime_r d_asctime_r
10943 eval $inlibc
10944 case "$d_asctime_r" in
10945 "$define")
10946         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10947         case "$d_asctime_r_proto:$usethreads" in
10948         ":define")      d_asctime_r_proto=define
10949                 set d_asctime_r_proto asctime_r $hdrs
10950                 eval $hasproto ;;
10951         *)      ;;
10952         esac
10953         case "$d_asctime_r_proto" in
10954         define)
10955         case "$asctime_r_proto" in
10956         ''|0) try='char* asctime_r(const struct tm*, char*);'
10957         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10958         esac
10959         case "$asctime_r_proto" in
10960         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10961         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10962         esac
10963         case "$asctime_r_proto" in
10964         ''|0) try='int asctime_r(const struct tm*, char*);'
10965         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10966         esac
10967         case "$asctime_r_proto" in
10968         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10969         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10970         esac
10971         case "$asctime_r_proto" in
10972         ''|0)   d_asctime_r=undef
10973                 asctime_r_proto=0
10974                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10975         * )     case "$asctime_r_proto" in
10976                 REENTRANT_PROTO*) ;;
10977                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10978                 esac
10979                 echo "Prototype: $try" ;;
10980         esac
10981         ;;
10982         *)      case "$usethreads" in
10983                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10984                 esac
10985                 d_asctime_r=undef
10986                 asctime_r_proto=0
10987                 ;;
10988         esac
10989         ;;
10990 *)      asctime_r_proto=0
10991         ;;
10992 esac
10993
10994 : see if asinh exists
10995 set asinh d_asinh
10996 eval $inlibc
10997
10998 : see if atanh exists
10999 set atanh d_atanh
11000 eval $inlibc
11001
11002 : see if atolf exists
11003 set atolf d_atolf
11004 eval $inlibc
11005
11006 : see if atoll exists
11007 set atoll d_atoll
11008 eval $inlibc
11009
11010 : Look for GCC-style attribute format
11011 case "$d_attribute_format" in
11012 '')
11013 echo " "
11014 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11015 $cat >attrib.c <<'EOCP'
11016 #include <stdio.h>
11017 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11018 EOCP
11019 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11020         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11021                 echo "Your C compiler doesn't support __attribute__((format))."
11022                 val="$undef"
11023         else
11024                 echo "Your C compiler supports __attribute__((format))."
11025                 val="$define"
11026         fi
11027 else
11028         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11029         val="$undef"
11030 fi
11031 ;;
11032 *) val="$d_attribute_format" ;;
11033 esac
11034 set d_attribute_format
11035 eval $setvar
11036 $rm -f attrib*
11037
11038 : Look for GCC-style attribute format with null format allowed
11039 case "$d_printf_format_null" in
11040 '') case "$d_attribute_format" in
11041     $define)
11042         echo " "
11043         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11044 $cat >attrib.c <<EOCP
11045 #include <stdio.h>
11046 #$i_stdlib I_STDLIB
11047 #ifdef I_STDLIB
11048 #include <stdlib.h>
11049 #endif
11050 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11051 int null_printf (char* pat,...) { return (int)pat; }
11052 int main () { exit(null_printf(NULL)); }
11053 EOCP
11054         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11055             : run the executable in case it produces a run-time warning
11056             if $run ./attrib >>attrib.out 2>&1; then
11057                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
11058                     echo "Your C compiler doesn't allow __printf__ format to be null."
11059                     val="$undef"
11060                 else
11061                     echo "Your C compiler allows __printf__ format to be null."
11062                     val="$define"
11063                 fi
11064             else
11065             echo "Your C compiler executable failed with __printf__ format null."
11066             val="$undef"
11067         fi
11068     else
11069         echo "Your C compiler fails with __printf__ format null."
11070         val="$undef"
11071     fi
11072     ;;
11073     *)  val="$undef" ;;
11074     esac
11075 ;;
11076 *)  val="$d_printf_format_null" ;;
11077 esac
11078 set d_printf_format_null
11079 eval $setvar
11080 $rm -f attrib*
11081
11082 : Look for GCC-style attribute malloc
11083 case "$d_attribute_malloc" in
11084 '')
11085 echo " "
11086 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11087 $cat >attrib.c <<'EOCP'
11088 #include <stdio.h>
11089 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11090 EOCP
11091 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11092         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11093                 echo "Your C compiler doesn't support __attribute__((malloc))."
11094                 val="$undef"
11095         else
11096                 echo "Your C compiler supports __attribute__((malloc))."
11097                 val="$define"
11098         fi
11099 else
11100         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11101         val="$undef"
11102 fi
11103 ;;
11104 *) val="$d_attribute_malloc" ;;
11105 esac
11106 set d_attribute_malloc
11107 eval $setvar
11108 $rm -f attrib*
11109
11110 : Look for GCC-style attribute nonnull
11111 case "$d_attribute_nonnull" in
11112 '')
11113 echo " "
11114 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11115 $cat >attrib.c <<'EOCP'
11116 #include <stdio.h>
11117 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11118 EOCP
11119 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11120         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11121                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11122                 val="$undef"
11123         else
11124                 echo "Your C compiler supports __attribute__((nonnull))."
11125                 val="$define"
11126         fi
11127 else
11128         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11129         val="$undef"
11130 fi
11131 ;;
11132 *) val="$d_attribute_nonnull" ;;
11133 esac
11134 set d_attribute_nonnull
11135 eval $setvar
11136 $rm -f attrib*
11137
11138 : Look for GCC-style attribute noreturn
11139 case "$d_attribute_noreturn" in
11140 '')
11141 echo " "
11142 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11143 $cat >attrib.c <<'EOCP'
11144 #include <stdio.h>
11145 void fall_over_dead( void ) __attribute__((noreturn));
11146 EOCP
11147 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11148         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11149                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11150                 val="$undef"
11151         else
11152                 echo "Your C compiler supports __attribute__((noreturn))."
11153                 val="$define"
11154         fi
11155 else
11156         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11157         val="$undef"
11158 fi
11159 ;;
11160 *) val="$d_attribute_noreturn" ;;
11161 esac
11162 set d_attribute_noreturn
11163 eval $setvar
11164 $rm -f attrib*
11165
11166 : Look for GCC-style attribute pure
11167 case "$d_attribute_pure" in
11168 '')
11169 echo " "
11170 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11171 $cat >attrib.c <<'EOCP'
11172 #include <stdio.h>
11173 int square( int n ) __attribute__((pure));
11174 EOCP
11175 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11176         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11177                 echo "Your C compiler doesn't support __attribute__((pure))."
11178                 val="$undef"
11179         else
11180                 echo "Your C compiler supports __attribute__((pure))."
11181                 val="$define"
11182         fi
11183 else
11184         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11185         val="$undef"
11186 fi
11187 ;;
11188 *) val="$d_attribute_pure" ;;
11189 esac
11190 set d_attribute_pure
11191 eval $setvar
11192 $rm -f attrib*
11193
11194 : Look for GCC-style attribute unused
11195 case "$d_attribute_unused" in
11196 '')
11197 echo " "
11198 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11199 $cat >attrib.c <<'EOCP'
11200 #include <stdio.h>
11201 int do_something( int dummy __attribute__((unused)), int n );
11202 EOCP
11203 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11204         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11205                 echo "Your C compiler doesn't support __attribute__((unused))."
11206                 val="$undef"
11207         else
11208                 echo "Your C compiler supports __attribute__((unused))."
11209                 val="$define"
11210         fi
11211 else
11212         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11213         val="$undef"
11214 fi
11215 ;;
11216 *) val="$d_attribute_unused" ;;
11217 esac
11218 set d_attribute_unused
11219 eval $setvar
11220 $rm -f attrib*
11221
11222 : Look for GCC-style attribute deprecated
11223 case "$d_attribute_deprecated" in
11224 '')
11225 echo " "
11226 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11227 $cat >attrib.c <<'EOCP'
11228 #include <stdio.h>
11229 int I_am_deprecated(void) __attribute__((deprecated));
11230 EOCP
11231 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11232         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11233                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11234                 val="$undef"
11235         else
11236                 echo "Your C compiler supports __attribute__((deprecated))."
11237                 val="$define"
11238         fi
11239 else
11240         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11241         val="$undef"
11242 fi
11243 ;;
11244 *) val="$d_attribute_deprecated" ;;
11245 esac
11246 set d_attribute_deprecated
11247 eval $setvar
11248 $rm -f attrib*
11249
11250 : Look for GCC-style attribute warn_unused_result
11251 case "$d_attribute_warn_unused_result" in
11252 '')
11253 echo " "
11254 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11255 $cat >attrib.c <<'EOCP'
11256 #include <stdio.h>
11257 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11258 EOCP
11259 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11260         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11261                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11262                 val="$undef"
11263         else
11264                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11265                 val="$define"
11266         fi
11267 else
11268         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11269         val="$undef"
11270 fi
11271 ;;
11272 *) val="$d_attribute_warn_unused_result" ;;
11273 esac
11274 set d_attribute_warn_unused_result
11275 eval $setvar
11276 $rm -f attrib*
11277
11278 : see if bcmp exists
11279 set bcmp d_bcmp
11280 eval $inlibc
11281
11282 : see if bcopy exists
11283 set bcopy d_bcopy
11284 eval $inlibc
11285
11286 : see if getpgrp exists
11287 set getpgrp d_getpgrp
11288 eval $inlibc
11289
11290 case "$d_getpgrp" in
11291 "$define")
11292         echo " "
11293         echo "Checking to see which flavor of getpgrp is in use..."
11294         $cat >try.c <<EOP
11295 #$i_unistd I_UNISTD
11296 #include <sys/types.h>
11297 #ifdef I_UNISTD
11298 #  include <unistd.h>
11299 #endif
11300 #$i_stdlib I_STDLIB
11301 #ifdef I_STDLIB
11302 #include <stdlib.h>
11303 #endif
11304 int main()
11305 {
11306         if (getuid() == 0) {
11307                 printf("(I see you are running Configure as super-user...)\n");
11308                 setuid(1);
11309         }
11310 #ifdef TRY_BSD_PGRP
11311         if (getpgrp(1) == 0)
11312                 exit(0);
11313 #else
11314         if (getpgrp() > 0)
11315                 exit(0);
11316 #endif
11317         exit(1);
11318 }
11319 EOP
11320         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11321                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11322                 val="$define"
11323         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11324                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11325                 val="$undef"
11326         else
11327                 echo "I can't seem to compile and run the test program."
11328                 if ./usg; then
11329                         xxx="a USG one, i.e. you use getpgrp()."
11330                 else
11331                         # SVR4 systems can appear rather BSD-ish.
11332                         case "$i_unistd" in
11333                         $undef)
11334                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11335                                 val="$define"
11336                                 ;;
11337                         $define)
11338                                 xxx="probably a USG one, i.e. you use getpgrp()."
11339                                 val="$undef"
11340                                 ;;
11341                         esac
11342                 fi
11343                 echo "Assuming your getpgrp is $xxx" >&4
11344         fi
11345         ;;
11346 *) val="$undef";;
11347 esac
11348 set d_bsdgetpgrp
11349 eval $setvar
11350 $rm_try
11351
11352 : see if setpgrp exists
11353 set setpgrp d_setpgrp
11354 eval $inlibc
11355
11356 case "$d_setpgrp" in
11357 "$define")
11358         echo " "
11359         echo "Checking to see which flavor of setpgrp is in use..."
11360         $cat >try.c <<EOP
11361 #$i_unistd I_UNISTD
11362 #include <sys/types.h>
11363 #ifdef I_UNISTD
11364 #  include <unistd.h>
11365 #endif
11366 #$i_stdlib I_STDLIB
11367 #ifdef I_STDLIB
11368 #include <stdlib.h>
11369 #endif
11370 int main()
11371 {
11372         if (getuid() == 0) {
11373                 printf("(I see you are running Configure as super-user...)\n");
11374                 setuid(1);
11375         }
11376 #ifdef TRY_BSD_PGRP
11377         if (-1 == setpgrp(1, 1))
11378                 exit(0);
11379 #else
11380         if (setpgrp() != -1)
11381                 exit(0);
11382 #endif
11383         exit(1);
11384 }
11385 EOP
11386         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11387                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11388                 val="$define"
11389         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11390                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11391                 val="$undef"
11392         else
11393                 echo "(I can't seem to compile and run the test program.)"
11394                 if ./usg; then
11395                         xxx="a USG one, i.e. you use setpgrp()."
11396                 else
11397                         # SVR4 systems can appear rather BSD-ish.
11398                         case "$i_unistd" in
11399                         $undef)
11400                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11401                                 val="$define"
11402                                 ;;
11403                         $define)
11404                                 xxx="probably a USG one, i.e. you use setpgrp()."
11405                                 val="$undef"
11406                                 ;;
11407                         esac
11408                 fi
11409                 echo "Assuming your setpgrp is $xxx" >&4
11410         fi
11411         ;;
11412 *) val="$undef";;
11413 esac
11414 set d_bsdsetpgrp
11415 eval $setvar
11416 $rm_try
11417
11418 : Look for GCC-style __builtin_choose_expr
11419 case "$d_builtin_choose_expr" in
11420 '')
11421     echo " "
11422     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11423     $cat >try.c <<'EOCP'
11424 #include <assert.h>
11425 #include <stdlib.h>
11426 #include <stdio.h>
11427
11428 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11429
11430 int main(void) {
11431     assert( SYRINX(1) == 2112 );
11432     assert( SYRINX(1) != 5150 );
11433     assert( SYRINX(0) == 5150 );
11434     assert( SYRINX(0) != 2112 );
11435     puts( "All good!" );
11436     exit(0);
11437 }
11438
11439 EOCP
11440     set try
11441     if eval $compile && $run ./try; then
11442         echo "Your C compiler supports __builtin_choose_expr."
11443         val="$define"
11444     else
11445         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11446         val="$undef"
11447     fi
11448 ;;
11449 *) val="$d_builtin_choose_expr" ;;
11450 esac
11451
11452 set d_builtin_choose_expr
11453 eval $setvar
11454 $rm_try
11455
11456 : Look for GCC-style __builtin_expect
11457 case "$d_builtin_expect" in
11458 '')
11459     echo " "
11460     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11461     $cat >try.c <<'EOCP'
11462 int main(void) {
11463     int n = 50;
11464     if ( __builtin_expect(n, 0) ) n = 1;
11465     /* Remember shell exit code truth is 0, C truth is non-zero */
11466     return !(n == 1);
11467 }
11468 EOCP
11469     set try
11470     if eval $compile && $run ./try; then
11471         echo "Your C compiler supports __builtin_expect."
11472         val="$define"
11473     else
11474         echo "Your C compiler doesn't seem to understand __builtin_expect."
11475         val="$undef"
11476     fi
11477     ;;
11478 *) val="$d_builtin_expect" ;;
11479 esac
11480
11481 set d_builtin_expect
11482 eval $setvar
11483 $rm_try
11484
11485 : see if bzero exists
11486 set bzero d_bzero
11487 eval $inlibc
11488
11489 : see if stdarg is available
11490 echo " "
11491 if $test `./findhdr stdarg.h`; then
11492         echo "<stdarg.h> found." >&4
11493         valstd="$define"
11494 else
11495         echo "<stdarg.h> NOT found." >&4
11496         valstd="$undef"
11497 fi
11498
11499 : see if varargs is available
11500 echo " "
11501 if $test `./findhdr varargs.h`; then
11502         echo "<varargs.h> found." >&4
11503 else
11504         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11505 fi
11506
11507 : set up the varargs testing programs
11508 $cat > varargs.c <<EOP
11509 #ifdef I_STDARG
11510 #include <stdarg.h>
11511 #endif
11512 #ifdef I_VARARGS
11513 #include <varargs.h>
11514 #endif
11515
11516 #ifdef I_STDARG
11517 int f(char *p, ...)
11518 #else
11519 int f(va_alist)
11520 va_dcl
11521 #endif
11522 {
11523         va_list ap;
11524 #ifndef I_STDARG
11525         char *p;
11526 #endif
11527 #ifdef I_STDARG
11528         va_start(ap,p);
11529 #else
11530         va_start(ap);
11531         p = va_arg(ap, char *);
11532 #endif
11533         va_end(ap);
11534         return 0;
11535 }
11536 EOP
11537 $cat > varargs <<EOP
11538 $startsh
11539 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11540         echo "true"
11541 else
11542         echo "false"
11543 fi
11544 $rm -f varargs$_o
11545 EOP
11546 chmod +x varargs
11547
11548 : now check which varargs header should be included
11549 echo " "
11550 i_varhdr=''
11551 val=''
11552 case "$valstd" in
11553 "$define")
11554         if `./varargs I_STDARG`; then
11555                 val='stdarg.h'
11556         elif `./varargs I_VARARGS`; then
11557                 val='varargs.h'
11558         fi
11559         ;;
11560 *)
11561         if `./varargs I_VARARGS`; then
11562                 val='varargs.h'
11563         fi
11564         ;;
11565 esac
11566 case "$val" in
11567 '')
11568         echo " "
11569         echo "*** WHOA THERE!!! ***" >&4
11570         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11571         case "$knowitall" in
11572         '')
11573         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11574                 exit 1
11575                 ;;
11576         esac
11577 echo "I could not find the definition for va_dcl... You have problems..." >&4
11578         val="$undef"; set i_stdarg; eval $setvar
11579         val="$undef"; set i_varargs; eval $setvar
11580         ;;
11581 *)
11582         set i_varhdr
11583         eval $setvar
11584         case "$i_varhdr" in
11585         stdarg.h)
11586                 val="$define"; set i_stdarg; eval $setvar
11587                 val="$undef"; set i_varargs; eval $setvar
11588                 ;;
11589         varargs.h)
11590                 val="$undef"; set i_stdarg; eval $setvar
11591                 val="$define"; set i_varargs; eval $setvar
11592                 ;;
11593         esac
11594         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11595 esac
11596 $rm -f varargs*
11597
11598 : see if the Compiler supports C99 variadic macros
11599 case "$i_stdarg$i_stdlib" in
11600     "$define$define")
11601     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11602     $cat >try.c <<EOCP
11603 #include <stdio.h>
11604 #include <stdarg.h>
11605
11606 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11607
11608 int main() {
11609   char buf[20];
11610   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11611   puts(buf);
11612   return 0;
11613 }
11614 EOCP
11615     set try
11616     if eval $compile && $run ./try 2>&1 >/dev/null; then
11617         case "`$run ./try`" in
11618             "123 456 789")
11619             echo "You have C99 variadic macros." >&4
11620             d_c99_variadic_macros="$define"
11621             ;;
11622             *)
11623             echo "You don't have functional C99 variadic macros." >&4
11624             d_c99_variadic_macros="$undef"
11625             ;;
11626         esac
11627     else
11628         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11629         d_c99_variadic_macros="$undef"
11630     fi
11631     $rm_try
11632     ;;
11633     *)
11634     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11635     d_c99_variadic_macros="$undef"
11636     ;;
11637 esac
11638
11639 : see if signal is declared as pointer to function returning int or void
11640 echo " "
11641 xxx=`./findhdr signal.h`
11642 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11643 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11644         echo "You have int (*signal())() instead of void." >&4
11645         val="$undef"
11646 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11647         echo "You have void (*signal())()." >&4
11648         val="$define"
11649 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11650         echo "You have int (*signal())() instead of void." >&4
11651         val="$undef"
11652 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11653         echo "You have void (*signal())()." >&4
11654         val="$define"
11655 else
11656         case "$d_voidsig" in
11657         '')
11658         echo "I can't determine whether signal handler returns void or int..." >&4
11659                 dflt=void
11660                 rp="What type does your signal handler return?"
11661                 . ./myread
11662                 case "$ans" in
11663                 v*) val="$define";;
11664                 *) val="$undef";;
11665                 esac;;
11666         "$define")
11667                 echo "As you already told me, signal handler returns void." >&4
11668                 val="$define"
11669                 ;;
11670         *)      echo "As you already told me, signal handler returns int." >&4
11671                 val="$undef"
11672                 ;;
11673         esac
11674 fi
11675 set d_voidsig
11676 eval $setvar
11677 case "$d_voidsig" in
11678 "$define") signal_t="void";;
11679 *) signal_t="int";;
11680 esac
11681 $rm -f $$.tmp
11682
11683 : check for ability to cast large floats to 32-bit ints.
11684 echo " "
11685 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11686 if $test "$intsize" -ge 4; then
11687         xxx=int
11688 else
11689         xxx=long
11690 fi
11691 $cat >try.c <<EOCP
11692 #include <stdio.h>
11693 #$i_stdlib I_STDLIB
11694 #ifdef I_STDLIB
11695 #include <stdlib.h>
11696 #endif
11697 #include <sys/types.h>
11698 #include <signal.h>
11699 $signal_t blech(int s) { exit(3); }
11700 int main()
11701 {
11702         $xxx i32;
11703         double f, g;
11704         int result = 0;
11705         char str[16];
11706         signal(SIGFPE, blech);
11707
11708         /* Don't let compiler optimize the test away.  Store the number
11709            in a writable string for gcc to pass to sscanf under HP-UX.
11710         */
11711         sprintf(str, "2147483647");
11712         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11713         g = 10 * f;
11714         i32  = ($xxx) g;
11715
11716         /* x86 processors will probably give 0x8000 0000, which is a
11717            sign change.  We don't want that.  We want to mimic SPARC
11718            behavior here, which is to preserve the sign and give
11719            back 0x7fff ffff.
11720         */
11721         if (i32 != ($xxx) f)
11722                 result |= 1;
11723         exit(result);
11724 }
11725 EOCP
11726 set try
11727 if eval $compile_ok; then
11728         $run ./try 2>/dev/null
11729         yyy=$?
11730 else
11731         echo "(I can't seem to compile the test program--assuming it can't)"
11732         yyy=1
11733 fi
11734 case "$yyy" in
11735 0)      val="$define"
11736         echo "Yup, it can."
11737         ;;
11738 *)      val="$undef"
11739         echo "Nope, it can't."
11740         ;;
11741 esac
11742 set d_casti32
11743 eval $setvar
11744 $rm_try
11745
11746 : check for ability to cast negative floats to unsigned
11747 echo " "
11748 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11749 $cat >try.c <<EOCP
11750 #include <stdio.h>
11751 #$i_stdlib I_STDLIB
11752 #ifdef I_STDLIB
11753 #include <stdlib.h>
11754 #endif
11755 #include <sys/types.h>
11756 #include <signal.h>
11757 $signal_t blech(int s) { exit(7); }
11758 $signal_t blech_in_list(int s) { exit(4); }
11759 unsigned long dummy_long(unsigned long p) { return p; }
11760 unsigned int dummy_int(unsigned int p) { return p; }
11761 unsigned short dummy_short(unsigned short p) { return p; }
11762 int main()
11763 {
11764         double f;
11765         unsigned long along;
11766         unsigned int aint;
11767         unsigned short ashort;
11768         int result = 0;
11769         char str[16];
11770
11771         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11772            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11773            optimized the whole file away
11774         */
11775         /* Store the number in a writable string for gcc to pass to
11776            sscanf under HP-UX.
11777         */
11778         sprintf(str, "-123");
11779         sscanf(str, "%lf", &f);  /* f = -123.; */
11780
11781         signal(SIGFPE, blech);
11782         along = (unsigned long)f;
11783         aint = (unsigned int)f;
11784         ashort = (unsigned short)f;
11785         if (along != (unsigned long)-123)
11786                 result |= 1;
11787         if (aint != (unsigned int)-123)
11788                 result |= 1;
11789         if (ashort != (unsigned short)-123)
11790                 result |= 1;
11791         sprintf(str, "1073741824.");
11792         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11793         f = f + f;
11794         along = 0;
11795         along = (unsigned long)f;
11796         if (along != 0x80000000)
11797                 result |= 2;
11798         f -= 1.;
11799         along = 0;
11800         along = (unsigned long)f;
11801         if (along != 0x7fffffff)
11802                 result |= 1;
11803         f += 2.;
11804         along = 0;
11805         along = (unsigned long)f;
11806         if (along != 0x80000001)
11807                 result |= 2;
11808         if (result)
11809                 exit(result);
11810         signal(SIGFPE, blech_in_list);
11811         sprintf(str, "123.");
11812         sscanf(str, "%lf", &f);  /* f = 123.; */
11813         along = dummy_long((unsigned long)f);
11814         aint = dummy_int((unsigned int)f);
11815         ashort = dummy_short((unsigned short)f);
11816         if (along != (unsigned long)123)
11817                 result |= 4;
11818         if (aint != (unsigned int)123)
11819                 result |= 4;
11820         if (ashort != (unsigned short)123)
11821                 result |= 4;
11822         exit(result);
11823
11824 }
11825 EOCP
11826 set try
11827 if eval $compile_ok; then
11828         $run ./try 2>/dev/null
11829         castflags=$?
11830 else
11831         echo "(I can't seem to compile the test program--assuming it can't)"
11832         castflags=7
11833 fi
11834 case "$castflags" in
11835 0)      val="$define"
11836         echo "Yup, it can."
11837         ;;
11838 *)      val="$undef"
11839         echo "Nope, it can't."
11840         ;;
11841 esac
11842 set d_castneg
11843 eval $setvar
11844 $rm_try
11845
11846 : see if cbrt exists
11847 set cbrt d_cbrt
11848 eval $inlibc
11849
11850 : see if vprintf exists
11851 echo " "
11852 if set vprintf val -f d_vprintf; eval $csym; $val; then
11853         echo 'vprintf() found.' >&4
11854         val="$define"
11855         $cat >try.c <<EOF
11856 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11857 #$i_varargs I_VARARGS
11858
11859 #$i_stdlib I_STDLIB
11860 #$i_unistd I_UNISTD
11861
11862 #ifdef I_STDARG
11863 #  include <stdarg.h>
11864 #else /* I_VARARGS */
11865 #  include <varargs.h>
11866 #endif
11867
11868 #ifdef I_UNISTD
11869 #  include <unistd.h>
11870 #endif
11871
11872 #ifdef I_STDLIB
11873 #  include <stdlib.h>
11874 #endif
11875
11876 #include <stdio.h> /* vsprintf prototype */
11877
11878 #ifdef I_STDARG
11879 void xxx(int n, ...)
11880 {
11881     va_list args;
11882     char buf[10];
11883     va_start(args, n);
11884     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11885 }
11886 int main() { xxx(1, "foo"); }
11887
11888 #else /* I_VARARGS */
11889
11890 xxx(va_alist)
11891 va_dcl
11892 {
11893     va_list args;
11894     char buf[10];
11895     va_start(args);
11896     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11897 }
11898 int main() { xxx("foo"); }
11899
11900 #endif
11901
11902 EOF
11903         set try
11904         if eval $compile_ok; then
11905                 if $run ./try; then
11906                         echo "Your vsprintf() returns (int)." >&4
11907                         val2="$undef"
11908                 else
11909                         echo "Your vsprintf() returns (char*)." >&4
11910                         val2="$define"
11911                 fi
11912         else
11913                 echo 'I am unable to compile the vsprintf() test program.' >&4
11914                 # We shouldn't get here.  If we do, assume the standard signature,
11915                 # not the old BSD one.
11916                 echo 'Guessing that vsprintf() returns (int).' >&4
11917                 val2="$undef"
11918         fi
11919 else
11920         echo 'vprintf() NOT found.' >&4
11921         val="$undef"
11922         val2="$undef"
11923 fi
11924 $rm_try
11925 set d_vprintf
11926 eval $setvar
11927 val=$val2
11928 set d_charvspr
11929 eval $setvar
11930
11931 : see if chown exists
11932 set chown d_chown
11933 eval $inlibc
11934
11935 : see if chroot exists
11936 set chroot d_chroot
11937 eval $inlibc
11938
11939 : see if chsize exists
11940 set chsize d_chsize
11941 eval $inlibc
11942
11943 : see if class exists
11944 set class d_class
11945 eval $inlibc
11946
11947 : see if clearenv exists
11948 set clearenv d_clearenv
11949 eval $inlibc
11950
11951 : Define hasstruct macro for Configure internal use
11952 hasstruct='varname=$1; struct=$2; shift; shift;
11953 while $test $# -ge 2; do
11954         case "$1" in
11955         $define) echo "#include <$2>";;
11956         esac ;
11957     shift 2;
11958 done > try.c;
11959 echo "int main () { struct $struct foo; }" >> try.c;
11960 set try;
11961 if eval $compile; then
11962         val="$define";
11963 else
11964         val="$undef";
11965 fi;
11966 set $varname;
11967 eval $setvar;
11968 $rm_try'
11969
11970 : see whether socket exists
11971 socketlib=''
11972 sockethdr=''
11973 echo " "
11974 $echo $n "Hmm... $c" >&4
11975 if set socket val -f d_socket; eval $csym; $val; then
11976     echo "Looks like you have Berkeley networking support." >&4
11977     d_socket="$define"
11978     if set setsockopt val -f; eval $csym; $val; then
11979         d_oldsock="$undef"
11980     else
11981         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11982         d_oldsock="$define"
11983     fi
11984 else
11985     if $contains socklib libc.list >/dev/null 2>&1; then
11986         echo "Looks like you have Berkeley networking support." >&4
11987         d_socket="$define"
11988         : we will have to assume that it supports the 4.2 BSD interface
11989         d_oldsock="$undef"
11990     else
11991         echo "You don't have Berkeley networking in libc$_a..." >&4
11992         if test "X$d_socket" = "X$define"; then
11993             echo "...but you seem to believe that you have sockets." >&4
11994         else
11995             for net in net socket
11996             do
11997                 if test -f $sysroot/usr/lib/lib$net$_a; then
11998                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11999                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
12000                     if $contains socket libc.list >/dev/null 2>&1; then
12001                         d_socket="$define"
12002                         socketlib="-l$net"
12003                         case "$net" in
12004                         net)
12005                             echo "...but the Wollongong group seems to have hacked it in." >&4
12006                             sockethdr="-I$sysroot/usr/netinclude"
12007                             ;;
12008                         esac
12009                         echo "Found Berkeley sockets interface in lib$net." >&4
12010                         if $contains setsockopt libc.list >/dev/null 2>&1; then
12011                             d_oldsock="$undef"
12012                         else
12013                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
12014                             d_oldsock="$define"
12015                         fi
12016                         break
12017                     fi
12018                 fi
12019             done
12020             if test "X$d_socket" != "X$define"; then
12021                echo "or anywhere else I see." >&4
12022                d_socket="$undef"
12023                d_oldsock="$undef"
12024             fi
12025         fi
12026     fi
12027 fi
12028
12029 : see if socketpair exists
12030 set socketpair d_sockpair
12031 eval $inlibc
12032
12033
12034 echo " "
12035 echo "Checking the availability sa_len in the sock struct ..." >&4
12036 $cat >try.c <<EOF
12037 #include <sys/types.h>
12038 #include <sys/socket.h>
12039 int main() {
12040 struct sockaddr sa;
12041 return (sa.sa_len);
12042 }
12043 EOF
12044 val="$undef"
12045 set try; if eval $compile; then
12046     val="$define"
12047 fi
12048 set d_sockaddr_sa_len; eval $setvar
12049 $rm_try
12050
12051 echo " "
12052 echo "Checking the availability struct sockaddr_in6 ..." >&4
12053 $cat >try.c <<EOF
12054 #include <sys/types.h>
12055 #include <sys/socket.h>
12056 #include <netinet/in.h>
12057 int main() {
12058 struct sockaddr_in6 sin6;
12059 return (sin6.sin6_family);
12060 }
12061 EOF
12062 val="$undef"
12063 set try; if eval $compile; then
12064     val="$define"
12065 fi
12066 set d_sockaddr_in6; eval $setvar
12067 $rm_try
12068
12069 echo " "
12070 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12071 $cat >try.c <<EOF
12072 #include <sys/types.h>
12073 #include <sys/socket.h>
12074 #include <netinet/in.h>
12075 int main() {
12076 struct sockaddr_in6 sin6;
12077 return (sin6.sin6_scope_id);
12078 }
12079 EOF
12080 val="$undef"
12081 set try; if eval $compile; then
12082     val="$define"
12083 fi
12084 set d_sin6_scope_id; eval $setvar
12085 $rm_try
12086
12087 echo " "
12088 echo "Checking the availability struct ip_mreq ..." >&4
12089 $cat >try.c <<EOF
12090 #include <sys/types.h>
12091 #include <sys/socket.h>
12092 #include <netinet/in.h>
12093 int main() {
12094 struct ip_mreq mreq;
12095 return (mreq.imr_multiaddr.s_addr);
12096 }
12097 EOF
12098 val="$undef"
12099 set try; if eval $compile; then
12100        val="$define"
12101 fi
12102 set d_ip_mreq; eval $setvar
12103 $rm_try
12104
12105 echo " "
12106 echo "Checking the availability struct ip_mreq_source ..." >&4
12107 $cat >try.c <<EOF
12108 #include <sys/types.h>
12109 #include <sys/socket.h>
12110 #include <netinet/in.h>
12111 int main() {
12112 struct ip_mreq_source mreq;
12113 return (mreq.imr_multiaddr.s_addr);
12114 }
12115 EOF
12116 val="$undef"
12117 set try; if eval $compile; then
12118        val="$define"
12119 fi
12120 set d_ip_mreq_source; eval $setvar
12121 $rm_try
12122
12123 echo " "
12124 echo "Checking the availability struct ipv6_mreq ..." >&4
12125 $cat >try.c <<EOF
12126 #include <sys/types.h>
12127 #include <sys/socket.h>
12128 #include <netinet/in.h>
12129 int main() {
12130 struct ipv6_mreq mreq;
12131 return (mreq.ipv6mr_interface);
12132 }
12133 EOF
12134 val="$undef"
12135 set try; if eval $compile; then
12136     val="$define"
12137 fi
12138 set d_ipv6_mreq; eval $setvar
12139 $rm_try
12140
12141 echo " "
12142 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12143 $cat >try.c <<EOF
12144 #include <sys/types.h>
12145 #include <sys/socket.h>
12146 #include <netinet/in.h>
12147 int main() {
12148 struct ipv6_mreq_source mreq;
12149 return (mreq.imr_multiaddr.s_addr);
12150 }
12151 EOF
12152 val="$undef"
12153 set try; if eval $compile; then
12154        val="$define"
12155 fi
12156 set d_ipv6_mreq_source; eval $setvar
12157 $rm_try
12158
12159 echo " "
12160 echo "Checking the availability of certain socket constants..." >&4
12161 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12162     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12163     $cat >try.c <<EOF
12164 #include <sys/types.h>
12165 #include <sys/socket.h>
12166 int main() {
12167     int i = $ENUM;
12168 }
12169 EOF
12170     val="$undef"
12171     set try; if eval $compile; then
12172         val="$define"
12173     fi
12174     set d_${enum}; eval $setvar
12175     $rm_try
12176 done
12177
12178 : see if this is a sys/uio.h system
12179 set sys/uio.h i_sysuio
12180 eval $inhdr
12181
12182 : Check for cmsghdr support
12183 echo " "
12184 echo "Checking to see if your system supports struct cmsghdr..." >&4
12185 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12186 eval $hasstruct
12187 case "$d_cmsghdr_s" in
12188 "$define")      echo "Yes, it does."   ;;
12189 *)              echo "No, it doesn't." ;;
12190 esac
12191
12192
12193 : check for const keyword
12194 echo " "
12195 echo 'Checking to see if your C compiler knows about "const"...' >&4
12196 $cat >const.c <<'EOCP'
12197 typedef struct spug { int drokk; } spug;
12198 int main()
12199 {
12200         const char *foo;
12201         const spug y = { 0 };
12202 }
12203 EOCP
12204 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12205         val="$define"
12206         echo "Yup, it does."
12207 else
12208         val="$undef"
12209         echo "Nope, it doesn't."
12210 fi
12211 set d_const
12212 eval $setvar
12213
12214 : see if copysign exists
12215 set copysign d_copysign
12216 eval $inlibc
12217
12218 : see if copysignl exists
12219 set copysignl d_copysignl
12220 eval $inlibc
12221
12222 : see if crypt exists
12223 echo " "
12224 set crypt d_crypt
12225 eval $inlibc
12226 case "$d_crypt" in
12227 $define) cryptlib='' ;;
12228 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12229                 echo 'crypt() found.' >&4
12230                 val="$define"
12231                 cryptlib=''
12232         else
12233                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12234                 if $test -z "$cryptlib"; then
12235                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12236                 else
12237                         cryptlib=-lcrypt
12238                 fi
12239                 if $test -z "$cryptlib"; then
12240                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12241                 else
12242                         cryptlib=-lcrypt
12243                 fi
12244                 if $test -z "$cryptlib"; then
12245                         cryptlib=`./loc libcrypt$_a "" $libpth`
12246                 else
12247                         cryptlib=-lcrypt
12248                 fi
12249                 if $test -z "$cryptlib"; then
12250                         echo 'crypt() NOT found.' >&4
12251                         val="$undef"
12252                 else
12253                         val="$define"
12254                 fi
12255         fi
12256         set d_crypt
12257         eval $setvar
12258         ;;
12259 esac
12260
12261 : see if this is a crypt.h system
12262 set crypt.h i_crypt
12263 eval $inhdr
12264
12265 : see if crypt_r exists
12266 set crypt_r d_crypt_r
12267 eval $inlibc
12268 case "$d_crypt_r" in
12269 "$define")
12270         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12271         case "$d_crypt_r_proto:$usethreads" in
12272         ":define")      d_crypt_r_proto=define
12273                 set d_crypt_r_proto crypt_r $hdrs
12274                 eval $hasproto ;;
12275         *)      ;;
12276         esac
12277         case "$d_crypt_r_proto" in
12278         define)
12279         case "$crypt_r_proto" in
12280         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12281         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12282         esac
12283         case "$crypt_r_proto" in
12284         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12285         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12286         esac
12287         case "$crypt_r_proto" in
12288         ''|0)   d_crypt_r=undef
12289                 crypt_r_proto=0
12290                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12291         * )     case "$crypt_r_proto" in
12292                 REENTRANT_PROTO*) ;;
12293                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12294                 esac
12295                 echo "Prototype: $try" ;;
12296         esac
12297         ;;
12298         *)      case "$usethreads" in
12299                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12300                 esac
12301                 d_crypt_r=undef
12302                 crypt_r_proto=0
12303                 ;;
12304         esac
12305         ;;
12306 *)      crypt_r_proto=0
12307         ;;
12308 esac
12309
12310 : get csh whereabouts
12311 case "$csh" in
12312 'csh') val="$undef" ;;
12313 *) val="$define" ;;
12314 esac
12315 set d_csh
12316 eval $setvar
12317 : Respect a hint or command line value for full_csh.
12318 case "$full_csh" in
12319 '') full_csh=$csh ;;
12320 esac
12321
12322 : see if ctermid exists
12323 set ctermid d_ctermid
12324 eval $inlibc
12325
12326 : see if ctermid_r exists
12327 set ctermid_r d_ctermid_r
12328 eval $inlibc
12329 case "$d_ctermid_r" in
12330 "$define")
12331         hdrs="$i_systypes sys/types.h define stdio.h "
12332         case "$d_ctermid_r_proto:$usethreads" in
12333         ":define")      d_ctermid_r_proto=define
12334                 set d_ctermid_r_proto ctermid_r $hdrs
12335                 eval $hasproto ;;
12336         *)      ;;
12337         esac
12338         case "$d_ctermid_r_proto" in
12339         define)
12340         case "$ctermid_r_proto" in
12341         ''|0) try='char* ctermid_r(char*);'
12342         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12343         esac
12344         case "$ctermid_r_proto" in
12345         ''|0)   d_ctermid_r=undef
12346                 ctermid_r_proto=0
12347                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12348         * )     case "$ctermid_r_proto" in
12349                 REENTRANT_PROTO*) ;;
12350                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12351                 esac
12352                 echo "Prototype: $try" ;;
12353         esac
12354         ;;
12355         *)      case "$usethreads" in
12356                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12357                 esac
12358                 d_ctermid_r=undef
12359                 ctermid_r_proto=0
12360                 ;;
12361         esac
12362         ;;
12363 *)      ctermid_r_proto=0
12364         ;;
12365 esac
12366
12367 : see if ctime_r exists
12368 set ctime_r d_ctime_r
12369 eval $inlibc
12370 case "$d_ctime_r" in
12371 "$define")
12372         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12373         case "$d_ctime_r_proto:$usethreads" in
12374         ":define")      d_ctime_r_proto=define
12375                 set d_ctime_r_proto ctime_r $hdrs
12376                 eval $hasproto ;;
12377         *)      ;;
12378         esac
12379         case "$d_ctime_r_proto" in
12380         define)
12381         case "$ctime_r_proto" in
12382         ''|0) try='char* ctime_r(const time_t*, char*);'
12383         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12384         esac
12385         case "$ctime_r_proto" in
12386         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12387         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12388         esac
12389         case "$ctime_r_proto" in
12390         ''|0) try='int ctime_r(const time_t*, char*);'
12391         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12392         esac
12393         case "$ctime_r_proto" in
12394         ''|0) try='int ctime_r(const time_t*, char*, int);'
12395         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12396         esac
12397         case "$ctime_r_proto" in
12398         ''|0)   d_ctime_r=undef
12399                 ctime_r_proto=0
12400                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12401         * )     case "$ctime_r_proto" in
12402                 REENTRANT_PROTO*) ;;
12403                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12404                 esac
12405                 echo "Prototype: $try" ;;
12406         esac
12407         ;;
12408         *)      case "$usethreads" in
12409                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12410                 esac
12411                 d_ctime_r=undef
12412                 ctime_r_proto=0
12413                 ;;
12414         esac
12415         ;;
12416 *)      ctime_r_proto=0
12417         ;;
12418 esac
12419
12420 : see if cuserid exists
12421 set cuserid d_cuserid
12422 eval $inlibc
12423
12424 : see if this is a limits.h system
12425 set limits.h i_limits
12426 eval $inhdr
12427
12428 : See if number of significant digits in a double precision number is known
12429 echo " "
12430 $cat >dbl_dig.c <<EOM
12431 #$i_limits I_LIMITS
12432 #$i_float I_FLOAT
12433 #ifdef I_LIMITS
12434 #include <limits.h>
12435 #endif
12436 #ifdef I_FLOAT
12437 #include <float.h>
12438 #endif
12439 #ifdef DBL_DIG
12440 printf("Contains DBL_DIG");
12441 #endif
12442 EOM
12443 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12444 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12445         echo "DBL_DIG found." >&4
12446         val="$define"
12447 else
12448         echo "DBL_DIG NOT found." >&4
12449         val="$undef"
12450 fi
12451 $rm -f dbl_dig.?
12452 set d_dbl_dig
12453 eval $setvar
12454
12455 : see if dbm.h is available
12456 : see if dbmclose exists
12457 set dbmclose d_dbmclose
12458 eval $inlibc
12459
12460 case "$d_dbmclose" in
12461 $define)
12462         set dbm.h i_dbm
12463         eval $inhdr
12464         case "$i_dbm" in
12465         $define)
12466                 val="$undef"
12467                 set i_rpcsvcdbm
12468                 eval $setvar
12469                 ;;
12470         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12471                 eval $inhdr
12472                 ;;
12473         esac
12474         ;;
12475 *)      echo "We won't be including <dbm.h>"
12476         val="$undef"
12477         set i_dbm
12478         eval $setvar
12479         val="$undef"
12480         set i_rpcsvcdbm
12481         eval $setvar
12482         ;;
12483 esac
12484
12485 : see if prototype for dbminit is available
12486 echo " "
12487 set d_dbminitproto dbminit $i_dbm dbm.h
12488 eval $hasproto
12489
12490 : see if difftime exists
12491 set difftime d_difftime
12492 eval $inlibc
12493
12494 : see if this is a dirent system
12495 echo " "
12496 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12497         val="$define"
12498         echo "<dirent.h> found." >&4
12499 else
12500         val="$undef"
12501         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12502                 echo "<sys/dir.h> found." >&4
12503                 echo " "
12504         else
12505                 xinc=`./findhdr sys/ndir.h`
12506         fi
12507         echo "<dirent.h> NOT found." >&4
12508 fi
12509 set i_dirent
12510 eval $setvar
12511
12512 : Look for type of directory structure.
12513 echo " "
12514 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12515
12516 case "$direntrytype" in
12517 ''|' ')
12518         case "$i_dirent" in
12519         $define) guess1='struct dirent' ;;
12520         *) guess1='struct direct'  ;;
12521         esac
12522         ;;
12523 *)      guess1="$direntrytype"
12524         ;;
12525 esac
12526
12527 case "$guess1" in
12528 'struct dirent') guess2='struct direct' ;;
12529 *) guess2='struct dirent' ;;
12530 esac
12531
12532 if $contains "$guess1" try.c >/dev/null 2>&1; then
12533         direntrytype="$guess1"
12534         echo "Your directory entries are $direntrytype." >&4
12535 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12536         direntrytype="$guess2"
12537         echo "Your directory entries seem to be $direntrytype." >&4
12538 else
12539         echo "I don't recognize your system's directory entries." >&4
12540         rp="What type is used for directory entries on this system?"
12541         dflt="$guess1"
12542         . ./myread
12543         direntrytype="$ans"
12544 fi
12545 $rm_try
12546
12547 : see if the directory entry stores field length
12548 echo " "
12549 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12550 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12551         echo "Good, your directory entry keeps length information in d_namlen." >&4
12552         val="$define"
12553 else
12554         echo "Your directory entry does not know about the d_namlen field." >&4
12555         val="$undef"
12556 fi
12557 set d_dirnamlen
12558 eval $setvar
12559 $rm_try
12560
12561 : Look for DIR.dd_fd
12562 case "$i_dirent" in
12563 "$define")
12564     echo "Checking to see if DIR has a dd_fd member variable" >&4
12565     $cat >try.c <<EOCP
12566 #$i_stdlib I_STDLIB
12567 #ifdef I_STDLIB
12568 #include <stdlib.h>
12569 #endif
12570 #include <dirent.h>
12571
12572 int main() {
12573     DIR dir;
12574     dir.dd_fd = 1;
12575     return 0;
12576 }
12577 EOCP
12578     val=$undef
12579     set try
12580     if eval $compile; then
12581         echo "Yes, it does."
12582         val="$define"
12583     else
12584         echo "No, it does not."
12585         val="$undef"
12586     fi
12587     ;;
12588 *)
12589     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12590     val="$undef"
12591     ;;
12592 esac
12593 set d_dir_dd_fd
12594 eval $setvar
12595 $rm_try
12596
12597 : see if this is an sysdir system
12598 set sys/dir.h i_sysdir
12599 eval $inhdr
12600
12601 : see if this is an sysndir system
12602 set sys/ndir.h i_sysndir
12603 eval $inhdr
12604
12605 : Look for dirfd
12606 echo " "
12607 $cat >dirfd.c <<EOM
12608 #include <stdio.h>
12609 #$i_stdlib I_STDLIB
12610 #ifdef I_STDLIB
12611 #include <stdlib.h>
12612 #endif
12613 #$i_dirent I_DIRENT             /**/
12614 #$i_sysdir I_SYS_DIR            /**/
12615 #$i_sysndir I_SYS_NDIR          /**/
12616 #$i_systypes I_SYS_TYPES        /**/
12617 #if defined(I_SYS_TYPES)
12618 #include <sys/types.h>
12619 #endif
12620 #if defined(I_DIRENT)
12621 #include <dirent.h>
12622 #else
12623 #ifdef I_SYS_NDIR
12624 #include <sys/ndir.h>
12625 #else
12626 #ifdef I_SYS_DIR
12627 #ifdef hp9000s500
12628 #include <ndir.h>       /* may be wrong in the future */
12629 #else
12630 #include <sys/dir.h>
12631 #endif
12632 #endif
12633 #endif
12634 #endif
12635 int main() {
12636         DIR *dirp = opendir(".");
12637         if (dirfd(dirp) >= 0)
12638                 exit(0);
12639         else
12640                 exit(1);
12641 }
12642 EOM
12643 val=$undef
12644 set dirfd
12645 if eval $compile; then
12646         val="$define"
12647 fi
12648 case "$val" in
12649 $define)        echo "dirfd() found." >&4       ;;
12650 *)              echo "dirfd() NOT found." >&4   ;;
12651 esac
12652 set d_dirfd
12653 eval $setvar
12654 $rm -f dirfd*
12655
12656 : see if dladdr exists
12657 set dladdr d_dladdr
12658 eval $inlibc
12659
12660 : see if dlerror exists
12661 xxx_runnm="$runnm"
12662 runnm=false
12663 set dlerror d_dlerror
12664 eval $inlibc
12665 runnm="$xxx_runnm"
12666
12667 : see if dlfcn is available
12668 set dlfcn.h i_dlfcn
12669 eval $inhdr
12670
12671 : Check what extension to use for shared libs
12672 case "$usedl" in
12673 $define|y|true)
12674         $cat << EOM
12675
12676 On a few systems, the dynamically loaded modules that perl generates and uses
12677 will need a different extension than shared libs. The default will probably
12678 be appropriate.
12679
12680 EOM
12681         case "$dlext" in
12682         '')     dflt="$so" ;;
12683         *)      dflt="$dlext" ;;
12684         esac
12685         rp='What is the extension of dynamically loaded modules'
12686         . ./myread
12687         dlext="$ans"
12688         ;;
12689 *)
12690         dlext="none"
12691         ;;
12692 esac
12693
12694 : Check if dlsym need a leading underscore
12695 echo " "
12696 val="$undef"
12697
12698 case "$dlsrc" in
12699 dl_dlopen.xs)
12700         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12701         $cat >dyna.c <<'EOM'
12702 fred () { }
12703 EOM
12704
12705 $cat >fred.c<<EOM
12706
12707 #include <stdio.h>
12708 #$i_stdlib I_STDLIB
12709 #ifdef I_STDLIB
12710 #include <stdlib.h>
12711 #endif
12712 #$i_dlfcn I_DLFCN
12713 #ifdef I_DLFCN
12714 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12715 #else
12716 #include <sys/types.h>
12717 #include <nlist.h>
12718 #include <link.h>
12719 #endif
12720
12721 extern int fred() ;
12722
12723 int main()
12724 {
12725     void * handle ;
12726     void * symbol ;
12727 #ifndef RTLD_LAZY
12728     int mode = 1 ;
12729 #else
12730     int mode = RTLD_LAZY ;
12731 #endif
12732     handle = dlopen("./dyna.$dlext", mode) ;
12733     if (handle == NULL) {
12734         printf ("1\n") ;
12735         fflush (stdout) ;
12736         exit(0);
12737     }
12738     symbol = dlsym(handle, "fred") ;
12739     if (symbol == NULL) {
12740         /* try putting a leading underscore */
12741         symbol = dlsym(handle, "_fred") ;
12742         if (symbol == NULL) {
12743             printf ("2\n") ;
12744             fflush (stdout) ;
12745             exit(0);
12746         }
12747         printf ("3\n") ;
12748     }
12749     else
12750         printf ("4\n") ;
12751     fflush (stdout) ;
12752     exit(0);
12753 }
12754 EOM
12755         : Call the object file tmp-dyna.o in case dlext=o.
12756         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12757                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12758                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12759                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12760                 xxx=`$run ./fred`
12761                 case $xxx in
12762                 1)      echo "Test program failed using dlopen." >&4
12763                         echo "Perhaps you should not use dynamic loading." >&4;;
12764                 2)      echo "Test program failed using dlsym." >&4
12765                         echo "Perhaps you should not use dynamic loading." >&4;;
12766                 3)      echo "dlsym needs a leading underscore" >&4
12767                         val="$define" ;;
12768                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12769                 esac
12770         else
12771                 echo "I can't compile and run the test program." >&4
12772                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12773         fi
12774         ;;
12775 esac
12776
12777 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12778
12779 set d_dlsymun
12780 eval $setvar
12781
12782 : see if drand48_r exists
12783 set drand48_r d_drand48_r
12784 eval $inlibc
12785 case "$d_drand48_r" in
12786 "$define")
12787         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12788         case "$d_drand48_r_proto:$usethreads" in
12789         ":define")      d_drand48_r_proto=define
12790                 set d_drand48_r_proto drand48_r $hdrs
12791                 eval $hasproto ;;
12792         *)      ;;
12793         esac
12794         case "$d_drand48_r_proto" in
12795         define)
12796         case "$drand48_r_proto" in
12797         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12798         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12799         esac
12800         case "$drand48_r_proto" in
12801         ''|0)   d_drand48_r=undef
12802                 drand48_r_proto=0
12803                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12804         * )     case "$drand48_r_proto" in
12805                 REENTRANT_PROTO*) ;;
12806                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12807                 esac
12808                 echo "Prototype: $try" ;;
12809         esac
12810         ;;
12811         *)      case "$usethreads" in
12812                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12813                 esac
12814                 d_drand48_r=undef
12815                 drand48_r_proto=0
12816                 ;;
12817         esac
12818         ;;
12819 *)      drand48_r_proto=0
12820         ;;
12821 esac
12822
12823 : see if prototype for drand48 is available
12824 echo " "
12825 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12826 eval $hasproto
12827
12828 : see if dup2 exists
12829 set dup2 d_dup2
12830 eval $inlibc
12831
12832 : see if eaccess exists
12833 set eaccess d_eaccess
12834 eval $inlibc
12835
12836 : see if endgrent exists
12837 set endgrent d_endgrent
12838 eval $inlibc
12839
12840 : see if this is an grp system
12841 set grp.h i_grp
12842 eval $inhdr
12843
12844 case "$i_grp" in
12845 $define)
12846         xxx=`./findhdr grp.h`
12847         $cppstdin $cppflags $cppminus < $xxx >$$.h
12848
12849         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12850                 val="$define"
12851         else
12852                 val="$undef"
12853         fi
12854         set d_grpasswd
12855         eval $setvar
12856
12857         $rm -f $$.h
12858         ;;
12859 *)
12860         val="$undef";
12861         set d_grpasswd; eval $setvar
12862         ;;
12863 esac
12864
12865 : see if endgrent_r exists
12866 set endgrent_r d_endgrent_r
12867 eval $inlibc
12868 case "$d_endgrent_r" in
12869 "$define")
12870         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12871         case "$d_endgrent_r_proto:$usethreads" in
12872         ":define")      d_endgrent_r_proto=define
12873                 set d_endgrent_r_proto endgrent_r $hdrs
12874                 eval $hasproto ;;
12875         *)      ;;
12876         esac
12877         case "$d_endgrent_r_proto" in
12878         define)
12879         case "$endgrent_r_proto" in
12880         ''|0) try='int endgrent_r(FILE**);'
12881         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12882         esac
12883         case "$endgrent_r_proto" in
12884         ''|0) try='void endgrent_r(FILE**);'
12885         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12886         esac
12887         case "$endgrent_r_proto" in
12888         ''|0)   d_endgrent_r=undef
12889                 endgrent_r_proto=0
12890                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12891         * )     case "$endgrent_r_proto" in
12892                 REENTRANT_PROTO*) ;;
12893                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12894                 esac
12895                 echo "Prototype: $try" ;;
12896         esac
12897         ;;
12898         *)      case "$usethreads" in
12899                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12900                 esac
12901                 d_endgrent_r=undef
12902                 endgrent_r_proto=0
12903                 ;;
12904         esac
12905         ;;
12906 *)      endgrent_r_proto=0
12907         ;;
12908 esac
12909
12910 : see if endhostent exists
12911 set endhostent d_endhent
12912 eval $inlibc
12913
12914 : see if this is a netdb.h system
12915 set netdb.h i_netdb
12916 eval $inhdr
12917
12918 : see if endhostent_r exists
12919 set endhostent_r d_endhostent_r
12920 eval $inlibc
12921 case "$d_endhostent_r" in
12922 "$define")
12923         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12924         case "$d_endhostent_r_proto:$usethreads" in
12925         ":define")      d_endhostent_r_proto=define
12926                 set d_endhostent_r_proto endhostent_r $hdrs
12927                 eval $hasproto ;;
12928         *)      ;;
12929         esac
12930         case "$d_endhostent_r_proto" in
12931         define)
12932         case "$endhostent_r_proto" in
12933         ''|0) try='int endhostent_r(struct hostent_data*);'
12934         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12935         esac
12936         case "$endhostent_r_proto" in
12937         ''|0) try='void endhostent_r(struct hostent_data*);'
12938         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12939         esac
12940         case "$endhostent_r_proto" in
12941         ''|0)   d_endhostent_r=undef
12942                 endhostent_r_proto=0
12943                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12944         * )     case "$endhostent_r_proto" in
12945                 REENTRANT_PROTO*) ;;
12946                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12947                 esac
12948                 echo "Prototype: $try" ;;
12949         esac
12950         ;;
12951         *)      case "$usethreads" in
12952                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12953                 esac
12954                 d_endhostent_r=undef
12955                 endhostent_r_proto=0
12956                 ;;
12957         esac
12958         ;;
12959 *)      endhostent_r_proto=0
12960         ;;
12961 esac
12962
12963 : see if endnetent exists
12964 set endnetent d_endnent
12965 eval $inlibc
12966
12967 : see if endnetent_r exists
12968 set endnetent_r d_endnetent_r
12969 eval $inlibc
12970 case "$d_endnetent_r" in
12971 "$define")
12972         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12973         case "$d_endnetent_r_proto:$usethreads" in
12974         ":define")      d_endnetent_r_proto=define
12975                 set d_endnetent_r_proto endnetent_r $hdrs
12976                 eval $hasproto ;;
12977         *)      ;;
12978         esac
12979         case "$d_endnetent_r_proto" in
12980         define)
12981         case "$endnetent_r_proto" in
12982         ''|0) try='int endnetent_r(struct netent_data*);'
12983         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12984         esac
12985         case "$endnetent_r_proto" in
12986         ''|0) try='void endnetent_r(struct netent_data*);'
12987         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12988         esac
12989         case "$endnetent_r_proto" in
12990         ''|0)   d_endnetent_r=undef
12991                 endnetent_r_proto=0
12992                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12993         * )     case "$endnetent_r_proto" in
12994                 REENTRANT_PROTO*) ;;
12995                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12996                 esac
12997                 echo "Prototype: $try" ;;
12998         esac
12999         ;;
13000         *)      case "$usethreads" in
13001                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
13002                 esac
13003                 d_endnetent_r=undef
13004                 endnetent_r_proto=0
13005                 ;;
13006         esac
13007         ;;
13008 *)      endnetent_r_proto=0
13009         ;;
13010 esac
13011
13012 : see if endprotoent exists
13013 set endprotoent d_endpent
13014 eval $inlibc
13015
13016 : see if endprotoent_r exists
13017 set endprotoent_r d_endprotoent_r
13018 eval $inlibc
13019 case "$d_endprotoent_r" in
13020 "$define")
13021         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13022         case "$d_endprotoent_r_proto:$usethreads" in
13023         ":define")      d_endprotoent_r_proto=define
13024                 set d_endprotoent_r_proto endprotoent_r $hdrs
13025                 eval $hasproto ;;
13026         *)      ;;
13027         esac
13028         case "$d_endprotoent_r_proto" in
13029         define)
13030         case "$endprotoent_r_proto" in
13031         ''|0) try='int endprotoent_r(struct protoent_data*);'
13032         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13033         esac
13034         case "$endprotoent_r_proto" in
13035         ''|0) try='void endprotoent_r(struct protoent_data*);'
13036         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13037         esac
13038         case "$endprotoent_r_proto" in
13039         ''|0)   d_endprotoent_r=undef
13040                 endprotoent_r_proto=0
13041                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13042         * )     case "$endprotoent_r_proto" in
13043                 REENTRANT_PROTO*) ;;
13044                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13045                 esac
13046                 echo "Prototype: $try" ;;
13047         esac
13048         ;;
13049         *)      case "$usethreads" in
13050                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13051                 esac
13052                 d_endprotoent_r=undef
13053                 endprotoent_r_proto=0
13054                 ;;
13055         esac
13056         ;;
13057 *)      endprotoent_r_proto=0
13058         ;;
13059 esac
13060
13061 : see if endpwent exists
13062 set endpwent d_endpwent
13063 eval $inlibc
13064
13065 : see if this is a pwd.h system
13066 set pwd.h i_pwd
13067 eval $inhdr
13068
13069 case "$i_pwd" in
13070 $define)
13071         xxx=`./findhdr pwd.h`
13072         $cppstdin $cppflags $cppminus < $xxx >$$.h
13073
13074         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13075                 val="$define"
13076         else
13077                 val="$undef"
13078         fi
13079         set d_pwquota
13080         eval $setvar
13081
13082         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13083                 val="$define"
13084         else
13085                 val="$undef"
13086         fi
13087         set d_pwage
13088         eval $setvar
13089
13090         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13091                 val="$define"
13092         else
13093                 val="$undef"
13094         fi
13095         set d_pwchange
13096         eval $setvar
13097
13098         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13099                 val="$define"
13100         else
13101                 val="$undef"
13102         fi
13103         set d_pwclass
13104         eval $setvar
13105
13106         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13107                 val="$define"
13108         else
13109                 val="$undef"
13110         fi
13111         set d_pwexpire
13112         eval $setvar
13113
13114         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13115                 val="$define"
13116         else
13117                 val="$undef"
13118         fi
13119         set d_pwcomment
13120         eval $setvar
13121
13122         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13123                 val="$define"
13124         else
13125                 val="$undef"
13126         fi
13127         set d_pwgecos
13128         eval $setvar
13129
13130         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13131                 val="$define"
13132         else
13133                 val="$undef"
13134         fi
13135         set d_pwpasswd
13136         eval $setvar
13137
13138         $rm -f $$.h
13139         ;;
13140 *)
13141         val="$undef";
13142         set d_pwquota; eval $setvar
13143         set d_pwage; eval $setvar
13144         set d_pwchange; eval $setvar
13145         set d_pwclass; eval $setvar
13146         set d_pwexpire; eval $setvar
13147         set d_pwcomment; eval $setvar
13148         set d_pwgecos; eval $setvar
13149         set d_pwpasswd; eval $setvar
13150         ;;
13151 esac
13152
13153 : see if endpwent_r exists
13154 set endpwent_r d_endpwent_r
13155 eval $inlibc
13156 case "$d_endpwent_r" in
13157 "$define")
13158         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13159         case "$d_endpwent_r_proto:$usethreads" in
13160         ":define")      d_endpwent_r_proto=define
13161                 set d_endpwent_r_proto endpwent_r $hdrs
13162                 eval $hasproto ;;
13163         *)      ;;
13164         esac
13165         case "$d_endpwent_r_proto" in
13166         define)
13167         case "$endpwent_r_proto" in
13168         ''|0) try='int endpwent_r(FILE**);'
13169         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13170         esac
13171         case "$endpwent_r_proto" in
13172         ''|0) try='void endpwent_r(FILE**);'
13173         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13174         esac
13175         case "$endpwent_r_proto" in
13176         ''|0)   d_endpwent_r=undef
13177                 endpwent_r_proto=0
13178                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13179         * )     case "$endpwent_r_proto" in
13180                 REENTRANT_PROTO*) ;;
13181                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13182                 esac
13183                 echo "Prototype: $try" ;;
13184         esac
13185         ;;
13186         *)      case "$usethreads" in
13187                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13188                 esac
13189                 d_endpwent_r=undef
13190                 endpwent_r_proto=0
13191                 ;;
13192         esac
13193         ;;
13194 *)      endpwent_r_proto=0
13195         ;;
13196 esac
13197
13198 : see if endservent exists
13199 set endservent d_endsent
13200 eval $inlibc
13201
13202 : see if endservent_r exists
13203 set endservent_r d_endservent_r
13204 eval $inlibc
13205 case "$d_endservent_r" in
13206 "$define")
13207         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13208         case "$d_endservent_r_proto:$usethreads" in
13209         ":define")      d_endservent_r_proto=define
13210                 set d_endservent_r_proto endservent_r $hdrs
13211                 eval $hasproto ;;
13212         *)      ;;
13213         esac
13214         case "$d_endservent_r_proto" in
13215         define)
13216         case "$endservent_r_proto" in
13217         ''|0) try='int endservent_r(struct servent_data*);'
13218         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13219         esac
13220         case "$endservent_r_proto" in
13221         ''|0) try='void endservent_r(struct servent_data*);'
13222         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13223         esac
13224         case "$endservent_r_proto" in
13225         ''|0)   d_endservent_r=undef
13226                 endservent_r_proto=0
13227                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13228         * )     case "$endservent_r_proto" in
13229                 REENTRANT_PROTO*) ;;
13230                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13231                 esac
13232                 echo "Prototype: $try" ;;
13233         esac
13234         ;;
13235         *)      case "$usethreads" in
13236                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13237                 esac
13238                 d_endservent_r=undef
13239                 endservent_r_proto=0
13240                 ;;
13241         esac
13242         ;;
13243 *)      endservent_r_proto=0
13244         ;;
13245 esac
13246
13247 : Locate the flags for 'open()'
13248 echo " "
13249 $cat >try.c <<EOCP
13250 #include <sys/types.h>
13251 #ifdef I_FCNTL
13252 #include <fcntl.h>
13253 #endif
13254 #ifdef I_SYS_FILE
13255 #include <sys/file.h>
13256 #endif
13257 #$i_stdlib I_STDLIB
13258 #ifdef I_STDLIB
13259 #include <stdlib.h>
13260 #endif
13261 int main() {
13262         if(O_RDONLY);
13263 #ifdef O_TRUNC
13264         exit(0);
13265 #else
13266         exit(1);
13267 #endif
13268 }
13269 EOCP
13270 : check sys/file.h first to get FREAD on Sun
13271 if $test `./findhdr sys/file.h` && \
13272                 set try -DI_SYS_FILE && eval $compile; then
13273         h_sysfile=true;
13274         echo "<sys/file.h> defines the O_* constants..." >&4
13275         if $run ./try; then
13276                 echo "and you have the 3 argument form of open()." >&4
13277                 val="$define"
13278         else
13279                 echo "but not the 3 argument form of open().  Oh, well." >&4
13280                 val="$undef"
13281         fi
13282 elif $test `./findhdr fcntl.h` && \
13283                 set try -DI_FCNTL && eval $compile; then
13284         h_fcntl=true;
13285         echo "<fcntl.h> defines the O_* constants..." >&4
13286         if $run ./try; then
13287                 echo "and you have the 3 argument form of open()." >&4
13288                 val="$define"
13289         else
13290                 echo "but not the 3 argument form of open().  Oh, well." >&4
13291                 val="$undef"
13292         fi
13293 else
13294         val="$undef"
13295         echo "I can't find the O_* constant definitions!  You got problems." >&4
13296 fi
13297 set d_open3
13298 eval $setvar
13299 $rm_try
13300
13301 : see if this is a sys/file.h system
13302 val=''
13303 set sys/file.h val
13304 eval $inhdr
13305
13306 : do we need to include sys/file.h ?
13307 case "$val" in
13308 "$define")
13309         echo " "
13310         if $h_sysfile; then
13311                 val="$define"
13312                 echo "We'll be including <sys/file.h>." >&4
13313         else
13314                 val="$undef"
13315                 echo "We won't be including <sys/file.h>." >&4
13316         fi
13317         ;;
13318 *)
13319         h_sysfile=false
13320         ;;
13321 esac
13322 set i_sysfile
13323 eval $setvar
13324
13325 : see if fcntl.h is there
13326 val=''
13327 set fcntl.h val
13328 eval $inhdr
13329
13330 : see if we can include fcntl.h
13331 case "$val" in
13332 "$define")
13333         echo " "
13334         if $h_fcntl; then
13335                 val="$define"
13336                 echo "We'll be including <fcntl.h>." >&4
13337         else
13338                 val="$undef"
13339                 if $h_sysfile; then
13340         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13341                 else
13342                         echo "We won't be including <fcntl.h>." >&4
13343                 fi
13344         fi
13345         ;;
13346 *)
13347         h_fcntl=false
13348         val="$undef"
13349         ;;
13350 esac
13351 set i_fcntl
13352 eval $setvar
13353
13354 : see if fork exists
13355 set fork d_fork
13356 eval $inlibc
13357
13358 : see if pipe exists
13359 set pipe d_pipe
13360 eval $inlibc
13361
13362 : check for non-blocking I/O stuff
13363 case "$h_sysfile" in
13364 true) echo "#include <sys/file.h>" > head.c;;
13365 *)
13366        case "$h_fcntl" in
13367        true) echo "#include <fcntl.h>" > head.c;;
13368        *) echo "#include <sys/fcntl.h>" > head.c;;
13369        esac
13370        ;;
13371 esac
13372 echo " "
13373 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13374 case "$o_nonblock" in
13375 '')
13376         $cat head.c > try.c
13377         $cat >>try.c <<EOCP
13378 #include <stdio.h>
13379 #$i_stdlib I_STDLIB
13380 #ifdef I_STDLIB
13381 #include <stdlib.h>
13382 #endif
13383 #$i_fcntl I_FCNTL
13384 #ifdef I_FCNTL
13385 #include <fcntl.h>
13386 #endif
13387 int main() {
13388 #ifdef O_NONBLOCK
13389         printf("O_NONBLOCK\n");
13390         exit(0);
13391 #endif
13392 #ifdef O_NDELAY
13393         printf("O_NDELAY\n");
13394         exit(0);
13395 #endif
13396 #ifdef FNDELAY
13397         printf("FNDELAY\n");
13398         exit(0);
13399 #endif
13400         exit(0);
13401 }
13402 EOCP
13403         set try
13404         if eval $compile_ok; then
13405                 o_nonblock=`$run ./try`
13406                 case "$o_nonblock" in
13407                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13408                 *) echo "Seems like we can use $o_nonblock.";;
13409                 esac
13410         else
13411                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13412         fi
13413         ;;
13414 *) echo "Using $hint value $o_nonblock.";;
13415 esac
13416 $rm_try
13417
13418 echo " "
13419 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13420 case "$eagain" in
13421 '')
13422         case "$d_fork:$d_pipe:$d_alarm" in
13423         define:define:define)
13424         $cat head.c > try.c
13425         $cat >>try.c <<EOCP
13426 #include <errno.h>
13427 #include <sys/types.h>
13428 #include <signal.h>
13429 #include <stdio.h>
13430 #$i_stdlib I_STDLIB
13431 #ifdef I_STDLIB
13432 #include <stdlib.h>
13433 #endif
13434 #$i_fcntl I_FCNTL
13435 #ifdef I_FCNTL
13436 #include <fcntl.h>
13437 #endif
13438 #define MY_O_NONBLOCK $o_nonblock
13439 #ifndef errno  /* XXX need better Configure test */
13440 extern int errno;
13441 #endif
13442 #$i_unistd I_UNISTD
13443 #ifdef I_UNISTD
13444 #include <unistd.h>
13445 #endif
13446 #$i_string I_STRING
13447 #ifdef I_STRING
13448 #include <string.h>
13449 #else
13450 #include <strings.h>
13451 #endif
13452 $signal_t blech(int x) { exit(3); }
13453 EOCP
13454         $cat >> try.c <<'EOCP'
13455 int main()
13456 {
13457         int pd[2];
13458         int pu[2];
13459         char buf[1];
13460         char string[100];
13461         int ret;
13462
13463         ret = pipe(pd); /* Down: child -> parent */
13464         if (ret != 0)
13465                 exit(3);
13466         ret = pipe(pu); /* Up: parent -> child */
13467         if (ret != 0)
13468                 exit(3);
13469         if (0 != fork()) {
13470                 close(pd[1]);   /* Parent reads from pd[0] */
13471                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13472 #ifdef F_SETFL
13473                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13474                         exit(1);
13475 #else
13476                 exit(4);
13477 #endif
13478                 signal(SIGALRM, blech);
13479                 alarm(5);
13480                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13481                         exit(2);
13482                 sprintf(string, "%d\n", ret);
13483                 ret = write(2, string, strlen(string));
13484                 if (ret != strlen(string))
13485                         exit(3);
13486                 alarm(0);
13487 #ifdef EAGAIN
13488                 if (errno == EAGAIN) {
13489                         printf("EAGAIN\n");
13490                         goto ok;
13491                 }
13492 #endif
13493 #ifdef EWOULDBLOCK
13494                 if (errno == EWOULDBLOCK)
13495                         printf("EWOULDBLOCK\n");
13496 #endif
13497         ok:
13498                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13499                 if (ret != 1)
13500                         exit(3);
13501                 sleep(2);                               /* Give it time to close our pipe */
13502                 alarm(5);
13503                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13504                 alarm(0);
13505                 sprintf(string, "%d\n", ret);
13506                 ret = write(4, string, strlen(string));
13507                 if (ret != strlen(string))
13508                         exit(3);
13509                 exit(0);
13510         }
13511
13512         close(pd[0]);                   /* We write to pd[1] */
13513         close(pu[1]);                   /* We read from pu[0] */
13514         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13515         if (ret != 1)
13516                 exit(3);
13517         close(pd[1]);                   /* Pipe pd is now fully closed! */
13518         exit(0);                                /* Bye bye, thank you for playing! */
13519 }
13520 EOCP
13521         set try
13522         if eval $compile_ok; then
13523                 echo "$startsh" >mtry
13524                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13525                 chmod +x mtry
13526                 $run ./mtry >/dev/null 2>&1
13527                 case $? in
13528                 0) eagain=`$cat try.out`;;
13529                 1) echo "Could not perform non-blocking setting!";;
13530                 2) echo "I did a successful read() for something that was not there!";;
13531                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13532                 4) echo "Could not find F_SETFL!";;
13533                 *) echo "Something terribly wrong happened during testing.";;
13534                 esac
13535                 rd_nodata=`$cat try.ret`
13536                 echo "A read() system call with no data present returns $rd_nodata."
13537                 case "$rd_nodata" in
13538                 0|-1) ;;
13539                 *)
13540                         echo "(That's peculiar, fixing that to be -1.)"
13541                         rd_nodata=-1
13542                         ;;
13543                 esac
13544                 case "$eagain" in
13545                 '')
13546                         echo "Forcing errno EAGAIN on read() with no data available."
13547                         eagain=EAGAIN
13548                         ;;
13549                 *)
13550                         echo "Your read() sets errno to $eagain when no data is available."
13551                         ;;
13552                 esac
13553                 status=`$cat try.err`
13554                 case "$status" in
13555                 0) echo "And it correctly returns 0 to signal EOF.";;
13556                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13557                 *) echo "However, your read() returns '$status' on EOF??";;
13558                 esac
13559                 val="$define"
13560                 if test "$status" = "$rd_nodata"; then
13561                         echo "WARNING: you can't distinguish between EOF and no data!"
13562                         val="$undef"
13563                 fi
13564         else
13565                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13566                 eagain=EAGAIN
13567         fi
13568         ;;
13569         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13570                 eagain=EAGAIN
13571                 val="$define"
13572                 ;;
13573         esac
13574         set d_eofnblk
13575         eval $setvar
13576         ;;
13577 *)
13578         echo "Using $hint value $eagain."
13579         echo "Your read() returns $rd_nodata when no data is present."
13580         case "$d_eofnblk" in
13581         "$define") echo "And you can see EOF because read() returns 0.";;
13582         "$undef") echo "But you can't see EOF status from read() returned value.";;
13583         *)
13584                 echo "(Assuming you can't see EOF status from read anyway.)"
13585                 d_eofnblk=$undef
13586                 ;;
13587         esac
13588         ;;
13589 esac
13590 $rm_try head.c mtry
13591
13592 : see if erf exists
13593 set erf d_erf
13594 eval $inlibc
13595
13596 : see if erfc exists
13597 set erfc d_erfc
13598 eval $inlibc
13599
13600 : see if exp2 exists
13601 set exp2 d_exp2
13602 eval $inlibc
13603
13604 : see if expm1 exists
13605 set expm1 d_expm1
13606 eval $inlibc
13607
13608 : see if _ptr and _cnt from stdio act std
13609 echo " "
13610
13611 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13612         echo "(Looks like you have stdio.h from BSD.)"
13613         case "$stdio_ptr" in
13614         '') stdio_ptr='((fp)->_p)'
13615                 ptr_lval=$define
13616                 ;;
13617         *)      ptr_lval=$d_stdio_ptr_lval;;
13618         esac
13619         case "$stdio_cnt" in
13620         '') stdio_cnt='((fp)->_r)'
13621                 cnt_lval=$define
13622                 ;;
13623         *)      cnt_lval=$d_stdio_cnt_lval;;
13624         esac
13625         case "$stdio_base" in
13626         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13627         esac
13628         case "$stdio_bufsiz" in
13629         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13630         esac
13631 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13632         echo "(Looks like you have stdio.h from Linux.)"
13633         case "$stdio_ptr" in
13634         '') stdio_ptr='((fp)->_IO_read_ptr)'
13635                 ptr_lval=$define
13636                 ;;
13637         *)      ptr_lval=$d_stdio_ptr_lval;;
13638         esac
13639         case "$stdio_cnt" in
13640         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13641                 cnt_lval=$undef
13642                 ;;
13643         *)      cnt_lval=$d_stdio_cnt_lval;;
13644         esac
13645         case "$stdio_base" in
13646         '') stdio_base='((fp)->_IO_read_base)';;
13647         esac
13648         case "$stdio_bufsiz" in
13649         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13650         esac
13651 else
13652         case "$stdio_ptr" in
13653         '') stdio_ptr='((fp)->_ptr)'
13654                 ptr_lval=$define
13655                 ;;
13656         *)      ptr_lval=$d_stdio_ptr_lval;;
13657         esac
13658         case "$stdio_cnt" in
13659         '') stdio_cnt='((fp)->_cnt)'
13660                 cnt_lval=$define
13661                 ;;
13662         *)      cnt_lval=$d_stdio_cnt_lval;;
13663         esac
13664         case "$stdio_base" in
13665         '') stdio_base='((fp)->_base)';;
13666         esac
13667         case "$stdio_bufsiz" in
13668         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13669         esac
13670 fi
13671
13672 : test whether _ptr and _cnt really work
13673 echo "Checking how std your stdio is..." >&4
13674 $cat >try.c <<EOP
13675 #include <stdio.h>
13676 #$i_stdlib I_STDLIB
13677 #ifdef I_STDLIB
13678 #include <stdlib.h>
13679 #endif
13680 #define FILE_ptr(fp)    $stdio_ptr
13681 #define FILE_cnt(fp)    $stdio_cnt
13682 int main() {
13683         FILE *fp = fopen("try.c", "r");
13684         char c = getc(fp);
13685         if (
13686                 18 <= FILE_cnt(fp) &&
13687                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13688         )
13689                 exit(0);
13690         exit(1);
13691 }
13692 EOP
13693 val="$undef"
13694 set try
13695 if eval $compile && $to try.c; then
13696         if $run ./try; then
13697                 echo "Your stdio acts pretty std."
13698                 val="$define"
13699         else
13700                 echo "Your stdio isn't very std."
13701         fi
13702 else
13703         echo "Your stdio doesn't appear very std."
13704 fi
13705 $rm_try
13706
13707 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13708 # direct buffer manipulation no longer works.  The Configure tests
13709 # should be changed to correctly detect this, but until then,
13710 # the following check should at least let perl compile and run.
13711 # (This quick fix should be updated before 5.8.1.)
13712 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13713 # A. Dougherty, June 3, 2002.
13714 case "$d_gnulibc" in
13715 $define)
13716         case "$gnulibc_version" in
13717         2.[01]*)  ;;
13718         2.2) ;;
13719         2.2.[0-9]) ;;
13720         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13721                 val="$undef"
13722                 ;;
13723         esac
13724         ;;
13725 esac
13726 set d_stdstdio
13727 eval $setvar
13728
13729 : Can _ptr be used as an lvalue?
13730 case "$d_stdstdio$ptr_lval" in
13731 $define$define) val=$define ;;
13732 *) val=$undef ;;
13733 esac
13734 set d_stdio_ptr_lval
13735 eval $setvar
13736
13737 : Can _cnt be used as an lvalue?
13738 case "$d_stdstdio$cnt_lval" in
13739 $define$define) val=$define ;;
13740 *) val=$undef ;;
13741 esac
13742 set d_stdio_cnt_lval
13743 eval $setvar
13744
13745
13746 : test whether setting _ptr sets _cnt as a side effect
13747 d_stdio_ptr_lval_sets_cnt="$undef"
13748 d_stdio_ptr_lval_nochange_cnt="$undef"
13749 case "$d_stdio_ptr_lval$d_stdstdio" in
13750 $define$define)
13751         echo "Checking to see what happens if we set the stdio ptr..." >&4
13752 $cat >try.c <<EOP
13753 #include <stdio.h>
13754 /* Can we scream? */
13755 /* Eat dust sed :-) */
13756 /* In the buffer space, no one can hear you scream. */
13757 #$i_stdlib I_STDLIB
13758 #ifdef I_STDLIB
13759 #include <stdlib.h>
13760 #endif
13761 #define FILE_ptr(fp)    $stdio_ptr
13762 #define FILE_cnt(fp)    $stdio_cnt
13763 #include <sys/types.h>
13764 int main() {
13765         FILE *fp = fopen("try.c", "r");
13766         int c;
13767         char *ptr;
13768         size_t cnt;
13769         if (!fp) {
13770             puts("Fail even to read");
13771             exit(1);
13772         }
13773         c = getc(fp); /* Read away the first # */
13774         if (c == EOF) {
13775             puts("Fail even to read");
13776             exit(1);
13777         }
13778         if (!(
13779                 18 <= FILE_cnt(fp) &&
13780                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13781         )) {
13782                 puts("Fail even to read");
13783                 exit (1);
13784         }
13785         ptr = (char*) FILE_ptr(fp);
13786         cnt = (size_t)FILE_cnt(fp);
13787
13788         FILE_ptr(fp) += 42;
13789
13790         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13791                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13792                 exit (1);
13793         }
13794         if (FILE_cnt(fp) <= 20) {
13795                 printf ("Fail (<20 chars to test)");
13796                 exit (1);
13797         }
13798         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13799                 puts("Fail compare");
13800                 exit (1);
13801         }
13802         if (cnt == FILE_cnt(fp)) {
13803                 puts("Pass_unchanged");
13804                 exit (0);
13805         }
13806         if (FILE_cnt(fp) == (cnt - 42)) {
13807                 puts("Pass_changed");
13808                 exit (0);
13809         }
13810         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13811         return 1;
13812
13813 }
13814 EOP
13815         set try
13816         if eval $compile && $to try.c; then
13817                 case `$run ./try` in
13818                 Pass_changed)
13819                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13820                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13821                 Pass_unchanged)
13822                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13823                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13824                 Fail*)
13825                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13826                 *)
13827                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13828         esac
13829         else
13830                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13831         fi
13832         $rm_try
13833         ;;
13834 esac
13835
13836 : see if _base is also standard
13837 val="$undef"
13838 case "$d_stdstdio" in
13839 $define)
13840         $cat >try.c <<EOP
13841 #include <stdio.h>
13842 #$i_stdlib I_STDLIB
13843 #ifdef I_STDLIB
13844 #include <stdlib.h>
13845 #endif
13846 #define FILE_base(fp)   $stdio_base
13847 #define FILE_bufsiz(fp) $stdio_bufsiz
13848 int main() {
13849         FILE *fp = fopen("try.c", "r");
13850         char c = getc(fp);
13851         if (
13852                 19 <= FILE_bufsiz(fp) &&
13853                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13854         )
13855                 exit(0);
13856         exit(1);
13857 }
13858 EOP
13859         set try
13860         if eval $compile && $to try.c; then
13861                 if $run ./try; then
13862                         echo "And its _base field acts std."
13863                         val="$define"
13864                 else
13865                         echo "But its _base field isn't std."
13866                 fi
13867         else
13868                 echo "However, it seems to be lacking the _base field."
13869         fi
13870         $rm_try
13871         ;;
13872 esac
13873 set d_stdiobase
13874 eval $setvar
13875
13876 : see if fast_stdio exists
13877 val="$undef"
13878 case "$d_stdstdio:$d_stdio_ptr_lval" in
13879 "$define:$define")
13880         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13881         *$define*)
13882                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13883                 val="$define"
13884                 ;;
13885         esac
13886         ;;
13887 esac
13888 set d_faststdio
13889 eval $setvar
13890
13891
13892
13893 : see if fchdir exists
13894 set fchdir d_fchdir
13895 eval $inlibc
13896
13897 : see if fchmod exists
13898 set fchmod d_fchmod
13899 eval $inlibc
13900
13901 : see if fchown exists
13902 set fchown d_fchown
13903 eval $inlibc
13904
13905 : see if this is an fcntl system
13906 set fcntl d_fcntl
13907 eval $inlibc
13908
13909 : See if fcntl-based locking works.
13910 echo " "
13911 $cat >try.c <<EOCP
13912 #$i_stdlib I_STDLIB
13913 #ifdef I_STDLIB
13914 #include <stdlib.h>
13915 #endif
13916 #include <unistd.h>
13917 #include <fcntl.h>
13918 #include <signal.h>
13919 $signal_t blech(int x) { exit(3); }
13920 int main() {
13921 #if defined(F_SETLK) && defined(F_SETLKW)
13922      struct flock flock;
13923      int retval, fd;
13924      fd = open("try.c", O_RDONLY);
13925      flock.l_type = F_RDLCK;
13926      flock.l_whence = SEEK_SET;
13927      flock.l_start = flock.l_len = 0;
13928      signal(SIGALRM, blech);
13929      alarm(10);
13930      retval = fcntl(fd, F_SETLK, &flock);
13931      close(fd);
13932      (retval < 0 ? exit(2) : exit(0));
13933 #else
13934      exit(2);
13935 #endif
13936 }
13937 EOCP
13938 echo "Checking if fcntl-based file locking works... "
13939 case "$d_fcntl" in
13940 "$define")
13941         set try
13942         if eval $compile_ok; then
13943                 if $run ./try; then
13944                         echo "Yes, it seems to work."
13945                         val="$define"
13946                 else
13947                         echo "Nope, it didn't work."
13948                         val="$undef"
13949                         case "$?" in
13950                         3) $cat >&4 <<EOM
13951 ***
13952 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13953 *** This is (almost) impossible.
13954 *** If your NFS lock daemons are not feeling well, something like
13955 *** this may happen, please investigate.  Cannot continue, aborting.
13956 ***
13957 EOM
13958                                 exit 1
13959                                 ;;
13960                         esac
13961                 fi
13962         else
13963                 echo "I'm unable to compile the test program, so I'll assume not."
13964                 val="$undef"
13965         fi
13966         ;;
13967 *) val="$undef";
13968         echo "Nope, since you don't even have fcntl()."
13969         ;;
13970 esac
13971 set d_fcntl_can_lock
13972 eval $setvar
13973 $rm_try
13974
13975 : check for fd_set items
13976 $cat <<EOM
13977
13978 Checking to see how well your C compiler handles fd_set and friends ...
13979 EOM
13980 $cat >try.c <<EOCP
13981 #$i_stdlib I_STDLIB
13982 #ifdef I_STDLIB
13983 #include <stdlib.h>
13984 #endif
13985 #$i_systime I_SYS_TIME
13986 #$i_sysselct I_SYS_SELECT
13987 #$d_socket HAS_SOCKET
13988 #include <sys/types.h>
13989 #ifdef HAS_SOCKET
13990 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13991 #endif
13992 #ifdef I_SYS_TIME
13993 #include <sys/time.h>
13994 #endif
13995 #ifdef I_SYS_SELECT
13996 #include <sys/select.h>
13997 #endif
13998 int main() {
13999         fd_set fds;
14000
14001 #ifdef TRYBITS
14002         if(fds.fds_bits);
14003 #endif
14004
14005 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
14006         exit(0);
14007 #else
14008         exit(1);
14009 #endif
14010 }
14011 EOCP
14012 set try -DTRYBITS
14013 if eval $compile; then
14014         d_fds_bits="$define"
14015         d_fd_set="$define"
14016         echo "Well, your system knows about the normal fd_set typedef..." >&4
14017         if $run ./try; then
14018                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14019                 d_fd_macros="$define"
14020         else
14021                 $cat >&4 <<'EOM'
14022 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
14023 EOM
14024                 d_fd_macros="$undef"
14025         fi
14026 else
14027         $cat <<'EOM'
14028 Hmm, your compiler has some difficulty with fd_set.  Checking further...
14029 EOM
14030         set try
14031         if eval $compile; then
14032                 d_fds_bits="$undef"
14033                 d_fd_set="$define"
14034                 echo "Well, your system has some sort of fd_set available..." >&4
14035                 if $run ./try; then
14036                         echo "and you have the normal fd_set macros." >&4
14037                         d_fd_macros="$define"
14038                 else
14039                         $cat <<'EOM'
14040 but not the normal fd_set macros!  Gross!  More work for me...
14041 EOM
14042                         d_fd_macros="$undef"
14043                 fi
14044         else
14045         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14046                 d_fd_set="$undef"
14047                 d_fds_bits="$undef"
14048                 d_fd_macros="$undef"
14049         fi
14050 fi
14051 $rm_try
14052
14053 : see if fdclose exists
14054 set fdclose d_fdclose
14055 eval $inlibc
14056
14057 : see if fdim exists
14058 set fdim d_fdim
14059 eval $inlibc
14060
14061 : see if fegetround exists
14062 set fegetround d_fegetround
14063 eval $inlibc
14064
14065 : see if fgetpos exists
14066 set fgetpos d_fgetpos
14067 eval $inlibc
14068
14069 : see if finite exists
14070 set finite d_finite
14071 eval $inlibc
14072
14073 : see if finitel exists
14074 set finitel d_finitel
14075 eval $inlibc
14076
14077 : see if flock exists
14078 set flock d_flock
14079 eval $inlibc
14080
14081 : see if prototype for flock is available
14082 echo " "
14083 set d_flockproto flock $i_sysfile sys/file.h
14084 eval $hasproto
14085
14086 : see if fma exists
14087 set fma d_fma
14088 eval $inlibc
14089
14090 : see if fmax exists
14091 set fmax d_fmax
14092 eval $inlibc
14093
14094 : see if fmin exists
14095 set fmin d_fmin
14096 eval $inlibc
14097
14098 : see if fp_class exists
14099 set fp_class d_fp_class
14100 eval $inlibc
14101
14102 : see if this is a math.h system
14103 set math.h i_math
14104 eval $inhdr
14105
14106 : check for fpclassify
14107 echo "Checking to see if you have fpclassify..." >&4
14108 $cat >try.c <<EOCP
14109 #$i_math I_MATH
14110 #ifdef I_MATH
14111 #include <math.h>
14112 #endif
14113 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14114 EOCP
14115 set try
14116 if eval $compile; then
14117         val="$define"
14118         echo "You have fpclassify."
14119 else
14120         val="$undef"
14121         echo "You do not have fpclassify."
14122 fi
14123 $rm_try
14124 set d_fpclassify
14125 eval $setvar
14126
14127 : see if fp_classify exists
14128 set fp_classify d_fp_classify
14129 eval $inlibc
14130
14131 : see if fp_classl exists
14132 set fp_classl d_fp_classl
14133 eval $inlibc
14134
14135 : see if pathconf exists
14136 set pathconf d_pathconf
14137 eval $inlibc
14138
14139 : see if fpathconf exists
14140 set fpathconf d_fpathconf
14141 eval $inlibc
14142
14143 : see if fpclass exists
14144 set fpclass d_fpclass
14145 eval $inlibc
14146
14147 : see if fpclassl exists
14148 set fpclassl d_fpclassl
14149 eval $inlibc
14150
14151 : see if fpgetround exists
14152 set fpgetround d_fpgetround
14153 eval $inlibc
14154
14155 : check for fpos64_t
14156 echo " "
14157 echo "Checking to see if you have fpos64_t..." >&4
14158 $cat >try.c <<EOCP
14159 #include <stdio.h>
14160 int main() { fpos64_t x = 7; }
14161 EOCP
14162 set try
14163 if eval $compile; then
14164         val="$define"
14165         echo "You have fpos64_t."
14166 else
14167         val="$undef"
14168         echo "You do not have fpos64_t."
14169         case "$fpossize" in
14170         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14171         esac
14172 fi
14173 $rm_try
14174 set d_fpos64_t
14175 eval $setvar
14176
14177 : see if frexpl exists
14178 set frexpl d_frexpl
14179 eval $inlibc
14180
14181 : see if this is a sys/param system
14182 set sys/param.h i_sysparam
14183 eval $inhdr
14184
14185 : see if this is a sys/mount.h system
14186 set sys/mount.h i_sysmount
14187 eval $inhdr
14188
14189 : Check for fs_data_s
14190 echo " "
14191 echo "Checking to see if your system supports struct fs_data..." >&4
14192 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14193 eval $hasstruct
14194 case "$d_fs_data_s" in
14195 "$define")      echo "Yes, it does."   ;;
14196 *)              echo "No, it doesn't." ;;
14197 esac
14198
14199 : see if fseeko exists
14200 set fseeko d_fseeko
14201 eval $inlibc
14202 case "$longsize" in
14203 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14204 esac
14205
14206 : see if fsetpos exists
14207 set fsetpos d_fsetpos
14208 eval $inlibc
14209
14210 : see if fstatfs exists
14211 set fstatfs d_fstatfs
14212 eval $inlibc
14213
14214 : see if statvfs exists
14215 set statvfs d_statvfs
14216 eval $inlibc
14217
14218 : see if fstatvfs exists
14219 set fstatvfs d_fstatvfs
14220 eval $inlibc
14221
14222
14223 : see if fsync exists
14224 set fsync d_fsync
14225 eval $inlibc
14226
14227 : see if ftello exists
14228 set ftello d_ftello
14229 eval $inlibc
14230 case "$longsize" in
14231 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14232 esac
14233
14234 : check for a working futimes
14235 d_futimes="$undef"
14236 echo " "
14237 echo "Checking if you have a working futimes()" >&4
14238 $cat >try.c <<EOCP
14239 #include <stdio.h>
14240 #include <sys/time.h>
14241 #include <errno.h>
14242 #include <fcntl.h>
14243
14244 int main ()
14245 {
14246     int fd, rv;
14247     fd = open ("try.c", O_RDWR);
14248     if (-1 == fd) exit (1);
14249     rv = futimes (fd, NULL);
14250     exit (rv == -1 ? errno : 0);
14251 }
14252 EOCP
14253 set try
14254 if eval $compile; then
14255     `$run ./try`
14256     rc=$?
14257     case "$rc" in
14258         0)  echo "Yes, you have" >&4
14259             d_futimes="$define"
14260             ;;
14261         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14262             ;;
14263     esac
14264 else
14265     echo "No, it does not (probably harmless)" >&4
14266 fi
14267 $rm_try
14268
14269 : see if ndbm.h is available
14270 set ndbm.h i_ndbm
14271 eval $inhdr
14272 : Compatibility location for RedHat 7.1
14273 set gdbm/ndbm.h i_gdbmndbm
14274 eval $inhdr
14275 : Compatibility location for Debian 4.0
14276 set gdbm-ndbm.h i_gdbm_ndbm
14277 eval $inhdr
14278
14279 val="$undef"
14280 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14281         : see if dbm_open exists
14282         set dbm_open d_dbm_open
14283         eval $inlibc
14284         case "$d_dbm_open" in
14285         $undef)
14286                 i_ndbm="$undef"
14287                 i_gdbmndbm="$undef"
14288                 i_gdbm_ndbm="$undef"
14289                 echo "We won't be including <ndbm.h>"
14290                 val="$undef"
14291                 ;;
14292         *) val="$define"
14293            ;;
14294         esac
14295 fi
14296 set d_ndbm
14297 eval $setvar
14298
14299 ndbm_hdr_protochk='name=$1; hdr=$2;
14300 eval "ihdr=\$""i_$name";
14301 val="$undef";
14302 if $test "$ihdr" = "$define"; then
14303         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14304         case "$d_cplusplus" in
14305         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14306         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14307         esac;
14308         case "$val" in
14309         $define) $echo "Your <$hdr> seems to have prototypes";;
14310         *) $echo "Your <$hdr> does not seem to have prototypes";;
14311         esac;
14312 fi;
14313 set "d_${name}_h_uses_prototypes";
14314 eval $setvar'
14315
14316 set ndbm ndbm.h
14317 eval $ndbm_hdr_protochk
14318 set gdbmndbm gdbm/ndbm.h
14319 eval $ndbm_hdr_protochk
14320 set gdbm_ndbm gdbm-ndbm.h
14321 eval $ndbm_hdr_protochk
14322
14323 : see if getaddrinfo exists
14324 set getaddrinfo d_getaddrinfo
14325 eval $inlibc
14326
14327 : see if getcwd exists
14328 set getcwd d_getcwd
14329 eval $inlibc
14330
14331 : see if getespwnam exists
14332 set getespwnam d_getespwnam
14333 eval $inlibc
14334
14335 : see if getfsstat exists
14336 set getfsstat d_getfsstat
14337 eval $inlibc
14338
14339 : see if getgrent exists
14340 set getgrent d_getgrent
14341 eval $inlibc
14342
14343 : see if getgrent_r exists
14344 set getgrent_r d_getgrent_r
14345 eval $inlibc
14346 case "$d_getgrent_r" in
14347 "$define")
14348         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14349         case "$d_getgrent_r_proto:$usethreads" in
14350         ":define")      d_getgrent_r_proto=define
14351                 set d_getgrent_r_proto getgrent_r $hdrs
14352                 eval $hasproto ;;
14353         *)      ;;
14354         esac
14355         case "$d_getgrent_r_proto" in
14356         define)
14357         case "$getgrent_r_proto" in
14358         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14359         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14360         esac
14361         case "$getgrent_r_proto" in
14362         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14363         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14364         esac
14365         case "$getgrent_r_proto" in
14366         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14367         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14368         esac
14369         case "$getgrent_r_proto" in
14370         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14371         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14372         esac
14373         case "$getgrent_r_proto" in
14374         ''|0) try='int getgrent_r(struct group*, char*, int);'
14375         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14376         esac
14377         case "$getgrent_r_proto" in
14378         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14379         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14380         esac
14381         case "$getgrent_r_proto" in
14382         ''|0)   d_getgrent_r=undef
14383                 getgrent_r_proto=0
14384                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14385         * )     case "$getgrent_r_proto" in
14386                 REENTRANT_PROTO*) ;;
14387                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14388                 esac
14389                 echo "Prototype: $try" ;;
14390         esac
14391         ;;
14392         *)      case "$usethreads" in
14393                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14394                 esac
14395                 d_getgrent_r=undef
14396                 getgrent_r_proto=0
14397                 ;;
14398         esac
14399         ;;
14400 *)      getgrent_r_proto=0
14401         ;;
14402 esac
14403
14404 : see if getgrgid_r exists
14405 set getgrgid_r d_getgrgid_r
14406 eval $inlibc
14407 case "$d_getgrgid_r" in
14408 "$define")
14409         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14410         case "$d_getgrgid_r_proto:$usethreads" in
14411         ":define")      d_getgrgid_r_proto=define
14412                 set d_getgrgid_r_proto getgrgid_r $hdrs
14413                 eval $hasproto ;;
14414         *)      ;;
14415         esac
14416         case "$d_getgrgid_r_proto" in
14417         define)
14418         case "$getgrgid_r_proto" in
14419         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14420         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14421         esac
14422         case "$getgrgid_r_proto" in
14423         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14424         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14425         esac
14426         case "$getgrgid_r_proto" in
14427         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14428         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14429         esac
14430         case "$getgrgid_r_proto" in
14431         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14432         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14433         esac
14434         case "$getgrgid_r_proto" in
14435         ''|0)   d_getgrgid_r=undef
14436                 getgrgid_r_proto=0
14437                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14438         * )     case "$getgrgid_r_proto" in
14439                 REENTRANT_PROTO*) ;;
14440                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14441                 esac
14442                 echo "Prototype: $try" ;;
14443         esac
14444         ;;
14445         *)      case "$usethreads" in
14446                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14447                 esac
14448                 d_getgrgid_r=undef
14449                 getgrgid_r_proto=0
14450                 ;;
14451         esac
14452         ;;
14453 *)      getgrgid_r_proto=0
14454         ;;
14455 esac
14456
14457 : see if getgrnam_r exists
14458 set getgrnam_r d_getgrnam_r
14459 eval $inlibc
14460 case "$d_getgrnam_r" in
14461 "$define")
14462         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14463         case "$d_getgrnam_r_proto:$usethreads" in
14464         ":define")      d_getgrnam_r_proto=define
14465                 set d_getgrnam_r_proto getgrnam_r $hdrs
14466                 eval $hasproto ;;
14467         *)      ;;
14468         esac
14469         case "$d_getgrnam_r_proto" in
14470         define)
14471         case "$getgrnam_r_proto" in
14472         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14473         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14474         esac
14475         case "$getgrnam_r_proto" in
14476         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14477         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14478         esac
14479         case "$getgrnam_r_proto" in
14480         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14481         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14482         esac
14483         case "$getgrnam_r_proto" in
14484         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14485         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14486         esac
14487         case "$getgrnam_r_proto" in
14488         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14489         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14490         esac
14491         case "$getgrnam_r_proto" in
14492         ''|0)   d_getgrnam_r=undef
14493                 getgrnam_r_proto=0
14494                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14495         * )     case "$getgrnam_r_proto" in
14496                 REENTRANT_PROTO*) ;;
14497                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14498                 esac
14499                 echo "Prototype: $try" ;;
14500         esac
14501         ;;
14502         *)      case "$usethreads" in
14503                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14504                 esac
14505                 d_getgrnam_r=undef
14506                 getgrnam_r_proto=0
14507                 ;;
14508         esac
14509         ;;
14510 *)      getgrnam_r_proto=0
14511         ;;
14512 esac
14513
14514 : see if gethostbyaddr exists
14515 set gethostbyaddr d_gethbyaddr
14516 eval $inlibc
14517
14518 : see if gethostbyname exists
14519 set gethostbyname d_gethbyname
14520 eval $inlibc
14521
14522 : see if gethostent exists
14523 set gethostent d_gethent
14524 eval $inlibc
14525
14526 : see how we will look up host name
14527 echo " "
14528 call=''
14529 if set gethostname val -f d_gethname; eval $csym; $val; then
14530         echo 'gethostname() found.' >&4
14531         d_gethname="$define"
14532         call=gethostname
14533 fi
14534 if set uname val -f d_uname; eval $csym; $val; then
14535         if ./xenix; then
14536                 $cat <<'EOM'
14537 uname() was found, but you're running xenix, and older versions of xenix
14538 have a broken uname(). If you don't really know whether your xenix is old
14539 enough to have a broken system call, use the default answer.
14540
14541 EOM
14542                 dflt=y
14543                 case "$d_uname" in
14544                 "$define") dflt=n;;
14545                 esac
14546                 rp='Is your uname() broken?'
14547                 . ./myread
14548                 case "$ans" in
14549                 n*) d_uname="$define"; call=uname;;
14550                 esac
14551         else
14552                 echo 'uname() found.' >&4
14553                 d_uname="$define"
14554                 case "$call" in
14555                 '') call=uname ;;
14556                 esac
14557         fi
14558 fi
14559 case "$d_gethname" in
14560 '') d_gethname="$undef";;
14561 esac
14562 case "$d_uname" in
14563 '') d_uname="$undef";;
14564 esac
14565 case "$d_uname$d_gethname" in
14566 *define*)
14567         dflt=n
14568         cat <<EOM
14569
14570 Every now and then someone has a $call() that lies about the hostname
14571 but can't be fixed for political or economic reasons.  If you wish, I can
14572 pretend $call() isn't there and maybe compute hostname at run-time
14573 thanks to the '$phostname' command.
14574
14575 EOM
14576         rp="Shall I ignore $call() from now on?"
14577         . ./myread
14578         case "$ans" in
14579         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14580         esac;;
14581 esac
14582 case "$phostname" in
14583 '') aphostname='';;
14584 *) case "$aphostname" in
14585         /*) ;;
14586         *) set X $phostname
14587                 shift
14588                 file=$1
14589                 shift
14590                 file=`./loc $file $file $pth`
14591                 aphostname=`echo $file $*`
14592                 ;;
14593         esac
14594         ;;
14595 esac
14596 case "$d_uname$d_gethname" in
14597 *define*) ;;
14598 *)
14599         case "$phostname" in
14600         '')
14601                 echo "There will be no way for $package to get your hostname." >&4;;
14602         *)
14603         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14604                 ;;
14605         esac;;
14606 esac
14607 case "$d_phostname" in
14608 '') d_phostname="$undef";;
14609 esac
14610
14611 : see if gethostbyaddr_r exists
14612 set gethostbyaddr_r d_gethostbyaddr_r
14613 eval $inlibc
14614 case "$d_gethostbyaddr_r" in
14615 "$define")
14616         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14617         case "$d_gethostbyaddr_r_proto:$usethreads" in
14618         ":define")      d_gethostbyaddr_r_proto=define
14619                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14620                 eval $hasproto ;;
14621         *)      ;;
14622         esac
14623         case "$d_gethostbyaddr_r_proto" in
14624         define)
14625         case "$gethostbyaddr_r_proto" in
14626         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14627         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14628         esac
14629         case "$gethostbyaddr_r_proto" in
14630         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14631         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14632         esac
14633         case "$gethostbyaddr_r_proto" in
14634         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14635         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14636         esac
14637         case "$gethostbyaddr_r_proto" in
14638         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14639         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14640         esac
14641         case "$gethostbyaddr_r_proto" in
14642         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14643         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14644         esac
14645         case "$gethostbyaddr_r_proto" in
14646         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14647         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14648         esac
14649         case "$gethostbyaddr_r_proto" in
14650         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14651         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14652         esac
14653         case "$gethostbyaddr_r_proto" in
14654         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14655         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14656         esac
14657         case "$gethostbyaddr_r_proto" in
14658         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14659         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14660         esac
14661         case "$gethostbyaddr_r_proto" in
14662         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14663         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14664         esac
14665         case "$gethostbyaddr_r_proto" in
14666         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14667         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14668         esac
14669         case "$gethostbyaddr_r_proto" in
14670         ''|0)   d_gethostbyaddr_r=undef
14671                 gethostbyaddr_r_proto=0
14672                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14673         * )     case "$gethostbyaddr_r_proto" in
14674                 REENTRANT_PROTO*) ;;
14675                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14676                 esac
14677                 echo "Prototype: $try" ;;
14678         esac
14679         ;;
14680         *)      case "$usethreads" in
14681                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14682                 esac
14683                 d_gethostbyaddr_r=undef
14684                 gethostbyaddr_r_proto=0
14685                 ;;
14686         esac
14687         ;;
14688 *)      gethostbyaddr_r_proto=0
14689         ;;
14690 esac
14691
14692 : see if gethostbyname_r exists
14693 set gethostbyname_r d_gethostbyname_r
14694 eval $inlibc
14695 case "$d_gethostbyname_r" in
14696 "$define")
14697         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14698         case "$d_gethostbyname_r_proto:$usethreads" in
14699         ":define")      d_gethostbyname_r_proto=define
14700                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14701                 eval $hasproto ;;
14702         *)      ;;
14703         esac
14704         case "$d_gethostbyname_r_proto" in
14705         define)
14706         case "$gethostbyname_r_proto" in
14707         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14708         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14709         esac
14710         case "$gethostbyname_r_proto" in
14711         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14712         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14713         esac
14714         case "$gethostbyname_r_proto" in
14715         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14716         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14717         esac
14718         case "$gethostbyname_r_proto" in
14719         ''|0)   d_gethostbyname_r=undef
14720                 gethostbyname_r_proto=0
14721                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14722         * )     case "$gethostbyname_r_proto" in
14723                 REENTRANT_PROTO*) ;;
14724                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14725                 esac
14726                 echo "Prototype: $try" ;;
14727         esac
14728         ;;
14729         *)      case "$usethreads" in
14730                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14731                 esac
14732                 d_gethostbyname_r=undef
14733                 gethostbyname_r_proto=0
14734                 ;;
14735         esac
14736         ;;
14737 *)      gethostbyname_r_proto=0
14738         ;;
14739 esac
14740
14741 : see if gethostent_r exists
14742 set gethostent_r d_gethostent_r
14743 eval $inlibc
14744 case "$d_gethostent_r" in
14745 "$define")
14746         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14747         case "$d_gethostent_r_proto:$usethreads" in
14748         ":define")      d_gethostent_r_proto=define
14749                 set d_gethostent_r_proto gethostent_r $hdrs
14750                 eval $hasproto ;;
14751         *)      ;;
14752         esac
14753         case "$d_gethostent_r_proto" in
14754         define)
14755         case "$gethostent_r_proto" in
14756         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14757         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14758         esac
14759         case "$gethostent_r_proto" in
14760         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14761         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14762         esac
14763         case "$gethostent_r_proto" in
14764         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14765         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14766         esac
14767         case "$gethostent_r_proto" in
14768         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14769         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14770         esac
14771         case "$gethostent_r_proto" in
14772         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14773         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14774         esac
14775         case "$gethostent_r_proto" in
14776         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14777         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14778         esac
14779         case "$gethostent_r_proto" in
14780         ''|0)   d_gethostent_r=undef
14781                 gethostent_r_proto=0
14782                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14783         * )     case "$gethostent_r_proto" in
14784                 REENTRANT_PROTO*) ;;
14785                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14786                 esac
14787                 echo "Prototype: $try" ;;
14788         esac
14789         ;;
14790         *)      case "$usethreads" in
14791                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14792                 esac
14793                 d_gethostent_r=undef
14794                 gethostent_r_proto=0
14795                 ;;
14796         esac
14797         ;;
14798 *)      gethostent_r_proto=0
14799         ;;
14800 esac
14801
14802 : see if prototypes for various gethostxxx netdb.h functions are available
14803 echo " "
14804 set d_gethostprotos gethostent $i_netdb netdb.h
14805 eval $hasproto
14806
14807 : see if getitimer exists
14808 set getitimer d_getitimer
14809 eval $inlibc
14810
14811 : see if getlogin exists
14812 set getlogin d_getlogin
14813 eval $inlibc
14814
14815 : see if getlogin_r exists
14816 set getlogin_r d_getlogin_r
14817 eval $inlibc
14818 case "$d_getlogin_r" in
14819 "$define")
14820         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14821         case "$d_getlogin_r_proto:$usethreads" in
14822         ":define")      d_getlogin_r_proto=define
14823                 set d_getlogin_r_proto getlogin_r $hdrs
14824                 eval $hasproto ;;
14825         *)      ;;
14826         esac
14827         case "$d_getlogin_r_proto" in
14828         define)
14829         case "$getlogin_r_proto" in
14830         ''|0) try='int getlogin_r(char*, size_t);'
14831         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14832         esac
14833         case "$getlogin_r_proto" in
14834         ''|0) try='int getlogin_r(char*, int);'
14835         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14836         esac
14837         case "$getlogin_r_proto" in
14838         ''|0) try='char* getlogin_r(char*, size_t);'
14839         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14840         esac
14841         case "$getlogin_r_proto" in
14842         ''|0) try='char* getlogin_r(char*, int);'
14843         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14844         esac
14845         case "$getlogin_r_proto" in
14846         ''|0)   d_getlogin_r=undef
14847                 getlogin_r_proto=0
14848                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14849         * )     case "$getlogin_r_proto" in
14850                 REENTRANT_PROTO*) ;;
14851                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14852                 esac
14853                 echo "Prototype: $try" ;;
14854         esac
14855         ;;
14856         *)      case "$usethreads" in
14857                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14858                 esac
14859                 d_getlogin_r=undef
14860                 getlogin_r_proto=0
14861                 ;;
14862         esac
14863         ;;
14864 *)      getlogin_r_proto=0
14865         ;;
14866 esac
14867
14868 : see if getmnt exists
14869 set getmnt d_getmnt
14870 eval $inlibc
14871
14872 : see if getmntent exists
14873 set getmntent d_getmntent
14874 eval $inlibc
14875
14876 : see if getnameinfo exists
14877 set getnameinfo d_getnameinfo
14878 eval $inlibc
14879
14880 : see if getnetbyaddr exists
14881 set getnetbyaddr d_getnbyaddr
14882 eval $inlibc
14883
14884 : see if getnetbyname exists
14885 set getnetbyname d_getnbyname
14886 eval $inlibc
14887
14888 : see if getnetent exists
14889 set getnetent d_getnent
14890 eval $inlibc
14891
14892 : see if getnetbyaddr_r exists
14893 set getnetbyaddr_r d_getnetbyaddr_r
14894 eval $inlibc
14895 case "$d_getnetbyaddr_r" in
14896 "$define")
14897         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14898         case "$d_getnetbyaddr_r_proto:$usethreads" in
14899         ":define")      d_getnetbyaddr_r_proto=define
14900                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14901                 eval $hasproto ;;
14902         *)      ;;
14903         esac
14904         case "$d_getnetbyaddr_r_proto" in
14905         define)
14906         case "$getnetbyaddr_r_proto" in
14907         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14908         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14909         esac
14910         case "$getnetbyaddr_r_proto" in
14911         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14912         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14913         esac
14914         case "$getnetbyaddr_r_proto" in
14915         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14916         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14917         esac
14918         case "$getnetbyaddr_r_proto" in
14919         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14920         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14921         esac
14922         case "$getnetbyaddr_r_proto" in
14923         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14924         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14925         esac
14926         case "$getnetbyaddr_r_proto" in
14927         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14928         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14929         esac
14930         case "$getnetbyaddr_r_proto" in
14931         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14932         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14933         esac
14934         case "$getnetbyaddr_r_proto" in
14935         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14936         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14937         esac
14938         case "$getnetbyaddr_r_proto" in
14939         ''|0)   d_getnetbyaddr_r=undef
14940                 getnetbyaddr_r_proto=0
14941                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14942         * )     case "$getnetbyaddr_r_proto" in
14943                 REENTRANT_PROTO*) ;;
14944                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14945                 esac
14946                 echo "Prototype: $try" ;;
14947         esac
14948         ;;
14949         *)      case "$usethreads" in
14950                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14951                 esac
14952                 d_getnetbyaddr_r=undef
14953                 getnetbyaddr_r_proto=0
14954                 ;;
14955         esac
14956         ;;
14957 *)      getnetbyaddr_r_proto=0
14958         ;;
14959 esac
14960
14961 : see if getnetbyname_r exists
14962 set getnetbyname_r d_getnetbyname_r
14963 eval $inlibc
14964 case "$d_getnetbyname_r" in
14965 "$define")
14966         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14967         case "$d_getnetbyname_r_proto:$usethreads" in
14968         ":define")      d_getnetbyname_r_proto=define
14969                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14970                 eval $hasproto ;;
14971         *)      ;;
14972         esac
14973         case "$d_getnetbyname_r_proto" in
14974         define)
14975         case "$getnetbyname_r_proto" in
14976         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14977         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14978         esac
14979         case "$getnetbyname_r_proto" in
14980         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14981         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14982         esac
14983         case "$getnetbyname_r_proto" in
14984         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14985         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14986         esac
14987         case "$getnetbyname_r_proto" in
14988         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14989         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14990         esac
14991         case "$getnetbyname_r_proto" in
14992         ''|0)   d_getnetbyname_r=undef
14993                 getnetbyname_r_proto=0
14994                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14995         * )     case "$getnetbyname_r_proto" in
14996                 REENTRANT_PROTO*) ;;
14997                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14998                 esac
14999                 echo "Prototype: $try" ;;
15000         esac
15001         ;;
15002         *)      case "$usethreads" in
15003                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
15004                 esac
15005                 d_getnetbyname_r=undef
15006                 getnetbyname_r_proto=0
15007                 ;;
15008         esac
15009         ;;
15010 *)      getnetbyname_r_proto=0
15011         ;;
15012 esac
15013
15014 : see if getnetent_r exists
15015 set getnetent_r d_getnetent_r
15016 eval $inlibc
15017 case "$d_getnetent_r" in
15018 "$define")
15019         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15020         case "$d_getnetent_r_proto:$usethreads" in
15021         ":define")      d_getnetent_r_proto=define
15022                 set d_getnetent_r_proto getnetent_r $hdrs
15023                 eval $hasproto ;;
15024         *)      ;;
15025         esac
15026         case "$d_getnetent_r_proto" in
15027         define)
15028         case "$getnetent_r_proto" in
15029         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15030         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15031         esac
15032         case "$getnetent_r_proto" in
15033         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15034         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15035         esac
15036         case "$getnetent_r_proto" in
15037         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15038         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15039         esac
15040         case "$getnetent_r_proto" in
15041         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15042         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15043         esac
15044         case "$getnetent_r_proto" in
15045         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15046         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15047         esac
15048         case "$getnetent_r_proto" in
15049         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15050         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15051         esac
15052         case "$getnetent_r_proto" in
15053         ''|0)   d_getnetent_r=undef
15054                 getnetent_r_proto=0
15055                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15056         * )     case "$getnetent_r_proto" in
15057                 REENTRANT_PROTO*) ;;
15058                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15059                 esac
15060                 echo "Prototype: $try" ;;
15061         esac
15062         ;;
15063         *)      case "$usethreads" in
15064                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15065                 esac
15066                 d_getnetent_r=undef
15067                 getnetent_r_proto=0
15068                 ;;
15069         esac
15070         ;;
15071 *)      getnetent_r_proto=0
15072         ;;
15073 esac
15074
15075 : see if prototypes for various getnetxxx netdb.h functions are available
15076 echo " "
15077 set d_getnetprotos getnetent $i_netdb netdb.h
15078 eval $hasproto
15079
15080 : see if getpagesize exists
15081 set getpagesize d_getpagsz
15082 eval $inlibc
15083
15084 : Optional checks for getprotobyname and getprotobynumber
15085
15086 : see if getprotobyname exists
15087 set getprotobyname d_getpbyname
15088 eval $inlibc
15089
15090 : see if getprotobynumber exists
15091 set getprotobynumber d_getpbynumber
15092 eval $inlibc
15093
15094 : see if getprotoent exists
15095 set getprotoent d_getpent
15096 eval $inlibc
15097
15098 : see if getpgid exists
15099 set getpgid d_getpgid
15100 eval $inlibc
15101
15102 : see if getpgrp2 exists
15103 set getpgrp2 d_getpgrp2
15104 eval $inlibc
15105
15106 : see if getppid exists
15107 set getppid d_getppid
15108 eval $inlibc
15109
15110 : see if getpriority exists
15111 set getpriority d_getprior
15112 eval $inlibc
15113
15114 : see if getprotobyname_r exists
15115 set getprotobyname_r d_getprotobyname_r
15116 eval $inlibc
15117 case "$d_getprotobyname_r" in
15118 "$define")
15119         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15120         case "$d_getprotobyname_r_proto:$usethreads" in
15121         ":define")      d_getprotobyname_r_proto=define
15122                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15123                 eval $hasproto ;;
15124         *)      ;;
15125         esac
15126         case "$d_getprotobyname_r_proto" in
15127         define)
15128         case "$getprotobyname_r_proto" in
15129         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15130         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15131         esac
15132         case "$getprotobyname_r_proto" in
15133         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15134         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15135         esac
15136         case "$getprotobyname_r_proto" in
15137         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15138         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15139         esac
15140         case "$getprotobyname_r_proto" in
15141         ''|0)   d_getprotobyname_r=undef
15142                 getprotobyname_r_proto=0
15143                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15144         * )     case "$getprotobyname_r_proto" in
15145                 REENTRANT_PROTO*) ;;
15146                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15147                 esac
15148                 echo "Prototype: $try" ;;
15149         esac
15150         ;;
15151         *)      case "$usethreads" in
15152                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15153                 esac
15154                 d_getprotobyname_r=undef
15155                 getprotobyname_r_proto=0
15156                 ;;
15157         esac
15158         ;;
15159 *)      getprotobyname_r_proto=0
15160         ;;
15161 esac
15162
15163 : see if getprotobynumber_r exists
15164 set getprotobynumber_r d_getprotobynumber_r
15165 eval $inlibc
15166 case "$d_getprotobynumber_r" in
15167 "$define")
15168         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15169         case "$d_getprotobynumber_r_proto:$usethreads" in
15170         ":define")      d_getprotobynumber_r_proto=define
15171                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15172                 eval $hasproto ;;
15173         *)      ;;
15174         esac
15175         case "$d_getprotobynumber_r_proto" in
15176         define)
15177         case "$getprotobynumber_r_proto" in
15178         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15179         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15180         esac
15181         case "$getprotobynumber_r_proto" in
15182         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15183         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15184         esac
15185         case "$getprotobynumber_r_proto" in
15186         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15187         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15188         esac
15189         case "$getprotobynumber_r_proto" in
15190         ''|0)   d_getprotobynumber_r=undef
15191                 getprotobynumber_r_proto=0
15192                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15193         * )     case "$getprotobynumber_r_proto" in
15194                 REENTRANT_PROTO*) ;;
15195                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15196                 esac
15197                 echo "Prototype: $try" ;;
15198         esac
15199         ;;
15200         *)      case "$usethreads" in
15201                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15202                 esac
15203                 d_getprotobynumber_r=undef
15204                 getprotobynumber_r_proto=0
15205                 ;;
15206         esac
15207         ;;
15208 *)      getprotobynumber_r_proto=0
15209         ;;
15210 esac
15211
15212 : see if getprotoent_r exists
15213 set getprotoent_r d_getprotoent_r
15214 eval $inlibc
15215 case "$d_getprotoent_r" in
15216 "$define")
15217         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15218         case "$d_getprotoent_r_proto:$usethreads" in
15219         ":define")      d_getprotoent_r_proto=define
15220                 set d_getprotoent_r_proto getprotoent_r $hdrs
15221                 eval $hasproto ;;
15222         *)      ;;
15223         esac
15224         case "$d_getprotoent_r_proto" in
15225         define)
15226         case "$getprotoent_r_proto" in
15227         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15228         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15229         esac
15230         case "$getprotoent_r_proto" in
15231         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15232         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15233         esac
15234         case "$getprotoent_r_proto" in
15235         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15236         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15237         esac
15238         case "$getprotoent_r_proto" in
15239         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15240         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15241         esac
15242         case "$getprotoent_r_proto" in
15243         ''|0)   d_getprotoent_r=undef
15244                 getprotoent_r_proto=0
15245                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15246         * )     case "$getprotoent_r_proto" in
15247                 REENTRANT_PROTO*) ;;
15248                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15249                 esac
15250                 echo "Prototype: $try" ;;
15251         esac
15252         ;;
15253         *)      case "$usethreads" in
15254                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15255                 esac
15256                 d_getprotoent_r=undef
15257                 getprotoent_r_proto=0
15258                 ;;
15259         esac
15260         ;;
15261 *)      getprotoent_r_proto=0
15262         ;;
15263 esac
15264
15265 : see if prototypes for various getprotoxxx netdb.h functions are available
15266 echo " "
15267 set d_getprotoprotos getprotoent $i_netdb netdb.h
15268 eval $hasproto
15269
15270 : see if getprpwnam exists
15271 set getprpwnam d_getprpwnam
15272 eval $inlibc
15273
15274 : see if getpwent exists
15275 set getpwent d_getpwent
15276 eval $inlibc
15277
15278 : see if getpwent_r exists
15279 set getpwent_r d_getpwent_r
15280 eval $inlibc
15281 case "$d_getpwent_r" in
15282 "$define")
15283         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15284         case "$d_getpwent_r_proto:$usethreads" in
15285         ":define")      d_getpwent_r_proto=define
15286                 set d_getpwent_r_proto getpwent_r $hdrs
15287                 eval $hasproto ;;
15288         *)      ;;
15289         esac
15290         case "$d_getpwent_r_proto" in
15291         define)
15292         case "$getpwent_r_proto" in
15293         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15294         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15295         esac
15296         case "$getpwent_r_proto" in
15297         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15298         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15299         esac
15300         case "$getpwent_r_proto" in
15301         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15302         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15303         esac
15304         case "$getpwent_r_proto" in
15305         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15306         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15307         esac
15308         case "$getpwent_r_proto" in
15309         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15310         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15311         esac
15312         case "$getpwent_r_proto" in
15313         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15314         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15315         esac
15316         case "$getpwent_r_proto" in
15317         ''|0)   d_getpwent_r=undef
15318                 getpwent_r_proto=0
15319                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15320         * )     case "$getpwent_r_proto" in
15321                 REENTRANT_PROTO*) ;;
15322                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15323                 esac
15324                 echo "Prototype: $try" ;;
15325         esac
15326         ;;
15327         *)      case "$usethreads" in
15328                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15329                 esac
15330                 d_getpwent_r=undef
15331                 getpwent_r_proto=0
15332                 ;;
15333         esac
15334         ;;
15335 *)      getpwent_r_proto=0
15336         ;;
15337 esac
15338
15339 : see if getpwnam_r exists
15340 set getpwnam_r d_getpwnam_r
15341 eval $inlibc
15342 case "$d_getpwnam_r" in
15343 "$define")
15344         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15345         case "$d_getpwnam_r_proto:$usethreads" in
15346         ":define")      d_getpwnam_r_proto=define
15347                 set d_getpwnam_r_proto getpwnam_r $hdrs
15348                 eval $hasproto ;;
15349         *)      ;;
15350         esac
15351         case "$d_getpwnam_r_proto" in
15352         define)
15353         case "$getpwnam_r_proto" in
15354         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15355         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15356         esac
15357         case "$getpwnam_r_proto" in
15358         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15359         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15360         esac
15361         case "$getpwnam_r_proto" in
15362         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15363         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15364         esac
15365         case "$getpwnam_r_proto" in
15366         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15367         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15368         esac
15369         case "$getpwnam_r_proto" in
15370         ''|0)   d_getpwnam_r=undef
15371                 getpwnam_r_proto=0
15372                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15373         * )     case "$getpwnam_r_proto" in
15374                 REENTRANT_PROTO*) ;;
15375                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15376                 esac
15377                 echo "Prototype: $try" ;;
15378         esac
15379         ;;
15380         *)      case "$usethreads" in
15381                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15382                 esac
15383                 d_getpwnam_r=undef
15384                 getpwnam_r_proto=0
15385                 ;;
15386         esac
15387         ;;
15388 *)      getpwnam_r_proto=0
15389         ;;
15390 esac
15391
15392 : see if getpwuid_r exists
15393 set getpwuid_r d_getpwuid_r
15394 eval $inlibc
15395 case "$d_getpwuid_r" in
15396 "$define")
15397         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15398         case "$d_getpwuid_r_proto:$usethreads" in
15399         ":define")      d_getpwuid_r_proto=define
15400                 set d_getpwuid_r_proto getpwuid_r $hdrs
15401                 eval $hasproto ;;
15402         *)      ;;
15403         esac
15404         case "$d_getpwuid_r_proto" in
15405         define)
15406         case "$getpwuid_r_proto" in
15407         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15408         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15409         esac
15410         case "$getpwuid_r_proto" in
15411         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15412         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15413         esac
15414         case "$getpwuid_r_proto" in
15415         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15416         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15417         esac
15418         case "$getpwuid_r_proto" in
15419         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15420         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15421         esac
15422         case "$getpwuid_r_proto" in
15423         ''|0)   d_getpwuid_r=undef
15424                 getpwuid_r_proto=0
15425                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15426         * )     case "$getpwuid_r_proto" in
15427                 REENTRANT_PROTO*) ;;
15428                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15429                 esac
15430                 echo "Prototype: $try" ;;
15431         esac
15432         ;;
15433         *)      case "$usethreads" in
15434                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15435                 esac
15436                 d_getpwuid_r=undef
15437                 getpwuid_r_proto=0
15438                 ;;
15439         esac
15440         ;;
15441 *)      getpwuid_r_proto=0
15442         ;;
15443 esac
15444
15445 : Optional checks for getsbyname and getsbyport
15446
15447 : see if getservbyname exists
15448 set getservbyname d_getsbyname
15449 eval $inlibc
15450
15451 : see if getservbyport exists
15452 set getservbyport d_getsbyport
15453 eval $inlibc
15454
15455 : see if getservent exists
15456 set getservent d_getsent
15457 eval $inlibc
15458
15459 : see if getservbyname_r exists
15460 set getservbyname_r d_getservbyname_r
15461 eval $inlibc
15462 case "$d_getservbyname_r" in
15463 "$define")
15464         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15465         case "$d_getservbyname_r_proto:$usethreads" in
15466         ":define")      d_getservbyname_r_proto=define
15467                 set d_getservbyname_r_proto getservbyname_r $hdrs
15468                 eval $hasproto ;;
15469         *)      ;;
15470         esac
15471         case "$d_getservbyname_r_proto" in
15472         define)
15473         case "$getservbyname_r_proto" in
15474         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15475         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15476         esac
15477         case "$getservbyname_r_proto" in
15478         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15479         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15480         esac
15481         case "$getservbyname_r_proto" in
15482         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15483         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15484         esac
15485         case "$getservbyname_r_proto" in
15486         ''|0)   d_getservbyname_r=undef
15487                 getservbyname_r_proto=0
15488                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15489         * )     case "$getservbyname_r_proto" in
15490                 REENTRANT_PROTO*) ;;
15491                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15492                 esac
15493                 echo "Prototype: $try" ;;
15494         esac
15495         ;;
15496         *)      case "$usethreads" in
15497                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15498                 esac
15499                 d_getservbyname_r=undef
15500                 getservbyname_r_proto=0
15501                 ;;
15502         esac
15503         ;;
15504 *)      getservbyname_r_proto=0
15505         ;;
15506 esac
15507
15508 : see if getservbyport_r exists
15509 set getservbyport_r d_getservbyport_r
15510 eval $inlibc
15511 case "$d_getservbyport_r" in
15512 "$define")
15513         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15514         case "$d_getservbyport_r_proto:$usethreads" in
15515         ":define")      d_getservbyport_r_proto=define
15516                 set d_getservbyport_r_proto getservbyport_r $hdrs
15517                 eval $hasproto ;;
15518         *)      ;;
15519         esac
15520         case "$d_getservbyport_r_proto" in
15521         define)
15522         case "$getservbyport_r_proto" in
15523         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15524         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15525         esac
15526         case "$getservbyport_r_proto" in
15527         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15528         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15529         esac
15530         case "$getservbyport_r_proto" in
15531         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15532         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15533         esac
15534         case "$getservbyport_r_proto" in
15535         ''|0)   d_getservbyport_r=undef
15536                 getservbyport_r_proto=0
15537                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15538         * )     case "$getservbyport_r_proto" in
15539                 REENTRANT_PROTO*) ;;
15540                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15541                 esac
15542                 echo "Prototype: $try" ;;
15543         esac
15544         ;;
15545         *)      case "$usethreads" in
15546                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15547                 esac
15548                 d_getservbyport_r=undef
15549                 getservbyport_r_proto=0
15550                 ;;
15551         esac
15552         ;;
15553 *)      getservbyport_r_proto=0
15554         ;;
15555 esac
15556
15557 : see if getservent_r exists
15558 set getservent_r d_getservent_r
15559 eval $inlibc
15560 case "$d_getservent_r" in
15561 "$define")
15562         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15563         case "$d_getservent_r_proto:$usethreads" in
15564         ":define")      d_getservent_r_proto=define
15565                 set d_getservent_r_proto getservent_r $hdrs
15566                 eval $hasproto ;;
15567         *)      ;;
15568         esac
15569         case "$d_getservent_r_proto" in
15570         define)
15571         case "$getservent_r_proto" in
15572         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15573         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15574         esac
15575         case "$getservent_r_proto" in
15576         ''|0) try='int getservent_r(struct servent*, char*, int);'
15577         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15578         esac
15579         case "$getservent_r_proto" in
15580         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15581         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15582         esac
15583         case "$getservent_r_proto" in
15584         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15585         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15586         esac
15587         case "$getservent_r_proto" in
15588         ''|0)   d_getservent_r=undef
15589                 getservent_r_proto=0
15590                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15591         * )     case "$getservent_r_proto" in
15592                 REENTRANT_PROTO*) ;;
15593                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15594                 esac
15595                 echo "Prototype: $try" ;;
15596         esac
15597         ;;
15598         *)      case "$usethreads" in
15599                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15600                 esac
15601                 d_getservent_r=undef
15602                 getservent_r_proto=0
15603                 ;;
15604         esac
15605         ;;
15606 *)      getservent_r_proto=0
15607         ;;
15608 esac
15609
15610 : see if prototypes for various getservxxx netdb.h functions are available
15611 echo " "
15612 set d_getservprotos getservent $i_netdb netdb.h
15613 eval $hasproto
15614
15615 : see if getspnam exists
15616 set getspnam d_getspnam
15617 eval $inlibc
15618
15619 : see if this is a shadow.h system
15620 set shadow.h i_shadow
15621 eval $inhdr
15622
15623 : see if getspnam_r exists
15624 set getspnam_r d_getspnam_r
15625 eval $inlibc
15626 case "$d_getspnam_r" in
15627 "$define")
15628         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15629         case "$d_getspnam_r_proto:$usethreads" in
15630         ":define")      d_getspnam_r_proto=define
15631                 set d_getspnam_r_proto getspnam_r $hdrs
15632                 eval $hasproto ;;
15633         *)      ;;
15634         esac
15635         case "$d_getspnam_r_proto" in
15636         define)
15637         case "$getspnam_r_proto" in
15638         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15639         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15640         esac
15641         case "$getspnam_r_proto" in
15642         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15643         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15644         esac
15645         case "$getspnam_r_proto" in
15646         ''|0)   d_getspnam_r=undef
15647                 getspnam_r_proto=0
15648                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15649         * )     case "$getspnam_r_proto" in
15650                 REENTRANT_PROTO*) ;;
15651                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15652                 esac
15653                 echo "Prototype: $try" ;;
15654         esac
15655         ;;
15656         *)      case "$usethreads" in
15657                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15658                 esac
15659                 d_getspnam_r=undef
15660                 getspnam_r_proto=0
15661                 ;;
15662         esac
15663         ;;
15664 *)      getspnam_r_proto=0
15665         ;;
15666 esac
15667
15668 : see if gettimeofday or ftime exists
15669 set gettimeofday d_gettimeod
15670 eval $inlibc
15671 case "$d_gettimeod" in
15672 "$undef")
15673         set ftime d_ftime 
15674         eval $inlibc
15675         ;;
15676 *)
15677         val="$undef"; set d_ftime; eval $setvar
15678         ;;
15679 esac
15680 case "$d_gettimeod$d_ftime" in
15681 "$undef$undef")
15682         echo " "
15683         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15684         ;;
15685 esac
15686
15687 : see if gmtime_r exists
15688 set gmtime_r d_gmtime_r
15689 eval $inlibc
15690 case "$d_gmtime_r" in
15691 "$define")
15692         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15693         case "$d_gmtime_r_proto:$usethreads" in
15694         ":define")      d_gmtime_r_proto=define
15695                 set d_gmtime_r_proto gmtime_r $hdrs
15696                 eval $hasproto ;;
15697         *)      ;;
15698         esac
15699         case "$d_gmtime_r_proto" in
15700         define)
15701         case "$gmtime_r_proto" in
15702         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15703         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15704         esac
15705         case "$gmtime_r_proto" in
15706         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15707         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15708         esac
15709         case "$gmtime_r_proto" in
15710         ''|0)   d_gmtime_r=undef
15711                 gmtime_r_proto=0
15712                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15713         * )     case "$gmtime_r_proto" in
15714                 REENTRANT_PROTO*) ;;
15715                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15716                 esac
15717                 echo "Prototype: $try" ;;
15718         esac
15719         ;;
15720         *)      case "$usethreads" in
15721                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15722                 esac
15723                 d_gmtime_r=undef
15724                 gmtime_r_proto=0
15725                 ;;
15726         esac
15727         ;;
15728 *)      gmtime_r_proto=0
15729         ;;
15730 esac
15731
15732 : see if hasmntopt exists
15733 set hasmntopt d_hasmntopt
15734 eval $inlibc
15735
15736 : see if this is a netinet/in.h or sys/in.h system
15737 set netinet/in.h i_niin sys/in.h i_sysin
15738 eval $inhdr
15739
15740 : see if arpa/inet.h has to be included
15741 set arpa/inet.h i_arpainet
15742 eval $inhdr
15743
15744 : see if htonl --and friends-- exists
15745 val=''
15746 set htonl val
15747 eval $inlibc
15748
15749 : Maybe they are macros.
15750 case "$val" in
15751 $undef)
15752         $cat >htonl.c <<EOM
15753 #include <stdio.h>
15754 #include <sys/types.h>
15755 #$i_niin I_NETINET_IN
15756 #$i_sysin I_SYS_IN
15757 #$i_arpainet I_ARPA_INET
15758 #ifdef I_NETINET_IN
15759 #include <netinet/in.h>
15760 #endif
15761 #ifdef I_SYS_IN
15762 #include <sys/in.h>
15763 #endif
15764 #ifdef I_ARPA_INET
15765 #include <arpa/inet.h>
15766 #endif
15767 #ifdef htonl
15768 printf("Defined as a macro.");
15769 #endif
15770 EOM
15771         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15772         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15773                 val="$define"
15774                 echo "But it seems to be defined as a macro." >&4
15775         fi
15776         $rm -f htonl.?
15777         ;;
15778 esac
15779 set d_htonl
15780 eval $setvar
15781
15782 : see if hypot exists
15783 set hypot d_hypot
15784 eval $inlibc
15785
15786 : see if ilogb exists
15787 set ilogb d_ilogb
15788 eval $inlibc
15789
15790 : see if ilogbl exists
15791 set ilogbl d_ilogbl
15792 eval $inlibc
15793
15794 : index or strchr
15795 echo " "
15796 if set index val -f; eval $csym; $val; then
15797         if set strchr val -f d_strchr; eval $csym; $val; then
15798                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15799                         val="$define"
15800                         vali="$undef"
15801                         echo "strchr() found." >&4
15802                 else
15803                         val="$undef"
15804                         vali="$define"
15805                         echo "index() found." >&4
15806                 fi
15807         else
15808                 val="$undef"
15809                 vali="$define"
15810                 echo "index() found." >&4
15811         fi
15812 else
15813         if set strchr val -f d_strchr; eval $csym; $val; then
15814                 val="$define"
15815                 vali="$undef"
15816                 echo "strchr() found." >&4
15817         else
15818                 echo "No index() or strchr() found!" >&4
15819                 val="$undef"
15820                 vali="$undef"
15821         fi
15822 fi
15823 set d_strchr; eval $setvar
15824 val="$vali"
15825 set d_index; eval $setvar
15826
15827 : check whether inet_aton exists
15828 set inet_aton d_inetaton
15829 eval $inlibc
15830
15831 : see if inet_ntop exists
15832 set inet_ntop d_inetntop
15833 eval $inlibc
15834
15835 : see if inet_pton exists
15836 set inet_pton d_inetpton
15837 eval $inlibc
15838
15839 : Look for isascii
15840 echo " "
15841 $cat >isascii.c <<EOCP
15842 #include <stdio.h>
15843 #include <ctype.h>
15844 #$i_stdlib I_STDLIB
15845 #ifdef I_STDLIB
15846 #include <stdlib.h>
15847 #endif
15848 int main() {
15849         int c = 'A';
15850         if (isascii(c))
15851                 exit(0);
15852         else
15853                 exit(1);
15854 }
15855 EOCP
15856 set isascii
15857 if eval $compile; then
15858         echo "isascii() found." >&4
15859         val="$define"
15860 else
15861         echo "isascii() NOT found." >&4
15862         val="$undef"
15863 fi
15864 set d_isascii
15865 eval $setvar
15866 $rm -f isascii*
15867
15868 : Look for isblank
15869 echo " "
15870 $cat >isblank.c <<'EOCP'
15871 #include <stdio.h>
15872 #include <ctype.h>
15873 int main() {
15874         int c = ' ';
15875         if (isblank(c))
15876                 return 0 ;
15877         else
15878                 return 1 ;
15879 }
15880 EOCP
15881 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15882         echo "isblank() found." >&4
15883         val="$define"
15884 else
15885         echo "isblank() NOT found." >&4
15886         val="$undef"
15887 fi
15888 set d_isblank
15889 eval $setvar
15890 $rm -f isblank*
15891
15892 : check for isfinite
15893 echo "Checking to see if you have isfinite..." >&4
15894 $cat >try.c <<EOCP
15895 #$i_math I_MATH
15896 #ifdef I_MATH
15897 #include <math.h>
15898 #endif
15899 int main() { return isfinite(0.0); }
15900 EOCP
15901 set try
15902 if eval $compile; then
15903         val="$define"
15904         echo "You have isfinite."
15905 else
15906         val="$undef"
15907         echo "You do not have isfinite."
15908 fi
15909 $rm_try
15910 set d_isfinite
15911 eval $setvar
15912
15913 : see if isfinitel exists
15914 set isfinitel d_isfinitel
15915 eval $inlibc
15916
15917 : check for isinf
15918 echo "Checking to see if you have isinf..." >&4
15919 $cat >try.c <<EOCP
15920 #$i_math I_MATH
15921 #ifdef I_MATH
15922 #include <math.h>
15923 #endif
15924 int main() { return isinf(0.0); }
15925 EOCP
15926 set try
15927 if eval $compile; then
15928         val="$define"
15929         echo "You have isinf."
15930 else
15931         val="$undef"
15932         echo "You do not have isinf."
15933 fi
15934 $rm_try
15935 set d_isinf
15936 eval $setvar
15937
15938 : see if isinfl exists
15939 set isinfl d_isinfl
15940 eval $inlibc
15941
15942 : check for isless
15943 echo "Checking to see if you have isless..." >&4
15944 $cat >try.c <<EOCP
15945 #$i_math I_MATH
15946 #ifdef I_MATH
15947 #include <math.h>
15948 #endif
15949 int main() { return isless(0.0); }
15950 EOCP
15951 set try
15952 if eval $compile; then
15953         val="$define"
15954         echo "You have isless."
15955 else
15956         val="$undef"
15957         echo "You do not have isless."
15958 fi
15959 $rm_try
15960 set d_isless
15961 eval $setvar
15962
15963 : check for isnan
15964 echo "Checking to see if you have isnan..." >&4
15965 $cat >try.c <<EOCP
15966 #$i_math I_MATH
15967 #ifdef I_MATH
15968 #include <math.h>
15969 #endif
15970 int main() { return isnan(0.0); }
15971 EOCP
15972 set try
15973 if eval $compile; then
15974         val="$define"
15975         echo "You have isnan."
15976 else
15977         val="$undef"
15978         echo "You do not have isnan."
15979 fi
15980 $rm_try
15981 set d_isnan
15982 eval $setvar
15983
15984 : see if isnanl exists
15985 set isnanl d_isnanl
15986 eval $inlibc
15987
15988 : check for isnormal
15989 echo "Checking to see if you have isnormal..." >&4
15990 $cat >try.c <<EOCP
15991 #$i_math I_MATH
15992 #ifdef I_MATH
15993 #include <math.h>
15994 #endif
15995 int main() { return isnormal(0.0); }
15996 EOCP
15997 set try
15998 if eval $compile; then
15999         val="$define"
16000         echo "You have isnormal."
16001 else
16002         val="$undef"
16003         echo "You do not have isnormal."
16004 fi
16005 $rm_try
16006 set d_isnormal
16007 eval $setvar
16008
16009 : see if j0 exists
16010 set j0 d_j0
16011 eval $inlibc
16012
16013 : see if j0l exists
16014 set j0l d_j0l
16015 eval $inlibc
16016
16017 : see if killpg exists
16018 set killpg d_killpg
16019 eval $inlibc
16020
16021 : see if localeconv exists
16022 set localeconv d_locconv
16023 eval $inlibc
16024
16025 : see if libc has the POSIX.1-2008 currency locale rules
16026 case "$d_locconv:$d_lc_monetary_2008" in
16027 $define:)
16028         $cat >try.c <<EOCP
16029 #include <locale.h>
16030 int main() {
16031         struct lconv *lc = localeconv();
16032         char int_p_cs_precedes = lc->int_p_cs_precedes;
16033         return 0;
16034 }
16035 EOCP
16036         set try
16037         if eval $compile; then
16038                 d_lc_monetary_2008="$define"
16039         else
16040                 d_lc_monetary_2008="$undef"
16041         fi;
16042         $rm_try
16043         ;;
16044 esac
16045
16046 : see if lchown exists
16047 echo " "
16048 $cat > try.c <<'EOCP'
16049 /* System header to define __stub macros and hopefully few prototypes,
16050     which can conflict with char lchown(); below.  */
16051 #include <assert.h>
16052 /* Override any gcc2 internal prototype to avoid an error.  */
16053 /* We use char because int might match the return type of a gcc2
16054    builtin and then its argument prototype would still apply.  */
16055 char lchown();
16056 int main() {
16057     /*  The GNU C library defines this for functions which it implements
16058         to always fail with ENOSYS.  Some functions are actually named
16059         something starting with __ and the normal name is an alias.  */
16060 #if defined (__stub_lchown) || defined (__stub___lchown)
16061 choke me
16062 #else
16063 lchown();
16064 #endif
16065 ; return 0; }
16066 EOCP
16067 set try
16068 if eval $compile; then
16069     $echo "lchown() found." >&4
16070     val="$define"
16071 else
16072     $echo "lchown() NOT found." >&4
16073     val="$undef"
16074 fi
16075 set d_lchown
16076 eval $setvar
16077
16078 : See if number of significant digits in a double precision number is known
16079 echo " "
16080 $cat >ldbl_dig.c <<EOM
16081 #$i_limits I_LIMITS
16082 #$i_float I_FLOAT
16083 #ifdef I_LIMITS
16084 #include <limits.h>
16085 #endif
16086 #ifdef I_FLOAT
16087 #include <float.h>
16088 #endif
16089 #ifdef LDBL_DIG
16090 printf("Contains LDBL_DIG");
16091 #endif
16092 EOM
16093 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16094 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16095         echo "LDBL_DIG found." >&4
16096         val="$define"
16097 else
16098         echo "LDBL_DIG NOT found." >&4
16099         val="$undef"
16100 fi
16101 $rm -f ldbl_dig.?
16102 set d_ldbl_dig
16103 eval $setvar
16104
16105 : see if lgamma exists
16106 set lgamma d_lgamma
16107 eval $inlibc
16108
16109 : see if lgamma_r exists
16110 set lgamma_r d_lgamma_r
16111 eval $inlibc
16112
16113 : check to see if math.h defines _LIB_VERSION
16114 d_libm_lib_version="$undef"
16115 case $i_math in
16116     $define)
16117         echo " "
16118         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16119         $cat >try.c <<EOCP
16120 #include <unistd.h>
16121 #include <math.h>
16122 int main (int argc, char *argv[])
16123 {
16124     printf ("%d\n", _LIB_VERSION);
16125     return (0);
16126     } /* main */
16127 EOCP
16128         set try
16129         if eval $compile; then
16130             foo=`$run ./try`
16131             echo "Yes, it does ($foo)" >&4
16132             d_libm_lib_version="$define"
16133         else
16134             echo "No, it does not (probably harmless)" >&4
16135             fi
16136         $rm_try
16137         ;;
16138
16139     esac
16140
16141 : see if link exists
16142 set link d_link
16143 eval $inlibc
16144
16145 : see if llrint exists
16146 set llrint d_llrint
16147 eval $inlibc
16148
16149 : see if llrintl exists
16150 set llrintl d_llrintl
16151 eval $inlibc
16152
16153 : see if llround exists
16154 set llround d_llround
16155 eval $inlibc
16156
16157 : see if llroundl exists
16158 set llroundl d_llroundl
16159 eval $inlibc
16160
16161 : see if localtime_r exists
16162 set localtime_r d_localtime_r
16163 eval $inlibc
16164 case "$d_localtime_r" in
16165 "$define")
16166         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16167         case "$d_localtime_r_proto:$usethreads" in
16168         ":define")      d_localtime_r_proto=define
16169                 set d_localtime_r_proto localtime_r $hdrs
16170                 eval $hasproto ;;
16171         *)      ;;
16172         esac
16173         case "$d_localtime_r_proto" in
16174         define)
16175         case "$localtime_r_proto" in
16176         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16177         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16178         esac
16179         case "$localtime_r_proto" in
16180         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16181         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16182         esac
16183         case "$localtime_r_proto" in
16184         ''|0)   d_localtime_r=undef
16185                 localtime_r_proto=0
16186                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16187         * )     case "$localtime_r_proto" in
16188                 REENTRANT_PROTO*) ;;
16189                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16190                 esac
16191                 echo "Prototype: $try" ;;
16192         esac
16193         ;;
16194         *)      case "$usethreads" in
16195                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16196                 esac
16197                 d_localtime_r=undef
16198                 localtime_r_proto=0
16199                 ;;
16200         esac
16201         ;;
16202 *)      localtime_r_proto=0
16203         ;;
16204 esac
16205
16206 : see if localtime_r calls tzset
16207 case "$localtime_r_proto" in
16208 REENTRANT_PROTO*)
16209         $cat >try.c <<EOCP
16210 /*  Does our libc's localtime_r call tzset ?
16211  *  return 0 if so, 1 otherwise.
16212  */
16213 #$i_systypes    I_SYS_TYPES
16214 #$i_unistd      I_UNISTD
16215 #$i_time        I_TIME
16216 #$i_stdlib      I_STDLIB
16217 #$i_string      I_STRING
16218 #$i_malloc      I_MALLOC
16219 #ifdef I_SYS_TYPES
16220 #  include <sys/types.h>
16221 #endif
16222 #ifdef I_UNISTD
16223 #  include <unistd.h>
16224 #endif
16225 #ifdef I_TIME
16226 #  include <time.h>
16227 #endif
16228 #ifdef I_STDLIB
16229 #include <stdlib.h>
16230 #endif
16231 #ifdef I_STRING
16232 #  include <string.h>
16233 #else
16234 #  include <strings.h>
16235 #endif
16236 #ifdef I_MALLOC
16237 #  include <malloc.h>
16238 #endif
16239 int main()
16240 {
16241     time_t t = time(0L);
16242     char w_tz[]="TZ" "=GMT+5",
16243          e_tz[]="TZ" "=GMT-5",
16244         *tz_e = (char*)malloc(16),
16245         *tz_w = (char*)malloc(16);
16246     struct tm tm_e, tm_w;
16247     memset(&tm_e,'\0',sizeof(struct tm));
16248     memset(&tm_w,'\0',sizeof(struct tm));
16249     strcpy(tz_e,e_tz);
16250     strcpy(tz_w,w_tz);
16251
16252     putenv(tz_e);
16253     localtime_r(&t, &tm_e);
16254
16255     putenv(tz_w);
16256     localtime_r(&t, &tm_w);
16257
16258     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16259         return 1;
16260     return 0;
16261 }
16262 EOCP
16263         set try
16264         if eval $compile; then
16265             if $run ./try; then
16266                 d_localtime_r_needs_tzset=undef;
16267             else
16268                 d_localtime_r_needs_tzset=define;
16269             fi;
16270         else
16271             d_localtime_r_needs_tzset=undef;
16272         fi;
16273      ;;
16274   *)
16275      d_localtime_r_needs_tzset=undef;
16276      ;;
16277 esac
16278 $rm_try
16279
16280 : see if lockf exists
16281 set lockf d_lockf
16282 eval $inlibc
16283
16284 : see if log1p exists
16285 set log1p d_log1p
16286 eval $inlibc
16287
16288 : see if log2 exists
16289 set log2 d_log2
16290 eval $inlibc
16291
16292 : see if logb exists
16293 set logb d_logb
16294 eval $inlibc
16295
16296 : see if lrint exists
16297 set lrint d_lrint
16298 eval $inlibc
16299
16300 : see if lrintl exists
16301 set lrintl d_lrintl
16302 eval $inlibc
16303
16304 : see if lround exists
16305 set lround d_lround
16306 eval $inlibc
16307
16308 : see if lroundl exists
16309 set lroundl d_lroundl
16310 eval $inlibc
16311
16312 : see if prototype for lseek is available
16313 echo " "
16314 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16315 eval $hasproto
16316
16317 : see if lstat exists
16318 set lstat d_lstat
16319 eval $inlibc
16320
16321 : see if madvise exists
16322 set madvise d_madvise
16323 eval $inlibc
16324
16325 : see if malloc_size exists
16326 set malloc_size d_malloc_size
16327 eval $inlibc
16328
16329 : see if malloc_size_good exists
16330 set malloc_good_size d_malloc_good_size
16331 eval $inlibc
16332
16333 : see if mblen exists
16334 set mblen d_mblen
16335 eval $inlibc
16336
16337 : see if mbstowcs exists
16338 set mbstowcs d_mbstowcs
16339 eval $inlibc
16340
16341 : see if mbtowc exists
16342 set mbtowc d_mbtowc
16343 eval $inlibc
16344
16345 : see if memchr exists
16346 set memchr d_memchr
16347 eval $inlibc
16348
16349 : see if memcmp exists
16350 set memcmp d_memcmp
16351 eval $inlibc
16352
16353 : see if memcpy exists
16354 set memcpy d_memcpy
16355 eval $inlibc
16356
16357 : see if memmem exists
16358 set memmem d_memmem
16359 eval $inlibc
16360
16361 : see if memmove exists
16362 set memmove d_memmove
16363 eval $inlibc
16364
16365 : see if memset exists
16366 set memset d_memset
16367 eval $inlibc
16368
16369 : see if mkdir exists
16370 set mkdir d_mkdir
16371 eval $inlibc
16372
16373 : see if mkdtemp exists
16374 set mkdtemp d_mkdtemp
16375 eval $inlibc
16376
16377 : see if mkfifo exists
16378 set mkfifo d_mkfifo
16379 eval $inlibc
16380
16381 : see if mkstemp exists
16382 set mkstemp d_mkstemp
16383 eval $inlibc
16384
16385 : see if mkstemps exists
16386 set mkstemps d_mkstemps
16387 eval $inlibc
16388
16389 : see if mktime exists
16390 set mktime d_mktime
16391 eval $inlibc
16392
16393 : see if this is a sys/mman.h system
16394 set sys/mman.h i_sysmman
16395 eval $inhdr
16396
16397 : see if mmap exists
16398 set mmap d_mmap
16399 eval $inlibc
16400 : see what shmat returns
16401 : default to something harmless
16402 mmaptype='void *'
16403 case "$i_sysmman$d_mmap" in
16404 "$define$define")
16405         $cat >mmap.c <<'END'
16406 #include <sys/mman.h>
16407 void *mmap();
16408 END
16409         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16410                 mmaptype='void *'
16411         else
16412                 mmaptype='caddr_t'
16413         fi
16414         echo "and it returns ($mmaptype)." >&4
16415         ;;
16416 esac
16417
16418
16419
16420 : see if sqrtl exists
16421 set sqrtl d_sqrtl
16422 eval $inlibc
16423
16424 : see if scalbnl exists
16425 set scalbnl d_scalbnl
16426 eval $inlibc
16427
16428 : see if truncl exists
16429 set truncl d_truncl
16430 eval $inlibc
16431
16432 : see if modfl exists
16433 set modfl d_modfl
16434 eval $inlibc
16435
16436 : see if prototype for modfl is available
16437 echo " "
16438 set d_modflproto modfl $i_math math.h
16439 eval $hasproto
16440
16441 d_modfl_pow32_bug="$undef"
16442
16443 case "$d_longdbl$d_modfl" in
16444 $define$define)
16445         $cat <<EOM
16446 Checking to see whether your modfl() is okay for large values...
16447 EOM
16448 $cat >try.c <<EOCP
16449 #include <math.h>
16450 #include <stdio.h>
16451 EOCP
16452 if $test "X$d_modflproto" != "X$define"; then
16453         $cat >>try.c <<EOCP
16454 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16455 long double modfl (long double, long double *);
16456 EOCP
16457 fi
16458 $cat >>try.c <<EOCP
16459 int main() {
16460     long double nv = 4294967303.15;
16461     long double v, w;
16462     v = modfl(nv, &w);
16463 #ifdef __GLIBC__
16464     printf("glibc");
16465 #endif
16466     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16467     return 0;
16468 }
16469 EOCP
16470         case "$osname:$gccversion" in
16471         aix:)   saveccflags="$ccflags"
16472                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16473         esac
16474         set try
16475         if eval $compile; then
16476                 foo=`$run ./try`
16477                 case "$foo" in
16478                 *" 4294967303.150000 1.150000 4294967302.000000")
16479                         echo >&4 "Your modfl() is broken for large values."
16480                         d_modfl_pow32_bug="$define"
16481                         case "$foo" in
16482                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16483                         ;;
16484                         esac
16485                         ;;
16486                 *" 4294967303.150000 0.150000 4294967303.000000")
16487                         echo >&4 "Your modfl() seems okay for large values."
16488                         ;;
16489                 *)      echo >&4 "I don't understand your modfl() at all."
16490                         d_modfl="$undef"
16491                         ;;
16492                 esac
16493                 $rm_try
16494         else
16495                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16496                 d_modfl="$undef"
16497         fi
16498         case "$osname:$gccversion" in
16499         aix:)   ccflags="$saveccflags" ;; # restore
16500         esac
16501         ;;
16502 esac
16503
16504 if $test "$uselongdouble" = "$define"; then
16505     message=""
16506     if $test "$d_sqrtl" != "$define"; then
16507         message="$message sqrtl"
16508     fi
16509     if $test "$d_modfl" != "$define"; then
16510         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16511             echo "You have both truncl and copysignl, so I can emulate modfl."
16512         else
16513             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16514                 echo "You have both aintl and copysignl, so I can emulate modfl."
16515             else
16516                 message="$message modfl"
16517             fi
16518         fi
16519     fi
16520     if $test "$d_frexpl" != "$define"; then
16521         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16522             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16523         else
16524             message="$message frexpl"
16525         fi
16526     fi
16527     if $test "$d_ldexpl" != "$define"; then
16528         message="$message ldexpl"
16529     fi
16530
16531     if $test "$message" != ""; then
16532         $cat <<EOM >&4
16533
16534 *** You requested the use of long doubles but you do not seem to have
16535 *** the following mathematical functions needed for long double support:
16536 ***    $message
16537 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16538 *** Cannot continue, aborting.
16539
16540 EOM
16541
16542         exit 1
16543     fi
16544 fi
16545
16546 : see if mprotect exists
16547 set mprotect d_mprotect
16548 eval $inlibc
16549
16550 : see if msgctl exists
16551 set msgctl d_msgctl
16552 eval $inlibc
16553
16554 : see if msgget exists
16555 set msgget d_msgget
16556 eval $inlibc
16557
16558 : see if msgsnd exists
16559 set msgsnd d_msgsnd
16560 eval $inlibc
16561
16562 : see if msgrcv exists
16563 set msgrcv d_msgrcv
16564 eval $inlibc
16565
16566 : see how much of the 'msg*(2)' library is present.
16567 h_msg=true
16568 echo " "
16569 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16570 *"$undef"*) h_msg=false;;
16571 esac
16572 case "$osname" in
16573 freebsd)
16574     case "`ipcs 2>&1`" in
16575     "SVID messages"*"not configured"*)
16576         echo "Your $osname does not have the msg*(2) configured." >&4
16577         h_msg=false
16578         val="$undef"
16579         set msgctl d_msgctl
16580         eval $setvar
16581         set msgget d_msgget
16582         eval $setvar
16583         set msgsnd d_msgsnd
16584         eval $setvar
16585         set msgrcv d_msgrcv
16586         eval $setvar
16587         ;;
16588     esac
16589     ;;
16590 esac
16591 : we could also check for sys/ipc.h ...
16592 if $h_msg && $test `./findhdr sys/msg.h`; then
16593         echo "You have the full msg*(2) library." >&4
16594         val="$define"
16595 else
16596         echo "You don't have the full msg*(2) library." >&4
16597         val="$undef"
16598 fi
16599 set d_msg
16600 eval $setvar
16601
16602 : Check for msghdr_s
16603 echo " "
16604 echo "Checking to see if your system supports struct msghdr..." >&4
16605 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16606 eval $hasstruct
16607 case "$d_msghdr_s" in
16608 "$define")      echo "Yes, it does."   ;;
16609 *)              echo "No, it doesn't." ;;
16610 esac
16611
16612
16613 : see if msync exists
16614 set msync d_msync
16615 eval $inlibc
16616
16617 : see if munmap exists
16618 set munmap d_munmap
16619 eval $inlibc
16620
16621 : see if nan exists
16622 set nan d_nan
16623 eval $inlibc
16624
16625 : see if nearbyint exists
16626 set nearbyint d_nearbyint
16627 eval $inlibc
16628
16629 : see if newlocale exists
16630 set newlocale d_newlocale
16631 eval $inlibc
16632
16633 : see if freelocale exists
16634 set freelocale d_freelocale
16635 eval $inlibc
16636
16637 : see if uselocale exists
16638 set uselocale d_uselocale
16639 eval $inlibc
16640
16641 : see if nextafter exists
16642 set nextafter d_nextafter
16643 eval $inlibc
16644
16645 : see if nexttoward exists
16646 set nexttoward d_nexttoward
16647 eval $inlibc
16648
16649 : see if nice exists
16650 set nice d_nice
16651 eval $inlibc
16652
16653 : see if this is a langinfo.h system
16654 set langinfo.h i_langinfo
16655 eval $inhdr
16656
16657 : see if nl_langinfo exists
16658 set nl_langinfo d_nl_langinfo
16659 eval $inlibc
16660
16661 : see if this is a quadmath.h system
16662 set quadmath.h i_quadmath
16663 eval $inhdr
16664
16665 : check for volatile keyword
16666 echo " "
16667 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16668 $cat >try.c <<'EOCP'
16669 int main()
16670 {
16671         typedef struct _goo_struct goo_struct;
16672         goo_struct * volatile goo = ((goo_struct *)0);
16673         struct _goo_struct {
16674                 long long_int;
16675                 int reg_int;
16676                 char char_var;
16677         };
16678         typedef unsigned short foo_t;
16679         char *volatile foo;
16680         volatile int bar;
16681         volatile foo_t blech;
16682         foo = foo;
16683 }
16684 EOCP
16685 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16686         val="$define"
16687         echo "Yup, it does."
16688 else
16689         val="$undef"
16690         echo "Nope, it doesn't."
16691 fi
16692 set d_volatile
16693 eval $setvar
16694 $rm_try
16695
16696 : Check basic sizes
16697 echo " "
16698 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16699
16700 case "$use64bitint:$d_quad:$quadtype" in
16701 define:define:?*)
16702         ivtype="$quadtype"
16703         uvtype="$uquadtype"
16704         ivsize=8
16705         uvsize=8
16706         ;;
16707 *)      ivtype="long"
16708         uvtype="unsigned long"
16709         ivsize=$longsize
16710         uvsize=$longsize
16711         ;;
16712 esac
16713
16714 case "$uselongdouble:$d_longdbl" in
16715 define:define)
16716         nvtype="long double"
16717         nvsize=$longdblsize
16718         ;;
16719 *)      nvtype=double
16720         nvsize=$doublesize
16721         ;;
16722 esac
16723
16724 case "$usequadmath:$i_quadmath" in
16725 define:define)
16726   nvtype="__float128"
16727   nvsize=16
16728   case "$libs" in
16729   *quadmath*) ;;
16730   *) $cat <<EOM >&4
16731
16732 *** You requested the use of the quadmath library, but you
16733 *** do not seem to have the quadmath library installed.
16734 *** Cannot continue, aborting.
16735 EOM
16736     exit 1
16737     ;;
16738   esac
16739   ;;
16740 define:*) $cat <<EOM >&4
16741
16742 *** You requested the use of the quadmath library, but you
16743 *** do not seem to have the required header, <quadmath.h>.
16744 EOM
16745   case "$gccversion" in
16746   [23].*|4.[0-5]*)
16747    $cat <<EOM >&4
16748 *** Your gcc looks a bit old:
16749 *** $gccversion
16750 EOM
16751     ;;
16752   '')
16753    $cat <<EOM >&4
16754 *** You are not running a gcc.
16755 EOM
16756     ;;
16757   esac
16758   $cat <<EOM >&4
16759 *** For the quadmath library you need at least gcc 4.6.
16760 *** Cannot continue, aborting.
16761 EOM
16762   exit 1
16763   ;;
16764 esac
16765
16766 $echo "(IV will be "$ivtype", $ivsize bytes)"
16767 $echo "(UV will be "$uvtype", $uvsize bytes)"
16768 $echo "(NV will be "$nvtype", $nvsize bytes)"
16769
16770 $cat >try.c <<EOCP
16771 #$i_inttypes I_INTTYPES
16772 #ifdef I_INTTYPES
16773 #include <inttypes.h>
16774 #endif
16775 #include <stdio.h>
16776 int main() {
16777 #ifdef INT8
16778    int8_t i =  INT8_MAX;
16779   uint8_t u = UINT8_MAX;
16780   printf("int8_t\n");
16781 #endif
16782 #ifdef INT16
16783    int16_t i =  INT16_MAX;
16784   uint16_t u = UINT16_MAX;
16785   printf("int16_t\n");
16786 #endif
16787 #ifdef INT32
16788    int32_t i =  INT32_MAX;
16789   uint32_t u = UINT32_MAX;
16790   printf("int32_t\n");
16791 #endif
16792 }
16793 EOCP
16794
16795 i8type="signed char"
16796 u8type="unsigned char"
16797 i8size=1
16798 u8size=1
16799
16800 case "$i16type" in
16801 '')     case "$shortsize" in
16802         2)      i16type=short
16803                 u16type="unsigned short"
16804                 i16size=$shortsize
16805                 u16size=$shortsize
16806                 ;;
16807         esac
16808         ;;
16809 esac
16810 case "$i16type" in
16811 '')     set try -DINT16
16812         if eval $compile; then
16813                 case "`$run ./try`" in
16814                 int16_t)
16815                         i16type=int16_t
16816                         u16type=uint16_t
16817                         i16size=2
16818                         u16size=2
16819                         ;;
16820                 esac
16821         fi
16822         ;;
16823 esac
16824 case "$i16type" in
16825 '')     if $test $shortsize -ge 2; then
16826                 i16type=short
16827                 u16type="unsigned short"
16828                 i16size=$shortsize
16829                 u16size=$shortsize
16830         fi
16831         ;;
16832 esac
16833
16834 case "$i32type" in
16835 '')     case "$longsize" in
16836         4)      i32type=long
16837                 u32type="unsigned long"
16838                 i32size=$longsize
16839                 u32size=$longsize
16840                 ;;
16841         *)      case "$intsize" in
16842                 4)      i32type=int
16843                         u32type="unsigned int"
16844                         i32size=$intsize
16845                         u32size=$intsize
16846                         ;;
16847                 esac
16848                 ;;
16849         esac
16850         ;;
16851 esac
16852 case "$i32type" in
16853 '')     set try -DINT32
16854         if eval $compile; then
16855                 case "`$run ./try`" in
16856                 int32_t)
16857                         i32type=int32_t
16858                         u32type=uint32_t
16859                         i32size=4
16860                         u32size=4
16861                         ;;
16862                 esac
16863         fi
16864         ;;
16865 esac
16866 case "$i32type" in
16867 '')     if $test $intsize -ge 4; then
16868                 i32type=int
16869                 u32type="unsigned int"
16870                 i32size=$intsize
16871                 u32size=$intsize
16872         fi
16873         ;;
16874 esac
16875
16876 case "$i64type" in
16877 '')     case "$d_quad:$quadtype" in
16878         define:?*)
16879                 i64type="$quadtype"
16880                 u64type="$uquadtype"
16881                 i64size=8
16882                 u64size=8
16883                 ;;
16884         esac
16885         ;;
16886 esac
16887
16888 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16889 : volatile so that the compiler has to store it out to memory.
16890 if test X"$d_volatile" = X"$define"; then
16891         volatile=volatile
16892 fi
16893 $cat <<EOP >try.c
16894 #include <stdio.h>
16895 #$i_stdlib I_STDLIB
16896 #ifdef I_STDLIB
16897 #include <stdlib.h>
16898 #endif
16899 #include <sys/types.h>
16900 #include <signal.h>
16901 #ifdef SIGFPE
16902 $volatile int bletched = 0;
16903 $signal_t blech(int s) { bletched = 1; }
16904 #endif
16905 int main() {
16906     $uvtype u = 0;
16907     $nvtype d;
16908     int     n = 8 * $uvsize;
16909     int     i;
16910 #ifdef SIGFPE
16911     signal(SIGFPE, blech);
16912 #endif
16913
16914     for (i = 0; i < n; i++) {
16915       u = u << 1 | ($uvtype)1;
16916       d = ($nvtype)u;
16917       if (($uvtype)d != u)
16918         break;
16919       if (d <= 0)
16920         break;
16921       d = ($nvtype)(u - 1);
16922       if (($uvtype)d != (u - 1))
16923         break;
16924 #ifdef SIGFPE
16925       if (bletched)
16926         break;
16927 #endif
16928     }
16929     printf("%d\n", ((i == n) ? -n : i));
16930     exit(0);
16931 }
16932 EOP
16933 set try
16934
16935 d_nv_preserves_uv="$undef"
16936 if eval $compile; then
16937         nv_preserves_uv_bits="`$run ./try`"
16938 fi
16939 case "$nv_preserves_uv_bits" in
16940 \-[1-9]*)
16941         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16942         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16943         d_nv_preserves_uv="$define"
16944         ;;
16945 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16946         d_nv_preserves_uv="$undef" ;;
16947 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16948         nv_preserves_uv_bits="0" ;;
16949 esac
16950 $rm_try
16951
16952 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16953 : volatile so that the compiler has to store it out to memory.
16954 if test X"$d_volatile" = X"$define"; then
16955         volatile=volatile
16956 fi
16957 $cat <<EOP >try.c
16958 #include <stdio.h>
16959
16960 typedef $nvtype NV;
16961
16962 int
16963 main() {
16964   NV value = 2;
16965   int count = 1;
16966
16967   while(count < 256) {
16968     $volatile NV up = value + 1.0;
16969     $volatile NV negated = -value;
16970     $volatile NV down = negated - 1.0;
16971     $volatile NV got_up = up - value;
16972     int up_good = got_up == 1.0;
16973     int got_down = down - negated;
16974     int down_good = got_down == -1.0;
16975
16976     if (down_good != up_good) {
16977       fprintf(stderr,
16978               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16979               up_good, (double) got_up, down_good, (double) got_down,
16980               count, (double) value);
16981       return 1;
16982     }
16983     if (!up_good) {
16984       while (1) {
16985         if (count > 8) {
16986           count -= 8;
16987           fputs("256.0", stdout);
16988         } else {
16989           count--;
16990           fputs("2.0", stdout);
16991         }
16992         if (!count) {
16993           puts("");
16994           return 0;
16995         }
16996         fputs("*", stdout);
16997       }
16998     }
16999     value *= 2;
17000     ++count;
17001   }
17002   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
17003           count, (double) value);
17004   return 1;
17005 }
17006 EOP
17007 set try
17008
17009 nv_overflows_integers_at='0'
17010 if eval $compile; then
17011     xxx="`$run ./try`"
17012     case "$?" in
17013         0)
17014             case "$xxx" in
17015                 2*)  cat >&4 <<EOM
17016 The largest integer your NVs can preserve is equal to $xxx
17017 EOM
17018                     nv_overflows_integers_at="$xxx"
17019                     ;;
17020                 *)  cat >&4 <<EOM
17021 Cannot determine the largest integer value your NVs can hold, unexpected output
17022 '$xxx'
17023 EOM
17024                     ;;
17025             esac
17026             ;;
17027         *)  cat >&4 <<EOM
17028 Cannot determine the largest integer value your NVs can hold
17029 EOM
17030             ;;
17031     esac
17032 fi
17033 $rm_try
17034
17035 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
17036 : volatile so that the compiler has to store it out to memory.
17037 if test X"$d_volatile" = X"$define"; then
17038         volatile=volatile
17039 fi
17040 $cat <<EOP >try.c
17041 #include <stdio.h>
17042 #$i_stdlib I_STDLIB
17043 #ifdef I_STDLIB
17044 #include <stdlib.h>
17045 #endif
17046 #$i_string I_STRING
17047 #ifdef I_STRING
17048 #  include <string.h>
17049 #else
17050 #  include <strings.h>
17051 #endif
17052 #include <sys/types.h>
17053 #include <signal.h>
17054 #ifdef SIGFPE
17055 $volatile int bletched = 0;
17056 $signal_t blech(int s) { bletched = 1; }
17057 #endif
17058
17059 int checkit($nvtype d, char *where) {
17060     unsigned char *p = (char *)&d;
17061     unsigned char *end = p + sizeof(d);
17062     int fail = 0;
17063
17064     while (p < end)
17065         fail += *p++;
17066
17067     if (!fail)
17068         return 0;
17069
17070     p = (char *)&d;
17071     printf("No - %s: 0x", where);
17072     while (p < end)
17073         printf ("%02X", *p++);
17074     printf("\n");
17075     return 1;
17076 }
17077
17078 int main(int argc, char **argv) {
17079     $nvtype d = 0.0;
17080     int fail = 0;
17081     fail += checkit(d, "0.0");
17082
17083     /* The compiler shouldn't be assuming that bletched is 0  */
17084     d = bletched;
17085
17086     fail += checkit(d, "bleched");
17087
17088 #ifdef SIGFPE
17089     signal(SIGFPE, blech);
17090 #endif
17091
17092     /* Paranoia - the compiler should have no way of knowing that ANSI says
17093        that argv[argc] will always be NULL.  Actually, if it did assume this it
17094        would be buggy, as this is C and main() can be called from elsewhere in
17095        the program.  */
17096     d = argv[argc] ? 1 : 0;
17097
17098     if (d) {
17099         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17100     }
17101
17102     fail += checkit(d, "ternary");
17103
17104     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17105
17106     if (d != 0.0) {
17107         printf("No - memset doesn't give 0.0\n");
17108         /* This might just blow up:  */
17109         printf("(gives %g)\n", d);
17110         return 1;
17111     }
17112
17113 #ifdef SIGFPE
17114     if (bletched) {
17115         printf("No - something bleched\n");
17116         return 1;
17117     }
17118 #endif
17119     if (fail) {
17120       printf("No - %d fail(s)\n", fail);
17121       return 1;
17122     }
17123     printf("Yes\n");
17124     return 0;
17125 }
17126 EOP
17127 set try
17128
17129 d_nv_zero_is_allbits_zero="$undef"
17130 if eval $compile; then
17131     xxx="`$run ./try`"
17132     case "$?" in
17133         0)
17134             case "$xxx" in
17135                 Yes)  cat >&4 <<EOM
17136 0.0 is represented as all bits zero in memory
17137 EOM
17138                     d_nv_zero_is_allbits_zero="$define"
17139                     ;;
17140                 *)  cat >&4 <<EOM
17141 0.0 is not represented as all bits zero in memory
17142 EOM
17143                     d_nv_zero_is_allbits_zero="$undef"
17144                     ;;
17145             esac
17146             ;;
17147         *)  cat >&4 <<EOM
17148 0.0 is not represented as all bits zero in memory
17149 EOM
17150             d_nv_zero_is_allbits_zero="$undef"
17151             ;;
17152     esac
17153 fi
17154 $rm_try
17155
17156 : check for off64_t
17157 echo " "
17158 echo "Checking to see if you have off64_t..." >&4
17159 $cat >try.c <<EOCP
17160 #include <sys/types.h>
17161 #include <unistd.h>
17162 int main() { off64_t x = 7; }
17163 EOCP
17164 set try
17165 if eval $compile; then
17166         val="$define"
17167         echo "You have off64_t."
17168 else
17169         val="$undef"
17170         echo "You do not have off64_t."
17171         case "$lseeksize" in
17172         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17173         esac
17174 fi
17175 $rm_try
17176 set d_off64_t
17177 eval $setvar
17178
17179 : how to create joinable pthreads
17180 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17181         echo " "
17182         echo "Checking what constant to use for creating joinable pthreads..." >&4
17183         $cat >try.c <<'EOCP'
17184 #include <pthread.h>
17185 int main() {
17186     int detachstate = JOINABLE;
17187 }
17188 EOCP
17189         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17190         if eval $compile; then
17191                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17192                 val="$undef" # Yes, undef.
17193                 set d_old_pthread_create_joinable
17194                 eval $setvar
17195                 val=""
17196                 set old_pthread_create_joinable
17197                 eval $setvar
17198         else
17199                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17200                 if eval $compile; then
17201                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17202                         val="$define"
17203                         set d_old_pthread_create_joinable
17204                         eval $setvar
17205                         val=PTHREAD_CREATE_UNDETACHED
17206                         set old_pthread_create_joinable
17207                         eval $setvar
17208                 else
17209                         set try -DJOINABLE=__UNDETACHED
17210                         if eval $compile; then
17211                                 echo "You seem to use __UNDETACHED." >&4
17212                                 val="$define"
17213                                 set d_old_pthread_create_joinable
17214                                 eval $setvar
17215                                 val=__UNDETACHED
17216                                 set old_pthread_create_joinable
17217                                 eval $setvar
17218                         else
17219                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17220                                 val="$define"
17221                                 set d_old_pthread_create_joinable
17222                                 eval $setvar
17223                                 val=0
17224                                 set old_pthread_create_joinable
17225                                 eval $setvar
17226                         fi
17227                 fi
17228         fi
17229         $rm_try
17230 else
17231     d_old_pthread_create_joinable="$undef"
17232     old_pthread_create_joinable=""
17233 fi
17234
17235 : see if pause exists
17236 set pause d_pause
17237 eval $inlibc
17238
17239 : see if poll exists
17240 set poll d_poll
17241 eval $inlibc
17242
17243 : see if prctl exists
17244 set prctl d_prctl
17245 eval $inlibc
17246
17247 : see if prctl supports PR_SET_NAME
17248 d_prctl_set_name=$undef
17249 case $d_prctl in
17250     $define)
17251         $cat >try.c <<EOM
17252 #ifdef __ANDROID__
17253 #include <unistd.h>
17254 #endif
17255 #include <sys/prctl.h>
17256
17257 int main (int argc, char *argv[])
17258 {
17259     return (prctl (PR_SET_NAME, "Test"));
17260     } /* main */
17261 EOM
17262         set try
17263         if eval $compile_ok && $run ./try; then
17264             echo "Your prctl (PR_SET_NAME, ...) works"
17265             d_prctl_set_name=$define
17266             fi
17267         $rm_try
17268         ;;
17269     esac
17270
17271 : see if readlink exists
17272 set readlink d_readlink
17273 eval $inlibc
17274
17275 : Check if there is a /proc symlink to the abs path of
17276 : the executing program.  We will honor hints of d_procselfexe=$undef
17277 : or procselfexe being non-empty, otherwise will try to determine both
17278 : if we have readlink.
17279 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17280 : referenced, and AmigaOS does not have a proc filesystem anyway.
17281 echo " "
17282 val="$undef"
17283 if $test "X$d_procselfexe" = Xundef; then
17284         procselfexe=''
17285 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17286         val="$define"
17287 elif $test "X$d_readlink" = Xdefine; then
17288         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17289         : and it feels more tidy to avoid an extra level of symlink
17290         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17291         while test $# -gt 0; do
17292             type=$1; try=$2
17293             shift; shift
17294             if $issymlink $try; then
17295                 $ls -l $try > reflect
17296                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17297                     echo "You have $type-like $try."
17298                     procselfexe='"'$try'"'
17299                     val="$define"
17300                     : This will break out of the loop
17301                     set X; shift
17302                 fi
17303             fi
17304         done
17305 fi
17306 $rm -f reflect
17307 set d_procselfexe
17308 eval $setvar
17309
17310 : backward compatibility for d_hvfork
17311 if test X$d_hvfork != X; then
17312         d_vfork="$d_hvfork"
17313         d_hvfork=''
17314 fi
17315 : see if there is a vfork
17316 val=''
17317 set vfork val
17318 eval $inlibc
17319
17320 d_pseudofork=$undef
17321
17322 : Ok, but do we want to use it. vfork is reportedly unreliable in
17323 : perl on Solaris 2.x, and probably elsewhere.
17324 case "$val" in
17325 $define)
17326         echo " "
17327         case "$usevfork" in
17328         false) dflt='n';;
17329         *) dflt='y';;
17330         esac
17331         cat <<'EOM'
17332
17333 Perl can only use a vfork() that doesn't suffer from strict
17334 restrictions on calling functions or modifying global data in
17335 the child.  For example, glibc-2.1 contains such a vfork()
17336 that is unsuitable.  If your system provides a proper fork()
17337 call, chances are that you do NOT want perl to use vfork().
17338
17339 EOM
17340         rp="Do you still want to use vfork()?"
17341         . ./myread
17342         case "$ans" in
17343         y|Y) ;;
17344         *)
17345                 echo "Ok, we won't use vfork()."
17346                 val="$undef"
17347                 ;;
17348         esac
17349         ;;
17350 esac
17351 set d_vfork
17352 eval $setvar
17353 case "$d_vfork" in
17354 $define) usevfork='true';;
17355 *) usevfork='false';;
17356 esac
17357
17358 : see whether the pthread_atfork exists
17359 $cat >try.c <<EOP
17360 #include <pthread.h>
17361 #include <stdio.h>
17362 int main() {
17363 #ifdef  PTHREAD_ATFORK
17364         pthread_atfork(NULL,NULL,NULL);
17365 #endif
17366 }
17367 EOP
17368
17369 : see if pthread_atfork exists
17370 set try -DPTHREAD_ATFORK
17371 if eval $compile; then
17372     val="$define"
17373 else
17374     val="$undef"
17375 fi
17376 case "$usethreads" in
17377 $define)
17378         case "$val" in
17379         $define) echo 'pthread_atfork found.' >&4        ;;
17380         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17381         esac
17382 esac
17383 set d_pthread_atfork
17384 eval $setvar
17385
17386 : see if pthread_attr_setscope exists
17387 set pthread_attr_setscope d_pthread_attr_setscope
17388 eval $inlibc
17389
17390 : see whether the various POSIXish _yields exist
17391 $cat >try.c <<EOP
17392 #include <pthread.h>
17393 #include <stdio.h>
17394 int main() {
17395 #ifdef SCHED_YIELD
17396         sched_yield();
17397 #else
17398 #ifdef PTHREAD_YIELD
17399         pthread_yield();
17400 #else
17401 #ifdef PTHREAD_YIELD_NULL
17402         pthread_yield(NULL);
17403 #endif
17404 #endif
17405 #endif
17406 }
17407 EOP
17408 : see if sched_yield exists
17409 set try -DSCHED_YIELD
17410 if eval $compile; then
17411     val="$define"
17412     sched_yield='sched_yield()'
17413 else
17414     val="$undef"
17415 fi
17416 case "$usethreads" in
17417 $define)
17418         case "$val" in
17419         $define) echo 'sched_yield() found.' >&4        ;;
17420         *)       echo 'sched_yield() NOT found.' >&4    ;;
17421         esac
17422 esac
17423 set d_sched_yield
17424 eval $setvar
17425
17426 : see if pthread_yield exists
17427 set try -DPTHREAD_YIELD
17428 if eval $compile; then
17429     val="$define"
17430     case "$sched_yield" in
17431     '') sched_yield='pthread_yield()' ;;
17432     esac
17433 else
17434     set try -DPTHREAD_YIELD_NULL
17435     if eval $compile; then
17436         val="$define"
17437         case "$sched_yield" in
17438         '') sched_yield='pthread_yield(NULL)' ;;
17439         esac
17440     else
17441         val="$undef"
17442     fi
17443 fi
17444 case "$usethreads" in
17445 $define)
17446         case "$val" in
17447         $define) echo 'pthread_yield() found.' >&4      ;;
17448         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17449         esac
17450         ;;
17451 esac
17452 set d_pthread_yield
17453 eval $setvar
17454 case "$sched_yield" in
17455 '') sched_yield=undef ;;
17456 esac
17457 $rm_try
17458
17459 : check for ptrdiff_t
17460 echo " "
17461 echo "Checking to see if you have ptrdiff_t..." >&4
17462 $cat >try.c <<EOCP
17463 #include <stddef.h>
17464 int main() { ptrdiff_t x = 7; }
17465 EOCP
17466 set try
17467 if eval $compile; then
17468         val="$define"
17469         echo "You have ptrdiff_t."
17470 else
17471         val="$undef"
17472         echo "You do not have ptrdiff_t."
17473 fi
17474 $rm_try
17475 set d_ptrdiff_t
17476 eval $setvar
17477
17478 : see if random_r exists
17479 set random_r d_random_r
17480 eval $inlibc
17481 case "$d_random_r" in
17482 "$define")
17483         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17484         case "$d_random_r_proto:$usethreads" in
17485         ":define")      d_random_r_proto=define
17486                 set d_random_r_proto random_r $hdrs
17487                 eval $hasproto ;;
17488         *)      ;;
17489         esac
17490         case "$d_random_r_proto" in
17491         define)
17492         case "$random_r_proto" in
17493         ''|0) try='int random_r(int*, struct random_data*);'
17494         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17495         esac
17496         case "$random_r_proto" in
17497         ''|0) try='int random_r(long*, struct random_data*);'
17498         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17499         esac
17500         case "$random_r_proto" in
17501         ''|0) try='int random_r(struct random_data*, int32_t*);'
17502         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17503         esac
17504         case "$random_r_proto" in
17505         ''|0)   d_random_r=undef
17506                 random_r_proto=0
17507                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17508         * )     case "$random_r_proto" in
17509                 REENTRANT_PROTO*) ;;
17510                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17511                 esac
17512                 echo "Prototype: $try" ;;
17513         esac
17514         ;;
17515         *)      case "$usethreads" in
17516                 define) echo "random_r has no prototype, not using it." >&4 ;;
17517                 esac
17518                 d_random_r=undef
17519                 random_r_proto=0
17520                 ;;
17521         esac
17522         ;;
17523 *)      random_r_proto=0
17524         ;;
17525 esac
17526
17527 : see if readdir and friends exist
17528 set readdir d_readdir
17529 eval $inlibc
17530 set seekdir d_seekdir
17531 eval $inlibc
17532 set telldir d_telldir
17533 eval $inlibc
17534 set rewinddir d_rewinddir
17535 eval $inlibc
17536
17537 : see if readdir64_r exists
17538 set readdir64_r d_readdir64_r
17539 eval $inlibc
17540 case "$d_readdir64_r" in
17541 "$define")
17542         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17543         case "$d_readdir64_r_proto:$usethreads" in
17544         ":define")      d_readdir64_r_proto=define
17545                 set d_readdir64_r_proto readdir64_r $hdrs
17546                 eval $hasproto ;;
17547         *)      ;;
17548         esac
17549         case "$d_readdir64_r_proto" in
17550         define)
17551         case "$readdir64_r_proto" in
17552         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17553         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17554         esac
17555         case "$readdir64_r_proto" in
17556         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17557         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17558         esac
17559         case "$readdir64_r_proto" in
17560         ''|0)   d_readdir64_r=undef
17561                 readdir64_r_proto=0
17562                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17563         * )     case "$readdir64_r_proto" in
17564                 REENTRANT_PROTO*) ;;
17565                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17566                 esac
17567                 echo "Prototype: $try" ;;
17568         esac
17569         ;;
17570         *)      case "$usethreads" in
17571                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17572                 esac
17573                 d_readdir64_r=undef
17574                 readdir64_r_proto=0
17575                 ;;
17576         esac
17577         ;;
17578 *)      readdir64_r_proto=0
17579         ;;
17580 esac
17581
17582 : see if readdir_r exists
17583 set readdir_r d_readdir_r
17584 eval $inlibc
17585 case "$d_readdir_r" in
17586 "$define")
17587         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17588         case "$d_readdir_r_proto:$usethreads" in
17589         ":define")      d_readdir_r_proto=define
17590                 set d_readdir_r_proto readdir_r $hdrs
17591                 eval $hasproto ;;
17592         *)      ;;
17593         esac
17594         case "$d_readdir_r_proto" in
17595         define)
17596         case "$readdir_r_proto" in
17597         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17598         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17599         esac
17600         case "$readdir_r_proto" in
17601         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17602         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17603         esac
17604         case "$readdir_r_proto" in
17605         ''|0)   d_readdir_r=undef
17606                 readdir_r_proto=0
17607                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17608         * )     case "$readdir_r_proto" in
17609                 REENTRANT_PROTO*) ;;
17610                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17611                 esac
17612                 echo "Prototype: $try" ;;
17613         esac
17614         ;;
17615         *)      case "$usethreads" in
17616                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17617                 esac
17618                 d_readdir_r=undef
17619                 readdir_r_proto=0
17620                 ;;
17621         esac
17622         ;;
17623 *)      readdir_r_proto=0
17624         ;;
17625 esac
17626
17627 : see if readv exists
17628 set readv d_readv
17629 eval $inlibc
17630
17631 : see if recvmsg exists
17632 set recvmsg d_recvmsg
17633 eval $inlibc
17634
17635 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17636 echo " "
17637 if set regcomp val -f d_regcomp; eval $csym; $val; then
17638         echo 'regcomp() found.' >&4
17639         d_regcomp="$define"
17640         d_regcmp="$undef"
17641         d_re_comp="$undef"
17642 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17643         echo 'regcmp() found.' >&4
17644         d_regcmp="$define"
17645         d_regcomp="$undef"
17646         d_re_comp="$undef"
17647 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17648         echo 're_comp() found, assuming re_exec() also exists.' >&4
17649         d_re_comp="$define"
17650         d_regcomp="$undef"
17651         d_regcmp="$undef"
17652 else
17653         $cat >&4 <<EOM
17654 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17655 EOM
17656         d_regcmp="$undef"
17657         d_re_comp="$undef"
17658         d_regcomp="$undef"
17659 fi
17660
17661 : see if remainder exists
17662 set remainder d_remainder
17663 eval $inlibc
17664
17665 : see if remquo exists
17666 set remquo d_remquo
17667 eval $inlibc
17668
17669 : see if rename exists
17670 set rename d_rename
17671 eval $inlibc
17672
17673 : see if rint exists
17674 set rint d_rint
17675 eval $inlibc
17676
17677 : see if rmdir exists
17678 set rmdir d_rmdir
17679 eval $inlibc
17680
17681 : see if round exists
17682 set round d_round
17683 eval $inlibc
17684
17685 : see if memory.h is available.
17686 val=''
17687 set memory.h val
17688 eval $inhdr
17689
17690 : See if it conflicts with string.h
17691 case "$val" in
17692 $define)
17693         case "$strings" in
17694         '') ;;
17695         *)
17696                 $cppstdin $cppflags $cppminus < $strings > mem.h
17697                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17698                         echo " "
17699                         echo "We won't be including <memory.h>."
17700                         val="$undef"
17701                 fi
17702                 $rm -f mem.h
17703                 ;;
17704         esac
17705 esac
17706 set i_memory
17707 eval $setvar
17708
17709 : can bcopy handle overlapping blocks?
17710 echo " "
17711 val="$undef"
17712 case "$d_memmove" in
17713 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17714 *)      case "$d_bcopy" in
17715         "$define")
17716                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17717                 $cat >try.c <<EOCP
17718 #$i_memory I_MEMORY
17719 #$i_stdlib I_STDLIB
17720 #$i_string I_STRING
17721 #$i_unistd I_UNISTD
17722 EOCP
17723         $cat >>try.c <<'EOCP'
17724 #include <stdio.h>
17725 #ifdef I_MEMORY
17726 #  include <memory.h>
17727 #endif
17728 #ifdef I_STDLIB
17729 #  include <stdlib.h>
17730 #endif
17731 #ifdef I_STRING
17732 #  include <string.h>
17733 #else
17734 #  include <strings.h>
17735 #endif
17736 #ifdef I_UNISTD
17737 #  include <unistd.h>  /* Needed for NetBSD */
17738 #endif
17739 int main()
17740 {
17741 char buf[128], abc[128];
17742 char *b;
17743 int len;
17744 int off;
17745 int align;
17746
17747 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17748    try to store the string in read-only memory. */
17749 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17750
17751 for (align = 7; align >= 0; align--) {
17752         for (len = 36; len; len--) {
17753                 b = buf+align;
17754                 bcopy(abc, b, len);
17755                 for (off = 1; off <= len; off++) {
17756                         bcopy(b, b+off, len);
17757                         bcopy(b+off, b, len);
17758                         if (bcmp(b, abc, len))
17759                                 exit(1);
17760                 }
17761         }
17762 }
17763 exit(0);
17764 }
17765 EOCP
17766                 set try
17767                 if eval $compile_ok; then
17768                         if $run ./try 2>/dev/null; then
17769                                 echo "Yes, it can."
17770                                 val="$define"
17771                         else
17772                                 echo "It can't, sorry."
17773                         fi
17774                 else
17775                         echo "(I can't compile the test program, so we'll assume not...)"
17776                 fi
17777                 ;;
17778         esac
17779         $rm_try
17780         ;;
17781 esac
17782 set d_safebcpy
17783 eval $setvar
17784
17785 : can memcpy handle overlapping blocks?
17786 echo " "
17787 val="$undef"
17788 case "$d_memmove" in
17789 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17790 *)      case "$d_memcpy" in
17791         "$define")
17792                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17793                 $cat >try.c <<EOCP
17794 #$i_memory I_MEMORY
17795 #$i_stdlib I_STDLIB
17796 #$i_string I_STRING
17797 #$i_unistd I_UNISTD
17798 EOCP
17799         $cat >>try.c <<'EOCP'
17800 #include <stdio.h>
17801 #ifdef I_MEMORY
17802 #  include <memory.h>
17803 #endif
17804 #ifdef I_STDLIB
17805 #  include <stdlib.h>
17806 #endif
17807 #ifdef I_STRING
17808 #  include <string.h>
17809 #else
17810 #  include <strings.h>
17811 #endif
17812 #ifdef I_UNISTD
17813 #  include <unistd.h>  /* Needed for NetBSD */
17814 #endif
17815 int main()
17816 {
17817 char buf[128], abc[128];
17818 char *b;
17819 int len;
17820 int off;
17821 int align;
17822
17823 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17824    try to store the string in read-only memory. */
17825 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17826
17827 for (align = 7; align >= 0; align--) {
17828         for (len = 36; len; len--) {
17829                 b = buf+align;
17830                 memcpy(b, abc, len);
17831                 for (off = 1; off <= len; off++) {
17832                         memcpy(b+off, b, len);
17833                         memcpy(b, b+off, len);
17834                         if (memcmp(b, abc, len))
17835                                 exit(1);
17836                 }
17837         }
17838 }
17839 exit(0);
17840 }
17841 EOCP
17842                 set try
17843                 if eval $compile_ok; then
17844                         if $run ./try 2>/dev/null; then
17845                                 echo "Yes, it can."
17846                                 val="$define"
17847                         else
17848                                 echo "It can't, sorry."
17849                         fi
17850                 else
17851                         echo "(I can't compile the test program, so we'll assume not...)"
17852                 fi
17853                 ;;
17854         esac
17855         $rm_try
17856         ;;
17857 esac
17858 set d_safemcpy
17859 eval $setvar
17860
17861 : can memcmp be trusted to compare relative magnitude?
17862 val="$undef"
17863 case "$d_memcmp" in
17864 "$define")
17865         echo " "
17866         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17867         $cat >try.c <<EOCP
17868 #$i_memory I_MEMORY
17869 #$i_stdlib I_STDLIB
17870 #$i_string I_STRING
17871 #$i_unistd I_UNISTD
17872 EOCP
17873         $cat >>try.c <<'EOCP'
17874 #include <stdio.h>
17875 #ifdef I_MEMORY
17876 #  include <memory.h>
17877 #endif
17878 #ifdef I_STDLIB
17879 #  include <stdlib.h>
17880 #endif
17881 #ifdef I_STRING
17882 #  include <string.h>
17883 #else
17884 #  include <strings.h>
17885 #endif
17886 #ifdef I_UNISTD
17887 #  include <unistd.h>  /* Needed for NetBSD */
17888 #endif
17889 int main()
17890 {
17891 char a = -1;
17892 char b = 0;
17893 if ((a < b) && memcmp(&a, &b, 1) < 0)
17894         exit(1);
17895 exit(0);
17896 }
17897 EOCP
17898         set try
17899         if eval $compile_ok; then
17900                 if $run ./try 2>/dev/null; then
17901                         echo "Yes, it can."
17902                         val="$define"
17903                 else
17904                         echo "No, it can't (it uses signed chars)."
17905                 fi
17906         else
17907                 echo "(I can't compile the test program, so we'll assume not...)"
17908         fi
17909         ;;
17910 esac
17911 $rm_try
17912 set d_sanemcmp
17913 eval $setvar
17914
17915 : see if prototype for sbrk is available
17916 echo " "
17917 set d_sbrkproto sbrk $i_unistd unistd.h
17918 eval $hasproto
17919
17920 : see if scalbn exists
17921 set scalbn d_scalbn
17922 eval $inlibc
17923
17924 : see if select exists
17925 set select d_select
17926 eval $inlibc
17927
17928 : see if semctl exists
17929 set semctl d_semctl
17930 eval $inlibc
17931
17932 : see if semget exists
17933 set semget d_semget
17934 eval $inlibc
17935
17936 : see if semop exists
17937 set semop d_semop
17938 eval $inlibc
17939
17940 : see how much of the 'sem*(2)' library is present.
17941 h_sem=true
17942 echo " "
17943 case "$d_semctl$d_semget$d_semop" in
17944 *"$undef"*) h_sem=false;;
17945 esac
17946 case "$osname" in
17947 freebsd)
17948     case "`ipcs 2>&1`" in
17949     "SVID messages"*"not configured"*)
17950         echo "Your $osname does not have the sem*(2) configured." >&4
17951         h_sem=false
17952         val="$undef"
17953         set semctl d_semctl
17954         eval $setvar
17955         set semget d_semget
17956         eval $setvar
17957         set semop d_semop
17958         eval $setvar
17959         ;;
17960     esac
17961     ;;
17962 esac
17963 : we could also check for sys/ipc.h ...
17964 if $h_sem && $test `./findhdr sys/sem.h`; then
17965         echo "You have the full sem*(2) library." >&4
17966         val="$define"
17967 else
17968         echo "You don't have the full sem*(2) library." >&4
17969         val="$undef"
17970 fi
17971 set d_sem
17972 eval $setvar
17973
17974 : see whether sys/sem.h defines union semun
17975 echo " "
17976 $cat > try.c <<'END'
17977 #include <sys/types.h>
17978 #include <sys/ipc.h>
17979 #include <sys/sem.h>
17980 int main () { union semun semun; semun.buf = 0; }
17981 END
17982 set try
17983 if eval $compile; then
17984     echo "You have union semun in <sys/sem.h>." >&4
17985     val="$define"
17986 else
17987     echo "You do not have union semun in <sys/sem.h>." >&4
17988     val="$undef"
17989 fi
17990 $rm_try
17991 set d_union_semun
17992 eval $setvar
17993
17994 : see how to do semctl IPC_STAT
17995 case "$d_sem" in
17996 $define)
17997     echo " "
17998     $cat > tryh.h <<END
17999 #ifndef S_IRUSR
18000 #   ifdef S_IREAD
18001 #       define S_IRUSR S_IREAD
18002 #       define S_IWUSR S_IWRITE
18003 #       define S_IXUSR S_IEXEC
18004 #   else
18005 #       define S_IRUSR 0400
18006 #       define S_IWUSR 0200
18007 #       define S_IXUSR 0100
18008 #   endif
18009 #   define S_IRGRP (S_IRUSR>>3)
18010 #   define S_IWGRP (S_IWUSR>>3)
18011 #   define S_IXGRP (S_IXUSR>>3)
18012 #   define S_IROTH (S_IRUSR>>6)
18013 #   define S_IWOTH (S_IWUSR>>6)
18014 #   define S_IXOTH (S_IXUSR>>6)
18015 #endif
18016 #ifndef S_IRWXU
18017 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
18018 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
18019 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
18020 #endif
18021 END
18022     : see whether semctl IPC_STAT can use union semun
18023     case "$d_semctl_semun" in
18024     '')
18025       val="$undef"
18026       $cat > try.c <<END
18027 #include <sys/types.h>
18028 #include <sys/ipc.h>
18029 #include <sys/sem.h>
18030 #include <sys/stat.h>
18031 #include <stdio.h>
18032 #include <errno.h>
18033 #include "tryh.h"
18034 #ifndef errno
18035 extern int errno;
18036 #endif
18037 #$d_union_semun HAS_UNION_SEMUN
18038 int main() {
18039     union semun
18040 #ifndef HAS_UNION_SEMUN
18041     {
18042         int val;
18043         struct semid_ds *buf;
18044         unsigned short *array;
18045     }
18046 #endif
18047     arg;
18048     int sem, st;
18049
18050 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18051     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18052     if (sem > -1) {
18053         struct semid_ds argbuf;
18054         arg.buf = &argbuf;
18055 #       ifdef IPC_STAT
18056         st = semctl(sem, 0, IPC_STAT, arg);
18057         if (st == 0)
18058             printf("semun\n");
18059         else
18060 #       endif /* IPC_STAT */
18061             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18062 #       ifdef IPC_RMID
18063         if (semctl(sem, 0, IPC_RMID, arg) != 0)
18064 #       endif /* IPC_RMID */
18065             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18066     } else
18067 #endif /* IPC_PRIVATE && ... */
18068         printf("semget failed: errno = %d\n", errno);
18069   return 0;
18070 }
18071 END
18072       set try
18073       if eval $compile; then
18074           xxx=`$run ./try`
18075           case "$xxx" in
18076           semun) val="$define" ;;
18077           esac
18078       fi
18079       $rm_try
18080       set d_semctl_semun
18081       eval $setvar
18082       ;;
18083     esac
18084     case "$d_semctl_semun" in
18085     $define)
18086         echo "You can use union semun for semctl IPC_STAT." >&4
18087         also='also'
18088         ;;
18089     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
18090         also=''
18091         ;;
18092     esac
18093
18094     : see whether semctl IPC_STAT can use struct semid_ds pointer
18095     case "$d_semctl_semid_ds" in
18096     '')
18097       val="$undef"
18098       $cat > try.c <<'END'
18099 #include <sys/types.h>
18100 #include <sys/ipc.h>
18101 #include <sys/sem.h>
18102 #include <sys/stat.h>
18103 #include "tryh.h"
18104 #include <stdio.h>
18105 #include <errno.h>
18106 #ifndef errno
18107 extern int errno;
18108 #endif
18109 int main() {
18110     struct semid_ds arg;
18111     int sem, st;
18112
18113 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18114     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18115     if (sem > -1) {
18116 #       ifdef IPC_STAT
18117         st = semctl(sem, 0, IPC_STAT, &arg);
18118         if (st == 0)
18119             printf("semid_ds\n");
18120         else
18121 #       endif /* IPC_STAT */
18122             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18123 #       ifdef IPC_RMID
18124         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18125 #       endif /* IPC_RMID */
18126             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18127     } else
18128 #endif /* IPC_PRIVATE && ... */
18129         printf("semget failed: errno = %d\n", errno);
18130
18131     return 0;
18132 }
18133 END
18134       set try
18135       if eval $compile; then
18136           xxx=`$run ./try`
18137           case "$xxx" in
18138           semid_ds) val="$define" ;;
18139           esac
18140       fi
18141       $rm_try
18142       set d_semctl_semid_ds
18143       eval $setvar
18144       ;;
18145     esac
18146     case "$d_semctl_semid_ds" in
18147     $define)
18148         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18149         ;;
18150     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18151         ;;
18152     esac
18153     ;;
18154 *)  val="$undef"
18155
18156     # We do not have the full sem*(2) library, so assume we can not
18157     # use either.
18158
18159     set d_semctl_semun
18160     eval $setvar
18161
18162     set d_semctl_semid_ds
18163     eval $setvar
18164     ;;
18165 esac
18166 $rm_try tryh.h
18167
18168 : see if sendmsg exists
18169 set sendmsg d_sendmsg
18170 eval $inlibc
18171
18172 : see if setegid exists
18173 set setegid d_setegid
18174 eval $inlibc
18175
18176 : see if seteuid exists
18177 set seteuid d_seteuid
18178 eval $inlibc
18179
18180 : see if setgrent exists
18181 set setgrent d_setgrent
18182 eval $inlibc
18183
18184 : see if setgrent_r exists
18185 set setgrent_r d_setgrent_r
18186 eval $inlibc
18187 case "$d_setgrent_r" in
18188 "$define")
18189         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18190         case "$d_setgrent_r_proto:$usethreads" in
18191         ":define")      d_setgrent_r_proto=define
18192                 set d_setgrent_r_proto setgrent_r $hdrs
18193                 eval $hasproto ;;
18194         *)      ;;
18195         esac
18196         case "$d_setgrent_r_proto" in
18197         define)
18198         case "$setgrent_r_proto" in
18199         ''|0) try='int setgrent_r(FILE**);'
18200         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18201         esac
18202         case "$setgrent_r_proto" in
18203         ''|0) try='void setgrent_r(FILE**);'
18204         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18205         esac
18206         case "$setgrent_r_proto" in
18207         ''|0)   d_setgrent_r=undef
18208                 setgrent_r_proto=0
18209                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18210         * )     case "$setgrent_r_proto" in
18211                 REENTRANT_PROTO*) ;;
18212                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18213                 esac
18214                 echo "Prototype: $try" ;;
18215         esac
18216         ;;
18217         *)      case "$usethreads" in
18218                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18219                 esac
18220                 d_setgrent_r=undef
18221                 setgrent_r_proto=0
18222                 ;;
18223         esac
18224         ;;
18225 *)      setgrent_r_proto=0
18226         ;;
18227 esac
18228
18229 : see if sethostent exists
18230 set sethostent d_sethent
18231 eval $inlibc
18232
18233 : see if sethostent_r exists
18234 set sethostent_r d_sethostent_r
18235 eval $inlibc
18236 case "$d_sethostent_r" in
18237 "$define")
18238         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18239         case "$d_sethostent_r_proto:$usethreads" in
18240         ":define")      d_sethostent_r_proto=define
18241                 set d_sethostent_r_proto sethostent_r $hdrs
18242                 eval $hasproto ;;
18243         *)      ;;
18244         esac
18245         case "$d_sethostent_r_proto" in
18246         define)
18247         case "$sethostent_r_proto" in
18248         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18249         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18250         esac
18251         case "$sethostent_r_proto" in
18252         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18253         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18254         esac
18255         case "$sethostent_r_proto" in
18256         ''|0)   d_sethostent_r=undef
18257                 sethostent_r_proto=0
18258                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18259         * )     case "$sethostent_r_proto" in
18260                 REENTRANT_PROTO*) ;;
18261                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18262                 esac
18263                 echo "Prototype: $try" ;;
18264         esac
18265         ;;
18266         *)      case "$usethreads" in
18267                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18268                 esac
18269                 d_sethostent_r=undef
18270                 sethostent_r_proto=0
18271                 ;;
18272         esac
18273         ;;
18274 *)      sethostent_r_proto=0
18275         ;;
18276 esac
18277
18278 : see if setitimer exists
18279 set setitimer d_setitimer
18280 eval $inlibc
18281
18282 : see if setlinebuf exists
18283 set setlinebuf d_setlinebuf
18284 eval $inlibc
18285
18286 : see if setlocale exists
18287 set setlocale d_setlocale
18288 eval $inlibc
18289
18290 : see if locale.h is available
18291 set locale.h i_locale
18292 eval $inhdr
18293
18294 : see if setlocale_r exists
18295 set setlocale_r d_setlocale_r
18296 eval $inlibc
18297 case "$d_setlocale_r" in
18298 "$define")
18299         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18300         case "$d_setlocale_r_proto:$usethreads" in
18301         ":define")      d_setlocale_r_proto=define
18302                 set d_setlocale_r_proto setlocale_r $hdrs
18303                 eval $hasproto ;;
18304         *)      ;;
18305         esac
18306         case "$d_setlocale_r_proto" in
18307         define)
18308         case "$setlocale_r_proto" in
18309         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18310         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18311         esac
18312         case "$setlocale_r_proto" in
18313         ''|0)   d_setlocale_r=undef
18314                 setlocale_r_proto=0
18315                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18316         * )     case "$setlocale_r_proto" in
18317                 REENTRANT_PROTO*) ;;
18318                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18319                 esac
18320                 echo "Prototype: $try" ;;
18321         esac
18322         ;;
18323         *)      case "$usethreads" in
18324                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18325                 esac
18326                 d_setlocale_r=undef
18327                 setlocale_r_proto=0
18328                 ;;
18329         esac
18330         ;;
18331 *)      setlocale_r_proto=0
18332         ;;
18333 esac
18334
18335 : see if setnetent exists
18336 set setnetent d_setnent
18337 eval $inlibc
18338
18339 : see if setnetent_r exists
18340 set setnetent_r d_setnetent_r
18341 eval $inlibc
18342 case "$d_setnetent_r" in
18343 "$define")
18344         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18345         case "$d_setnetent_r_proto:$usethreads" in
18346         ":define")      d_setnetent_r_proto=define
18347                 set d_setnetent_r_proto setnetent_r $hdrs
18348                 eval $hasproto ;;
18349         *)      ;;
18350         esac
18351         case "$d_setnetent_r_proto" in
18352         define)
18353         case "$setnetent_r_proto" in
18354         ''|0) try='int setnetent_r(int, struct netent_data*);'
18355         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18356         esac
18357         case "$setnetent_r_proto" in
18358         ''|0) try='void setnetent_r(int, struct netent_data*);'
18359         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18360         esac
18361         case "$setnetent_r_proto" in
18362         ''|0)   d_setnetent_r=undef
18363                 setnetent_r_proto=0
18364                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18365         * )     case "$setnetent_r_proto" in
18366                 REENTRANT_PROTO*) ;;
18367                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18368                 esac
18369                 echo "Prototype: $try" ;;
18370         esac
18371         ;;
18372         *)      case "$usethreads" in
18373                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18374                 esac
18375                 d_setnetent_r=undef
18376                 setnetent_r_proto=0
18377                 ;;
18378         esac
18379         ;;
18380 *)      setnetent_r_proto=0
18381         ;;
18382 esac
18383
18384 : see if setprotoent exists
18385 set setprotoent d_setpent
18386 eval $inlibc
18387
18388 : see if setpgid exists
18389 set setpgid d_setpgid
18390 eval $inlibc
18391
18392 : see if setpgrp2 exists
18393 set setpgrp2 d_setpgrp2
18394 eval $inlibc
18395
18396 : see if setpriority exists
18397 set setpriority d_setprior
18398 eval $inlibc
18399
18400 : see if setproctitle exists
18401 set setproctitle d_setproctitle
18402 eval $inlibc
18403
18404 : see if setprotoent_r exists
18405 set setprotoent_r d_setprotoent_r
18406 eval $inlibc
18407 case "$d_setprotoent_r" in
18408 "$define")
18409         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18410         case "$d_setprotoent_r_proto:$usethreads" in
18411         ":define")      d_setprotoent_r_proto=define
18412                 set d_setprotoent_r_proto setprotoent_r $hdrs
18413                 eval $hasproto ;;
18414         *)      ;;
18415         esac
18416         case "$d_setprotoent_r_proto" in
18417         define)
18418         case "$setprotoent_r_proto" in
18419         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18420         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18421         esac
18422         case "$setprotoent_r_proto" in
18423         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18424         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18425         esac
18426         case "$setprotoent_r_proto" in
18427         ''|0)   d_setprotoent_r=undef
18428                 setprotoent_r_proto=0
18429                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18430         * )     case "$setprotoent_r_proto" in
18431                 REENTRANT_PROTO*) ;;
18432                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18433                 esac
18434                 echo "Prototype: $try" ;;
18435         esac
18436         ;;
18437         *)      case "$usethreads" in
18438                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18439                 esac
18440                 d_setprotoent_r=undef
18441                 setprotoent_r_proto=0
18442                 ;;
18443         esac
18444         ;;
18445 *)      setprotoent_r_proto=0
18446         ;;
18447 esac
18448
18449 : see if setpwent exists
18450 set setpwent d_setpwent
18451 eval $inlibc
18452
18453 : see if setpwent_r exists
18454 set setpwent_r d_setpwent_r
18455 eval $inlibc
18456 case "$d_setpwent_r" in
18457 "$define")
18458         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18459         case "$d_setpwent_r_proto:$usethreads" in
18460         ":define")      d_setpwent_r_proto=define
18461                 set d_setpwent_r_proto setpwent_r $hdrs
18462                 eval $hasproto ;;
18463         *)      ;;
18464         esac
18465         case "$d_setpwent_r_proto" in
18466         define)
18467         case "$setpwent_r_proto" in
18468         ''|0) try='int setpwent_r(FILE**);'
18469         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18470         esac
18471         case "$setpwent_r_proto" in
18472         ''|0) try='void setpwent_r(FILE**);'
18473         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18474         esac
18475         case "$setpwent_r_proto" in
18476         ''|0)   d_setpwent_r=undef
18477                 setpwent_r_proto=0
18478                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18479         * )     case "$setpwent_r_proto" in
18480                 REENTRANT_PROTO*) ;;
18481                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18482                 esac
18483                 echo "Prototype: $try" ;;
18484         esac
18485         ;;
18486         *)      case "$usethreads" in
18487                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18488                 esac
18489                 d_setpwent_r=undef
18490                 setpwent_r_proto=0
18491                 ;;
18492         esac
18493         ;;
18494 *)      setpwent_r_proto=0
18495         ;;
18496 esac
18497
18498 : see if setregid exists
18499 set setregid d_setregid
18500 eval $inlibc
18501 set setresgid d_setresgid
18502 eval $inlibc
18503
18504 : see if setreuid exists
18505 set setreuid d_setreuid
18506 eval $inlibc
18507 set setresuid d_setresuid
18508 eval $inlibc
18509
18510 : see if setrgid exists
18511 set setrgid d_setrgid
18512 eval $inlibc
18513
18514 : see if setruid exists
18515 set setruid d_setruid
18516 eval $inlibc
18517
18518 : see if setservent exists
18519 set setservent d_setsent
18520 eval $inlibc
18521
18522 : see if setservent_r exists
18523 set setservent_r d_setservent_r
18524 eval $inlibc
18525 case "$d_setservent_r" in
18526 "$define")
18527         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18528         case "$d_setservent_r_proto:$usethreads" in
18529         ":define")      d_setservent_r_proto=define
18530                 set d_setservent_r_proto setservent_r $hdrs
18531                 eval $hasproto ;;
18532         *)      ;;
18533         esac
18534         case "$d_setservent_r_proto" in
18535         define)
18536         case "$setservent_r_proto" in
18537         ''|0) try='int setservent_r(int, struct servent_data*);'
18538         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18539         esac
18540         case "$setservent_r_proto" in
18541         ''|0) try='void setservent_r(int, struct servent_data*);'
18542         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18543         esac
18544         case "$setservent_r_proto" in
18545         ''|0)   d_setservent_r=undef
18546                 setservent_r_proto=0
18547                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18548         * )     case "$setservent_r_proto" in
18549                 REENTRANT_PROTO*) ;;
18550                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18551                 esac
18552                 echo "Prototype: $try" ;;
18553         esac
18554         ;;
18555         *)      case "$usethreads" in
18556                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18557                 esac
18558                 d_setservent_r=undef
18559                 setservent_r_proto=0
18560                 ;;
18561         esac
18562         ;;
18563 *)      setservent_r_proto=0
18564         ;;
18565 esac
18566
18567 : see if setsid exists
18568 set setsid d_setsid
18569 eval $inlibc
18570
18571 : see if setvbuf exists
18572 set setvbuf d_setvbuf
18573 eval $inlibc
18574
18575 : see if shmctl exists
18576 set shmctl d_shmctl
18577 eval $inlibc
18578
18579 : see if shmget exists
18580 set shmget d_shmget
18581 eval $inlibc
18582
18583 : see if shmat exists
18584 set shmat d_shmat
18585 eval $inlibc
18586 : see what shmat returns
18587 case "$d_shmat" in
18588 "$define")
18589         $cat >shmat.c <<'END'
18590 #include <sys/shm.h>
18591 void *shmat();
18592 END
18593         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18594                 shmattype='void *'
18595         else
18596                 shmattype='char *'
18597         fi
18598         echo "and it returns ($shmattype)." >&4
18599         : see if a prototype for shmat is available
18600         xxx=`./findhdr sys/shm.h`
18601         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18602         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18603                 val="$define"
18604         else
18605                 val="$undef"
18606         fi
18607         $rm -f shmat.[co]
18608         ;;
18609 *)
18610         val="$undef"
18611         ;;
18612 esac
18613 set d_shmatprototype
18614 eval $setvar
18615
18616 : see if shmdt exists
18617 set shmdt d_shmdt
18618 eval $inlibc
18619
18620 : see how much of the 'shm*(2)' library is present.
18621 h_shm=true
18622 echo " "
18623 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18624 *"$undef"*) h_shm=false;;
18625 esac
18626 case "$osname" in
18627 freebsd)
18628     case "`ipcs 2>&1`" in
18629     "SVID shared memory"*"not configured"*)
18630         echo "Your $osname does not have the shm*(2) configured." >&4
18631         h_shm=false
18632         val="$undef"
18633         set shmctl d_shmctl
18634         eval $setvar
18635         set shmget d_shmget
18636         eval $setvar
18637         set shmat d_shmat
18638         eval $setvar
18639         set shmdt d_shmdt
18640         eval $setvar
18641         ;;
18642     esac
18643     ;;
18644 esac
18645 : we could also check for sys/ipc.h ...
18646 if $h_shm && $test `./findhdr sys/shm.h`; then
18647         echo "You have the full shm*(2) library." >&4
18648         val="$define"
18649 else
18650         echo "You don't have the full shm*(2) library." >&4
18651         val="$undef"
18652 fi
18653 set d_shm
18654 eval $setvar
18655
18656 : see if we have sigaction
18657 echo " "
18658 if set sigaction val -f d_sigaction; eval $csym; $val; then
18659         echo 'sigaction() found.' >&4
18660         $cat > try.c <<EOP
18661 #include <stdio.h>
18662 #include <sys/types.h>
18663 #include <signal.h>
18664 #$i_stdlib I_STDLIB
18665 #ifdef I_STDLIB
18666 #include <stdlib.h>
18667 #endif
18668 int main()
18669 {
18670     struct sigaction act, oact;
18671     act.sa_flags = 0;
18672     oact.sa_handler = 0;
18673     /* so that act and oact are used */
18674     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18675 }
18676 EOP
18677         set try
18678         if eval $compile_ok; then
18679                 val="$define"
18680         else
18681                 echo "But you don't seem to have a usable struct sigaction." >&4
18682                 val="$undef"
18683         fi
18684 else
18685         echo 'sigaction NOT found.' >&4
18686         val="$undef"
18687 fi
18688 set d_sigaction; eval $setvar
18689 $rm_try
18690
18691 : see if this is a sunmath.h system
18692 set sunmath.h i_sunmath
18693 eval $inhdr
18694
18695 : see if signbit exists
18696 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18697 $cat >try.c <<EOCP
18698 #$i_math I_MATH
18699 #$i_sunmath I_SUNMATH
18700 #ifdef I_MATH
18701 #  include <math.h>
18702 #endif
18703 #ifdef I_SUNMATH  /* Solaris special math library */
18704 #  include <sunmath.h>
18705 #endif
18706 #define NV $nvtype
18707 int main(int argc, char **argv)
18708 {
18709     NV x = 0.0;
18710     NV y = -0.0;
18711     if ((signbit(x) == 0) && (signbit(y) != 0))
18712         return 0;
18713     else
18714         return 1;
18715 }
18716 EOCP
18717 val="$undef"
18718 set try
18719 if eval $compile; then
18720     if $run ./try; then
18721         $echo "Yes." >&4
18722         val="$define"
18723     else
18724         $echo "Signbit seems to be available, but doesn't work as I expected."
18725         $echo "I won't use it." >&4
18726         val="$undef"
18727     fi
18728 else
18729     $echo "Nope." >&4
18730     dflt="$undef"
18731 fi
18732 set d_signbit
18733 eval $setvar
18734 $rm_try
18735
18736 : see if sigprocmask exists
18737 set sigprocmask d_sigprocmask
18738 eval $inlibc
18739
18740 : see if sigsetjmp exists
18741 echo " "
18742 case "$d_sigsetjmp" in
18743 '')
18744         $cat >try.c <<EOP
18745 #include <setjmp.h>
18746 #$i_stdlib I_STDLIB
18747 #ifdef I_STDLIB
18748 #include <stdlib.h>
18749 #endif
18750 sigjmp_buf env;
18751 int set = 1;
18752 int main()
18753 {
18754         if (sigsetjmp(env,1))
18755                 exit(set);
18756         set = 0;
18757         siglongjmp(env, 1);
18758         exit(1);
18759 }
18760 EOP
18761         set try
18762         if eval $compile; then
18763                 if $run ./try >/dev/null 2>&1; then
18764                         echo "POSIX sigsetjmp found." >&4
18765                         val="$define"
18766                 else
18767                         $cat >&4 <<EOM
18768 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18769 I'll ignore them.
18770 EOM
18771                         val="$undef"
18772                 fi
18773         else
18774                 echo "sigsetjmp not found." >&4
18775                 val="$undef"
18776         fi
18777         ;;
18778 *) val="$d_sigsetjmp"
18779         case "$d_sigsetjmp" in
18780         $define) echo "POSIX sigsetjmp found." >&4;;
18781         $undef) echo "sigsetjmp not found." >&4;;
18782         esac
18783         ;;
18784 esac
18785 set d_sigsetjmp
18786 eval $setvar
18787 $rm_try
18788
18789 : see if snprintf exists
18790 set snprintf d_snprintf
18791 eval $inlibc
18792
18793 : see if vsnprintf exists
18794 set vsnprintf d_vsnprintf
18795 eval $inlibc
18796
18797 case "$d_snprintf-$d_vsnprintf" in
18798 "$define-$define")
18799     $cat <<EOM
18800 Checking whether your snprintf() and vsnprintf() work okay...
18801 EOM
18802     $cat >try.c <<'EOCP'
18803 /* v?snprintf testing logic courtesy of Russ Allbery.
18804  * According to C99:
18805  * - if the buffer is too short it still must be \0-terminated
18806  * - if the buffer is too short the potentially required length
18807  *   must be returned and not -1
18808  * - if the buffer is NULL the potentially required length
18809  *   must be returned and not -1 or core dump
18810  */
18811 #include <stdio.h>
18812 #include <stdarg.h>
18813
18814 char buf[2];
18815
18816 int test (char *format, ...)
18817 {
18818     va_list args;
18819     int count;
18820
18821     va_start (args, format);
18822     count = vsnprintf (buf, sizeof buf, format, args);
18823     va_end (args);
18824     return count;
18825 }
18826
18827 int main ()
18828 {
18829     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18830              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18831 }
18832 EOCP
18833     set try
18834     if eval $compile; then
18835         `$run ./try`
18836         case "$?" in
18837         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18838         *) cat <<EOM >&4
18839 Your snprintf() and snprintf() don't seem to be working okay.
18840 EOM
18841            d_snprintf="$undef"
18842            d_vsnprintf="$undef"
18843            ;;
18844         esac
18845     else
18846         echo "(I can't seem to compile the test program--assuming they don't)"
18847         d_snprintf="$undef"
18848         d_vsnprintf="$undef"
18849     fi
18850     $rm_try
18851     ;;
18852 esac
18853
18854 : see if sockatmark exists
18855 set sockatmark d_sockatmark
18856 eval $inlibc
18857
18858 : see if prototype for sockatmark is available
18859 echo " "
18860 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18861 eval $hasproto
18862
18863 : see if socks5_init exists
18864 set socks5_init d_socks5_init
18865 eval $inlibc
18866
18867 : see if sprintf returns the length of the string in the buffer as per ANSI
18868 $echo "Checking whether sprintf returns the length of the string..." >&4
18869 $cat <<EOP >try.c
18870 #include <stdio.h>
18871 #$i_stdlib I_STDLIB
18872 #ifdef I_STDLIB
18873 #include <stdlib.h>
18874 #endif
18875 #$i_string I_STRING
18876 #ifdef I_STRING
18877 #  include <string.h>
18878 #else
18879 #  include <strings.h>
18880 #endif
18881 #$i_math I_MATH
18882 #ifdef I_MATH
18883 #include <math.h>
18884 #endif
18885
18886 char buffer[256];
18887
18888 int check (size_t expect, int test) {
18889   size_t got = strlen(buffer);
18890   if (expect == got)
18891     return 0;
18892
18893   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18894        test, buffer);
18895   exit (test);
18896 }
18897
18898 int main(int argc, char **argv) {
18899   int test = 0;
18900
18901   check(sprintf(buffer, ""), ++test);
18902   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18903   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18904
18905   return 0;
18906 }
18907 EOP
18908 set try
18909
18910 if eval $compile; then
18911     xxx="`$run ./try`"
18912     case "$?" in
18913         0) cat >&4 <<EOM
18914 sprintf returns the length of the string (as ANSI says it should)
18915 EOM
18916         d_sprintf_returns_strlen="$define"
18917         ;;
18918         *) cat >&4 <<EOM
18919 sprintf does not return the length of the string (how old is this system?)
18920 EOM
18921         d_sprintf_returns_strlen="$undef"
18922         ;;
18923     esac
18924 else
18925     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18926     d_sprintf_returns_strlen="$undef"
18927 fi
18928 $rm_try
18929
18930 : see if srand48_r exists
18931 set srand48_r d_srand48_r
18932 eval $inlibc
18933 case "$d_srand48_r" in
18934 "$define")
18935         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18936         case "$d_srand48_r_proto:$usethreads" in
18937         ":define")      d_srand48_r_proto=define
18938                 set d_srand48_r_proto srand48_r $hdrs
18939                 eval $hasproto ;;
18940         *)      ;;
18941         esac
18942         case "$d_srand48_r_proto" in
18943         define)
18944         case "$srand48_r_proto" in
18945         ''|0) try='int srand48_r(long, struct drand48_data*);'
18946         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18947         esac
18948         case "$srand48_r_proto" in
18949         ''|0)   d_srand48_r=undef
18950                 srand48_r_proto=0
18951                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18952         * )     case "$srand48_r_proto" in
18953                 REENTRANT_PROTO*) ;;
18954                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18955                 esac
18956                 echo "Prototype: $try" ;;
18957         esac
18958         ;;
18959         *)      case "$usethreads" in
18960                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18961                 esac
18962                 d_srand48_r=undef
18963                 srand48_r_proto=0
18964                 ;;
18965         esac
18966         ;;
18967 *)      srand48_r_proto=0
18968         ;;
18969 esac
18970
18971 : see if srandom_r exists
18972 set srandom_r d_srandom_r
18973 eval $inlibc
18974 case "$d_srandom_r" in
18975 "$define")
18976         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18977         case "$d_srandom_r_proto:$usethreads" in
18978         ":define")      d_srandom_r_proto=define
18979                 set d_srandom_r_proto srandom_r $hdrs
18980                 eval $hasproto ;;
18981         *)      ;;
18982         esac
18983         case "$d_srandom_r_proto" in
18984         define)
18985         case "$srandom_r_proto" in
18986         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18987         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18988         esac
18989         case "$srandom_r_proto" in
18990         ''|0)   d_srandom_r=undef
18991                 srandom_r_proto=0
18992                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18993         * )     case "$srandom_r_proto" in
18994                 REENTRANT_PROTO*) ;;
18995                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18996                 esac
18997                 echo "Prototype: $try" ;;
18998         esac
18999         ;;
19000         *)      case "$usethreads" in
19001                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
19002                 esac
19003                 d_srandom_r=undef
19004                 srandom_r_proto=0
19005                 ;;
19006         esac
19007         ;;
19008 *)      srandom_r_proto=0
19009         ;;
19010 esac
19011
19012 : see if prototype for setresgid is available
19013 echo " "
19014 set d_sresgproto setresgid $i_unistd unistd.h
19015 eval $hasproto
19016
19017 : see if prototype for setresuid is available
19018 echo " "
19019 set d_sresuproto setresuid $i_unistd unistd.h
19020 eval $hasproto
19021
19022 : see if stat exists
19023 set stat d_stat
19024 eval $inlibc
19025
19026 : see if sys/stat.h is available
19027 set sys/stat.h i_sysstat
19028 eval $inhdr
19029
19030 : see if stat knows about block sizes
19031 echo " "
19032 echo "Checking to see if your struct stat has st_blocks field..." >&4
19033 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19034 eval $hasfield
19035
19036 : see if this is a sys/vfs.h system
19037 set sys/vfs.h i_sysvfs
19038 eval $inhdr
19039
19040 : see if this is a sys/statfs.h system
19041 set sys/statfs.h i_sysstatfs
19042 eval $inhdr
19043
19044 : Check for statfs_s
19045 echo " "
19046 echo "Checking to see if your system supports struct statfs..." >&4
19047 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
19048 eval $hasstruct
19049 case "$d_statfs_s" in
19050 "$define")      echo "Yes, it does."   ;;
19051 *)              echo "No, it doesn't." ;;
19052 esac
19053
19054
19055 : see if struct statfs knows about f_flags
19056 case "$d_statfs_s" in
19057 define)
19058         echo " "
19059         echo "Checking to see if your struct statfs has f_flags field..." >&4
19060         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
19061         eval $hasfield
19062         ;;
19063 *)      val="$undef"
19064         set d_statfs_f_flags
19065         eval $setvar
19066         ;;
19067 esac
19068 case "$d_statfs_f_flags" in
19069 "$define")      echo "Yes, it does."   ;;
19070 *)              echo "No, it doesn't." ;;
19071 esac
19072
19073 : see what flavor, if any, of static inline is supported
19074 echo " "
19075 echo "Checking to see if your system supports static inline..."
19076 $cat > try.c <<'EOCP'
19077 #include <stdlib.h>
19078 extern int f_via_a(int x);
19079 extern int f_via_b(int x);
19080 int main(int argc, char **argv)
19081 {
19082     int y;
19083
19084     y = f_via_a(0);
19085 #ifdef USE_B
19086     y = f_via_b(0);
19087 #endif
19088     if (y == 42) {
19089         return EXIT_SUCCESS;
19090     }
19091     else {
19092         return EXIT_FAILURE;
19093     }
19094 }
19095 EOCP
19096 $cat > a.c <<'EOCP'
19097 static INLINE int f(int x) {
19098     int y;
19099     y = x + 42;
19100     return y;
19101 }
19102
19103 int f_via_a(int x)
19104 {
19105     return f(x);
19106 }
19107 EOCP
19108 $cat > b.c <<'EOCP'
19109 extern int f(int x);
19110
19111 int f_via_b(int x)
19112 {
19113     return f(x);
19114 }
19115 EOCP
19116
19117 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19118 case "$perl_static_inline" in
19119 '')     # Check the various possibilities, and break out on success.
19120         # For gcc, prefer __inline__, which will still permit
19121         # cflags.SH to add in -ansi.
19122         case "$gccversion" in
19123                 '') xxx="inline __inline__ __inline _inline";;
19124                 *)  xxx="__inline__ inline __inline _inline";;
19125         esac
19126         for inline in $xxx; do
19127                 set try -DINLINE=$inline a.c
19128                 if eval $compile && $run ./try; then
19129                         # Now make sure there is no external linkage of static
19130                         # functions
19131                         set try -DINLINE=$inline -DUSE_B a.c b.c
19132                         if eval $compile && $run ./try; then
19133                                 $echo "Your compiler supports static $inline, " >&4
19134                                 $echo "but it also creates an external definition," >&4
19135                                 $echo "so I won't use it." >&4
19136                                 val=$undef
19137                         else
19138                                 $echo "Your compiler supports static $inline." >&4
19139                                 val=$define
19140                                 perl_static_inline="static $inline";
19141                                 break;
19142                         fi
19143                 else
19144                         $echo "Your compiler does NOT support static $inline." >&4
19145                         val="$undef"
19146                 fi
19147         done
19148         ;;
19149 *inline*) # Some variant of inline exists.
19150         echo "Keeping your $hint value of $perl_static_inline."
19151         val=$define
19152         ;;
19153 static)  # No inline capabilities
19154         echo "Keeping your $hint value of $perl_static_inline."
19155         val=$undef
19156         ;;
19157 *)  # Unrecognized previous value -- blindly trust the supplied
19158         # value and hope it makes sense.  Use old value for
19159         # d_static_inline, if there is one.
19160         echo "Keeping your $hint value of $perl_static_inline."
19161         case "$d_static_inline" in
19162                 '') val=$define ;;
19163                 *)  val=$d_static_inline ;;
19164         esac
19165         ;;
19166 esac
19167 # Fallback to plain 'static' if nothing worked.
19168 case "$perl_static_inline" in
19169 '')
19170         perl_static_inline="static"
19171         val=$undef
19172         ;;
19173 esac
19174 set d_static_inline
19175 eval $setvar
19176 $rm -f a.[co] b.[co]
19177 $rm_try
19178
19179 : Check stream access
19180 $cat >&4 <<EOM
19181 Checking how to access stdio streams by file descriptor number...
19182 EOM
19183 case "$stdio_stream_array" in
19184 '')     $cat >try.c <<EOCP
19185 #include <stdio.h>
19186 int main() {
19187   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19188     printf("yes\n");
19189 }
19190 EOCP
19191         for s in _iob __iob __sF
19192         do
19193                 set try -DSTDIO_STREAM_ARRAY=$s
19194                 if eval $compile; then
19195                         case "`$run ./try`" in
19196                         yes)    stdio_stream_array=$s; break ;;
19197                         esac
19198                 fi
19199         done
19200         $rm_try
19201 esac
19202 case "$stdio_stream_array" in
19203 '')     $cat >&4 <<EOM
19204 I can't figure out how to access stdio streams by file descriptor number.
19205 EOM
19206         d_stdio_stream_array="$undef"
19207         ;;
19208 *)      $cat >&4 <<EOM
19209 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19210 EOM
19211         d_stdio_stream_array="$define"
19212         ;;
19213 esac
19214
19215 : see if strcoll exists
19216 set strcoll d_strcoll
19217 eval $inlibc
19218
19219 : check for structure copying
19220 echo " "
19221 echo "Checking to see if your C compiler can copy structs..." >&4
19222 $cat >try.c <<'EOCP'
19223 int main()
19224 {
19225         struct blurfl {
19226                 int dyick;
19227         } foo, bar;
19228
19229         foo = bar;
19230 }
19231 EOCP
19232 if $cc -c try.c >/dev/null 2>&1 ; then
19233         val="$define"
19234         echo "Yup, it can."
19235 else
19236         val="$undef"
19237         echo "Nope, it can't."
19238 fi
19239 set d_strctcpy
19240 eval $setvar
19241 $rm_try
19242
19243 : see if strerror and/or sys_errlist[] exist
19244 echo " "
19245 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19246     if set strerror val -f d_strerror; eval $csym; $val; then
19247                 echo 'strerror() found.' >&4
19248                 d_strerror="$define"
19249                 d_strerrm='strerror(e)'
19250                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19251                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19252                         d_syserrlst="$define"
19253                 else
19254                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19255                         d_syserrlst="$undef"
19256                 fi
19257     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19258                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19259                 echo 'strerror() found in string header.' >&4
19260                 d_strerror="$define"
19261                 d_strerrm='strerror(e)'
19262                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19263                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19264                                 d_syserrlst="$define"
19265                 else
19266                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19267                         d_syserrlst="$undef"
19268                 fi
19269     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19270                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19271                 d_strerror="$undef"
19272                 d_syserrlst="$define"
19273                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19274     else
19275                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19276                 d_strerror="$undef"
19277                 d_syserrlst="$undef"
19278                 d_strerrm='"unknown"'
19279     fi
19280 fi
19281
19282 : see if strerror_r exists
19283 set strerror_r d_strerror_r
19284 eval $inlibc
19285 case "$d_strerror_r" in
19286 "$define")
19287         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19288         case "$d_strerror_r_proto:$usethreads" in
19289         ":define")      d_strerror_r_proto=define
19290                 set d_strerror_r_proto strerror_r $hdrs
19291                 eval $hasproto ;;
19292         *)      ;;
19293         esac
19294         case "$d_strerror_r_proto" in
19295         define)
19296         case "$strerror_r_proto" in
19297         ''|0) try='int strerror_r(int, char*, size_t);'
19298         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19299         esac
19300         case "$strerror_r_proto" in
19301         ''|0) try='int strerror_r(int, char*, int);'
19302         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19303         esac
19304         case "$strerror_r_proto" in
19305         ''|0) try='char* strerror_r(int, char*, size_t);'
19306         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19307         esac
19308         case "$strerror_r_proto" in
19309         ''|0)   d_strerror_r=undef
19310                 strerror_r_proto=0
19311                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19312         * )     case "$strerror_r_proto" in
19313                 REENTRANT_PROTO*) ;;
19314                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19315                 esac
19316                 echo "Prototype: $try" ;;
19317         esac
19318         ;;
19319         *)      case "$usethreads" in
19320                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19321                 esac
19322                 d_strerror_r=undef
19323                 strerror_r_proto=0
19324                 ;;
19325         esac
19326         ;;
19327 *)      strerror_r_proto=0
19328         ;;
19329 esac
19330
19331 : see if strftime exists
19332 set strftime d_strftime
19333 eval $inlibc
19334
19335 : see if strlcat exists
19336 set strlcat d_strlcat
19337 eval $inlibc
19338
19339 : see if strlcpy exists
19340 set strlcpy d_strlcpy
19341 eval $inlibc
19342
19343 : see if strtod exists
19344 set strtod d_strtod
19345 eval $inlibc
19346
19347 : see if strtol exists
19348 set strtol d_strtol
19349 eval $inlibc
19350
19351 : see if strtold exists
19352 set strtold d_strtold
19353 eval $inlibc
19354
19355 : see if strtoll exists
19356 set strtoll d_strtoll
19357 eval $inlibc
19358
19359 case "$d_longlong-$d_strtoll" in
19360 "$define-$define")
19361         $cat <<EOM
19362 Checking whether your strtoll() works okay...
19363 EOM
19364         $cat >try.c <<'EOCP'
19365 #include <errno.h>
19366 #ifdef __hpux
19367 #define strtoll __strtoll
19368 #endif
19369 #ifdef __EMX__
19370 #define strtoll _strtoll
19371 #endif
19372 #include <stdio.h>
19373 extern long long int strtoll(char *s, char **, int);
19374 static int bad = 0;
19375 int check(char *s, long long ell, int een) {
19376         long long gll;
19377         errno = 0;
19378         gll = strtoll(s, 0, 10);
19379         if (!((gll == ell) && (errno == een)))
19380                 bad++;
19381 }
19382 int main() {
19383         check(" 1",                                      1LL, 0);
19384         check(" 0",                                      0LL, 0);
19385         check("-1",                                     -1LL, 0);
19386         check("-9223372036854775808", -9223372036854775808LL, 0);
19387         check("-9223372036854775808", -9223372036854775808LL, 0);
19388         check(" 9223372036854775807",  9223372036854775807LL, 0);
19389         check("-9223372036854775808", -9223372036854775808LL, 0);
19390         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19391         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19392         if (!bad)
19393                 printf("ok\n");
19394 }
19395 EOCP
19396         set try
19397         if eval $compile; then
19398                 yyy=`$run ./try`
19399                 case "$yyy" in
19400                 ok) echo "Your strtoll() seems to be working okay." ;;
19401                 *) cat <<EOM >&4
19402 Your strtoll() doesn't seem to be working okay.
19403 EOM
19404                    d_strtoll="$undef"
19405                    ;;
19406                 esac
19407         else
19408                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19409                 d_strtoll="$undef"
19410         fi
19411         ;;
19412 esac
19413
19414 : see if strtoq exists
19415 set strtoq d_strtoq
19416 eval $inlibc
19417
19418 : see if strtoul exists
19419 set strtoul d_strtoul
19420 eval $inlibc
19421
19422 case "$d_strtoul" in
19423 "$define")
19424         $cat <<EOM
19425 Checking whether your strtoul() works okay...
19426 EOM
19427         $cat >try.c <<'EOCP'
19428 #include <errno.h>
19429 #include <stdio.h>
19430 extern unsigned long int strtoul(char *s, char **, int);
19431 static int bad = 0;
19432 void check(char *s, unsigned long eul, int een) {
19433         unsigned long gul;
19434         errno = 0;
19435         gul = strtoul(s, 0, 10);
19436         if (!((gul == eul) && (errno == een)))
19437                 bad++;
19438 }
19439 int main() {
19440         check(" 1", 1L, 0);
19441         check(" 0", 0L, 0);
19442 EOCP
19443         case "$longsize" in
19444         8)
19445             $cat >>try.c <<'EOCP'
19446         check("18446744073709551615", 18446744073709551615UL, 0);
19447         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19448 #if 0 /* strtoul() for /^-/ strings is undefined. */
19449         check("-1", 18446744073709551615UL, 0);
19450         check("-18446744073709551614", 2, 0);
19451         check("-18446744073709551615", 1, 0);
19452         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19453         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19454 #endif
19455 EOCP
19456                 ;;
19457         4)
19458                     $cat >>try.c <<'EOCP'
19459         check("4294967295", 4294967295UL, 0);
19460         check("4294967296", 4294967295UL, ERANGE);
19461 #if 0 /* strtoul() for /^-/ strings is undefined. */
19462         check("-1", 4294967295UL, 0);
19463         check("-4294967294", 2, 0);
19464         check("-4294967295", 1, 0);
19465         check("-4294967296", 4294967295UL, ERANGE);
19466         check("-4294967297", 4294967295UL, ERANGE);
19467 #endif
19468 EOCP
19469                 ;;
19470         *)
19471 : Should we write these tests to be more portable by sprintf-ing
19472 : ~0 and then manipulating that char string as input for strtol?
19473                 ;;
19474         esac
19475         $cat >>try.c <<'EOCP'
19476         if (!bad)
19477                 printf("ok\n");
19478         return 0;
19479 }
19480 EOCP
19481         set try
19482         if eval $compile; then
19483                 case "`$run ./try`" in
19484                 ok) echo "Your strtoul() seems to be working okay." ;;
19485                 *) cat <<EOM >&4
19486 Your strtoul() doesn't seem to be working okay.
19487 EOM
19488                    d_strtoul="$undef"
19489                    ;;
19490                 esac
19491         else
19492                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19493                 d_strtoul="$undef"
19494         fi
19495         ;;
19496 esac
19497
19498 : see if strtoull exists
19499 set strtoull d_strtoull
19500 eval $inlibc
19501
19502 case "$d_longlong-$d_strtoull" in
19503 "$define-$define")
19504         $cat <<EOM
19505 Checking whether your strtoull() works okay...
19506 EOM
19507         $cat >try.c <<'EOCP'
19508 #include <errno.h>
19509 #ifdef __hpux
19510 #define strtoull __strtoull
19511 #endif
19512 #include <stdio.h>
19513 extern unsigned long long int strtoull(char *s, char **, int);
19514 static int bad = 0;
19515 int check(char *s, long long eull, int een) {
19516         long long gull;
19517         errno = 0;
19518         gull = strtoull(s, 0, 10);
19519         if (!((gull == eull) && (errno == een)))
19520                 bad++;
19521 }
19522 int main() {
19523         check(" 1",                                        1LL, 0);
19524         check(" 0",                                        0LL, 0);
19525         check("18446744073709551615",  18446744073709551615ULL, 0);
19526         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19527 #if 0 /* strtoull() for /^-/ strings is undefined. */
19528         check("-1",                    18446744073709551615ULL, 0);
19529         check("-18446744073709551614",                     2LL, 0);
19530         check("-18446744073709551615",                     1LL, 0);
19531         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19532         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19533 #endif
19534         if (!bad)
19535                 printf("ok\n");
19536 }
19537 EOCP
19538         set try
19539         if eval $compile; then
19540                 case "`$run ./try`" in
19541                 ok) echo "Your strtoull() seems to be working okay." ;;
19542                 *) cat <<EOM >&4
19543 Your strtoull() doesn't seem to be working okay.
19544 EOM
19545                    d_strtoull="$undef"
19546                    ;;
19547                 esac
19548         else
19549                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19550                 d_strtoull="$undef"
19551         fi
19552         ;;
19553 esac
19554
19555 : see if strtouq exists
19556 set strtouq d_strtouq
19557 eval $inlibc
19558
19559 case "$d_strtouq" in
19560 "$define")
19561         $cat <<EOM
19562 Checking whether your strtouq() works okay...
19563 EOM
19564         $cat >try.c <<'EOCP'
19565 #include <errno.h>
19566 #include <stdio.h>
19567 extern unsigned long long int strtouq(char *s, char **, int);
19568 static int bad = 0;
19569 void check(char *s, unsigned long long eull, int een) {
19570         unsigned long long gull;
19571         errno = 0;
19572         gull = strtouq(s, 0, 10);
19573         if (!((gull == eull) && (errno == een)))
19574                 bad++;
19575 }
19576 int main() {
19577         check(" 1",                                        1LL, 0);
19578         check(" 0",                                        0LL, 0);
19579         check("18446744073709551615",  18446744073709551615ULL, 0);
19580         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19581 #if 0 /* strtouq() for /^-/ strings is undefined. */
19582         check("-1",                    18446744073709551615ULL, 0);
19583         check("-18446744073709551614",                     2LL, 0);
19584         check("-18446744073709551615",                     1LL, 0);
19585         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19586         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19587 #endif
19588         if (!bad)
19589                 printf("ok\n");
19590         return 0;
19591 }
19592 EOCP
19593         set try
19594         if eval $compile; then
19595                 case "`$run ./try`" in
19596                 ok) echo "Your strtouq() seems to be working okay." ;;
19597                 *) cat <<EOM >&4
19598 Your strtouq() doesn't seem to be working okay.
19599 EOM
19600                    d_strtouq="$undef"
19601                    ;;
19602                 esac
19603         else
19604                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19605                 d_strtouq="$undef"
19606         fi
19607         ;;
19608 esac
19609
19610 : see if strxfrm exists
19611 set strxfrm d_strxfrm
19612 eval $inlibc
19613
19614 : see if symlink exists
19615 set symlink d_symlink
19616 eval $inlibc
19617
19618 : see if syscall exists
19619 set syscall d_syscall
19620 eval $inlibc
19621
19622 : see if prototype for syscall is available
19623 echo " "
19624 set d_syscallproto syscall $i_unistd unistd.h
19625 eval $hasproto
19626
19627 : see if sysconf exists
19628 set sysconf d_sysconf
19629 eval $inlibc
19630
19631 : see if system exists
19632 set system d_system
19633 eval $inlibc
19634
19635 : see if tcgetpgrp exists
19636 set tcgetpgrp d_tcgetpgrp
19637 eval $inlibc
19638
19639 : see if tcsetpgrp exists
19640 set tcsetpgrp d_tcsetpgrp
19641 eval $inlibc
19642
19643 : see if prototype for telldir is available
19644 echo " "
19645 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19646 eval $hasproto
19647
19648 : see if tgamma exists
19649 set tgamma d_tgamma
19650 eval $inlibc
19651
19652 : see if time exists
19653 echo " "
19654 if test "X$d_time" = X -o X"$timetype" = X; then
19655     if set time val -f d_time; eval $csym; $val; then
19656                 echo 'time() found.' >&4
19657                 val="$define"
19658                 rp="What is the type returned by time() on this system?"
19659                 set time_t timetype long stdio.h sys/types.h
19660                 eval $typedef_ask
19661     else
19662                 echo 'time() not found, hope that will do.' >&4
19663                 val="$undef"
19664                 timetype='int';
19665     fi
19666     set d_time
19667     eval $setvar
19668 fi
19669
19670 : see if timegm exists
19671 set timegm d_timegm
19672 eval $inlibc
19673
19674 : see if this is a sys/times.h system
19675 set sys/times.h i_systimes
19676 eval $inhdr
19677
19678 : see if times exists
19679 echo " "
19680 if set times val -f d_times; eval $csym; $val; then
19681         echo 'times() found.' >&4
19682         d_times="$define"
19683         inc=''
19684         case "$i_systimes" in
19685         "$define") inc='sys/times.h';;
19686         esac
19687         rp="What is the type returned by times() on this system?"
19688         set clock_t clocktype long stdio.h sys/types.h $inc
19689         eval $typedef_ask
19690 else
19691         echo 'times() NOT found, hope that will do.' >&4
19692         d_times="$undef"
19693         clocktype='int'
19694 fi
19695
19696 : see if tmpnam_r exists
19697 set tmpnam_r d_tmpnam_r
19698 eval $inlibc
19699 case "$d_tmpnam_r" in
19700 "$define")
19701         hdrs="$i_systypes sys/types.h define stdio.h "
19702         case "$d_tmpnam_r_proto:$usethreads" in
19703         ":define")      d_tmpnam_r_proto=define
19704                 set d_tmpnam_r_proto tmpnam_r $hdrs
19705                 eval $hasproto ;;
19706         *)      ;;
19707         esac
19708         case "$d_tmpnam_r_proto" in
19709         define)
19710         case "$tmpnam_r_proto" in
19711         ''|0) try='char* tmpnam_r(char*);'
19712         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19713         esac
19714         case "$tmpnam_r_proto" in
19715         ''|0)   d_tmpnam_r=undef
19716                 tmpnam_r_proto=0
19717                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19718         * )     case "$tmpnam_r_proto" in
19719                 REENTRANT_PROTO*) ;;
19720                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19721                 esac
19722                 echo "Prototype: $try" ;;
19723         esac
19724         ;;
19725         *)      case "$usethreads" in
19726                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19727                 esac
19728                 d_tmpnam_r=undef
19729                 tmpnam_r_proto=0
19730                 ;;
19731         esac
19732         ;;
19733 *)      tmpnam_r_proto=0
19734         ;;
19735 esac
19736
19737 : see if trunc exists
19738 set trunc d_trunc
19739 eval $inlibc
19740
19741 : see if truncate exists
19742 set truncate d_truncate
19743 eval $inlibc
19744
19745 : see if ttyname_r exists
19746 set ttyname_r d_ttyname_r
19747 eval $inlibc
19748 case "$d_ttyname_r" in
19749 "$define")
19750         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19751         case "$d_ttyname_r_proto:$usethreads" in
19752         ":define")      d_ttyname_r_proto=define
19753                 set d_ttyname_r_proto ttyname_r $hdrs
19754                 eval $hasproto ;;
19755         *)      ;;
19756         esac
19757         case "$d_ttyname_r_proto" in
19758         define)
19759         case "$ttyname_r_proto" in
19760         ''|0) try='int ttyname_r(int, char*, size_t);'
19761         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19762         esac
19763         case "$ttyname_r_proto" in
19764         ''|0) try='int ttyname_r(int, char*, int);'
19765         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19766         esac
19767         case "$ttyname_r_proto" in
19768         ''|0) try='char* ttyname_r(int, char*, int);'
19769         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19770         esac
19771         case "$ttyname_r_proto" in
19772         ''|0)   d_ttyname_r=undef
19773                 ttyname_r_proto=0
19774                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19775         * )     case "$ttyname_r_proto" in
19776                 REENTRANT_PROTO*) ;;
19777                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19778                 esac
19779                 echo "Prototype: $try" ;;
19780         esac
19781         ;;
19782         *)      case "$usethreads" in
19783                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19784                 esac
19785                 d_ttyname_r=undef
19786                 ttyname_r_proto=0
19787                 ;;
19788         esac
19789         ;;
19790 *)      ttyname_r_proto=0
19791         ;;
19792 esac
19793
19794 : see if tzname[] exists
19795 echo " "
19796 if set tzname val -a d_tzname; eval $csym; $val; then
19797         val="$define"
19798         echo 'tzname[] found.' >&4
19799 else
19800         val="$undef"
19801         echo 'tzname[] NOT found.' >&4
19802 fi
19803 set d_tzname
19804 eval $setvar
19805
19806 : Check if is a multiplatform env
19807 case "$osname" in
19808 darwin) multiarch="$define" ;;
19809 esac
19810 case "$multiarch" in
19811 ''|[nN]*) multiarch="$undef" ;;
19812 esac
19813
19814 : check for ordering of bytes in a UV
19815 echo " "
19816 case "$multiarch" in
19817 *$define*)
19818         $cat <<EOM
19819 You seem to be doing a multiarchitecture build,
19820 skipping the byteorder check.
19821
19822 EOM
19823         byteorder='ffff'
19824         ;;
19825 *)
19826         case "$byteorder" in
19827         '')
19828                 $cat <<'EOM'
19829 In the following, larger digits indicate more significance.  A big-endian
19830 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19831 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19832 machines may have weird orders like 3412.  A Cray will report 87654321,
19833 an Alpha will report 12345678. If the test program works the default is
19834 probably right.
19835 I'm now running the test program...
19836 EOM
19837                 $cat >try.c <<EOCP
19838 #include <stdio.h>
19839 #$i_stdlib I_STDLIB
19840 #ifdef I_STDLIB
19841 #include <stdlib.h>
19842 #endif
19843 #include <sys/types.h>
19844 typedef $uvtype UV;
19845 int main()
19846 {
19847         int i;
19848         union {
19849                 UV l;
19850                 char c[$uvsize];
19851         } u;
19852
19853         if ($uvsize > 4)
19854                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19855         else
19856                 u.l = (UV)0x04030201;
19857         for (i = 0; i < $uvsize; i++)
19858                 printf("%c", u.c[i]+'0');
19859         printf("\n");
19860         exit(0);
19861 }
19862 EOCP
19863                 xxx_prompt=y
19864                 set try
19865                 if eval $compile && $run ./try > /dev/null; then
19866                         dflt=`$run ./try`
19867                         case "$dflt" in
19868                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19869                                 echo "(The test program ran ok.)"
19870                                 echo "byteorder=$dflt"
19871                                 xxx_prompt=n
19872                         ;;
19873                         ????|????????) echo "(The test program ran ok.)" ;;
19874                         *) echo "(The test program didn't run right for some reason.)" ;;
19875                         esac
19876                 else
19877                         dflt='4321'
19878                         cat <<'EOM'
19879 (I can't seem to compile the test program.  Guessing big-endian...)
19880 EOM
19881                 fi
19882                 case "$xxx_prompt" in
19883                 y)
19884                         rp="What is the order of bytes in $uvtype?"
19885                         . ./myread
19886                         byteorder="$ans"
19887                         ;;
19888                 *)      byteorder=$dflt
19889                         ;;
19890                 esac
19891                 ;;
19892         esac
19893         $rm_try
19894         ;;
19895 esac
19896
19897 : Checking 32bit alignedness
19898 $cat <<EOM
19899
19900 Checking to see whether you can access character data unalignedly...
19901 EOM
19902 case "$d_u32align" in
19903 '')   $cat >try.c <<EOCP
19904 #include <stdio.h>
19905 #$i_stdlib I_STDLIB
19906 #ifdef I_STDLIB
19907 #include <stdlib.h>
19908 #endif
19909 #define U32 $u32type
19910 #define BYTEORDER 0x$byteorder
19911 #define U8 $u8type
19912 #include <signal.h>
19913 #ifdef SIGBUS
19914 $signal_t bletch(int s) { exit(4); }
19915 #endif
19916 int main() {
19917 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19918     volatile U8 buf[8];
19919     volatile U32 *up;
19920     int i;
19921
19922     if (sizeof(U32) != 4) {
19923         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19924         exit(1);
19925     }
19926
19927     fflush(stdout);
19928
19929 #ifdef SIGBUS
19930     signal(SIGBUS, bletch);
19931 #endif
19932
19933     buf[0] = 0;
19934     buf[1] = 0;
19935     buf[2] = 0;
19936     buf[3] = 1;
19937     buf[4] = 0;
19938     buf[5] = 0;
19939     buf[6] = 0;
19940     buf[7] = 1;
19941
19942     for (i = 0; i < 4; i++) {
19943         up = (U32*)(buf + i);
19944         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19945                (*up == 1 << (8*(3-i)))  /* little-endian */
19946               )
19947            )
19948         {
19949             printf("read failed (%x)\n", *up);
19950             exit(2);
19951         }
19952     }
19953
19954     /* write test */
19955     for (i = 0; i < 4; i++) {
19956         up = (U32*)(buf + i);
19957         *up = 0xBeef;
19958         if (*up != 0xBeef) {
19959             printf("write failed (%x)\n", *up);
19960             exit(3);
19961         }
19962     }
19963
19964     exit(0);
19965 #else
19966     printf("1\n");
19967     exit(1);
19968 #endif
19969     return 0;
19970 }
19971 EOCP
19972 set try
19973 if eval $compile_ok; then
19974         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19975         $run ./try 2>&1 >/dev/null
19976         case "$?" in
19977         0)      cat >&4 <<EOM
19978 You can access character data pretty unalignedly.
19979 EOM
19980                 d_u32align="$undef"
19981                 ;;
19982         *)      cat >&4 <<EOM
19983 It seems that you must access character data in an aligned manner.
19984 EOM
19985                 d_u32align="$define"
19986                 ;;
19987         esac
19988 else
19989         rp='Can you access character data at unaligned addresses?'
19990         dflt='n'
19991         . ./myread
19992         case "$ans" in
19993         [yY]*)  d_u32align="$undef"  ;;
19994         *)      d_u32align="$define" ;;
19995         esac
19996 fi
19997 $rm_try
19998 ;;
19999 esac
20000
20001 : see if ualarm exists
20002 set ualarm d_ualarm
20003 eval $inlibc
20004
20005 : see if umask exists
20006 set umask d_umask
20007 eval $inlibc
20008
20009 : see if unordered exists
20010 set unordered d_unordered
20011 eval $inlibc
20012
20013 : see if unsetenv exists
20014 set unsetenv d_unsetenv
20015 eval $inlibc
20016
20017 : see if usleep exists
20018 set usleep d_usleep
20019 eval $inlibc
20020
20021 : see if prototype for usleep is available
20022 echo " "
20023 set d_usleepproto usleep $i_unistd unistd.h
20024 eval $hasproto
20025
20026 : see if ustat exists
20027 set ustat d_ustat
20028 eval $inlibc
20029
20030 : see if closedir exists
20031 set closedir d_closedir
20032 eval $inlibc
20033
20034 case "$d_closedir" in
20035 "$define")
20036         echo " "
20037         echo "Checking whether closedir() returns a status..." >&4
20038         cat > try.c <<EOM
20039 #$i_dirent I_DIRENT             /**/
20040 #$i_sysdir I_SYS_DIR            /**/
20041 #$i_sysndir I_SYS_NDIR          /**/
20042 #$i_systypes I_SYS_TYPES        /**/
20043
20044 #if defined(I_SYS_TYPES)
20045 #include <sys/types.h>
20046 #endif
20047 #if defined(I_DIRENT)
20048 #include <dirent.h>
20049 #else
20050 #ifdef I_SYS_NDIR
20051 #include <sys/ndir.h>
20052 #else
20053 #ifdef I_SYS_DIR
20054 #ifdef hp9000s500
20055 #include <ndir.h>       /* may be wrong in the future */
20056 #else
20057 #include <sys/dir.h>
20058 #endif
20059 #endif
20060 #endif
20061 #endif
20062 int main() { return closedir(opendir(".")); }
20063 EOM
20064         set try
20065         if eval $compile_ok; then
20066                 if $run ./try > /dev/null 2>&1 ; then
20067                         echo "Yes, it does."
20068                         val="$undef"
20069                 else
20070                         echo "No, it doesn't."
20071                         val="$define"
20072                 fi
20073         else
20074                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20075                 val="$define"
20076         fi
20077         ;;
20078 *)
20079         val="$undef";
20080         ;;
20081 esac
20082 set d_void_closedir
20083 eval $setvar
20084 $rm_try
20085
20086 : see if there is a wait4
20087 set wait4 d_wait4
20088 eval $inlibc
20089
20090 : see if waitpid exists
20091 set waitpid d_waitpid
20092 eval $inlibc
20093
20094 : look for wcscmp
20095 echo " "
20096 $cat >try.c <<'EOCP'
20097 #include <stdio.h>
20098 #include <wchar.h>
20099 int main ()
20100 {
20101     wchar_t *s = L" ";
20102     return (wcscmp (s, s) ? 1 : 0);
20103     }
20104 EOCP
20105 set try
20106 val="$undef"
20107 if eval $compile; then
20108     `$run ./try`
20109     case "$?" in
20110         0)  echo "A working wcscmp() found." >&4
20111             val="$define" ;;
20112         *)  echo "wcscmp() found, but it doesn't work" >&4
20113             ;;
20114         esac
20115 else
20116     echo "wcscmp() NOT found." >&4
20117     fi
20118 set d_wcscmp
20119 eval $setvar
20120 $rm_try
20121
20122 : see if wcstombs exists
20123 set wcstombs d_wcstombs
20124 eval $inlibc
20125
20126 : look for wcsxfrm
20127 echo " "
20128 $cat >try.c <<'EOCP'
20129 #include <errno.h>
20130 #include <wchar.h>
20131 int main ()
20132 {
20133     wchar_t dst[4], *src = L" ";
20134     errno = 0;
20135     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20136     }
20137 EOCP
20138 set try
20139 val="$undef"
20140 if eval $compile; then
20141     `$run ./try`
20142     case "$?" in
20143         0)  echo "A working wcsxfrm() found." >&4
20144             val="$define" ;;
20145         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20146             ;;
20147         esac
20148 else
20149     echo "wcsxfrm() NOT found." >&4
20150     fi
20151 set d_wcsxfrm
20152 eval $setvar
20153 $rm_try
20154
20155 : see if wctomb exists
20156 set wctomb d_wctomb
20157 eval $inlibc
20158
20159 : see if writev exists
20160 set writev d_writev
20161 eval $inlibc
20162
20163 : check for alignment requirements
20164 echo " "
20165 case "$alignbytes" in
20166     '') echo "Checking alignment constraints..." >&4
20167         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
20168             $cat >try.c <<'EOCP'
20169 typedef long double NV;
20170 EOCP
20171         else
20172             $cat >try.c <<'EOCP'
20173 typedef double NV;
20174 EOCP
20175         fi
20176         $cat >>try.c <<'EOCP'
20177 #include <stdio.h>
20178 struct foobar {
20179     char foo;
20180     NV bar;
20181 } try_algn;
20182 int main()
20183 {
20184     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20185     return(0);
20186 }
20187 EOCP
20188         set try
20189         if eval $compile_ok; then
20190             dflt=`$run ./try`
20191         else
20192             dflt='8'
20193             echo "(I can't seem to compile the test program...)"
20194         fi
20195         case "$multiarch" in
20196             *$define*)
20197                 : The usual safe value is 8, but Darwin with -Duselongdouble
20198                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20199                 : Configure to pick a larger value if needed.
20200                 if $test "$dflt" -lt 8; then
20201                     dflt='8'
20202                     echo "Setting alignment to 8 for multiarch support.">&4
20203                 fi
20204                 ;;
20205         esac
20206         ;;
20207     *) dflt="$alignbytes"
20208         ;;
20209 esac
20210 rp="Doubles must be aligned on a how-many-byte boundary?"
20211 . ./myread
20212 alignbytes="$ans"
20213 $rm_try
20214
20215 : set the base revision
20216 baserev=5.0
20217
20218 : length of character in bytes. Is always 1, otherwise it is not C
20219 : This used to be a test using sizeof
20220 charsize=1
20221
20222 : Check for the number of bits in a character
20223 case "$charbits" in
20224 '')     echo "Checking how long a character is (in bits)..." >&4
20225         $cat >try.c <<EOCP
20226 #include <stdio.h>
20227 int main ()
20228 {
20229     int n;
20230     unsigned char c;
20231     for (c = 1, n = 0; c; c <<= 1, n++) ;
20232     printf ("%d\n", n);
20233     return (0);
20234     }
20235 EOCP
20236         set try
20237         if eval $compile_ok; then
20238                 dflt=`$run ./try`
20239         else
20240                 dflt='8'
20241                 echo "(I can't seem to compile the test program.  Guessing...)"
20242         fi
20243         ;;
20244 *)
20245         dflt="$charbits"
20246         ;;
20247 esac
20248 rp="What is the length of a character (in bits)?"
20249 . ./myread
20250 charbits="$ans"
20251 $rm_try
20252 case "$charbits" in
20253 8)      ;;
20254 *)      cat >&4 << EOM
20255 Your system has an unsigned character size of $charbits bits, which
20256 is rather unusual (normally it is 8 bits).  Perl likely will not work
20257 correctly on your system, with subtle bugs in various places.
20258 EOM
20259         rp='Do you really want to continue?'
20260         dflt='n'
20261         . ./myread
20262         case "$ans" in
20263                 [yY])   echo >&4 "Okay, continuing."    ;;
20264                 *)      exit 1                          ;;
20265         esac
20266 esac
20267
20268 : how do we concatenate cpp tokens here?
20269 echo " "
20270 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20271 $cat >cpp_stuff.c <<'EOCP'
20272 #define RCAT(a,b)a/**/b
20273 #define ACAT(a,b)a ## b
20274 RCAT(Rei,ser)
20275 ACAT(Cir,cus)
20276 EOCP
20277 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20278 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20279         echo "Oh!  Smells like ANSI's been here." >&4
20280         echo "We can catify or stringify, separately or together!"
20281         cpp_stuff=42
20282 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20283         echo "Ah, yes!  The good old days!" >&4
20284         echo "However, in the good old days we don't know how to stringify and"
20285         echo "catify at the same time."
20286         cpp_stuff=1
20287 else
20288         $cat >&4 <<EOM
20289 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20290 You're going to have to edit the values of CAT[2-5] in config.h...
20291 EOM
20292         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20293 fi
20294 $rm -f cpp_stuff.*
20295
20296 : see if this is a db.h system
20297 set db.h i_db
20298 eval $inhdr
20299
20300 case "$i_db" in
20301 $define)
20302         : Check db version.
20303         echo " "
20304         echo "Checking Berkeley DB version ..." >&4
20305         $cat >try.c <<EOCP
20306 #$d_const HASCONST
20307 #ifndef HASCONST
20308 #define const
20309 #endif
20310 #include <sys/types.h>
20311 #include <stdio.h>
20312 #$i_stdlib I_STDLIB
20313 #ifdef I_STDLIB
20314 #include <stdlib.h>
20315 #endif
20316 #include <db.h>
20317 int main(int argc, char *argv[])
20318 {
20319 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20320     int Major, Minor, Patch ;
20321     unsigned long Version ;
20322     (void)db_version(&Major, &Minor, &Patch) ;
20323     if (argc == 2) {
20324         printf("%d %d %d %d %d %d\n",
20325                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20326                Major, Minor, Patch);
20327         exit(0);
20328     }
20329     printf("You have Berkeley DB Version 2 or greater.\n");
20330
20331     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20332                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20333     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20334                 Major, Minor, Patch) ;
20335
20336     /* check that db.h & libdb are compatible */
20337     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20338         printf("db.h and libdb are incompatible.\n") ;
20339         exit(3);
20340     }
20341
20342     printf("db.h and libdb are compatible.\n") ;
20343
20344     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20345                 + DB_VERSION_PATCH ;
20346
20347     /* needs to be >= 2.3.4 */
20348     if (Version < 2003004) {
20349     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20350         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20351         exit(2);
20352     }
20353
20354     exit(0);
20355 #else
20356 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20357     if (argc == 2) {
20358         printf("1 0 0\n");
20359         exit(0);
20360     }
20361     printf("You have Berkeley DB Version 1.\n");
20362     exit(0);    /* DB version < 2: the coast is clear. */
20363 #else
20364     exit(1);    /* <db.h> not Berkeley DB? */
20365 #endif
20366 #endif
20367 }
20368 EOCP
20369         set try
20370         if eval $compile_ok && $run ./try; then
20371                 echo 'Looks OK.' >&4
20372                 set `$run ./try 1`
20373                 db_version_major=$1
20374                 db_version_minor=$2
20375                 db_version_patch=$3
20376         else
20377                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20378                 i_db=$undef
20379                 case " $libs " in
20380                 *"-ldb "*)
20381                         : Remove db from list of libraries to use
20382                         echo "Removing unusable -ldb from library list" >&4
20383                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20384                         shift
20385                         libs="$*"
20386                         echo "libs = $libs" >&4
20387                         ;;
20388                 esac
20389         fi
20390         $rm_try
20391         ;;
20392 esac
20393
20394 case "$i_db" in
20395 define)
20396         : Check the return type needed for hash
20397         echo " "
20398         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20399         $cat >try.c <<EOCP
20400 #$d_const HASCONST
20401 #ifndef HASCONST
20402 #define const
20403 #endif
20404 #include <sys/types.h>
20405 #include <db.h>
20406
20407 #ifndef DB_VERSION_MAJOR
20408 u_int32_t hash_cb (const void* ptr, size_t size)
20409 {
20410 }
20411 HASHINFO info;
20412 int main()
20413 {
20414         info.hash = hash_cb;
20415 }
20416 #endif
20417 EOCP
20418         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20419                 if $contains warning try.out >>/dev/null 2>&1 ; then
20420                         db_hashtype='int'
20421                 else
20422                         db_hashtype='u_int32_t'
20423                 fi
20424         else
20425                 : XXX Maybe we should just give up here.
20426                 db_hashtype=u_int32_t
20427                 $cat try.out >&4
20428                 echo "Help:  I can't seem to compile the db test program." >&4
20429                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20430         fi
20431         $rm_try
20432         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20433         ;;
20434 *)      db_hashtype=u_int32_t
20435         ;;
20436 esac
20437 case "$i_db" in
20438 define)
20439         : Check the return type needed for prefix
20440         echo " "
20441         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20442         cat >try.c <<EOCP
20443 #$d_const HASCONST
20444 #ifndef HASCONST
20445 #define const
20446 #endif
20447 #include <sys/types.h>
20448 #include <db.h>
20449
20450 #ifndef DB_VERSION_MAJOR
20451 size_t prefix_cb (const DBT *key1, const DBT *key2)
20452 {
20453 }
20454 BTREEINFO info;
20455 int main()
20456 {
20457         info.prefix = prefix_cb;
20458 }
20459 #endif
20460 EOCP
20461         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20462                 if $contains warning try.out >>/dev/null 2>&1 ; then
20463                         db_prefixtype='int'
20464                 else
20465                         db_prefixtype='size_t'
20466                 fi
20467         else
20468                 db_prefixtype='size_t'
20469                 : XXX Maybe we should just give up here.
20470                 $cat try.out >&4
20471                 echo "Help:  I can't seem to compile the db test program." >&4
20472                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20473         fi
20474         $rm_try
20475         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20476         ;;
20477 *)      db_prefixtype='size_t'
20478         ;;
20479 esac
20480
20481 : Check what kind of inf/nan your system has
20482 $echo "Checking the kind of infinities and nans you have..." >&4
20483 $cat >try.c <<EOP
20484 #define DOUBLESIZE $doublesize
20485 #$d_longdbl HAS_LONG_DOUBLE
20486 #ifdef HAS_LONG_DOUBLE
20487 #define LONGDBLSIZE $longdblsize
20488 #define LONGDBLKIND $longdblkind
20489 #endif
20490 #$i_math I_MATH
20491 #ifdef I_MATH
20492 #include <math.h>
20493 #endif
20494 #include <stdio.h>
20495 /* Note that whether the sign bit is on or off
20496  * for NaN depends on the CPU/FPU, and possibly
20497  * can be affected by the build toolchain.
20498  *
20499  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20500  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20501  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20502  * (respectively) as opposed to the more usual
20503  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20504  */
20505 static void bytes(unsigned char *p, unsigned int n) {
20506   int i;
20507   for (i = 0; i < n; i++) {
20508     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20509   }
20510 }
20511 int main(int argc, char *argv[]) {
20512    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20513     * because some compilers are 'smart' and not only warn but refuse to
20514     * compile such 'illegal' values. */
20515    double dinf = exp(1e9);
20516    double dnan = sqrt(-1.0);
20517 #ifdef HAS_LONG_DOUBLE
20518    long double ldinf = (long double)exp(1e9);
20519    long double ldnan = (long double)sqrt(-1.0);
20520 #endif
20521   if (argc == 2) {
20522     switch (argv[1][0]) {
20523     case '1': bytes(&dinf, sizeof(dinf)); break;
20524     case '2': bytes(&dnan, sizeof(dnan)); break;
20525 #ifdef HAS_LONG_DOUBLE
20526 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20527 /* the 80-bit long doubles might have garbage in their excess bytes */
20528     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20529 # endif
20530     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20531     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20532 #endif
20533     }
20534   }
20535   return 0;
20536 }
20537 EOP
20538 set try
20539 if eval $compile; then
20540     doubleinfbytes=`$run ./try 1`
20541     doublenanbytes=`$run ./try 2`
20542     case "$d_longdbl" in
20543     $define)
20544       longdblinfbytes=`$run ./try 3`
20545       longdblnanbytes=`$run ./try 4`
20546       ;;
20547     esac
20548 else
20549     # Defaults in case the above test program failed.
20550     case "$doublekind" in
20551     1) # IEEE 754 32-bit LE
20552        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20553        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20554        ;;
20555     2) # IEEE 754 32-bit BE
20556        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20557        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20558        ;;
20559     3) # IEEE 754 64-bit LE
20560        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20561        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20562        ;;
20563     4) # IEEE 754 64-bit BE
20564        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20565        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20566        ;;
20567     5) # IEEE 754 128-bit LE
20568        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20569        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20570        ;;
20571     6) # IEEE 754 128-bit BE
20572        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20573        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20574        ;;
20575     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20576        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20577        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20578        ;;
20579     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20580        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20581        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20582        ;;
20583     *) # No idea.
20584        doubleinfbytes=$undef
20585        doublenanbytes=$undef
20586        ;;
20587     esac
20588     case "$longdblkind" in
20589     1) # IEEE 754 128-bit LE
20590        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20591        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20592        ;;
20593     2) # IEEE 754 128-bit BE
20594        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20595        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20596        ;;
20597     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20598        case "$longdblsize" in
20599        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20600            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20601            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20602            ;;
20603        16) # x86_64
20604            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20605            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20606            ;;
20607        *)  # No idea.
20608            longdblinfbytes=$undef
20609            longdblnanbytes=$undef
20610        ;;
20611        esac
20612        ;;
20613     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20614        case "$longdblsize" in
20615        12) # 32-bit system
20616            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20617            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20618            ;;
20619        16) # 64-bit system
20620            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20621            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20622            ;;
20623        *)  # No idea.
20624            longdblinfbytes=$undef
20625            longdblnanbytes=$undef
20626        ;;
20627        esac
20628        ;;
20629     5) # 128-bit LE-LE "double double"
20630        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20631        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20632        ;;
20633     6) # 128-bit BE-BE "double double"
20634        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20635        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20636        ;;
20637     7) # 128-bit LE-BE "double double"
20638        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20639        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20640        ;;
20641     8) # 128-bit BE-LE "double double"
20642        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20643        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20644        ;;
20645     *) # No idea.
20646        longdblinfbytes=$undef
20647        longdblnanbytes=$undef
20648        ;;
20649     esac
20650 fi
20651 $rm_try
20652
20653 : Check the length of the double mantissa
20654 $echo "Checking how many mantissa bits your doubles have..." >&4
20655 $cat >try.c <<EOP
20656 #$i_float I_FLOAT
20657 #$i_sunmath I_SUNMATH
20658 #ifdef I_FLOAT
20659 # include <float.h>
20660 #endif
20661 #ifdef I_SUNMATH
20662 # include <sunmath.h>
20663 #endif
20664 #ifdef DBL_MANT_DIG
20665 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20666 #endif
20667 #include <stdio.h>
20668 int main(int argc, char *argv[]) {
20669 #ifdef BITS
20670   printf("%d\n", BITS);
20671 #endif
20672   return 0;
20673 }
20674 EOP
20675 set try
20676 if eval $compile; then
20677     doublemantbits=`$run ./try`
20678 else
20679     doublemantbits="$undef"
20680 fi
20681 $rm_try
20682
20683 : Check the length of the longdouble mantissa
20684 $echo "Checking how many mantissa bits your long doubles have..." >&4
20685 $cat >try.c <<EOP
20686 #$i_float I_FLOAT
20687 #$i_sunmath I_SUNMATH
20688 #ifdef I_FLOAT
20689 # include <float.h>
20690 #endif
20691 #ifdef I_SUNMATH
20692 # include <sunmath.h>
20693 #endif
20694 #$d_longdbl HAS_LONG_DOUBLE
20695 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20696 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20697 /* This format has no implicit bit.  Beware, however, that for
20698  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20699  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20700  * and the top bit must have been one since 387, zero is plain invalid.
20701  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20702 #  define BITS LDBL_MANT_DIG
20703 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20704 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20705  * reason e.g. Irix thinks 107.  But in any case, we want only
20706  * the number of real bits, the implicit bits are of no interest.  */
20707 #  define BITS 2 * (DBL_MANT_DIG - 1)
20708 # else
20709 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20710 # endif
20711 #endif
20712 #include <stdio.h>
20713 int main(int argc, char *argv[]) {
20714 #ifdef BITS
20715   printf("%d\n", BITS);
20716 #endif
20717   return 0;
20718 }
20719 EOP
20720 set try
20721 if eval $compile; then
20722     longdblmantbits=`$run ./try`
20723 else
20724     longdblmantbits="$undef"
20725 fi
20726 $rm_try
20727
20728 : Check the length of the NV mantissa
20729 $echo "Checking how many mantissa bits your NVs have..." >&4
20730 if test "X$usequadmath" = "X$define"; then
20731   nvmantbits=112 # 128-1-15
20732 else
20733   if test "X$nvsize" = "X$doublesize"; then
20734     nvmantbits="$doublemantbits"
20735   else
20736      if test "X$nvsize" = "X$longdblsize"; then
20737        nvmantbits="$longdblmantbits"
20738      else
20739        nvmantbits="$undef"
20740      fi
20741   fi
20742 fi
20743
20744 : How can we generate normalized random numbers ?
20745 echo " "
20746 echo "Using our internal random number implementation..." >&4
20747
20748 case "$ccflags" in
20749 *-Dmy_rand=*|*-Dmy_srand=*)
20750         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20751         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20752         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20753         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20754         ;;
20755 esac
20756
20757 randfunc=Perl_drand48
20758 drand01="Perl_drand48()"
20759 seedfunc="Perl_drand48_init"
20760 randbits=48
20761 randseedtype=U32
20762
20763 : Determine if this is an EBCDIC system
20764 echo " "
20765 echo "Determining whether or not we are on an EBCDIC system..." >&4
20766 $cat >try.c <<'EOM'
20767 int main()
20768 {
20769   if ('M'==0xd4) return 0;
20770   return 1;
20771 }
20772 EOM
20773
20774 val=$undef
20775 set try
20776 if eval $compile_ok; then
20777         if $run ./try; then
20778                 echo "You seem to speak EBCDIC." >&4
20779                 val="$define"
20780         else
20781                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20782         fi
20783 else
20784         echo "I'm unable to compile the test program." >&4
20785         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20786 fi
20787 $rm_try
20788 set ebcdic
20789 eval $setvar
20790
20791 : Check how to flush
20792 echo " "
20793 $cat >&4 <<EOM
20794 Checking how to flush all pending stdio output...
20795 EOM
20796 # I only know how to find the first 32 possibly open files on SunOS.
20797 # See also hints/sunos_4_1.sh and util.c  --AD
20798 case "$osname" in
20799 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20800 esac
20801 $cat >>try.c <<EOCP
20802 #include <stdio.h>
20803 #$i_stdlib I_STDLIB
20804 #ifdef I_STDLIB
20805 #include <stdlib.h>
20806 #endif
20807 #$i_unistd I_UNISTD
20808 #ifdef I_UNISTD
20809 # include <unistd.h>
20810 #endif
20811 #$d_sysconf HAS_SYSCONF
20812 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20813 #ifdef HAS_STDIO_STREAM_ARRAY
20814 # define STDIO_STREAM_ARRAY $stdio_stream_array
20815 #endif
20816 int main() {
20817   FILE* p;
20818   unlink("try.out");
20819   p = fopen("try.out", "w");
20820 #ifdef TRY_FPUTC
20821   fputc('x', p);
20822 #else
20823 # ifdef TRY_FPRINTF
20824   fprintf(p, "x");
20825 # endif
20826 #endif
20827 #ifdef TRY_FFLUSH_NULL
20828   fflush(NULL);
20829 #endif
20830 #ifdef TRY_FFLUSH_ALL
20831   {
20832     long open_max = -1;
20833 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20834     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20835 # else
20836 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20837     open_max = sysconf(_SC_OPEN_MAX);
20838 #  else
20839 #   ifdef FOPEN_MAX
20840     open_max = FOPEN_MAX;
20841 #   else
20842 #    ifdef OPEN_MAX
20843     open_max = OPEN_MAX;
20844 #    else
20845 #     ifdef _NFILE
20846     open_max = _NFILE;
20847 #     endif
20848 #    endif
20849 #   endif
20850 #  endif
20851 # endif
20852 # ifdef HAS_STDIO_STREAM_ARRAY
20853     if (open_max > 0) {
20854       long i;
20855       for (i = 0; i < open_max; i++)
20856             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20857                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20858                 STDIO_STREAM_ARRAY[i]._flag)
20859                 fflush(&STDIO_STREAM_ARRAY[i]);
20860     }
20861   }
20862 # endif
20863 #endif
20864   _exit(42);
20865 }
20866 EOCP
20867 : first we have to find out how _not_ to flush
20868 $to try.c
20869 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20870     output=''
20871     set try -DTRY_FPUTC
20872     if eval $compile; then
20873             $run ./try 2>/dev/null
20874             code="$?"
20875             $from try.out
20876             if $test ! -s try.out -a "X$code" = X42; then
20877                 output=-DTRY_FPUTC
20878             fi
20879     fi
20880     case "$output" in
20881     '')
20882             set try -DTRY_FPRINTF
20883             if eval $compile; then
20884                     $run ./try 2>/dev/null
20885                     code="$?"
20886                     $from try.out
20887                     if $test ! -s try.out -a "X$code" = X42; then
20888                         output=-DTRY_FPRINTF
20889                     fi
20890             fi
20891         ;;
20892     esac
20893 fi
20894 : check for fflush NULL behavior
20895 case "$fflushNULL" in
20896 '')     set try -DTRY_FFLUSH_NULL $output
20897         if eval $compile; then
20898                 $run ./try 2>/dev/null
20899                 code="$?"
20900                 $from try.out
20901                 if $test -s try.out -a "X$code" = X42; then
20902                         fflushNULL="`$cat try.out`"
20903                 else
20904                         if $test "X$code" != X42; then
20905                                 $cat >&4 <<EOM
20906 (If this test failed, don't worry, we'll try another method shortly.)
20907 EOM
20908                         fi
20909                 fi
20910         fi
20911         $rm -f core try.core core.try.*
20912         case "$fflushNULL" in
20913         x)      $cat >&4 <<EOM
20914 Your fflush(NULL) works okay for output streams.
20915 Let's see if it clobbers input pipes...
20916 EOM
20917 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20918 # bug that improperly flushes the input end of pipes.  So we avoid the
20919 # autoflush on fork/system/exec support for now. :-(
20920 $cat >tryp.c <<EOCP
20921 #include <stdio.h>
20922 int
20923 main(int argc, char **argv)
20924 {
20925     char buf[1024];
20926     int i;
20927     char *bp = buf;
20928     while (1) {
20929         while ((i = getc(stdin)) != -1
20930                && (*bp++ = i) != '\n'
20931                && bp < &buf[1024])
20932         /* DO NOTHING */ ;
20933         *bp = '\0';
20934         fprintf(stdout, "%s", buf);
20935         fflush(NULL);
20936         if (i == -1)
20937             return 0;
20938         bp = buf;
20939     }
20940 }
20941 EOCP
20942                 fflushNULL="$define"
20943                 set tryp
20944                 if eval $compile; then
20945                     $rm -f tryp.out
20946                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20947                     if $test "X$targethost" != X; then
20948                         $to tryp.c
20949                         $to tryp
20950                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20951                     else
20952                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20953                     fi
20954                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20955                        $cat >&4 <<EOM
20956 fflush(NULL) seems to behave okay with input streams.
20957 EOM
20958                         fflushNULL="$define"
20959                     else
20960                         $cat >&4 <<EOM
20961 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20962 EOM
20963                         fflushNULL="$undef"
20964                     fi
20965                 fi
20966                 $rm -f core tryp.c tryp.core core.tryp.*
20967                 ;;
20968         '')     $cat >&4 <<EOM
20969 Your fflush(NULL) isn't working (contrary to ANSI C).
20970 EOM
20971                 fflushNULL="$undef"
20972                 ;;
20973         *)      $cat >&4 <<EOM
20974 Cannot figure out whether your fflush(NULL) works or not.
20975 I'm assuming it doesn't (contrary to ANSI C).
20976 EOM
20977                 fflushNULL="$undef"
20978                 ;;
20979         esac
20980         ;;
20981 $define|true|[yY]*)
20982         fflushNULL="$define"
20983         ;;
20984 *)
20985         fflushNULL="$undef"
20986         ;;
20987 esac
20988 : check explicit looping only if NULL did not work, and if the pipe
20989 : bug does not show up on an explicit flush too
20990 case "$fflushNULL" in
20991 "$undef")
20992         $cat >tryp.c <<EOCP
20993 #include <stdio.h>
20994 int
20995 main(int argc, char **argv)
20996 {
20997     char buf[1024];
20998     int i;
20999     char *bp = buf;
21000     while (1) {
21001         while ((i = getc(stdin)) != -1
21002                && (*bp++ = i) != '\n'
21003                && bp < &buf[1024])
21004         /* DO NOTHING */ ;
21005         *bp = '\0';
21006         fprintf(stdout, "%s", buf);
21007         fflush(stdin);
21008         if (i == -1)
21009             return 0;
21010         bp = buf;
21011     }
21012 }
21013 EOCP
21014         set tryp
21015         if eval $compile; then
21016             $rm -f tryp.out
21017             if $test "X$targethost" != X; then
21018                 $to tryp.c
21019                 $to tryp
21020                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21021             else
21022                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21023             fi
21024             if cmp tryp.c tryp.out >/dev/null 2>&1; then
21025                $cat >&4 <<EOM
21026 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21027 EOM
21028                 : now check for fflushall behaviour
21029                 case "$fflushall" in
21030                 '')     set try -DTRY_FFLUSH_ALL $output
21031                         if eval $compile; then
21032                                 $cat >&4 <<EOM
21033 (Now testing the other method--but note that this also may fail.)
21034 EOM
21035                                 $run ./try 2>/dev/null
21036                                 code=$?
21037                                 $from try.out
21038                                 if $test -s try.out -a "X$code" = X42; then
21039                                         fflushall="`$cat try.out`"
21040                                 fi
21041                         fi
21042                         $rm_try
21043                         case "$fflushall" in
21044                         x)      $cat >&4 <<EOM
21045 Whew. Flushing explicitly all the stdio streams works.
21046 EOM
21047                                 fflushall="$define"
21048                                 ;;
21049                         '')     $cat >&4 <<EOM
21050 Sigh. Flushing explicitly all the stdio streams doesn't work.
21051 EOM
21052                                 fflushall="$undef"
21053                                 ;;
21054                         *)      $cat >&4 <<EOM
21055 Cannot figure out whether flushing stdio streams explicitly works or not.
21056 I'm assuming it doesn't.
21057 EOM
21058                                 fflushall="$undef"
21059                                 ;;
21060                         esac
21061                         ;;
21062                 "$define"|true|[yY]*)
21063                         fflushall="$define"
21064                         ;;
21065                 *)
21066                         fflushall="$undef"
21067                         ;;
21068                 esac
21069             else
21070                 $cat >&4 <<EOM
21071 All is futile.  Even fflush(stdin) clobbers input pipes!
21072 EOM
21073                 fflushall="$undef"
21074             fi
21075         else
21076             fflushall="$undef"
21077         fi
21078         $rm -f core tryp.c tryp.core core.tryp.*
21079         ;;
21080 *)      fflushall="$undef"
21081         ;;
21082 esac
21083
21084 case "$fflushNULL$fflushall" in
21085 undefundef)
21086         $cat <<EOM
21087 OK, I give up.  I cannot figure out how to flush pending stdio output.
21088 We won't be flushing handles at all before fork/exec/popen.
21089 EOM
21090         ;;
21091 esac
21092 $rm_try tryp
21093
21094 : Store the full pathname to the ar program for use in the C program
21095 : Respect a hint or command line value for full_ar.
21096 case "$full_ar" in
21097 '') full_ar=$ar ;;
21098 esac
21099
21100 : Store the full pathname to the sed program for use in the C program
21101 full_sed=$sed
21102
21103 : see what type gids are declared as in the kernel
21104 echo " "
21105 echo "Looking for the type for group ids returned by getgid()."
21106 set gid_t gidtype xxx stdio.h sys/types.h
21107 eval $typedef
21108 case "$gidtype" in
21109 xxx)
21110         xxx=`./findhdr sys/user.h`
21111         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21112         case $1 in
21113         unsigned) dflt="$1 $2" ;;
21114         *) dflt="$1" ;;
21115         esac
21116         ;;
21117 *) dflt="$gidtype";;
21118 esac
21119 case "$gidtype" in
21120 gid_t) echo "gid_t found." ;;
21121 *)      rp="What is the type for group ids returned by getgid()?"
21122         . ./myread
21123         gidtype="$ans"
21124         ;;
21125 esac
21126
21127 : Check the size of GID
21128 echo " "
21129 case "$gidtype" in
21130 *_t) zzz="$gidtype"     ;;
21131 *)   zzz="gid"          ;;
21132 esac
21133 echo "Checking the size of $zzz..." >&4
21134 cat > try.c <<EOCP
21135 #include <sys/types.h>
21136 #include <stdio.h>
21137 #$i_stdlib I_STDLIB
21138 #ifdef I_STDLIB
21139 #include <stdlib.h>
21140 #endif
21141 int main() {
21142     printf("%d\n", (int)sizeof($gidtype));
21143     exit(0);
21144 }
21145 EOCP
21146 set try
21147 if eval $compile_ok; then
21148         yyy=`$run ./try`
21149         case "$yyy" in
21150         '')     gidsize=4
21151                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21152                 ;;
21153         *)      gidsize=$yyy
21154                 echo "Your $zzz is $gidsize bytes long."
21155                 ;;
21156         esac
21157 else
21158         gidsize=4
21159         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21160 fi
21161
21162
21163 : Check if GID is signed
21164 echo " "
21165 case "$gidtype" in
21166 *_t) zzz="$gidtype"     ;;
21167 *)   zzz="gid"          ;;
21168 esac
21169 echo "Checking the sign of $zzz..." >&4
21170 cat > try.c <<EOCP
21171 #include <sys/types.h>
21172 #include <stdio.h>
21173 int main() {
21174         $gidtype foo = -1;
21175         if (foo < 0)
21176                 printf("-1\n");
21177         else
21178                 printf("1\n");
21179 }
21180 EOCP
21181 set try
21182 if eval $compile; then
21183         yyy=`$run ./try`
21184         case "$yyy" in
21185         '')     gidsign=1
21186                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21187                 ;;
21188         *)      gidsign=$yyy
21189                 case "$gidsign" in
21190                  1) echo "Your $zzz is unsigned." ;;
21191                 -1) echo "Your $zzz is signed."   ;;
21192                 esac
21193                 ;;
21194         esac
21195 else
21196         gidsign=1
21197         echo "(I can't compile the test program--guessing unsigned.)" >&4
21198 fi
21199
21200
21201 : Check 64bit sizes
21202 echo " "
21203
21204 if $test X"$quadtype" != X; then
21205
21206 echo "Checking how to print 64-bit integers..." >&4
21207
21208 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21209         $cat >try.c <<'EOCP'
21210 #include <sys/types.h>
21211 #include <stdio.h>
21212 int main() {
21213   int q = 12345678901;
21214   printf("%ld\n", q);
21215 }
21216 EOCP
21217         set try
21218         if eval $compile; then
21219                 yyy=`$run ./try`
21220                 case "$yyy" in
21221                 12345678901)
21222                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21223                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21224                         echo "We will use %d."
21225                         ;;
21226                 esac
21227         fi
21228 fi
21229
21230 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21231         $cat >try.c <<'EOCP'
21232 #include <sys/types.h>
21233 #include <stdio.h>
21234 int main() {
21235   long q = 12345678901;
21236   printf("%ld\n", q);
21237 }
21238 EOCP
21239         set try
21240         if eval $compile; then
21241                 yyy=`$run ./try`
21242                 case "$yyy" in
21243                 12345678901)
21244                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21245                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21246                         echo "We will use %ld."
21247                         ;;
21248                 esac
21249         fi
21250 fi
21251
21252 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21253         $cat >try.c <<'EOCP'
21254 #include <sys/types.h>
21255 #include <inttypes.h>
21256 #include <stdio.h>
21257 int main() {
21258   int64_t q = 12345678901;
21259   printf("%" PRId64 "\n", q);
21260 }
21261 EOCP
21262         set try
21263         if eval $compile; then
21264                 yyy=`$run ./try`
21265                 case "$yyy" in
21266                 12345678901)
21267                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21268                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21269                         echo "We will use the C9X style."
21270                         ;;
21271                 esac
21272         fi
21273 fi
21274
21275 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21276         $cat >try.c <<EOCP
21277 #include <sys/types.h>
21278 #include <stdio.h>
21279 int main() {
21280   $quadtype q = 12345678901;
21281   printf("%Ld\n", q);
21282 }
21283 EOCP
21284         set try
21285         if eval $compile; then
21286                 yyy=`$run ./try`
21287                 case "$yyy" in
21288                 12345678901)
21289                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21290                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21291                         echo "We will use %Ld."
21292                         ;;
21293                 esac
21294         fi
21295 fi
21296
21297 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21298         $cat >try.c <<'EOCP'
21299 #include <sys/types.h>
21300 #include <stdio.h>
21301 int main() {
21302   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21303   printf("%lld\n", q);
21304 }
21305 EOCP
21306         set try
21307         if eval $compile; then
21308                 yyy=`$run ./try`
21309                 case "$yyy" in
21310                 12345678901)
21311                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21312                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21313                         echo "We will use the %lld style."
21314                         ;;
21315                 esac
21316         fi
21317 fi
21318
21319 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21320         $cat >try.c <<EOCP
21321 #include <sys/types.h>
21322 #include <stdio.h>
21323 int main() {
21324   $quadtype q = 12345678901;
21325   printf("%qd\n", q);
21326 }
21327 EOCP
21328         set try
21329         if eval $compile; then
21330                 yyy=`$run ./try`
21331                 case "$yyy" in
21332                 12345678901)
21333                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21334                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21335                         echo "We will use %qd."
21336                         ;;
21337                 esac
21338         fi
21339 fi
21340
21341 if $test X"$sPRId64" = X; then
21342         echo "Cannot figure out how to print 64-bit integers." >&4
21343 fi
21344 $rm_try
21345
21346 fi
21347
21348 case "$sPRId64" in
21349 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21350         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21351         ;;
21352 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21353         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21354         ;;
21355 esac
21356
21357 : Check format strings for internal types
21358 echo " "
21359 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21360
21361 if $test X"$ivsize" = X8; then
21362         ivdformat="$sPRId64"
21363         uvuformat="$sPRIu64"
21364         uvoformat="$sPRIo64"
21365         uvxformat="$sPRIx64"
21366         uvXUformat="$sPRIXU64"
21367 else
21368         if $test X"$ivsize" = X"$longsize"; then
21369                 ivdformat='"ld"'
21370                 uvuformat='"lu"'
21371                 uvoformat='"lo"'
21372                 uvxformat='"lx"'
21373                 uvXUformat='"lX"'
21374         else
21375                 if $test X"$ivsize" = X"$intsize"; then
21376                         ivdformat='"d"'
21377                         uvuformat='"u"'
21378                         uvoformat='"o"'
21379                         uvxformat='"x"'
21380                         uvXUformat='"X"'
21381                 else
21382                         : far out
21383                         if $test X"$ivsize" = X"$shortsize"; then
21384                                 ivdformat='"hd"'
21385                                 uvuformat='"hu"'
21386                                 uvoformat='"ho"'
21387                                 uvxformat='"hx"'
21388                                 uvXUformat='"hX"'
21389                         fi
21390                 fi
21391         fi
21392 fi
21393
21394 if $test X"$usequadmath" = X"$define"; then
21395     nveformat='"Qe"'
21396     nvfformat='"Qf"'
21397     nvgformat='"Qg"'
21398     nvEUformat='"QE"'
21399     nvFUformat='"QF"'
21400     nvGUformat='"QG"'
21401 else
21402     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21403         nveformat="$sPRIeldbl"
21404         nvfformat="$sPRIfldbl"
21405         nvgformat="$sPRIgldbl"
21406         nvEUformat="$sPRIEUldbl"
21407         nvFUformat="$sPRIFUldbl"
21408         nvGUformat="$sPRIGUldbl"
21409     else
21410         nveformat='"e"'
21411         nvfformat='"f"'
21412         nvgformat='"g"'
21413         nvEUformat='"E"'
21414         nvFUformat='"F"'
21415         nvGUformat='"G"'
21416     fi
21417 fi
21418
21419 case "$ivdformat" in
21420 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21421     exit 1
21422     ;;
21423 esac
21424
21425 : Check format string for GID
21426
21427 echo " "
21428 $echo "Checking the format string to be used for gids..." >&4
21429
21430 case "$gidsign" in
21431 -1)     if $test X"$gidsize" = X"$ivsize"; then
21432                 gidformat="$ivdformat"
21433         else
21434                 if $test X"$gidsize" = X"$longsize"; then
21435                         gidformat='"ld"'
21436                 else
21437                         if $test X"$gidsize" = X"$intsize"; then
21438                                 gidformat='"d"'
21439                         else
21440                                 if $test X"$gidsize" = X"$shortsize"; then
21441                                         gidformat='"hd"'
21442                                 fi
21443                         fi
21444                 fi
21445         fi
21446         ;;
21447 *)      if $test X"$gidsize" = X"$uvsize"; then
21448                 gidformat="$uvuformat"
21449         else
21450                 if $test X"$gidsize" = X"$longsize"; then
21451                         gidformat='"lu"'
21452                 else
21453                         if $test X"$gidsize" = X"$intsize"; then
21454                                 gidformat='"u"'
21455                         else
21456                                 if $test X"$gidsize" = X"$shortsize"; then
21457                                         gidformat='"hu"'
21458                                 fi
21459                         fi
21460                 fi
21461         fi
21462         ;;
21463 esac
21464
21465 : see if getgroups exists
21466 set getgroups d_getgrps
21467 eval $inlibc
21468
21469 : see if setgroups exists
21470 set setgroups d_setgrps
21471 eval $inlibc
21472
21473 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21474 echo " "
21475 case "$d_getgrps$d_setgrps" in
21476 *define*)
21477         case "$groupstype" in
21478         '') dflt="$gidtype" ;;
21479         *)  dflt="$groupstype" ;;
21480         esac
21481         $cat <<EOM
21482 What type of pointer is the second argument to getgroups() and setgroups()?
21483 Usually this is the same as group ids, $gidtype, but not always.
21484
21485 EOM
21486         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21487         . ./myread
21488         groupstype="$ans"
21489         ;;
21490 *)  groupstype="$gidtype";;
21491 esac
21492
21493 : check whether make sets MAKE
21494 echo " "
21495 echo "Checking if your $make program sets \$(MAKE)..." >&4
21496 case "$make_set_make" in
21497 '')
21498         $sed 's/^X //' > testmake.mak << 'EOF'
21499 Xall:
21500 X       @echo 'maketemp="$(MAKE)"'
21501 EOF
21502         case "`$make -f testmake.mak 2>/dev/null`" in
21503         *maketemp=*) make_set_make='#' ;;
21504         *)      make_set_make="MAKE=$make" ;;
21505         esac
21506         $rm -f testmake.mak
21507         ;;
21508 esac
21509 case "$make_set_make" in
21510 '#') echo "Yup, it does.";;
21511 *) echo "Nope, it doesn't.";;
21512 esac
21513
21514 : see what type is used for mode_t
21515 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21516 set mode_t modetype int stdio.h sys/types.h
21517 eval $typedef_ask
21518
21519 : see if we need va_copy
21520 echo " "
21521 case "$i_stdarg" in
21522 "$define")
21523         $cat >try.c <<EOCP
21524 #include <stdarg.h>
21525 #include <stdio.h>
21526 #$i_stdlib I_STDLIB
21527 #ifdef I_STDLIB
21528 #include <stdlib.h>
21529 #endif
21530 #include <signal.h>
21531
21532 int
21533 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21534 {
21535   return vfprintf(f, fmt, *valp);
21536 }
21537
21538 int
21539 myvfprintf(FILE *f, const  char *fmt, va_list val)
21540 {
21541   return ivfprintf(f, fmt, &val);
21542 }
21543
21544 int
21545 myprintf(char *fmt, ...)
21546 {
21547   va_list val;
21548   va_start(val, fmt);
21549   return myvfprintf(stdout, fmt, val);
21550 }
21551
21552 int
21553 main(int ac, char **av)
21554 {
21555   signal(SIGSEGV, exit);
21556
21557   myprintf("%s%cs all right, then\n", "that", '\'');
21558   exit(0);
21559 }
21560 EOCP
21561         set try
21562         if eval $compile && $run ./try 2>&1 >/dev/null; then
21563                 case "`$run ./try`" in
21564                 "that's all right, then")
21565                         okay=yes
21566                         ;;
21567                 esac
21568         fi
21569         case "$okay" in
21570         yes)    echo "It seems that you don't need va_copy()." >&4
21571                 need_va_copy="$undef"
21572                 ;;
21573         *)      echo "It seems that va_copy() or similar will be needed." >&4
21574                 need_va_copy="$define"
21575                 ;;
21576         esac
21577         $rm_try
21578         ;;
21579 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21580         need_va_copy="$undef"
21581         ;;
21582 esac
21583
21584 : see what type is used for size_t
21585 rp="What is the type used for the length parameter for string functions?"
21586 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21587 eval $typedef_ask
21588
21589 : check for type of arguments to gethostbyaddr.
21590 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21591         case "$d_gethbyaddr" in
21592         $define)
21593                 $cat <<EOM
21594
21595 Checking to see what type of arguments are accepted by gethostbyaddr().
21596 EOM
21597                 hdrs="$define sys/types.h
21598                         $d_socket sys/socket.h
21599                         $i_niin netinet/in.h
21600                         $i_netdb netdb.h
21601                         $i_unistd unistd.h"
21602                 : The first arg can 'char *' or 'void *'
21603                 : The second arg is some of integral type
21604                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21605                         for yyy in size_t long int; do
21606                                 case "$netdb_host_type" in
21607                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21608                                         if ./protochk "$try" $hdrs; then
21609                                                 echo "Your system accepts $xxx for the first arg."
21610                                                 echo "...and $yyy for the second arg."
21611                                                 netdb_host_type="$xxx"
21612                                                 netdb_hlen_type="$yyy"
21613                                         fi
21614                                         ;;
21615                                 esac
21616                         done
21617                 done
21618                 : In case none of those worked, prompt the user.
21619                 case "$netdb_host_type" in
21620                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21621                         dflt='char *'
21622                         . ./myread
21623                         netdb_host_type=$ans
21624                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21625                         dflt="$sizetype"
21626                         . ./myread
21627                         netdb_hlen_type=$ans
21628                         ;;
21629                 esac
21630                 ;;
21631         *)      : no gethostbyaddr, so pick harmless defaults
21632                 netdb_host_type='char *'
21633                 netdb_hlen_type="$sizetype"
21634                 ;;
21635         esac
21636         # Remove the "const" if needed. -- but then we'll have a
21637         # prototype clash!
21638         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21639 fi
21640
21641 : check for type of argument to gethostbyname.
21642 if test "X$netdb_name_type" = X ; then
21643         case "$d_gethbyname" in
21644         $define)
21645                 $cat <<EOM
21646
21647 Checking to see what type of argument is accepted by gethostbyname().
21648 EOM
21649                 hdrs="$define sys/types.h
21650                         $d_socket sys/socket.h
21651                         $i_niin netinet/in.h
21652                         $i_netdb netdb.h
21653                         $i_unistd unistd.h"
21654                 for xxx in "const char *" "char *"; do
21655                         case "$netdb_name_type" in
21656                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21657                                 if ./protochk "$try" $hdrs; then
21658                                         echo "Your system accepts $xxx."
21659                                         netdb_name_type="$xxx"
21660                                 fi
21661                                 ;;
21662                         esac
21663                 done
21664                 : In case none of those worked, prompt the user.
21665                 case "$netdb_name_type" in
21666                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21667                         dflt='char *'
21668                         . ./myread
21669                         netdb_name_type=$ans
21670                         ;;
21671                 esac
21672                 ;;
21673         *)      : no gethostbyname, so pick harmless default
21674                 netdb_name_type='char *'
21675                 ;;
21676         esac
21677 fi
21678
21679 : check for type of 1st argument to getnetbyaddr.
21680 if test "X$netdb_net_type" = X ; then
21681         case "$d_getnbyaddr" in
21682         $define)
21683                 $cat <<EOM
21684
21685 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21686 EOM
21687                 hdrs="$define sys/types.h
21688                         $d_socket sys/socket.h
21689                         $i_niin netinet/in.h
21690                         $i_netdb netdb.h
21691                         $i_unistd unistd.h"
21692                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21693                         case "$netdb_net_type" in
21694                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21695                                 if ./protochk "$try" $hdrs; then
21696                                         echo "Your system accepts $xxx."
21697                                         netdb_net_type="$xxx"
21698                                 fi
21699                                 ;;
21700                         esac
21701                 done
21702                 : In case none of those worked, prompt the user.
21703                 case "$netdb_net_type" in
21704                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21705                         dflt='long'
21706                         . ./myread
21707                         netdb_net_type=$ans
21708                         ;;
21709                 esac
21710                 ;;
21711         *)      : no getnetbyaddr, so pick harmless default
21712                 netdb_net_type='long'
21713                 ;;
21714         esac
21715 fi
21716 : locate the preferred pager for this system
21717 fn=f/
21718 case "$pager" in
21719 '')
21720         dflt=''
21721         case "$pg" in
21722         /*) dflt=$pg;;
21723         [a-zA-Z]:/*) dflt=$pg;;
21724         esac
21725         case "$more" in
21726         /*) dflt=$more;;
21727         [a-zA-Z]:/*) dflt=$more;;
21728         esac
21729         case "$less" in
21730         /*) dflt=$less;;
21731         [a-zA-Z]:/*) dflt=$less;;
21732         esac
21733         case "$dflt" in
21734         '') dflt=/usr/ucb/more;;
21735         esac
21736         ;;
21737 *)      dflt="$pager"
21738         ;;
21739 esac
21740 fn="f/($dflt)"
21741 echo " "
21742 rp='What pager is used on your system?'
21743 . ./getfile
21744 pager="$ans"
21745
21746 : see what type pids are declared as in the kernel
21747 rp="What is the type of process ids on this system?"
21748 set pid_t pidtype int stdio.h sys/types.h
21749 eval $typedef_ask
21750
21751 : see if ar generates random libraries by itself
21752 echo " "
21753 echo "Checking how to generate random libraries on your machine..." >&4
21754 echo 'int bar1() { return bar2(); }' > bar1.c
21755 echo 'int bar2() { return 2; }' > bar2.c
21756 $cat > foo.c <<EOP
21757 #$i_stdlib I_STDLIB
21758 #ifdef I_STDLIB
21759 #include <stdlib.h>
21760 #endif
21761 int main() { printf("%d\n", bar1()); exit(0); }
21762 EOP
21763 $cc $ccflags -c bar1.c >/dev/null 2>&1
21764 $cc $ccflags -c bar2.c >/dev/null 2>&1
21765 $cc $ccflags -c foo.c >/dev/null 2>&1
21766 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21767 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21768         $run ./foobar >/dev/null 2>&1; then
21769         echo "$ar appears to generate random libraries itself."
21770         orderlib=false
21771         if [ "X$ranlib" = "X" ]; then
21772             ranlib=":"
21773         fi
21774 elif $ar s bar$_a >/dev/null 2>&1 &&
21775         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21776         $run ./foobar >/dev/null 2>&1; then
21777                 echo "a table of contents needs to be added with '$ar s'."
21778                 orderlib=false
21779                 ranlib="$ar s"
21780 elif $ar ts bar$_a >/dev/null 2>&1 &&
21781         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21782         $run ./foobar >/dev/null 2>&1; then
21783                 echo "a table of contents needs to be added with '$ar ts'."
21784                 orderlib=false
21785                 ranlib="$ar ts"
21786 else
21787         case "$ranlib" in
21788         :) ranlib='';;
21789         '')
21790                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21791                 $test -f $ranlib || ranlib=''
21792                 ;;
21793         esac
21794         if $test -n "$ranlib"; then
21795                 echo "your system has '$ranlib'; we'll use that."
21796                 orderlib=false
21797         else
21798                 echo "your system doesn't seem to support random libraries"
21799                 echo "so we'll use lorder and tsort to order the libraries."
21800                 orderlib=true
21801                 ranlib=":"
21802         fi
21803 fi
21804 $rm -f foo* bar*
21805
21806 : see if this is a values.h system
21807 set values.h i_values
21808 eval $inhdr
21809
21810 : Check the max offset that gmtime and localtime accept
21811 echo "Checking max offsets that gmtime () accepts"
21812
21813 case $i_values in
21814     define) yyy="#include <values.h>" ;;
21815     *)      yyy="" ;;
21816     esac
21817
21818 case "$sGMTIME_min/$sGMTIME_max" in
21819     0/0|/)
21820         $cat >try.c <<EOCP
21821 #include <sys/types.h>
21822 #include <stdio.h>
21823 #include <time.h>
21824 $yyy
21825
21826 int i;
21827 struct tm *tmp;
21828 time_t pt;
21829
21830 void gm_check (time_t t, int min_year, int max_year)
21831 {
21832     tmp = gmtime (&t);
21833     if ( tmp == NULL ||
21834         /* Check tm_year overflow */
21835          tmp->tm_year < min_year || tmp->tm_year > max_year)
21836         tmp = NULL;
21837     else
21838         pt = t;
21839     } /* gm_check */
21840
21841 int check_max ()
21842 {
21843     tmp = NULL;
21844     pt  = 0;
21845 #ifdef MAXLONG
21846     gm_check (MAXLONG, 69, 0x7fffffff);
21847 #endif
21848     if (tmp == NULL || tmp->tm_year < 0) {
21849         for (i = 63; i >= 0; i--) {
21850             time_t x = pt | ((time_t)1 << i);
21851             if (x < 0 || x < pt) continue;
21852             gm_check (x, 69, 0x7fffffff);
21853             }
21854         }
21855     printf ("sGMTIME_max=%ld\n", pt);
21856     return (0);
21857     } /* check_max */
21858
21859 int check_min ()
21860 {
21861     tmp = NULL;
21862     pt  = 0;
21863 #ifdef MINLONG
21864     gm_check (MINLONG, -1900, 70);
21865 #endif
21866     if (tmp == NULL) {
21867         for (i = 36; i >= 0; i--) {
21868             time_t x = pt - ((time_t)1 << i);
21869             if (x > 0) continue;
21870             gm_check (x, -1900, 70);
21871             }
21872         }
21873     printf ("sGMTIME_min=%ld\n", pt);
21874     return (0);
21875     } /* check_min */
21876
21877 int main (int argc, char *argv[])
21878 {
21879     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21880     check_max ();
21881     check_min ();
21882     return (0);
21883     } /* main */
21884 EOCP
21885         set try
21886         if eval $compile; then
21887             eval `$run ./try 2>/dev/null`
21888         else
21889             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21890             fi
21891         $rm_try
21892         ;;
21893     esac
21894
21895 echo "Checking max offsets that localtime () accepts"
21896
21897 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21898     0/0|/)
21899         $cat >try.c <<EOCP
21900 #include <sys/types.h>
21901 #include <stdio.h>
21902 #include <time.h>
21903 $yyy
21904
21905 int i;
21906 struct tm *tmp;
21907 time_t pt;
21908
21909 void local_check (time_t t, int min_year, int max_year)
21910 {
21911     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21912         tmp = NULL;
21913     else
21914         tmp = localtime (&t);
21915     if ( tmp == NULL ||
21916         /* Check tm_year overflow */
21917          tmp->tm_year < min_year || tmp->tm_year > max_year)
21918         tmp = NULL;
21919     else
21920         pt = t;
21921     } /* local_check */
21922
21923 int check_max ()
21924 {
21925     tmp = NULL;
21926     pt  = 0;
21927 #ifdef MAXLONG
21928     local_check (MAXLONG, 69, 0x7fffffff);
21929 #endif
21930     if (tmp == NULL || tmp->tm_year < 0) {
21931         for (i = 63; i >= 0; i--) {
21932             time_t x = pt | ((time_t)1 << i);
21933             if (x < 0 || x < pt) continue;
21934             local_check (x, 69, 0x7fffffff);
21935             }
21936         }
21937     printf ("sLOCALTIME_max=%ld\n", pt);
21938     return (0);
21939    } /* check_max */
21940
21941 int check_min ()
21942 {
21943     tmp = NULL;
21944     pt  = 0;
21945 #ifdef MINLONG
21946     local_check (MINLONG, -1900, 70);
21947 #endif
21948     if (tmp == NULL) {
21949         for (i = 36; i >= 0; i--) {
21950             time_t x = pt - ((time_t)1 << i);
21951             if (x > 0) continue;
21952             local_check (x, -1900, 70);
21953             }
21954         }
21955     printf ("sLOCALTIME_min=%ld\n", pt);
21956     return (0);
21957     } /* check_min */
21958
21959 int main (int argc, char *argv[])
21960 {
21961     check_max ();
21962     check_min ();
21963     return (0);
21964     } /* main */
21965 EOCP
21966         set try
21967         if eval $compile; then
21968             eval `$run ./try 2>/dev/null`
21969         else
21970             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21971             fi
21972         $rm_try
21973         ;;
21974     esac
21975
21976 : check for type of arguments to select.
21977 case "$selecttype" in
21978 '') case "$d_select" in
21979         $define)
21980                 echo " "
21981                 $cat <<EOM
21982 Checking to see what type of arguments are accepted by select().
21983 EOM
21984                 hdrs="$define sys/types.h
21985                         $i_systime sys/time.h
21986                         $i_sysselct sys/select.h
21987                         $d_socket sys/socket.h"
21988                 : The first arg can be int, unsigned, or size_t
21989                 : The last arg may or may not be 'const'
21990                 val=''
21991                 : void pointer has been seen but using that
21992                 : breaks the selectminbits test
21993                 for xxx in 'fd_set *' 'int *'; do
21994                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21995                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21996                                         case "$val" in
21997                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21998                                                 if ./protochk "$try" $hdrs; then
21999                                                         echo "Your system accepts $xxx."
22000                                                         val="$xxx"
22001                                                 fi
22002                                                 ;;
22003                                         esac
22004                                 done
22005                         done
22006                 done
22007                 case "$val" in
22008                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22009                         case "$d_fd_set" in
22010                                 $define) dflt="fd_set *" ;;
22011                                 *)              dflt="int *" ;;
22012                         esac
22013                         . ./myread
22014                         val=$ans
22015                         ;;
22016                 esac
22017                 selecttype="$val"
22018                 ;;
22019         *)      : no select, so pick a harmless default
22020                 selecttype='int *'
22021                 ;;
22022         esac
22023         ;;
22024 esac
22025
22026 : check for the select 'width'
22027 case "$selectminbits" in
22028 '') safebits=`expr $ptrsize \* 8`
22029     case "$d_select" in
22030         $define)
22031                 $cat <<EOM
22032
22033 Checking to see on how many bits at a time your select() operates...
22034 EOM
22035                 $cat >try.c <<EOCP
22036 #include <sys/types.h>
22037 #$i_time I_TIME
22038 #$i_systime I_SYS_TIME
22039 #$i_systimek I_SYS_TIME_KERNEL
22040 #ifdef I_TIME
22041 #   include <time.h>
22042 #endif
22043 #ifdef I_SYS_TIME
22044 #   ifdef I_SYS_TIME_KERNEL
22045 #       define KERNEL
22046 #   endif
22047 #   include <sys/time.h>
22048 #   ifdef I_SYS_TIME_KERNEL
22049 #       undef KERNEL
22050 #   endif
22051 #endif
22052 #$i_sysselct I_SYS_SELECT
22053 #ifdef I_SYS_SELECT
22054 #include <sys/select.h>
22055 #endif
22056 #$d_socket HAS_SOCKET
22057 #ifdef HAS_SOCKET
22058 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22059 #endif
22060 #include <stdio.h>
22061 #$i_stdlib I_STDLIB
22062 #ifdef I_STDLIB
22063 #include <stdlib.h>
22064 #endif
22065 $selecttype b;
22066 #define S sizeof(*(b))
22067 #define MINBITS 64
22068 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22069 #define NBITS  (NBYTES * 8)
22070 int main() {
22071     char *s = (char *)malloc(NBYTES);
22072     struct timeval t;
22073     int i;
22074     FILE* fp;
22075     int fd;
22076
22077     if (!s)
22078         exit(1);
22079     fclose(stdin);
22080     fp = fopen("try.c", "r");
22081     if (fp == 0)
22082       exit(2);
22083     fd = fileno(fp);
22084     if (fd < 0)
22085       exit(3);
22086     b = ($selecttype)s;
22087     for (i = 0; i < NBITS; i++)
22088         FD_SET(i, b);
22089     t.tv_sec  = 0;
22090     t.tv_usec = 0;
22091     select(fd + 1, b, 0, 0, &t);
22092     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22093     free(s);
22094     printf("%d\n", i + 1);
22095     return 0;
22096 }
22097 EOCP
22098                 set try
22099                 if eval $compile_ok; then
22100                         selectminbits=`$run ./try 2>/dev/null`
22101                         case "$selectminbits" in
22102                         '')     cat >&4 <<EOM
22103 Cannot figure out on how many bits at a time your select() operates.
22104 I'll play safe and guess it is $safebits bits.
22105 EOM
22106                                 selectminbits=$safebits
22107                                 bits="$safebits bits"
22108                                 ;;
22109                         1)      bits="1 bit" ;;
22110                         *)      bits="$selectminbits bits" ;;
22111                         esac
22112                         echo "Your select() operates on $bits at a time." >&4
22113                 else
22114                         rp='What is the minimum number of bits your select() operates on?'
22115                         case "$byteorder" in
22116                         12345678)       dflt=64 ;;
22117                         1234)           dflt=32 ;;
22118                         *)              dflt=1  ;;
22119                         esac
22120                         . ./myread
22121                         val=$ans
22122                         selectminbits="$val"
22123                 fi
22124                 $rm_try
22125                 ;;
22126         *)      : no select, so pick a harmless default
22127                 selectminbits=$safebits
22128                 ;;
22129         esac
22130         ;;
22131 esac
22132
22133 : Trace out the files included by signal.h, then look for SIGxxx names.
22134 case "$sig_num_init" in
22135 '')
22136 if [ "X$fieldn" = X ]; then
22137         : Just make some guesses.  We check them later.
22138         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22139 else
22140         xxx=`echo '#include <signal.h>' |
22141         $cppstdin $cppminus $cppflags 2>/dev/null |
22142         $grep '^[       ]*#.*include' |
22143         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22144                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22145 fi
22146 xxxfiles=''
22147 for xx in $xxx /dev/null ; do
22148         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22149 done
22150 case "$xxxfiles" in
22151 '')     xxxfiles=`./findhdr signal.h` ;;
22152 esac
22153 xxx=`awk '
22154 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22155         print substr($2, 4, 20)
22156 }
22157 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22158         print substr($3, 4, 20)
22159 }' $xxxfiles`
22160 : Append some common names just in case the awk scan failed.
22161 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22162 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22163 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22164 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22165 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22166
22167 : generate a few handy files for later
22168 $cat > signal.c <<EOCP
22169 #include <sys/types.h>
22170 #include <signal.h>
22171 #$i_stdlib I_STDLIB
22172 #ifdef I_STDLIB
22173 #include <stdlib.h>
22174 #endif
22175 #include <stdio.h>
22176 int main() {
22177
22178 /* Strange style to avoid deeply-nested #if/#else/#endif */
22179 #ifndef NSIG
22180 #  ifdef _NSIG
22181 #    define NSIG (_NSIG)
22182 #  endif
22183 #endif
22184
22185 #ifndef NSIG
22186 #  ifdef SIGMAX
22187 #    define NSIG (SIGMAX+1)
22188 #  endif
22189 #endif
22190
22191 #ifndef NSIG
22192 #  ifdef SIG_MAX
22193 #    define NSIG (SIG_MAX+1)
22194 #  endif
22195 #endif
22196
22197 #ifndef NSIG
22198 #  ifdef _SIG_MAX
22199 #    define NSIG (_SIG_MAX+1)
22200 #  endif
22201 #endif
22202
22203 #ifndef NSIG
22204 #  ifdef MAXSIG
22205 #    define NSIG (MAXSIG+1)
22206 #  endif
22207 #endif
22208
22209 #ifndef NSIG
22210 #  ifdef MAX_SIG
22211 #    define NSIG (MAX_SIG+1)
22212 #  endif
22213 #endif
22214
22215 #ifndef NSIG
22216 #  ifdef SIGARRAYSIZE
22217 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22218 #  endif
22219 #endif
22220
22221 #ifndef NSIG
22222 #  ifdef _sys_nsig
22223 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22224 #  endif
22225 #endif
22226
22227 /* Default to some arbitrary number that's big enough to get most
22228    of the common signals.
22229 */
22230 #ifndef NSIG
22231 #    define NSIG 50
22232 #endif
22233
22234 printf("NSIG %d\n", NSIG);
22235
22236 #ifndef JUST_NSIG
22237
22238 EOCP
22239
22240 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22241 {
22242         printf "#ifdef SIG"; printf $1; printf "\n"
22243         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22244         printf $1; printf ");\n"
22245         printf "#endif\n"
22246 }
22247 END {
22248         printf "#endif /* JUST_NSIG */\n";
22249         printf "exit(0);\n}\n";
22250 }
22251 ' >>signal.c
22252 $cat >signal.awk <<'EOP'
22253 BEGIN { ndups = 0 }
22254 $1 ~ /^NSIG$/ { nsig = $2 }
22255 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22256     if ($2 > maxsig) { maxsig = $2 }
22257     if (sig_name[$2]) {
22258         dup_name[ndups] = $1
22259         dup_num[ndups] = $2
22260         ndups++
22261     }
22262     else {
22263         sig_name[$2] = $1
22264         sig_num[$2] = $2
22265     }
22266 }
22267 END {
22268     if (nsig == 0) {
22269         nsig = maxsig + 1
22270     }
22271     printf("NSIG %d\n", nsig);
22272     for (n = 1; n < nsig; n++) {
22273         if (sig_name[n]) {
22274             printf("%s %d\n", sig_name[n], sig_num[n])
22275         }
22276         else {
22277             printf("NUM%d %d\n", n, n)
22278         }
22279     }
22280     for (n = 0; n < ndups; n++) {
22281         printf("%s %d\n", dup_name[n], dup_num[n])
22282     }
22283 }
22284 EOP
22285 $cat >signal_cmd <<EOS
22286 $startsh
22287 if $test -s signal.lst; then
22288     echo "Using your existing signal.lst file"
22289         exit 0
22290 fi
22291 xxx="$xxx"
22292 EOS
22293 $cat >>signal_cmd <<'EOS'
22294
22295 set signal
22296 if eval $compile_ok; then
22297         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22298                 $uniq | $awk -f signal.awk >signal.lst
22299 else
22300         echo "(I can't seem be able to compile the whole test program)" >&4
22301         echo "(I'll try it in little pieces.)" >&4
22302         set signal -DJUST_NSIG
22303         if eval $compile_ok; then
22304                 $run ./signal$_exe > signal.nsg
22305                 $cat signal.nsg
22306         else
22307                 echo "I can't seem to figure out how many signals you have." >&4
22308                 echo "Guessing 50." >&4
22309                 echo 'NSIG 50' > signal.nsg
22310         fi
22311         : Now look at all the signal names, one at a time.
22312         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22313                 $cat > signal.c <<EOCP
22314 #include <sys/types.h>
22315 #include <signal.h>
22316 #include <stdio.h>
22317 int main() {
22318 printf("$xx %d\n", SIG${xx});
22319 return 0;
22320 }
22321 EOCP
22322                 set signal
22323                 if eval $compile; then
22324                         echo "SIG${xx} found."
22325                         $run ./signal$_exe  >> signal.ls1
22326                 else
22327                         echo "SIG${xx} NOT found."
22328                 fi
22329         done
22330         if $test -s signal.ls1; then
22331                 $cat signal.nsg signal.ls1 |
22332                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22333         fi
22334
22335 fi
22336 if $test -s signal.lst; then
22337         :
22338 else
22339         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22340         echo 'kill -l' >signal
22341         set X `csh -f <signal`
22342         $rm -f signal
22343         shift
22344         case $# in
22345         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22346         esac
22347         echo $@ | $tr ' ' $trnl | \
22348             $awk '{ printf "%s %d\n", $1, ++s; }
22349                   END { printf "NSIG %d\n", ++s }' >signal.lst
22350 fi
22351 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22352 EOS
22353 chmod a+x signal_cmd
22354 $eunicefix signal_cmd
22355
22356 : generate list of signal names
22357 echo " "
22358 case "$sig_name_init" in
22359 '') doinit=yes ;;
22360 *)  case "$sig_num_init" in
22361     ''|*,*) doinit=yes ;;
22362     esac ;;
22363 esac
22364 case "$doinit" in
22365 yes)
22366         echo "Generating a list of signal names and numbers..." >&4
22367         . ./signal_cmd
22368         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22369         sig_name=`$awk 'BEGIN { printf "ZERO " }
22370                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22371         sig_num=`$awk  'BEGIN { printf "0 " }
22372                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22373         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22374                              !/^NSIG/   { printf "\"%s\", ", $1 }
22375                              END        { printf "0\n" }' signal.lst`
22376         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22377                              !/^NSIG/   { printf "%d, ", $2}
22378                              END        { printf "0\n"}' signal.lst`
22379         ;;
22380 esac
22381 echo "The following $sig_count signals are available:"
22382 echo " "
22383 echo $sig_name | $awk \
22384 'BEGIN { linelen = 0 }
22385 {
22386         for (i = 1; i <= NF; i++) {
22387                 name = "SIG" $i " "
22388                 linelen = linelen + length(name)
22389                 if (linelen > 70) {
22390                         printf "\n"
22391                         linelen = length(name)
22392                 }
22393                 printf "%s", name
22394         }
22395         printf "\n"
22396 }'
22397 sig_size=`echo $sig_name | awk '{print NF}'`
22398 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22399 ;;
22400 esac
22401
22402 : Check size of size
22403 echo " "
22404 case "$sizetype" in
22405 *_t) zzz="$sizetype"    ;;
22406 *)   zzz="filesize"     ;;
22407 esac
22408 echo "Checking the size of $zzz..." >&4
22409 cat > try.c <<EOCP
22410 #include <sys/types.h>
22411 #include <stdio.h>
22412 #$i_stdlib I_STDLIB
22413 #ifdef I_STDLIB
22414 #include <stdlib.h>
22415 #endif
22416 int main() {
22417     printf("%d\n", (int)sizeof($sizetype));
22418     exit(0);
22419 }
22420 EOCP
22421 set try
22422 if eval $compile_ok; then
22423         yyy=`$run ./try`
22424         case "$yyy" in
22425         '')     sizesize=4
22426                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22427                 ;;
22428         *)      sizesize=$yyy
22429                 echo "Your $zzz size is $sizesize bytes."
22430                 ;;
22431         esac
22432 else
22433         sizesize=4
22434         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22435 fi
22436
22437
22438 : check for socklen_t
22439 echo " "
22440 echo "Checking to see if you have socklen_t..." >&4
22441 $cat >try.c <<EOCP
22442 #include <sys/types.h>
22443 #$d_socket HAS_SOCKET
22444 #ifdef HAS_SOCKET
22445 #include <sys/socket.h>
22446 #endif
22447 int main() { socklen_t x = 16; }
22448 EOCP
22449 set try
22450 if eval $compile; then
22451         val="$define"
22452         echo "You have socklen_t."
22453 else
22454         val="$undef"
22455         echo "You do not have socklen_t."
22456         case "$sizetype" in
22457         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22458         esac
22459 fi
22460 $rm_try
22461 set d_socklen_t
22462 eval $setvar
22463
22464 : see if this is a socks.h system
22465 set socks.h i_socks
22466 eval $inhdr
22467
22468 : check for type of the size argument to socket calls
22469 case "$d_socket" in
22470 "$define")
22471         $cat <<EOM
22472
22473 Checking to see what type is the last argument of accept().
22474 EOM
22475         yyy=''
22476         case "$d_socklen_t" in
22477         "$define") yyy="$yyy socklen_t"
22478         esac
22479         yyy="$yyy $sizetype int long unsigned"
22480         for xxx in $yyy; do
22481                 case "$socksizetype" in
22482                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22483                         case "$usesocks" in
22484                         "$define")
22485                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22486                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22487                                         socksizetype="$xxx"
22488                                 fi
22489                                 ;;
22490                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22491                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22492                                         socksizetype="$xxx"
22493                                 fi
22494                                 ;;
22495                         esac
22496                         ;;
22497                 esac
22498         done
22499 : In case none of those worked, prompt the user.
22500         case "$socksizetype" in
22501         '')     rp='What is the type for socket address structure sizes?'
22502                 dflt='int'
22503                 . ./myread
22504                 socksizetype=$ans
22505                 ;;
22506         esac
22507         ;;
22508 *)      : no sockets, so pick relatively harmless default
22509         socksizetype='int'
22510         ;;
22511 esac
22512
22513 : see what type is used for signed size_t
22514 set ssize_t ssizetype int stdio.h sys/types.h
22515 eval $typedef
22516 dflt="$ssizetype"
22517 $cat > try.c <<EOM
22518 #include <stdio.h>
22519 #$i_stdlib I_STDLIB
22520 #ifdef I_STDLIB
22521 #include <stdlib.h>
22522 #endif
22523 #include <sys/types.h>
22524 #define Size_t $sizetype
22525 #define SSize_t $dflt
22526 int main()
22527 {
22528         if (sizeof(Size_t) == sizeof(SSize_t))
22529                 printf("$dflt\n");
22530         else if (sizeof(Size_t) == sizeof(int))
22531                 printf("int\n");
22532         else
22533                 printf("long\n");
22534         exit(0);
22535 }
22536 EOM
22537 echo " "
22538 set try
22539 if eval $compile_ok && $run ./try > /dev/null; then
22540         ssizetype=`$run ./try`
22541         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22542 else
22543         $cat >&4 <<EOM
22544 Help! I can't compile and run the ssize_t test program: please enlighten me!
22545 (This is probably a misconfiguration in your system or libraries, and
22546 you really ought to fix it.  Still, I'll try anyway.)
22547
22548 I need a type that is the same size as $sizetype, but is guaranteed to
22549 be signed.  Common values are ssize_t, int and long.
22550
22551 EOM
22552         rp="What signed type is the same size as $sizetype?"
22553         . ./myread
22554         ssizetype="$ans"
22555 fi
22556 $rm_try
22557
22558 : Check the size of st_ino
22559 $echo " "
22560 $echo "Checking the size of st_ino..." >&4
22561 $cat > try.c <<EOCP
22562 #include <sys/stat.h>
22563 #include <stdio.h>
22564 #$i_stdlib I_STDLIB
22565 #ifdef I_STDLIB
22566 #include <stdlib.h>
22567 #endif
22568 int main() {
22569     struct stat st;
22570     printf("%d\n", (int)sizeof(st.st_ino));
22571     exit(0);
22572 }
22573 EOCP
22574 set try
22575 if eval $compile_ok; then
22576         val=`$run ./try`
22577         case "$val" in
22578         '')     st_ino_size=4
22579                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22580                 ;;
22581         *)      st_ino_size=$val
22582                 $echo "Your st_ino is $st_ino_size bytes long."
22583                 ;;
22584         esac
22585 else
22586         st_ino_size=4
22587         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22588 fi
22589 $rm_try
22590
22591 : Check if st_ino is signed
22592 $echo " "
22593 $echo "Checking the sign of st_ino..." >&4
22594 $cat > try.c <<EOCP
22595 #include <sys/stat.h>
22596 #include <stdio.h>
22597 int main() {
22598         struct stat foo;
22599         foo.st_ino = -1;
22600         if (foo.st_ino < 0)
22601                 printf("-1\n");
22602         else
22603                 printf("1\n");
22604 }
22605 EOCP
22606 set try
22607 if eval $compile; then
22608         val=`$run ./try`
22609         case "$val" in
22610         '')     st_ino_sign=1
22611                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22612                 ;;
22613         *)      st_ino_sign=$val
22614                 case "$st_ino_sign" in
22615                  1) $echo "Your st_ino is unsigned." ;;
22616                 -1) $echo "Your st_ino is signed."   ;;
22617                 esac
22618                 ;;
22619         esac
22620 else
22621         st_ino_sign=1
22622         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22623 fi
22624 $rm_try
22625
22626 : see what type of char stdio uses.
22627 echo " "
22628 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22629 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22630         echo "Your stdio uses unsigned chars." >&4
22631         stdchar="unsigned char"
22632 else
22633         echo "Your stdio uses signed chars." >&4
22634         stdchar="char"
22635 fi
22636 $rm -f stdioh
22637
22638 : see what type uids are declared as in the kernel
22639 echo " "
22640 echo "Looking for the type for user ids returned by getuid()."
22641 set uid_t uidtype xxx stdio.h sys/types.h
22642 eval $typedef
22643 case "$uidtype" in
22644 xxx)
22645         xxx=`./findhdr sys/user.h`
22646         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22647         case $1 in
22648         unsigned) dflt="$1 $2" ;;
22649         *) dflt="$1" ;;
22650         esac
22651         ;;
22652 *) dflt="$uidtype";;
22653 esac
22654 case "$uidtype" in
22655 uid_t)  echo "uid_t found." ;;
22656 *)      rp="What is the type for user ids returned by getuid()?"
22657         . ./myread
22658         uidtype="$ans"
22659         ;;
22660 esac
22661
22662 : Check size of UID
22663 echo " "
22664 case "$uidtype" in
22665 *_t) zzz="$uidtype"     ;;
22666 *)   zzz="uid"          ;;
22667 esac
22668 echo "Checking the size of $zzz..." >&4
22669 cat > try.c <<EOCP
22670 #include <sys/types.h>
22671 #include <stdio.h>
22672 #$i_stdlib I_STDLIB
22673 #ifdef I_STDLIB
22674 #include <stdlib.h>
22675 #endif
22676 int main() {
22677     printf("%d\n", (int)sizeof($uidtype));
22678     exit(0);
22679 }
22680 EOCP
22681 set try
22682 if eval $compile_ok; then
22683         yyy=`$run ./try`
22684         case "$yyy" in
22685         '')     uidsize=4
22686                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22687                 ;;
22688         *)      uidsize=$yyy
22689                 echo "Your $zzz is $uidsize bytes long."
22690                 ;;
22691         esac
22692 else
22693         uidsize=4
22694         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22695 fi
22696
22697 : Check if UID is signed
22698 echo " "
22699 case "$uidtype" in
22700 *_t) zzz="$uidtype"     ;;
22701 *)   zzz="uid"          ;;
22702 esac
22703 echo "Checking the sign of $zzz..." >&4
22704 cat > try.c <<EOCP
22705 #include <sys/types.h>
22706 #include <stdio.h>
22707 int main() {
22708         $uidtype foo = -1;
22709         if (foo < 0)
22710                 printf("-1\n");
22711         else
22712                 printf("1\n");
22713 }
22714 EOCP
22715 set try
22716 if eval $compile; then
22717         yyy=`$run ./try`
22718         case "$yyy" in
22719         '')     uidsign=1
22720                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22721                 ;;
22722         *)      uidsign=$yyy
22723                 case "$uidsign" in
22724                  1) echo "Your $zzz is unsigned." ;;
22725                 -1) echo "Your $zzz is signed."   ;;
22726                 esac
22727                 ;;
22728         esac
22729 else
22730         uidsign=1
22731         echo "(I can't compile the test program--guessing unsigned.)" >&4
22732 fi
22733
22734
22735 : Check format string for UID
22736 echo " "
22737 $echo "Checking the format string to be used for uids..." >&4
22738
22739 case "$uidsign" in
22740 -1)     if $test X"$uidsize" = X"$ivsize"; then
22741                 uidformat="$ivdformat"
22742         else
22743                 if $test X"$uidsize" = X"$longsize"; then
22744                         uidformat='"ld"'
22745                 else
22746                         if $test X"$uidsize" = X"$intsize"; then
22747                                 uidformat='"d"'
22748                         else
22749                                 if $test X"$uidsize" = X"$shortsize"; then
22750                                         uidformat='"hd"'
22751                                 fi
22752                         fi
22753                 fi
22754         fi
22755         ;;
22756 *)      if $test X"$uidsize" = X"$uvsize"; then
22757                 uidformat="$uvuformat"
22758         else
22759                 if $test X"$uidsize" = X"$longsize"; then
22760                         uidformat='"lu"'
22761                 else
22762                         if $test X"$uidsize" = X"$intsize"; then
22763                                 uidformat='"u"'
22764                         else
22765                                 if $test X"$uidsize" = X"$shortsize"; then
22766                                         uidformat='"hu"'
22767                                 fi
22768                         fi
22769                 fi
22770         fi
22771         ;;
22772 esac
22773
22774 : see what siginfo fields we have
22775 case "$d_sigaction" in
22776 "$define")
22777         echo "Checking if your siginfo_t has si_errno field...">&4
22778         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
22779         eval $hasfield_t;
22780
22781         echo "Checking if your siginfo_t has si_pid field...">&4
22782         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
22783         eval $hasfield_t;
22784
22785         echo "Checking if your siginfo_t has si_uid field...">&4
22786         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
22787         eval $hasfield_t;
22788
22789         echo "Checking if your siginfo_t has si_addr field...">&4
22790         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
22791         eval $hasfield_t;
22792
22793         echo "Checking if your siginfo_t has si_status field...">&4
22794         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
22795         eval $hasfield_t;
22796
22797         echo "Checking if your siginfo_t has si_band field...">&4
22798         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
22799         eval $hasfield_t;
22800
22801         echo "Checking if your siginfo_t has si_value field...">&4
22802         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
22803         eval $hasfield_t;
22804
22805         ;;
22806 *)
22807         d_siginfo_si_errno="$undef"
22808         d_siginfo_si_pid="$undef"
22809         d_siginfo_si_uid="$undef"
22810         d_siginfo_si_addr="$undef"
22811         d_siginfo_si_status="$undef"
22812         d_siginfo_si_band="$undef"
22813         d_siginfo_si_value="$undef"
22814         ;;
22815 esac
22816
22817 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22818 echo " "
22819 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22820 $cat >try.c <<'EOM'
22821 /* Intentionally a long probe as I'd like to sanity check that the exact
22822    approach is going to work, as thinking it will work, but only having it
22823    part working at runtime is worse than not having it.  */
22824
22825 #include <sys/types.h>
22826 #include <sys/sysctl.h>
22827 #include <sys/param.h>
22828 #include <stdio.h>
22829 #include <string.h>
22830 #include <stdlib.h>
22831 #include <unistd.h>
22832
22833 int
22834 main(int argc, char **argv) {
22835     char *buffer;
22836     char *argv_leaf = strrchr(argv[0], '/');
22837     char *buffer_leaf;
22838     size_t size = 0;
22839     int mib[4];
22840
22841     mib[0] = CTL_KERN;
22842     mib[1] = KERN_PROC;
22843     mib[2] = KERN_PROC_PATHNAME;
22844     mib[3] = -1;
22845
22846     if (!argv_leaf) {
22847         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22848         return 1;
22849     }
22850
22851     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22852         perror("sysctl");
22853         return 2;
22854     }
22855
22856     if (size < strlen(argv_leaf) + 1) {
22857         fprintf(stderr, "size %lu is too short for a path\n",
22858                 (unsigned long) size);
22859         return 3;
22860     }
22861
22862     if (size > MAXPATHLEN * MAXPATHLEN) {
22863         fprintf(stderr, "size %lu is too long for a path\n",
22864                 (unsigned long) size);
22865         return 4;
22866     }
22867
22868     buffer = malloc(size);
22869     if (!buffer) {
22870         perror("malloc");
22871         return 5;
22872     }
22873
22874     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22875         perror("sysctl");
22876         return 6;
22877     }
22878
22879     if (strlen(buffer) + 1 != size) {
22880         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22881                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22882         return 7;
22883     }
22884
22885
22886     if (*buffer != '/') {
22887         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22888         return 8;
22889     }
22890
22891     if (strstr(buffer, "/./")) {
22892         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22893         return 9;
22894     }
22895
22896     if (strstr(buffer, "/../")) {
22897         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22898         return 10;
22899     }
22900
22901     buffer_leaf = strrchr(buffer, '/');
22902     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22903         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22904         return 11;
22905     }
22906
22907     free(buffer);
22908
22909     return 0;
22910 }
22911 EOM
22912
22913 val=$undef
22914 set try
22915 if eval $compile; then
22916         if $run ./try; then
22917                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22918                 val="$define"
22919         else
22920                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22921                 val="$undef"
22922         fi
22923 else
22924         echo "I'm unable to compile the test program." >&4
22925         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22926         val="$undef"
22927 fi
22928 $rm_try
22929 set usekernprocpathname
22930 eval $setvar
22931
22932 : Determine if we can use _NSGetExecutablePath to find executing program
22933 echo " "
22934 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22935 $cat >try.c <<'EOM'
22936 /* Intentionally a long probe as I'd like to sanity check that the exact
22937    approach is going to work, as thinking it will work, but only having it
22938    part working at runtime is worse than not having it.  */
22939 #include <mach-o/dyld.h>
22940 #include <stdio.h>
22941 #include <stdlib.h>
22942 #include <sys/param.h>
22943 #include <string.h>
22944
22945 int
22946 main(int argc, char **argv) {
22947     char buf[1];
22948     uint32_t size = sizeof(buf);
22949     int result;
22950     char *buffer;
22951     char *tidied;
22952     char *argv_leaf = strrchr(argv[0], '/');
22953     char *tidied_leaf;
22954
22955     if (!argv_leaf) {
22956         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22957         return 1;
22958     }
22959
22960     _NSGetExecutablePath(buf, &size);
22961     if (size > MAXPATHLEN * MAXPATHLEN) {
22962         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22963                 (unsigned int) size);
22964         return 2;
22965     }
22966
22967     buffer = malloc(size);
22968     if (!buffer) {
22969         perror("malloc");
22970         return 3;
22971     }
22972
22973     result = _NSGetExecutablePath(buffer, &size);
22974     if (result != 0) {
22975         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22976                 result, (unsigned int) size);
22977         return 4;
22978     }
22979
22980     tidied = realpath(buffer, NULL);
22981     if (!tidied) {
22982         perror("realpath");
22983         return 5;
22984     }
22985
22986     free(buffer);
22987
22988     if (*tidied != '/') {
22989         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22990         return 6;
22991     }
22992
22993     if (strstr(tidied, "/./")) {
22994         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22995         return 7;
22996     }
22997
22998     if (strstr(tidied, "/../")) {
22999         fprintf(stderr, "Contains /../: '%s'\n", tidied);
23000         return 8;
23001     }
23002
23003     tidied_leaf = strrchr(tidied, '/');
23004     if (strcmp(tidied_leaf, argv_leaf) != 0) {
23005         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
23006         return 9;
23007     }
23008
23009     free(tidied);
23010
23011     return 0;
23012 }
23013 EOM
23014
23015 val=$undef
23016 set try
23017 if eval $compile; then
23018         if $run ./try; then
23019                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
23020                 val="$define"
23021         else
23022                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23023         fi
23024 else
23025         echo "I'm unable to compile the test program." >&4
23026         echo "I'll assume no _NSGetExecutablePath here." >&4
23027 fi
23028 $rm_try
23029 set usensgetexecutablepath
23030 eval $setvar
23031
23032 : Check if site customization support was requested
23033 case "$usesitecustomize" in
23034     $define|true|[Yy]*)
23035         usesitecustomize="$define"
23036         ;;
23037     *)
23038         usesitecustomize="$undef"
23039         ;;
23040     esac
23041
23042 : see if prototypes support variable argument declarations
23043 echo " "
23044 case "$prototype$i_stdarg" in
23045 $define$define)
23046         echo "It appears we'll be able to prototype varargs functions." >&4
23047         val="$define"
23048         ;;
23049 *)
23050         echo "Too bad... We won't be using prototyped varargs functions..." >&4
23051         val="$undef"
23052         ;;
23053 esac
23054 set vaproto
23055 eval $setvar
23056
23057 : determine compiler compiler
23058 case "$yacc" in
23059 '')
23060         dflt=yacc;;
23061 *)
23062         dflt="$yacc";;
23063 esac
23064 echo " "
23065 comp='yacc'
23066 if $test -f "$byacc$_exe"; then
23067         dflt="$byacc"
23068         comp="byacc or $comp"
23069 fi
23070 if $test -f "$bison$_exe"; then
23071         comp="$comp or bison -y"
23072 fi
23073 rp="Which compiler compiler ($comp) shall I use?"
23074 . ./myread
23075 yacc="$ans"
23076 case "$yacc" in
23077 *bis*)
23078         case "$yacc" in
23079         *-y*) ;;
23080         *)
23081                 yacc="$yacc -y"
23082                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23083                 ;;
23084         esac
23085         ;;
23086 esac
23087
23088 : see if this is a assert.h system
23089 set assert.h i_assert
23090 eval $inhdr
23091
23092 : see if this is a bfd.h system
23093 set bfd.h i_bfd
23094 eval $inhdr
23095
23096 : see if this is an execinfo.h system
23097 set execinfo.h i_execinfo
23098 eval $inhdr
23099
23100 : see if this is a fenv.h system
23101 set fenv.h i_fenv
23102 eval $inhdr
23103
23104 : see if this is a fp.h system
23105 set fp.h i_fp
23106 eval $inhdr
23107
23108 : see if this is a fp_class.h system
23109 set fp_class.h i_fp_class
23110 eval $inhdr
23111
23112 : see if gdbm.h is available
23113 set gdbm.h t_gdbm
23114 eval $inhdr
23115 case "$t_gdbm" in
23116 $define)
23117         : see if gdbm_open exists
23118         set gdbm_open d_gdbm_open
23119         eval $inlibc
23120         case "$d_gdbm_open" in
23121         $undef)
23122                 t_gdbm="$undef"
23123                 echo "We won't be including <gdbm.h>"
23124                 ;;
23125         esac
23126         ;;
23127 esac
23128 val="$t_gdbm"
23129 set i_gdbm
23130 eval $setvar
23131
23132 : see if this is a ieeefp.h system
23133 case "$i_ieeefp" in
23134 '' ) set ieeefp.h i_ieeefp
23135      eval $inhdr
23136      ;;
23137 esac
23138
23139 : see if this is a libutil.h system
23140 set libutil.h i_libutil
23141 eval $inhdr
23142
23143 : see if mach cthreads are available
23144 if test "X$usethreads" = "X$define"; then
23145         set mach/cthreads.h i_machcthr
23146         eval $inhdr
23147 else
23148         i_machcthr="$undef"
23149 fi
23150
23151 : see if this is a mntent.h system
23152 set mntent.h i_mntent
23153 eval $inhdr
23154
23155 : see if net/errno.h is available
23156 val=''
23157 set net/errno.h val
23158 eval $inhdr
23159
23160 : Unfortunately, it causes problems on some systems.  Arrgh.
23161 case "$val" in
23162 $define)
23163         cat > try.c <<'EOM'
23164 #include <stdio.h>
23165 #include <errno.h>
23166 #include <net/errno.h>
23167 int func()
23168 {
23169         return ENOTSOCK;
23170 }
23171 EOM
23172         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23173                 echo "We'll be including <net/errno.h>." >&4
23174         else
23175                 echo "We won't be including <net/errno.h>." >&4
23176                 val="$undef"
23177         fi
23178         $rm_try
23179         ;;
23180 esac
23181 set i_neterrno
23182 eval $setvar
23183
23184 : see if netinet/tcp.h is available
23185 set netinet/tcp.h i_netinettcp
23186 eval $inhdr
23187
23188 : see if this is a poll.h system
23189 set poll.h i_poll
23190 eval $inhdr
23191
23192 : see if this is a prot.h system
23193 set prot.h i_prot
23194 eval $inhdr
23195
23196 : Preprocessor symbols
23197 echo " "
23198 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23199 $cat <<'EOSH' > Cppsym.know
23200 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23201 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23202 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23203 arch_pwr ardent ARM ARM32 atarist att386 att3b
23204 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23205 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23206 byteorder byte_order
23207 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23208 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23209 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23210 ELF encore EPI EXTENSIONS
23211 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23212 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23213 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23214 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23215 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23216 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23217 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23218 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23219 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23220 ksr1
23221 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23222 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23223 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23224 luna88k Lynx
23225 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23226 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23227 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23228 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23229 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23230 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23231 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23232 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23233 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23234 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23235 ns32000 ns32016 ns32332 ns32k nsc32000
23236 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23237 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23238 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23239 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23240 QK_USER QNX
23241 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23242 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23243 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23244 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23245 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23246 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23247 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23248 SYSV4 SYSV5 sysV68 sysV88
23249 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23250 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23251 tower32_800 tower32_850 tss
23252 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23253 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23254 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23255 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23256 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23257 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23258 uxpm uxps
23259 vax venix VMESA vms
23260 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23261 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23262 z8000 zarch
23263 EOSH
23264 # Maybe put other stuff here too.
23265 ./tr '-' '_' <<EOSH >>Cppsym.know
23266 $osname
23267 EOSH
23268 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23269 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23270 $cat Cppsym.know > Cppsym.c
23271 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23272 $rm -f Cppsym.a Cppsym.b Cppsym.c
23273 cat <<EOSH > Cppsym
23274 $startsh
23275 if $test \$# -gt 0; then
23276     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23277     if $test -s Cppsym.got; then
23278         $rm -f Cppsym.got
23279         exit 0
23280     fi
23281     $rm -f Cppsym.got
23282     exit 1
23283 else
23284     $tr " " "$trnl" | ./Cppsym.try
23285     exit 0
23286 fi
23287 EOSH
23288 chmod +x Cppsym
23289 $eunicefix Cppsym
23290 cat <<EOSH > Cppsym.try
23291 $startsh
23292 cat <<'EOCP' > try.c
23293 #include <stdio.h>
23294 #if cpp_stuff == 1
23295 #define STRINGIFY(a)    "a"
23296 #endif
23297 #if cpp_stuff == 42
23298 #define StGiFy(a)  #a
23299 #define STRINGIFY(a)    StGiFy(a)
23300 #endif
23301 #if $cpp_stuff != 1 && $cpp_stuff != 42
23302 #   include "Bletch: How does this C preprocessor stringify macros?"
23303 #endif
23304 int main() {
23305 EOCP
23306 $awk \\
23307 EOSH
23308 cat <<'EOSH' >> Cppsym.try
23309 'length($1) > 0 {
23310     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23311     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23312     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23313     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23314 }'       >> try.c
23315 echo 'return 0;}' >> try.c
23316 EOSH
23317 cat <<EOSH >> Cppsym.try
23318 ccflags="$ccflags"
23319 case "$osname-$gccversion" in
23320 irix-) ccflags="\$ccflags -woff 1178" ;;
23321 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23322 esac
23323 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try  | $sed 's/ /\\\\ /g'
23324 EOSH
23325 chmod +x Cppsym.try
23326 $eunicefix Cppsym.try
23327 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23328 : Add in any Linux cpp "predefined macros":
23329 case "$osname::$gccversion" in
23330   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23331     tHdrH=_tmpHdr
23332     rm -f $tHdrH'.h' $tHdrH
23333     touch $tHdrH'.h'
23334     # Filter out macro arguments, such as Linux's __INT8_C(c)
23335     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23336        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23337        if [ -s $tHdrH'_cppsym.real' ]; then
23338           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23339        fi
23340     fi
23341     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23342   ;;
23343 esac
23344 : now check the C compiler for additional symbols
23345 postprocess_cc_v=''
23346 case "$osname" in
23347 aix) postprocess_cc_v="|$tr , ' '" ;;
23348 esac
23349 $cat >ccsym <<EOS
23350 $startsh
23351 $cat >tmp.c <<EOF
23352 extern int foo;
23353 EOF
23354 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23355 do
23356         case "\$i" in
23357         -D*) echo "\$i" | $sed 's/^-D//';;
23358         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23359         esac
23360 done
23361 $rm_try
23362 EOS
23363 postprocess_cc_v=''
23364 chmod +x ccsym
23365 $eunicefix ccsym
23366 ./ccsym > ccsym1.raw
23367 if $test -s ccsym1.raw; then
23368     $sort ccsym1.raw | $uniq >ccsym.raw
23369 else
23370     mv ccsym1.raw ccsym.raw
23371 fi
23372
23373 $awk '/\=/ { print $0; next }
23374         { print $0"=1" }' ccsym.raw >ccsym.list
23375 $comm -13 Cppsym.true ccsym.list >ccsym.own
23376 $comm -12 Cppsym.true ccsym.list >ccsym.com
23377 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23378 also=''
23379 if $test -z ccsym.raw; then
23380         echo "Your C compiler doesn't seem to define any symbols!" >&4
23381         echo " "
23382         echo "However, your C preprocessor defines the following symbols:"
23383         $cat Cppsym.true
23384         ccsymbols=''
23385         cppsymbols=`$cat Cppsym.true`
23386         cppsymbols=`echo $cppsymbols`
23387         cppccsymbols="$cppsymbols"
23388 else
23389         if $test -s ccsym.com; then
23390                 echo "Your C compiler and pre-processor define these symbols:"
23391                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23392                 also='also '
23393                 symbols='ones'
23394                 cppccsymbols=`$cat ccsym.com`
23395                 cppccsymbols=`echo $cppccsymbols`
23396                 $test "$silent" || sleep 1
23397         fi
23398         if $test -s ccsym.cpp; then
23399                 $test "$also" && echo " "
23400                 echo "Your C pre-processor ${also}defines the following symbols:"
23401                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23402                 also='further '
23403                 cppsymbols=`$cat ccsym.cpp`
23404                 cppsymbols=`echo $cppsymbols`
23405                 $test "$silent" || sleep 1
23406         fi
23407         if $test -s ccsym.own; then
23408                 $test "$also" && echo " "
23409                 echo "Your C compiler ${also}defines the following cpp symbols:"
23410                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23411                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23412                 ccsymbols=`$cat ccsym.own`
23413                 ccsymbols=`echo $ccsymbols`
23414                 $test "$silent" || sleep 1
23415         fi
23416 fi
23417
23418 : add -D_FORTIFY_SOURCE if feasible and not already there
23419 case "$gccversion" in
23420 [45].*) case "$optimize$ccflags" in
23421         *-O*)   case "$ccflags$cppsymbols" in
23422                 *_FORTIFY_SOURCE=*) # Don't add it again.
23423                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23424                         ;;
23425                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23426                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23427                         ;;
23428                 esac
23429                 ;;
23430         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23431                 ;;
23432         esac
23433         ;;
23434 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23435         ;;
23436 esac
23437
23438 : see if this is a termio system
23439 val="$undef"
23440 val2="$undef"
23441 val3="$undef"
23442 if $test `./findhdr termios.h`; then
23443     set tcsetattr i_termios
23444     eval $inlibc
23445     val3="$i_termios"
23446 fi
23447 echo " "
23448 case "$val3" in
23449     "$define") echo "You have POSIX termios.h... good!" >&4;;
23450     *)  if ./Cppsym pyr; then
23451             case "`$run /bin/universe`" in
23452                 ucb) if $test `./findhdr sgtty.h`; then
23453                         val2="$define"
23454                         echo "<sgtty.h> found." >&4
23455                     else
23456                         echo "System is pyramid with BSD universe."
23457                         ./warn "<sgtty.h> not found--you could have problems."
23458                     fi;;
23459                 *)  if $test `./findhdr termio.h`; then
23460                         val="$define"
23461                         echo "<termio.h> found." >&4
23462                     else
23463                         echo "System is pyramid with USG universe."
23464                         ./warn "<termio.h> not found--you could have problems."
23465                     fi;;
23466             esac
23467         elif ./usg; then
23468             if $test `./findhdr termio.h`; then
23469                 echo "<termio.h> found." >&4
23470                 val="$define"
23471             elif $test `./findhdr sgtty.h`; then
23472                 echo "<sgtty.h> found." >&4
23473                 val2="$define"
23474             else
23475                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23476             fi
23477         else
23478             if $test `./findhdr sgtty.h`; then
23479                 echo "<sgtty.h> found." >&4
23480                 val2="$define"
23481             elif $test `./findhdr termio.h`; then
23482                 echo "<termio.h> found." >&4
23483                 val="$define"
23484             else
23485                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23486             fi
23487         fi;;
23488 esac
23489 set i_termio; eval $setvar
23490 val=$val2; set i_sgtty; eval $setvar
23491 val=$val3; set i_termios; eval $setvar
23492
23493 : see if stdbool is available
23494 : we want a real compile instead of Inhdr because some Solaris systems
23495 : have stdbool.h, but it can only be used if the compiler indicates it
23496 : is sufficiently c99-compliant.
23497 echo " "
23498 $cat >try.c <<EOCP
23499 #include <stdio.h>
23500 #include <stdbool.h>
23501 int func(bool x)
23502 {
23503     return x ? 1 : 0;
23504 }
23505 int main(int argc, char **argv)
23506 {
23507     return func(0);
23508 }
23509 EOCP
23510 set try
23511 if eval $compile; then
23512         echo "<stdbool.h> found." >&4
23513         val="$define"
23514 else
23515         echo "<stdbool.h> NOT found." >&4
23516         val="$undef"
23517 fi
23518 $rm_try
23519 set i_stdbool
23520 eval $setvar
23521
23522 : see if stddef is available
23523 set stddef.h i_stddef
23524 eval $inhdr
23525
23526 : see if stdint is available
23527 set stdint.h i_stdint
23528 eval $inhdr
23529
23530 : see if sys/access.h is available
23531 set sys/access.h i_sysaccess
23532 eval $inhdr
23533
23534 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23535 set sys/filio.h i_sysfilio
23536 eval $inhdr
23537 echo " "
23538 if $test `./findhdr sys/ioctl.h`; then
23539         val="$define"
23540         echo '<sys/ioctl.h> found.' >&4
23541 else
23542         val="$undef"
23543         if $test $i_sysfilio = "$define"; then
23544             echo '<sys/ioctl.h> NOT found.' >&4
23545         else
23546                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23547                 $test $i_termio = "$define" && xxx="termio.h"
23548                 $test $i_termios = "$define" && xxx="termios.h"
23549 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23550         fi
23551 fi
23552 set i_sysioctl
23553 eval $setvar
23554
23555 : see if socket ioctl defs are in sys/sockio.h
23556 echo " "
23557 xxx=`./findhdr sys/sockio.h`
23558 if $test "$xxx"; then
23559         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23560                 val="$define"
23561                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23562         else
23563                 val="$undef"
23564                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23565         fi
23566 else
23567         val="$undef"
23568         $cat <<EOM
23569 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23570 EOM
23571 fi
23572 set i_syssockio
23573 eval $setvar
23574
23575 : see if this is a syslog.h system
23576 set syslog.h i_syslog
23577 eval $inhdr
23578
23579 : see if this is a sys/mode.h system
23580 set sys/mode.h i_sysmode
23581 eval $inhdr
23582
23583 : see if there is a sys/poll.h file
23584 set sys/poll.h i_syspoll
23585 eval $inhdr
23586
23587 : see if sys/resource.h has to be included
23588 set sys/resource.h i_sysresrc
23589 eval $inhdr
23590
23591 : see if sys/security.h is available
23592 set sys/security.h i_syssecrt
23593 eval $inhdr
23594
23595 : see if this is a sys/statvfs.h system
23596 set sys/statvfs.h i_sysstatvfs
23597 eval $inhdr
23598
23599 : see if this is a sys/un.h system
23600 set sys/un.h i_sysun
23601 eval $inhdr
23602
23603 : see if this is a sys/utsname.h system
23604 set sys/utsname.h i_sysutsname
23605 eval $inhdr
23606
23607 : see if this is a syswait system
23608 set sys/wait.h i_syswait
23609 eval $inhdr
23610
23611 : see if this is a ustat.h system
23612 set ustat.h i_ustat
23613 eval $inhdr
23614
23615 : see if this is an utime system
23616 set utime.h i_utime
23617 eval $inhdr
23618
23619 : see if this is a vfork system
23620 case "$d_vfork" in
23621 "$define")
23622         set vfork.h i_vfork
23623         eval $inhdr
23624         ;;
23625 *)
23626         i_vfork="$undef"
23627         ;;
23628 esac
23629
23630 : Check extensions
23631 echo " "
23632 echo "Looking for extensions..." >&4
23633 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23634 : contain old or inaccurate or duplicate values.
23635 nonxs_extensions=''
23636 xs_extensions=''
23637 : We do not use find because it might not be available.
23638 : We do not just use MANIFEST because the user may have dropped
23639 : some additional extensions into the source tree and expect them
23640 : to be built.
23641
23642 : Function to recursively find available extensions, ignoring DynaLoader
23643 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23644 : In 5.10.1 and later, extensions are stored in directories
23645 : like File-Glob instead of the older File/Glob/.
23646 find_extensions='
23647     for xxx in *; do
23648         case "$xxx" in
23649             DynaLoader|dynaload) ;;
23650             *)
23651             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23652             case "$this_ext" in
23653                 Scalar/List/Utils) this_ext="List/Util" ;;
23654                 PathTools)         this_ext="Cwd"       ;;
23655             esac;
23656             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23657             if $contains " $this_ext " "$tdir/$$.tmp"; then
23658                 echo >&4;
23659                 echo "Duplicate directories detected for extension $xxx" >&4;
23660                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23661                 case "$knowitall" in
23662                 "") dflt=y;;
23663                 *) dflt=n;;
23664                 esac;
23665                 . ../UU/myread;
23666                 case "$ans" in
23667                 n*|N*) ;;
23668                 *) echo >&4;
23669                     echo "Ok.  Stopping Configure." >&4;
23670                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23671                     exit 1;;
23672                 esac;
23673                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23674             fi;
23675             $ls -1 "$xxx" > "$tdir/$$.tmp";
23676             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23677                 xs_extensions="$xs_extensions $this_ext";
23678             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23679                 xs_extensions="$xs_extensions $this_ext";
23680             elif $test -d "$xxx"; then
23681                 nonxs_extensions="$nonxs_extensions $this_ext";
23682             fi;
23683             $rm -f "$tdir/$$.tmp";
23684             ;;
23685         esac;
23686     done'
23687 tdir=`pwd`
23688 cd "$rsrc/cpan"
23689 set X
23690 shift
23691 eval $find_extensions
23692 cd "$rsrc/dist"
23693 set X
23694 shift
23695 eval $find_extensions
23696 cd "$rsrc/ext"
23697 set X
23698 shift
23699 eval $find_extensions
23700 set X $xs_extensions
23701 shift
23702 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23703 set X $nonxs_extensions
23704 shift
23705 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23706 cd "$tdir"
23707 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23708
23709 : Now see which are supported on this system.
23710 avail_ext=''
23711 for xxx in $xs_extensions ; do
23712         case "$xxx" in
23713         Amiga*)
23714                 case "$osname" in
23715                 amigaos) avail_ext="$avail_ext $xxx" ;;
23716                 esac
23717                 ;;
23718         DB_File|db_file)
23719                 case "$i_db" in
23720                 $define) avail_ext="$avail_ext $xxx" ;;
23721                 esac
23722                 ;;
23723         GDBM_File|gdbm_fil)
23724                 case "$i_gdbm" in
23725                 $define) avail_ext="$avail_ext $xxx" ;;
23726                 esac
23727                 ;;
23728         I18N/Langinfo|i18n_lan)
23729                 case "$i_langinfo$d_nl_langinfo" in
23730                 $define$define) avail_ext="$avail_ext $xxx" ;;
23731                 esac
23732                 ;;
23733         IPC/SysV|ipc/sysv)
23734                 : XXX Do we need a useipcsysv variable here
23735                 case "${d_msg}${d_sem}${d_shm}" in
23736                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23737                 esac
23738                 ;;
23739         NDBM_File|ndbm_fil)
23740                 case "$d_ndbm" in
23741                 $define)
23742                     case "$osname-$use64bitint" in
23743                     hpux-define)
23744                         case "$libs" in
23745                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23746                         esac
23747                         ;;
23748                     *) avail_ext="$avail_ext $xxx" ;;
23749                     esac
23750                     ;;
23751                 esac
23752                 ;;
23753         ODBM_File|odbm_fil)
23754                 case "${i_dbm}${i_rpcsvcdbm}" in
23755                 *"${define}"*)
23756                     case "$d_cplusplus" in
23757                     define) ;; # delete as a function name will not work
23758                     *)  case "$osname-$use64bitint" in
23759                         hpux-define)
23760                             case "$libs" in
23761                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23762                             esac
23763                             ;;
23764                         *) avail_ext="$avail_ext $xxx" ;;
23765                         esac
23766                         ;;
23767                     esac
23768                     ;;
23769                 esac
23770                 ;;
23771         Opcode|opcode)
23772                 case "$useopcode" in
23773                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23774                 esac
23775                 ;;
23776         POSIX|posix)
23777                 case "$useposix" in
23778                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23779                 esac
23780                 ;;
23781         Socket|socket)
23782                 case "$d_socket" in
23783                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23784                 esac
23785                 ;;
23786         Sys/Syslog|sys/syslog)
23787                 case $osname in
23788                         amigaos) ;; # not really very useful on AmigaOS
23789                         *)
23790                         : XXX syslog requires socket
23791                         case "$d_socket" in
23792                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23793                         esac
23794                         ;;
23795                 esac
23796                 ;;
23797         Thread|thread)
23798                 case "$usethreads" in
23799                 true|$define|y)
23800                         case "$use5005threads" in
23801                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23802                         esac
23803                 esac
23804                 ;;
23805         threads|threads/shared)
23806                 # threads and threads::shared are special cases.
23807                 # To stop people from asking "Perl 5.8.0 was supposed
23808                 # to have this new fancy threads implementation but my
23809                 # perl doesn't have it" and from people trying to
23810                 # (re)install the threads module using CPAN.pm and
23811                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23812                 # the threads.pm and threads/shared.pm will always be
23813                 # there, croaking informatively ("you need to rebuild
23814                 # all of Perl with threads, sorry") when threads haven't
23815                 # been compiled in.
23816                 # --jhi
23817                 avail_ext="$avail_ext $xxx"
23818                 ;;
23819         VMS*)
23820                 ;;
23821         Win32*)
23822                 case "$osname" in
23823                 cygwin) avail_ext="$avail_ext $xxx" ;;
23824                 esac
23825                 ;;
23826         XS/APItest|xs/apitest)
23827                 # This is just for testing.  Skip it unless we have dynamic loading.
23828
23829                 case "$usedl" in
23830                 $define) avail_ext="$avail_ext $xxx" ;;
23831                 esac
23832                 ;;
23833         XS/Typemap|xs/typemap)
23834                 # This is just for testing.  Skip it unless we have dynamic loading.
23835                 case "$usedl" in
23836                 $define) avail_ext="$avail_ext $xxx" ;;
23837                 esac
23838                 ;;
23839         *)      avail_ext="$avail_ext $xxx"
23840                 ;;
23841         esac
23842 done
23843
23844 set X $avail_ext
23845 shift
23846 avail_ext="$*"
23847
23848 case "$onlyextensions" in
23849 '') ;;
23850 *)  keepextensions=''
23851     echo "You have requested that only certain extensions be included..." >&4
23852     for i in $onlyextensions; do
23853         case " $avail_ext " in
23854         *" $i "*)
23855             echo "Keeping extension $i."
23856             keepextensions="$keepextensions $i"
23857             ;;
23858         *) echo "Ignoring extension $i." ;;
23859         esac
23860     done
23861     avail_ext="$keepextensions"
23862     ;;
23863 esac
23864
23865 case "$noextensions" in
23866 '') ;;
23867 *)  keepextensions=''
23868     echo "You have requested that certain extensions be ignored..." >&4
23869     for i in $avail_ext; do
23870         case " $noextensions " in
23871         *" $i "*) echo "Ignoring extension $i." ;;
23872         *) echo "Keeping extension $i.";
23873            keepextensions="$keepextensions $i"
23874            ;;
23875         esac
23876     done
23877     avail_ext="$keepextensions"
23878     ;;
23879 esac
23880
23881 : Now see which nonxs extensions are supported on this system.
23882 : For now assume all are.
23883 nonxs_ext=''
23884 for xxx in $nonxs_extensions ; do
23885         case "$xxx" in
23886         VMS*)
23887                 ;;
23888         *)      nonxs_ext="$nonxs_ext $xxx"
23889                 ;;
23890         esac
23891 done
23892
23893 set X $nonxs_ext
23894 shift
23895 nonxs_ext="$*"
23896
23897 case $usedl in
23898 $define)
23899         $cat <<EOM
23900 A number of extensions are supplied with $package.  You may choose to
23901 compile these extensions for dynamic loading (the default), compile
23902 them into the $package executable (static loading), or not include
23903 them at all.  Answer "none" to include no extensions.
23904 Note that DynaLoader is always built and need not be mentioned here.
23905
23906 EOM
23907         case "$dynamic_ext" in
23908         '')
23909                 : Exclude those listed in static_ext
23910                 dflt=''
23911                 for xxx in $avail_ext; do
23912                         case " $static_ext " in
23913                         *" $xxx "*) ;;
23914                         *) dflt="$dflt $xxx" ;;
23915                         esac
23916                 done
23917                 set X $dflt
23918                 shift
23919                 dflt="$*"
23920                 ;;
23921         *)      dflt="$dynamic_ext"
23922                 # Perhaps we are reusing an old out-of-date config.sh.
23923                 case "$hint" in
23924                 previous)
23925                         if test X"$dynamic_ext" != X"$avail_ext"; then
23926                                 $cat <<EOM
23927 NOTICE:  Your previous config.sh list may be incorrect.
23928 The extensions now available to you are
23929         ${avail_ext}
23930 but the default list from your previous config.sh is
23931         ${dynamic_ext}
23932
23933 EOM
23934                         fi
23935                         ;;
23936                 esac
23937                 ;;
23938         esac
23939         case "$dflt" in
23940         '')     dflt=none;;
23941         esac
23942         rp="What extensions do you wish to load dynamically?"
23943         . ./myread
23944         case "$ans" in
23945         none) dynamic_ext=' ' ;;
23946         *) dynamic_ext="$ans" ;;
23947         esac
23948
23949         case "$static_ext" in
23950         '')
23951                 : Exclude those already listed in dynamic linking
23952                 dflt=''
23953                 for xxx in $avail_ext; do
23954                         case " $dynamic_ext " in
23955                         *" $xxx "*) ;;
23956                         *) dflt="$dflt $xxx" ;;
23957                         esac
23958                 done
23959                 set X $dflt
23960                 shift
23961                 dflt="$*"
23962                 ;;
23963         *)  dflt="$static_ext"
23964                 ;;
23965         esac
23966
23967         case "$dflt" in
23968         '')     dflt=none;;
23969         esac
23970         rp="What extensions do you wish to load statically?"
23971         . ./myread
23972         case "$ans" in
23973         none) static_ext=' ' ;;
23974         *) static_ext="$ans" ;;
23975         esac
23976         ;;
23977 *)
23978         $cat <<EOM
23979 A number of extensions are supplied with $package.  Answer "none"
23980 to include no extensions.
23981 Note that DynaLoader is always built and need not be mentioned here.
23982
23983 EOM
23984         case "$static_ext" in
23985         '') dflt="$avail_ext" ;;
23986         *)      dflt="$static_ext"
23987                 # Perhaps we are reusing an old out-of-date config.sh.
23988                 case "$hint" in
23989                 previous)
23990                         if test X"$static_ext" != X"$avail_ext"; then
23991                                 $cat <<EOM
23992 NOTICE:  Your previous config.sh list may be incorrect.
23993 The extensions now available to you are
23994         ${avail_ext}
23995 but the default list from your previous config.sh is
23996         ${static_ext}
23997
23998 EOM
23999                         fi
24000                         ;;
24001                 esac
24002                 ;;
24003         esac
24004         : Exclude those that are not xs extensions
24005         case "$dflt" in
24006         '')     dflt=none;;
24007         esac
24008         rp="What extensions do you wish to include?"
24009         . ./myread
24010         case "$ans" in
24011         none) static_ext=' ' ;;
24012         *) static_ext="$ans" ;;
24013         esac
24014         ;;
24015 esac
24016 #
24017 # Encode is a special case.  If we are building Encode as a static
24018 # extension, we need to explicitly list its subextensions as well.
24019 # For other nested extensions, this is handled automatically by
24020 # the appropriate Makefile.PL.
24021 case " $static_ext " in
24022         *" Encode "*) # Add the subextensions of Encode
24023         cd "$rsrc/cpan"
24024         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24025                 static_ext="$static_ext Encode/$xxx"
24026                 known_extensions="$known_extensions Encode/$xxx"
24027         done
24028         cd "$tdir"
24029         ;;
24030 esac
24031
24032 set X $dynamic_ext $static_ext $nonxs_ext
24033 shift
24034 extensions="$*"
24035
24036 # Sanity check:  We require an extension suitable for use with
24037 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
24038 # should show up as failures in the test suite, but it's helpful to
24039 # catch them now.) The 'extensions' list is normally sorted
24040 # alphabetically, so we need to accept either
24041 #    DB_File ... Fcntl ... IO  ....
24042 # or something like
24043 #    Fcntl ... NDBM_File ... IO  ....
24044 case " $extensions"  in
24045 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
24046 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24047 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24048 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24049    echo "WARNING: The Perl you are building will be quite crippled." >& 4
24050    ;;
24051 esac
24052
24053 : Remove libraries needed only for extensions
24054 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24055 : The exception is SunOS 4.x, which needs them.
24056 case "${osname}X${osvers}" in
24057 sunos*X4*)
24058     perllibs="$libs"
24059     ;;
24060 *) case "$usedl" in
24061     $define|true|[yY]*)
24062             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24063             shift
24064             perllibs="$*"
24065             ;;
24066     *)  perllibs="$libs"
24067             ;;
24068     esac
24069     ;;
24070 esac
24071
24072 : Remove build directory name from cppstdin so it can be used from
24073 : either the present location or the final installed location.
24074 echo " "
24075 : Get out of the UU directory to get correct path name.
24076 cd ..
24077 case "$cppstdin" in
24078 `pwd`/cppstdin)
24079         echo "Stripping down cppstdin path name"
24080         cppstdin=cppstdin
24081         ;;
24082 esac
24083 cd UU
24084
24085 : end of configuration questions
24086 echo " "
24087 echo "End of configuration questions."
24088 echo " "
24089
24090 : back to where it started
24091 if test -d ../UU; then
24092         cd ..
24093 fi
24094
24095 : configuration may be unconditionally patched via a 'config.arch' file
24096 if $test -f config.arch; then
24097         echo "I see a config.arch file, loading it." >&4
24098         . ./config.arch
24099 fi
24100
24101 : configuration may be patched via a 'config.over' file
24102 if $test -f config.over; then
24103         echo " "
24104         dflt=y
24105         rp='I see a config.over file.  Do you wish to load it?'
24106         . UU/myread
24107         case "$ans" in
24108         n*) echo "OK, I'll ignore it.";;
24109         *)      . ./config.over
24110                 echo "Configuration override changes have been loaded."
24111                 ;;
24112         esac
24113 fi
24114
24115 : in case they want portability, strip down executable paths
24116 case "$d_portable" in
24117 "$define")
24118         echo " "
24119         echo "Stripping down executable paths..." >&4
24120         for file in $loclist $trylist; do
24121                 eval temp=\$$file
24122                 eval $file=`basename $temp`
24123         done
24124         ;;
24125 esac
24126
24127 : create config.sh file
24128 echo " "
24129 echo "Creating config.sh..." >&4
24130 $spitshell <<EOT >config.sh
24131 $startsh
24132 #
24133 # This file was produced by running the Configure script. It holds all the
24134 # definitions figured out by Configure. Should you modify one of these values,
24135 # do not forget to propagate your changes by running "Configure -der". You may
24136 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24137 #
24138
24139 # Package name      : $package
24140 # Source directory  : $src
24141 # Configuration time: $cf_time
24142 # Configured by     : $cf_by
24143 # Target system     : $myuname
24144
24145 EOT
24146 : Add in command line options if available
24147 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24148
24149 $spitshell <<EOT >>config.sh
24150
24151 Author='$Author'
24152 Date='$Date'
24153 Header='$Header'
24154 Id='$Id'
24155 Locker='$Locker'
24156 Log='$Log'
24157 RCSfile='$RCSfile'
24158 Revision='$Revision'
24159 Source='$Source'
24160 State='$State'
24161 _a='$_a'
24162 _exe='$_exe'
24163 _o='$_o'
24164 afs='$afs'
24165 afsroot='$afsroot'
24166 alignbytes='$alignbytes'
24167 ansi2knr='$ansi2knr'
24168 aphostname='$aphostname'
24169 api_revision='$api_revision'
24170 api_subversion='$api_subversion'
24171 api_version='$api_version'
24172 api_versionstring='$api_versionstring'
24173 ar='$ar'
24174 archlib='$archlib'
24175 archlibexp='$archlibexp'
24176 archname64='$archname64'
24177 archname='$archname'
24178 archobjs='$archobjs'
24179 asctime_r_proto='$asctime_r_proto'
24180 awk='$awk'
24181 baserev='$baserev'
24182 bash='$bash'
24183 bin='$bin'
24184 bin_ELF='$bin_ELF'
24185 binexp='$binexp'
24186 bison='$bison'
24187 byacc='$byacc'
24188 byteorder='$byteorder'
24189 c='$c'
24190 castflags='$castflags'
24191 cat='$cat'
24192 cc='$cc'
24193 cccdlflags='$cccdlflags'
24194 ccdlflags='$ccdlflags'
24195 ccflags='$ccflags'
24196 ccflags_uselargefiles='$ccflags_uselargefiles'
24197 ccname='$ccname'
24198 ccsymbols='$ccsymbols'
24199 ccversion='$ccversion'
24200 cf_by='$cf_by'
24201 cf_email='$cf_email'
24202 cf_time='$cf_time'
24203 charbits='$charbits'
24204 charsize='$charsize'
24205 chgrp='$chgrp'
24206 chmod='$chmod'
24207 chown='$chown'
24208 clocktype='$clocktype'
24209 comm='$comm'
24210 compress='$compress'
24211 contains='$contains'
24212 cp='$cp'
24213 cpio='$cpio'
24214 cpp='$cpp'
24215 cpp_stuff='$cpp_stuff'
24216 cppccsymbols='$cppccsymbols'
24217 cppflags='$cppflags'
24218 cpplast='$cpplast'
24219 cppminus='$cppminus'
24220 cpprun='$cpprun'
24221 cppstdin='$cppstdin'
24222 cppsymbols='$cppsymbols'
24223 crypt_r_proto='$crypt_r_proto'
24224 cryptlib='$cryptlib'
24225 csh='$csh'
24226 ctermid_r_proto='$ctermid_r_proto'
24227 ctime_r_proto='$ctime_r_proto'
24228 d_Gconvert='$d_Gconvert'
24229 d_PRIEUldbl='$d_PRIEUldbl'
24230 d_PRIFUldbl='$d_PRIFUldbl'
24231 d_PRIGUldbl='$d_PRIGUldbl'
24232 d_PRIXU64='$d_PRIXU64'
24233 d_PRId64='$d_PRId64'
24234 d_PRIeldbl='$d_PRIeldbl'
24235 d_PRIfldbl='$d_PRIfldbl'
24236 d_PRIgldbl='$d_PRIgldbl'
24237 d_PRIi64='$d_PRIi64'
24238 d_PRIo64='$d_PRIo64'
24239 d_PRIu64='$d_PRIu64'
24240 d_PRIx64='$d_PRIx64'
24241 d_SCNfldbl='$d_SCNfldbl'
24242 d__fwalk='$d__fwalk'
24243 d_access='$d_access'
24244 d_accessx='$d_accessx'
24245 d_acosh='$d_acosh'
24246 d_aintl='$d_aintl'
24247 d_alarm='$d_alarm'
24248 d_archlib='$d_archlib'
24249 d_asctime64='$d_asctime64'
24250 d_asctime_r='$d_asctime_r'
24251 d_asinh='$d_asinh'
24252 d_atanh='$d_atanh'
24253 d_atolf='$d_atolf'
24254 d_atoll='$d_atoll'
24255 d_attribute_deprecated='$d_attribute_deprecated'
24256 d_attribute_format='$d_attribute_format'
24257 d_attribute_malloc='$d_attribute_malloc'
24258 d_attribute_nonnull='$d_attribute_nonnull'
24259 d_attribute_noreturn='$d_attribute_noreturn'
24260 d_attribute_pure='$d_attribute_pure'
24261 d_attribute_unused='$d_attribute_unused'
24262 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24263 d_backtrace='$d_backtrace'
24264 d_bcmp='$d_bcmp'
24265 d_bcopy='$d_bcopy'
24266 d_bsd='$d_bsd'
24267 d_bsdgetpgrp='$d_bsdgetpgrp'
24268 d_bsdsetpgrp='$d_bsdsetpgrp'
24269 d_builtin_choose_expr='$d_builtin_choose_expr'
24270 d_builtin_expect='$d_builtin_expect'
24271 d_bzero='$d_bzero'
24272 d_c99_variadic_macros='$d_c99_variadic_macros'
24273 d_casti32='$d_casti32'
24274 d_castneg='$d_castneg'
24275 d_cbrt='$d_cbrt'
24276 d_charvspr='$d_charvspr'
24277 d_chown='$d_chown'
24278 d_chroot='$d_chroot'
24279 d_chsize='$d_chsize'
24280 d_class='$d_class'
24281 d_clearenv='$d_clearenv'
24282 d_closedir='$d_closedir'
24283 d_cmsghdr_s='$d_cmsghdr_s'
24284 d_const='$d_const'
24285 d_copysign='$d_copysign'
24286 d_copysignl='$d_copysignl'
24287 d_cplusplus='$d_cplusplus'
24288 d_crypt='$d_crypt'
24289 d_crypt_r='$d_crypt_r'
24290 d_csh='$d_csh'
24291 d_ctermid='$d_ctermid'
24292 d_ctermid_r='$d_ctermid_r'
24293 d_ctime64='$d_ctime64'
24294 d_ctime_r='$d_ctime_r'
24295 d_cuserid='$d_cuserid'
24296 d_dbl_dig='$d_dbl_dig'
24297 d_dbminitproto='$d_dbminitproto'
24298 d_difftime64='$d_difftime64'
24299 d_difftime='$d_difftime'
24300 d_dir_dd_fd='$d_dir_dd_fd'
24301 d_dirfd='$d_dirfd'
24302 d_dirnamlen='$d_dirnamlen'
24303 d_dladdr='$d_dladdr'
24304 d_dlerror='$d_dlerror'
24305 d_dlopen='$d_dlopen'
24306 d_dlsymun='$d_dlsymun'
24307 d_dosuid='$d_dosuid'
24308 d_drand48_r='$d_drand48_r'
24309 d_drand48proto='$d_drand48proto'
24310 d_dup2='$d_dup2'
24311 d_eaccess='$d_eaccess'
24312 d_endgrent='$d_endgrent'
24313 d_endgrent_r='$d_endgrent_r'
24314 d_endhent='$d_endhent'
24315 d_endhostent_r='$d_endhostent_r'
24316 d_endnent='$d_endnent'
24317 d_endnetent_r='$d_endnetent_r'
24318 d_endpent='$d_endpent'
24319 d_endprotoent_r='$d_endprotoent_r'
24320 d_endpwent='$d_endpwent'
24321 d_endpwent_r='$d_endpwent_r'
24322 d_endsent='$d_endsent'
24323 d_endservent_r='$d_endservent_r'
24324 d_eofnblk='$d_eofnblk'
24325 d_erf='$d_erf'
24326 d_erfc='$d_erfc'
24327 d_eunice='$d_eunice'
24328 d_exp2='$d_exp2'
24329 d_expm1='$d_expm1'
24330 d_faststdio='$d_faststdio'
24331 d_fchdir='$d_fchdir'
24332 d_fchmod='$d_fchmod'
24333 d_fchown='$d_fchown'
24334 d_fcntl='$d_fcntl'
24335 d_fcntl_can_lock='$d_fcntl_can_lock'
24336 d_fd_macros='$d_fd_macros'
24337 d_fd_set='$d_fd_set'
24338 d_fdclose='$d_fdclose'
24339 d_fdim='$d_fdim'
24340 d_fds_bits='$d_fds_bits'
24341 d_fegetround='$d_fegetround'
24342 d_fgetpos='$d_fgetpos'
24343 d_finite='$d_finite'
24344 d_finitel='$d_finitel'
24345 d_flexfnam='$d_flexfnam'
24346 d_flock='$d_flock'
24347 d_flockproto='$d_flockproto'
24348 d_fma='$d_fma'
24349 d_fmax='$d_fmax'
24350 d_fmin='$d_fmin'
24351 d_fork='$d_fork'
24352 d_fp_class='$d_fp_class'
24353 d_fp_classify='$d_fp_classify'
24354 d_fp_classl='$d_fp_classl'
24355 d_fpathconf='$d_fpathconf'
24356 d_fpclass='$d_fpclass'
24357 d_fpclassify='$d_fpclassify'
24358 d_fpclassl='$d_fpclassl'
24359 d_fpgetround='$d_fpgetround'
24360 d_fpos64_t='$d_fpos64_t'
24361 d_freelocale='$d_freelocale'
24362 d_frexpl='$d_frexpl'
24363 d_fs_data_s='$d_fs_data_s'
24364 d_fseeko='$d_fseeko'
24365 d_fsetpos='$d_fsetpos'
24366 d_fstatfs='$d_fstatfs'
24367 d_fstatvfs='$d_fstatvfs'
24368 d_fsync='$d_fsync'
24369 d_ftello='$d_ftello'
24370 d_ftime='$d_ftime'
24371 d_futimes='$d_futimes'
24372 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24373 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24374 d_getaddrinfo='$d_getaddrinfo'
24375 d_getcwd='$d_getcwd'
24376 d_getespwnam='$d_getespwnam'
24377 d_getfsstat='$d_getfsstat'
24378 d_getgrent='$d_getgrent'
24379 d_getgrent_r='$d_getgrent_r'
24380 d_getgrgid_r='$d_getgrgid_r'
24381 d_getgrnam_r='$d_getgrnam_r'
24382 d_getgrps='$d_getgrps'
24383 d_gethbyaddr='$d_gethbyaddr'
24384 d_gethbyname='$d_gethbyname'
24385 d_gethent='$d_gethent'
24386 d_gethname='$d_gethname'
24387 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24388 d_gethostbyname_r='$d_gethostbyname_r'
24389 d_gethostent_r='$d_gethostent_r'
24390 d_gethostprotos='$d_gethostprotos'
24391 d_getitimer='$d_getitimer'
24392 d_getlogin='$d_getlogin'
24393 d_getlogin_r='$d_getlogin_r'
24394 d_getmnt='$d_getmnt'
24395 d_getmntent='$d_getmntent'
24396 d_getnameinfo='$d_getnameinfo'
24397 d_getnbyaddr='$d_getnbyaddr'
24398 d_getnbyname='$d_getnbyname'
24399 d_getnent='$d_getnent'
24400 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24401 d_getnetbyname_r='$d_getnetbyname_r'
24402 d_getnetent_r='$d_getnetent_r'
24403 d_getnetprotos='$d_getnetprotos'
24404 d_getpagsz='$d_getpagsz'
24405 d_getpbyname='$d_getpbyname'
24406 d_getpbynumber='$d_getpbynumber'
24407 d_getpent='$d_getpent'
24408 d_getpgid='$d_getpgid'
24409 d_getpgrp2='$d_getpgrp2'
24410 d_getpgrp='$d_getpgrp'
24411 d_getppid='$d_getppid'
24412 d_getprior='$d_getprior'
24413 d_getprotobyname_r='$d_getprotobyname_r'
24414 d_getprotobynumber_r='$d_getprotobynumber_r'
24415 d_getprotoent_r='$d_getprotoent_r'
24416 d_getprotoprotos='$d_getprotoprotos'
24417 d_getprpwnam='$d_getprpwnam'
24418 d_getpwent='$d_getpwent'
24419 d_getpwent_r='$d_getpwent_r'
24420 d_getpwnam_r='$d_getpwnam_r'
24421 d_getpwuid_r='$d_getpwuid_r'
24422 d_getsbyname='$d_getsbyname'
24423 d_getsbyport='$d_getsbyport'
24424 d_getsent='$d_getsent'
24425 d_getservbyname_r='$d_getservbyname_r'
24426 d_getservbyport_r='$d_getservbyport_r'
24427 d_getservent_r='$d_getservent_r'
24428 d_getservprotos='$d_getservprotos'
24429 d_getspnam='$d_getspnam'
24430 d_getspnam_r='$d_getspnam_r'
24431 d_gettimeod='$d_gettimeod'
24432 d_gmtime64='$d_gmtime64'
24433 d_gmtime_r='$d_gmtime_r'
24434 d_gnulibc='$d_gnulibc'
24435 d_grpasswd='$d_grpasswd'
24436 d_hasmntopt='$d_hasmntopt'
24437 d_htonl='$d_htonl'
24438 d_hypot='$d_hypot'
24439 d_ilogb='$d_ilogb'
24440 d_ilogbl='$d_ilogbl'
24441 d_inc_version_list='$d_inc_version_list'
24442 d_index='$d_index'
24443 d_inetaton='$d_inetaton'
24444 d_inetntop='$d_inetntop'
24445 d_inetpton='$d_inetpton'
24446 d_int64_t='$d_int64_t'
24447 d_ip_mreq='$d_ip_mreq'
24448 d_ip_mreq_source='$d_ip_mreq_source'
24449 d_ipv6_mreq='$d_ipv6_mreq'
24450 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24451 d_isascii='$d_isascii'
24452 d_isblank='$d_isblank'
24453 d_isfinite='$d_isfinite'
24454 d_isfinitel='$d_isfinitel'
24455 d_isinf='$d_isinf'
24456 d_isinfl='$d_isinfl'
24457 d_isless='$d_isless'
24458 d_isnan='$d_isnan'
24459 d_isnanl='$d_isnanl'
24460 d_isnormal='$d_isnormal'
24461 d_j0='$d_j0'
24462 d_j0l='$d_j0l'
24463 d_killpg='$d_killpg'
24464 d_lc_monetary_2008='$d_lc_monetary_2008'
24465 d_lchown='$d_lchown'
24466 d_ldbl_dig='$d_ldbl_dig'
24467 d_ldexpl='$d_ldexpl'
24468 d_lgamma='$d_lgamma'
24469 d_lgamma_r='$d_lgamma_r'
24470 d_libm_lib_version='$d_libm_lib_version'
24471 d_libname_unique='$d_libname_unique'
24472 d_link='$d_link'
24473 d_llrint='$d_llrint'
24474 d_llrintl='$d_llrintl'
24475 d_llround='$d_llround'
24476 d_llroundl='$d_llroundl'
24477 d_localtime64='$d_localtime64'
24478 d_localtime_r='$d_localtime_r'
24479 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24480 d_locconv='$d_locconv'
24481 d_lockf='$d_lockf'
24482 d_log1p='$d_log1p'
24483 d_log2='$d_log2'
24484 d_logb='$d_logb'
24485 d_longdbl='$d_longdbl'
24486 d_longlong='$d_longlong'
24487 d_lrint='$d_lrint'
24488 d_lrintl='$d_lrintl'
24489 d_lround='$d_lround'
24490 d_lroundl='$d_lroundl'
24491 d_lseekproto='$d_lseekproto'
24492 d_lstat='$d_lstat'
24493 d_madvise='$d_madvise'
24494 d_malloc_good_size='$d_malloc_good_size'
24495 d_malloc_size='$d_malloc_size'
24496 d_mblen='$d_mblen'
24497 d_mbstowcs='$d_mbstowcs'
24498 d_mbtowc='$d_mbtowc'
24499 d_memchr='$d_memchr'
24500 d_memcmp='$d_memcmp'
24501 d_memcpy='$d_memcpy'
24502 d_memmem='$d_memmem'
24503 d_memmove='$d_memmove'
24504 d_memset='$d_memset'
24505 d_mkdir='$d_mkdir'
24506 d_mkdtemp='$d_mkdtemp'
24507 d_mkfifo='$d_mkfifo'
24508 d_mkstemp='$d_mkstemp'
24509 d_mkstemps='$d_mkstemps'
24510 d_mktime64='$d_mktime64'
24511 d_mktime='$d_mktime'
24512 d_mmap='$d_mmap'
24513 d_modfl='$d_modfl'
24514 d_modfl_pow32_bug='$d_modfl_pow32_bug'
24515 d_modflproto='$d_modflproto'
24516 d_mprotect='$d_mprotect'
24517 d_msg='$d_msg'
24518 d_msg_ctrunc='$d_msg_ctrunc'
24519 d_msg_dontroute='$d_msg_dontroute'
24520 d_msg_oob='$d_msg_oob'
24521 d_msg_peek='$d_msg_peek'
24522 d_msg_proxy='$d_msg_proxy'
24523 d_msgctl='$d_msgctl'
24524 d_msgget='$d_msgget'
24525 d_msghdr_s='$d_msghdr_s'
24526 d_msgrcv='$d_msgrcv'
24527 d_msgsnd='$d_msgsnd'
24528 d_msync='$d_msync'
24529 d_munmap='$d_munmap'
24530 d_mymalloc='$d_mymalloc'
24531 d_nan='$d_nan'
24532 d_ndbm='$d_ndbm'
24533 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24534 d_nearbyint='$d_nearbyint'
24535 d_newlocale='$d_newlocale'
24536 d_nextafter='$d_nextafter'
24537 d_nexttoward='$d_nexttoward'
24538 d_nice='$d_nice'
24539 d_nl_langinfo='$d_nl_langinfo'
24540 d_nv_preserves_uv='$d_nv_preserves_uv'
24541 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24542 d_off64_t='$d_off64_t'
24543 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24544 d_oldpthreads='$d_oldpthreads'
24545 d_oldsock='$d_oldsock'
24546 d_open3='$d_open3'
24547 d_pathconf='$d_pathconf'
24548 d_pause='$d_pause'
24549 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24550 d_phostname='$d_phostname'
24551 d_pipe='$d_pipe'
24552 d_poll='$d_poll'
24553 d_portable='$d_portable'
24554 d_prctl='$d_prctl'
24555 d_prctl_set_name='$d_prctl_set_name'
24556 d_printf_format_null='$d_printf_format_null'
24557 d_procselfexe='$d_procselfexe'
24558 d_pseudofork='$d_pseudofork'
24559 d_pthread_atfork='$d_pthread_atfork'
24560 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24561 d_pthread_yield='$d_pthread_yield'
24562 d_ptrdiff_t='$d_ptrdiff_t'
24563 d_pwage='$d_pwage'
24564 d_pwchange='$d_pwchange'
24565 d_pwclass='$d_pwclass'
24566 d_pwcomment='$d_pwcomment'
24567 d_pwexpire='$d_pwexpire'
24568 d_pwgecos='$d_pwgecos'
24569 d_pwpasswd='$d_pwpasswd'
24570 d_pwquota='$d_pwquota'
24571 d_qgcvt='$d_qgcvt'
24572 d_quad='$d_quad'
24573 d_random_r='$d_random_r'
24574 d_re_comp='$d_re_comp'
24575 d_readdir64_r='$d_readdir64_r'
24576 d_readdir='$d_readdir'
24577 d_readdir_r='$d_readdir_r'
24578 d_readlink='$d_readlink'
24579 d_readv='$d_readv'
24580 d_recvmsg='$d_recvmsg'
24581 d_regcmp='$d_regcmp'
24582 d_regcomp='$d_regcomp'
24583 d_remainder='$d_remainder'
24584 d_remquo='$d_remquo'
24585 d_rename='$d_rename'
24586 d_rewinddir='$d_rewinddir'
24587 d_rint='$d_rint'
24588 d_rmdir='$d_rmdir'
24589 d_round='$d_round'
24590 d_safebcpy='$d_safebcpy'
24591 d_safemcpy='$d_safemcpy'
24592 d_sanemcmp='$d_sanemcmp'
24593 d_sbrkproto='$d_sbrkproto'
24594 d_scalbn='$d_scalbn'
24595 d_scalbnl='$d_scalbnl'
24596 d_sched_yield='$d_sched_yield'
24597 d_scm_rights='$d_scm_rights'
24598 d_seekdir='$d_seekdir'
24599 d_select='$d_select'
24600 d_sem='$d_sem'
24601 d_semctl='$d_semctl'
24602 d_semctl_semid_ds='$d_semctl_semid_ds'
24603 d_semctl_semun='$d_semctl_semun'
24604 d_semget='$d_semget'
24605 d_semop='$d_semop'
24606 d_sendmsg='$d_sendmsg'
24607 d_setegid='$d_setegid'
24608 d_seteuid='$d_seteuid'
24609 d_setgrent='$d_setgrent'
24610 d_setgrent_r='$d_setgrent_r'
24611 d_setgrps='$d_setgrps'
24612 d_sethent='$d_sethent'
24613 d_sethostent_r='$d_sethostent_r'
24614 d_setitimer='$d_setitimer'
24615 d_setlinebuf='$d_setlinebuf'
24616 d_setlocale='$d_setlocale'
24617 d_setlocale_r='$d_setlocale_r'
24618 d_setnent='$d_setnent'
24619 d_setnetent_r='$d_setnetent_r'
24620 d_setpent='$d_setpent'
24621 d_setpgid='$d_setpgid'
24622 d_setpgrp2='$d_setpgrp2'
24623 d_setpgrp='$d_setpgrp'
24624 d_setprior='$d_setprior'
24625 d_setproctitle='$d_setproctitle'
24626 d_setprotoent_r='$d_setprotoent_r'
24627 d_setpwent='$d_setpwent'
24628 d_setpwent_r='$d_setpwent_r'
24629 d_setregid='$d_setregid'
24630 d_setresgid='$d_setresgid'
24631 d_setresuid='$d_setresuid'
24632 d_setreuid='$d_setreuid'
24633 d_setrgid='$d_setrgid'
24634 d_setruid='$d_setruid'
24635 d_setsent='$d_setsent'
24636 d_setservent_r='$d_setservent_r'
24637 d_setsid='$d_setsid'
24638 d_setvbuf='$d_setvbuf'
24639 d_shm='$d_shm'
24640 d_shmat='$d_shmat'
24641 d_shmatprototype='$d_shmatprototype'
24642 d_shmctl='$d_shmctl'
24643 d_shmdt='$d_shmdt'
24644 d_shmget='$d_shmget'
24645 d_sigaction='$d_sigaction'
24646 d_siginfo_si_errno='$d_siginfo_si_errno'
24647 d_siginfo_si_pid='$d_siginfo_si_pid'
24648 d_siginfo_si_uid='$d_siginfo_si_uid'
24649 d_siginfo_si_addr='$d_siginfo_si_addr'
24650 d_siginfo_si_status='$d_siginfo_si_status'
24651 d_siginfo_si_band='$d_siginfo_si_band'
24652 d_siginfo_si_value='$d_siginfo_si_value'
24653 d_signbit='$d_signbit'
24654 d_sigprocmask='$d_sigprocmask'
24655 d_sigsetjmp='$d_sigsetjmp'
24656 d_sin6_scope_id='$d_sin6_scope_id'
24657 d_sitearch='$d_sitearch'
24658 d_snprintf='$d_snprintf'
24659 d_sockaddr_in6='$d_sockaddr_in6'
24660 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24661 d_sockatmark='$d_sockatmark'
24662 d_sockatmarkproto='$d_sockatmarkproto'
24663 d_socket='$d_socket'
24664 d_socklen_t='$d_socklen_t'
24665 d_sockpair='$d_sockpair'
24666 d_socks5_init='$d_socks5_init'
24667 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24668 d_sqrtl='$d_sqrtl'
24669 d_srand48_r='$d_srand48_r'
24670 d_srandom_r='$d_srandom_r'
24671 d_sresgproto='$d_sresgproto'
24672 d_sresuproto='$d_sresuproto'
24673 d_stat='$d_stat'
24674 d_statblks='$d_statblks'
24675 d_statfs_f_flags='$d_statfs_f_flags'
24676 d_statfs_s='$d_statfs_s'
24677 d_static_inline='$d_static_inline'
24678 d_statvfs='$d_statvfs'
24679 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24680 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24681 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24682 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24683 d_stdio_stream_array='$d_stdio_stream_array'
24684 d_stdiobase='$d_stdiobase'
24685 d_stdstdio='$d_stdstdio'
24686 d_strchr='$d_strchr'
24687 d_strcoll='$d_strcoll'
24688 d_strctcpy='$d_strctcpy'
24689 d_strerrm='$d_strerrm'
24690 d_strerror='$d_strerror'
24691 d_strerror_r='$d_strerror_r'
24692 d_strftime='$d_strftime'
24693 d_strlcat='$d_strlcat'
24694 d_strlcpy='$d_strlcpy'
24695 d_strtod='$d_strtod'
24696 d_strtol='$d_strtol'
24697 d_strtold='$d_strtold'
24698 d_strtoll='$d_strtoll'
24699 d_strtoq='$d_strtoq'
24700 d_strtoul='$d_strtoul'
24701 d_strtoull='$d_strtoull'
24702 d_strtouq='$d_strtouq'
24703 d_strxfrm='$d_strxfrm'
24704 d_suidsafe='$d_suidsafe'
24705 d_symlink='$d_symlink'
24706 d_syscall='$d_syscall'
24707 d_syscallproto='$d_syscallproto'
24708 d_sysconf='$d_sysconf'
24709 d_sysernlst='$d_sysernlst'
24710 d_syserrlst='$d_syserrlst'
24711 d_system='$d_system'
24712 d_tcgetpgrp='$d_tcgetpgrp'
24713 d_tcsetpgrp='$d_tcsetpgrp'
24714 d_telldir='$d_telldir'
24715 d_telldirproto='$d_telldirproto'
24716 d_tgamma='$d_tgamma'
24717 d_time='$d_time'
24718 d_timegm='$d_timegm'
24719 d_times='$d_times'
24720 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24721 d_tm_tm_zone='$d_tm_tm_zone'
24722 d_tmpnam_r='$d_tmpnam_r'
24723 d_trunc='$d_trunc'
24724 d_truncate='$d_truncate'
24725 d_truncl='$d_truncl'
24726 d_ttyname_r='$d_ttyname_r'
24727 d_tzname='$d_tzname'
24728 d_u32align='$d_u32align'
24729 d_ualarm='$d_ualarm'
24730 d_umask='$d_umask'
24731 d_uname='$d_uname'
24732 d_union_semun='$d_union_semun'
24733 d_unordered='$d_unordered'
24734 d_unsetenv='$d_unsetenv'
24735 d_uselocale='$d_uselocale'
24736 d_usleep='$d_usleep'
24737 d_usleepproto='$d_usleepproto'
24738 d_ustat='$d_ustat'
24739 d_vendorarch='$d_vendorarch'
24740 d_vendorbin='$d_vendorbin'
24741 d_vendorlib='$d_vendorlib'
24742 d_vendorscript='$d_vendorscript'
24743 d_vfork='$d_vfork'
24744 d_void_closedir='$d_void_closedir'
24745 d_voidsig='$d_voidsig'
24746 d_voidtty='$d_voidtty'
24747 d_volatile='$d_volatile'
24748 d_vprintf='$d_vprintf'
24749 d_vsnprintf='$d_vsnprintf'
24750 d_wait4='$d_wait4'
24751 d_waitpid='$d_waitpid'
24752 d_wcscmp='$d_wcscmp'
24753 d_wcstombs='$d_wcstombs'
24754 d_wcsxfrm='$d_wcsxfrm'
24755 d_wctomb='$d_wctomb'
24756 d_writev='$d_writev'
24757 d_xenix='$d_xenix'
24758 date='$date'
24759 db_hashtype='$db_hashtype'
24760 db_prefixtype='$db_prefixtype'
24761 db_version_major='$db_version_major'
24762 db_version_minor='$db_version_minor'
24763 db_version_patch='$db_version_patch'
24764 direntrytype='$direntrytype'
24765 dlext='$dlext'
24766 dlsrc='$dlsrc'
24767 doubleinfbytes='$doubleinfbytes'
24768 doublekind='$doublekind'
24769 doublemantbits='$doublemantbits'
24770 doublenanbytes='$doublenanbytes'
24771 doublesize='$doublesize'
24772 drand01='$drand01'
24773 drand48_r_proto='$drand48_r_proto'
24774 dtrace='$dtrace'
24775 dtraceobject='$dtraceobject'
24776 dynamic_ext='$dynamic_ext'
24777 eagain='$eagain'
24778 ebcdic='$ebcdic'
24779 echo='$echo'
24780 egrep='$egrep'
24781 emacs='$emacs'
24782 endgrent_r_proto='$endgrent_r_proto'
24783 endhostent_r_proto='$endhostent_r_proto'
24784 endnetent_r_proto='$endnetent_r_proto'
24785 endprotoent_r_proto='$endprotoent_r_proto'
24786 endpwent_r_proto='$endpwent_r_proto'
24787 endservent_r_proto='$endservent_r_proto'
24788 eunicefix='$eunicefix'
24789 exe_ext='$exe_ext'
24790 expr='$expr'
24791 extensions='$extensions'
24792 extern_C='$extern_C'
24793 extras='$extras'
24794 fflushNULL='$fflushNULL'
24795 fflushall='$fflushall'
24796 find='$find'
24797 firstmakefile='$firstmakefile'
24798 flex='$flex'
24799 fpossize='$fpossize'
24800 fpostype='$fpostype'
24801 freetype='$freetype'
24802 from='$from'
24803 full_ar='$full_ar'
24804 full_csh='$full_csh'
24805 full_sed='$full_sed'
24806 gccansipedantic='$gccansipedantic'
24807 gccosandvers='$gccosandvers'
24808 gccversion='$gccversion'
24809 getgrent_r_proto='$getgrent_r_proto'
24810 getgrgid_r_proto='$getgrgid_r_proto'
24811 getgrnam_r_proto='$getgrnam_r_proto'
24812 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24813 gethostbyname_r_proto='$gethostbyname_r_proto'
24814 gethostent_r_proto='$gethostent_r_proto'
24815 getlogin_r_proto='$getlogin_r_proto'
24816 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24817 getnetbyname_r_proto='$getnetbyname_r_proto'
24818 getnetent_r_proto='$getnetent_r_proto'
24819 getprotobyname_r_proto='$getprotobyname_r_proto'
24820 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24821 getprotoent_r_proto='$getprotoent_r_proto'
24822 getpwent_r_proto='$getpwent_r_proto'
24823 getpwnam_r_proto='$getpwnam_r_proto'
24824 getpwuid_r_proto='$getpwuid_r_proto'
24825 getservbyname_r_proto='$getservbyname_r_proto'
24826 getservbyport_r_proto='$getservbyport_r_proto'
24827 getservent_r_proto='$getservent_r_proto'
24828 getspnam_r_proto='$getspnam_r_proto'
24829 gidformat='$gidformat'
24830 gidsign='$gidsign'
24831 gidsize='$gidsize'
24832 gidtype='$gidtype'
24833 glibpth='$glibpth'
24834 gmake='$gmake'
24835 gmtime_r_proto='$gmtime_r_proto'
24836 gnulibc_version='$gnulibc_version'
24837 grep='$grep'
24838 groupcat='$groupcat'
24839 groupstype='$groupstype'
24840 gzip='$gzip'
24841 h_fcntl='$h_fcntl'
24842 h_sysfile='$h_sysfile'
24843 hint='$hint'
24844 hostcat='$hostcat'
24845 hostgenerate='$hostgenerate'
24846 hostosname='$hostosname'
24847 hostperl='$hostperl'
24848 html1dir='$html1dir'
24849 html1direxp='$html1direxp'
24850 html3dir='$html3dir'
24851 html3direxp='$html3direxp'
24852 i16size='$i16size'
24853 i16type='$i16type'
24854 i32size='$i32size'
24855 i32type='$i32type'
24856 i64size='$i64size'
24857 i64type='$i64type'
24858 i8size='$i8size'
24859 i8type='$i8type'
24860 i_arpainet='$i_arpainet'
24861 i_assert='$i_assert'
24862 i_bfd='$i_bfd'
24863 i_bsdioctl='$i_bsdioctl'
24864 i_crypt='$i_crypt'
24865 i_db='$i_db'
24866 i_dbm='$i_dbm'
24867 i_dirent='$i_dirent'
24868 i_dlfcn='$i_dlfcn'
24869 i_execinfo='$i_execinfo'
24870 i_fcntl='$i_fcntl'
24871 i_fenv='$i_fenv'
24872 i_float='$i_float'
24873 i_fp='$i_fp'
24874 i_fp_class='$i_fp_class'
24875 i_gdbm='$i_gdbm'
24876 i_gdbm_ndbm='$i_gdbm_ndbm'
24877 i_gdbmndbm='$i_gdbmndbm'
24878 i_grp='$i_grp'
24879 i_ieeefp='$i_ieeefp'
24880 i_inttypes='$i_inttypes'
24881 i_langinfo='$i_langinfo'
24882 i_libutil='$i_libutil'
24883 i_limits='$i_limits'
24884 i_locale='$i_locale'
24885 i_machcthr='$i_machcthr'
24886 i_malloc='$i_malloc'
24887 i_mallocmalloc='$i_mallocmalloc'
24888 i_math='$i_math'
24889 i_memory='$i_memory'
24890 i_mntent='$i_mntent'
24891 i_ndbm='$i_ndbm'
24892 i_netdb='$i_netdb'
24893 i_neterrno='$i_neterrno'
24894 i_netinettcp='$i_netinettcp'
24895 i_niin='$i_niin'
24896 i_poll='$i_poll'
24897 i_prot='$i_prot'
24898 i_pthread='$i_pthread'
24899 i_pwd='$i_pwd'
24900 i_quadmath='$i_quadmath'
24901 i_rpcsvcdbm='$i_rpcsvcdbm'
24902 i_sgtty='$i_sgtty'
24903 i_shadow='$i_shadow'
24904 i_socks='$i_socks'
24905 i_stdarg='$i_stdarg'
24906 i_stdbool='$i_stdbool'
24907 i_stddef='$i_stddef'
24908 i_stdint='$i_stdint'
24909 i_stdlib='$i_stdlib'
24910 i_string='$i_string'
24911 i_sunmath='$i_sunmath'
24912 i_sysaccess='$i_sysaccess'
24913 i_sysdir='$i_sysdir'
24914 i_sysfile='$i_sysfile'
24915 i_sysfilio='$i_sysfilio'
24916 i_sysin='$i_sysin'
24917 i_sysioctl='$i_sysioctl'
24918 i_syslog='$i_syslog'
24919 i_sysmman='$i_sysmman'
24920 i_sysmode='$i_sysmode'
24921 i_sysmount='$i_sysmount'
24922 i_sysndir='$i_sysndir'
24923 i_sysparam='$i_sysparam'
24924 i_syspoll='$i_syspoll'
24925 i_sysresrc='$i_sysresrc'
24926 i_syssecrt='$i_syssecrt'
24927 i_sysselct='$i_sysselct'
24928 i_syssockio='$i_syssockio'
24929 i_sysstat='$i_sysstat'
24930 i_sysstatfs='$i_sysstatfs'
24931 i_sysstatvfs='$i_sysstatvfs'
24932 i_systime='$i_systime'
24933 i_systimek='$i_systimek'
24934 i_systimes='$i_systimes'
24935 i_systypes='$i_systypes'
24936 i_sysuio='$i_sysuio'
24937 i_sysun='$i_sysun'
24938 i_sysutsname='$i_sysutsname'
24939 i_sysvfs='$i_sysvfs'
24940 i_syswait='$i_syswait'
24941 i_termio='$i_termio'
24942 i_termios='$i_termios'
24943 i_time='$i_time'
24944 i_unistd='$i_unistd'
24945 i_ustat='$i_ustat'
24946 i_utime='$i_utime'
24947 i_values='$i_values'
24948 i_varargs='$i_varargs'
24949 i_varhdr='$i_varhdr'
24950 i_vfork='$i_vfork'
24951 ignore_versioned_solibs='$ignore_versioned_solibs'
24952 inc_version_list='$inc_version_list'
24953 inc_version_list_init='$inc_version_list_init'
24954 incpath='$incpath'
24955 incpth='$incpth'
24956 inews='$inews'
24957 initialinstalllocation='$initialinstalllocation'
24958 installarchlib='$installarchlib'
24959 installbin='$installbin'
24960 installhtml1dir='$installhtml1dir'
24961 installhtml3dir='$installhtml3dir'
24962 installman1dir='$installman1dir'
24963 installman3dir='$installman3dir'
24964 installprefix='$installprefix'
24965 installprefixexp='$installprefixexp'
24966 installprivlib='$installprivlib'
24967 installscript='$installscript'
24968 installsitearch='$installsitearch'
24969 installsitebin='$installsitebin'
24970 installsitehtml1dir='$installsitehtml1dir'
24971 installsitehtml3dir='$installsitehtml3dir'
24972 installsitelib='$installsitelib'
24973 installsiteman1dir='$installsiteman1dir'
24974 installsiteman3dir='$installsiteman3dir'
24975 installsitescript='$installsitescript'
24976 installstyle='$installstyle'
24977 installusrbinperl='$installusrbinperl'
24978 installvendorarch='$installvendorarch'
24979 installvendorbin='$installvendorbin'
24980 installvendorhtml1dir='$installvendorhtml1dir'
24981 installvendorhtml3dir='$installvendorhtml3dir'
24982 installvendorlib='$installvendorlib'
24983 installvendorman1dir='$installvendorman1dir'
24984 installvendorman3dir='$installvendorman3dir'
24985 installvendorscript='$installvendorscript'
24986 intsize='$intsize'
24987 issymlink='$issymlink'
24988 ivdformat='$ivdformat'
24989 ivsize='$ivsize'
24990 ivtype='$ivtype'
24991 known_extensions='$known_extensions'
24992 ksh='$ksh'
24993 ld='$ld'
24994 ld_can_script='$ld_can_script'
24995 lddlflags='$lddlflags'
24996 ldflags='$ldflags'
24997 ldflags_uselargefiles='$ldflags_uselargefiles'
24998 ldlibpthname='$ldlibpthname'
24999 less='$less'
25000 lib_ext='$lib_ext'
25001 libc='$libc'
25002 libperl='$libperl'
25003 libpth='$libpth'
25004 libs='$libs'
25005 libsdirs='$libsdirs'
25006 libsfiles='$libsfiles'
25007 libsfound='$libsfound'
25008 libspath='$libspath'
25009 libswanted='$libswanted'
25010 libswanted_uselargefiles='$libswanted_uselargefiles'
25011 line='$line'
25012 lint='$lint'
25013 lkflags='$lkflags'
25014 ln='$ln'
25015 lns='$lns'
25016 localtime_r_proto='$localtime_r_proto'
25017 locincpth='$locincpth'
25018 loclibpth='$loclibpth'
25019 longdblinfbytes='$longdblinfbytes'
25020 longdblkind='$longdblkind'
25021 longdblmantbits='$longdblmantbits'
25022 longdblnanbytes='$longdblnanbytes'
25023 longdblsize='$longdblsize'
25024 longlongsize='$longlongsize'
25025 longsize='$longsize'
25026 lp='$lp'
25027 lpr='$lpr'
25028 ls='$ls'
25029 lseeksize='$lseeksize'
25030 lseektype='$lseektype'
25031 mail='$mail'
25032 mailx='$mailx'
25033 make='$make'
25034 make_set_make='$make_set_make'
25035 mallocobj='$mallocobj'
25036 mallocsrc='$mallocsrc'
25037 malloctype='$malloctype'
25038 man1dir='$man1dir'
25039 man1direxp='$man1direxp'
25040 man1ext='$man1ext'
25041 man3dir='$man3dir'
25042 man3direxp='$man3direxp'
25043 man3ext='$man3ext'
25044 mips_type='$mips_type'
25045 mistrustnm='$mistrustnm'
25046 mkdir='$mkdir'
25047 mmaptype='$mmaptype'
25048 modetype='$modetype'
25049 more='$more'
25050 multiarch='$multiarch'
25051 mv='$mv'
25052 myarchname='$myarchname'
25053 mydomain='$mydomain'
25054 myhostname='$myhostname'
25055 myuname='$myuname'
25056 n='$n'
25057 need_va_copy='$need_va_copy'
25058 netdb_hlen_type='$netdb_hlen_type'
25059 netdb_host_type='$netdb_host_type'
25060 netdb_name_type='$netdb_name_type'
25061 netdb_net_type='$netdb_net_type'
25062 nm='$nm'
25063 nm_opt='$nm_opt'
25064 nm_so_opt='$nm_so_opt'
25065 nonxs_ext='$nonxs_ext'
25066 nroff='$nroff'
25067 nvEUformat='$nvEUformat'
25068 nvFUformat='$nvFUformat'
25069 nvGUformat='$nvGUformat'
25070 nv_overflows_integers_at='$nv_overflows_integers_at'
25071 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25072 nveformat='$nveformat'
25073 nvfformat='$nvfformat'
25074 nvgformat='$nvgformat'
25075 nvmantbits='$nvmantbits'
25076 nvsize='$nvsize'
25077 nvtype='$nvtype'
25078 o_nonblock='$o_nonblock'
25079 obj_ext='$obj_ext'
25080 old_pthread_create_joinable='$old_pthread_create_joinable'
25081 optimize='$optimize'
25082 orderlib='$orderlib'
25083 osname='$osname'
25084 osvers='$osvers'
25085 otherlibdirs='$otherlibdirs'
25086 package='$package'
25087 pager='$pager'
25088 passcat='$passcat'
25089 patchlevel='$patchlevel'
25090 path_sep='$path_sep'
25091 perl5='$perl5'
25092 perl='$perl'
25093 perl_patchlevel='$perl_patchlevel'
25094 perl_static_inline='$perl_static_inline'
25095 perladmin='$perladmin'
25096 perllibs='$perllibs'
25097 perlpath='$perlpath'
25098 pg='$pg'
25099 phostname='$phostname'
25100 pidtype='$pidtype'
25101 plibpth='$plibpth'
25102 pmake='$pmake'
25103 pr='$pr'
25104 prefix='$prefix'
25105 prefixexp='$prefixexp'
25106 privlib='$privlib'
25107 privlibexp='$privlibexp'
25108 procselfexe='$procselfexe'
25109 prototype='$prototype'
25110 ptrsize='$ptrsize'
25111 quadkind='$quadkind'
25112 quadtype='$quadtype'
25113 randbits='$randbits'
25114 randfunc='$randfunc'
25115 random_r_proto='$random_r_proto'
25116 randseedtype='$randseedtype'
25117 ranlib='$ranlib'
25118 rd_nodata='$rd_nodata'
25119 readdir64_r_proto='$readdir64_r_proto'
25120 readdir_r_proto='$readdir_r_proto'
25121 revision='$revision'
25122 rm='$rm'
25123 rm_try='$rm_try'
25124 rmail='$rmail'
25125 run='$run'
25126 runnm='$runnm'
25127 sGMTIME_max='$sGMTIME_max'
25128 sGMTIME_min='$sGMTIME_min'
25129 sLOCALTIME_max='$sLOCALTIME_max'
25130 sLOCALTIME_min='$sLOCALTIME_min'
25131 sPRIEUldbl='$sPRIEUldbl'
25132 sPRIFUldbl='$sPRIFUldbl'
25133 sPRIGUldbl='$sPRIGUldbl'
25134 sPRIXU64='$sPRIXU64'
25135 sPRId64='$sPRId64'
25136 sPRIeldbl='$sPRIeldbl'
25137 sPRIfldbl='$sPRIfldbl'
25138 sPRIgldbl='$sPRIgldbl'
25139 sPRIi64='$sPRIi64'
25140 sPRIo64='$sPRIo64'
25141 sPRIu64='$sPRIu64'
25142 sPRIx64='$sPRIx64'
25143 sSCNfldbl='$sSCNfldbl'
25144 sched_yield='$sched_yield'
25145 scriptdir='$scriptdir'
25146 scriptdirexp='$scriptdirexp'
25147 sed='$sed'
25148 seedfunc='$seedfunc'
25149 selectminbits='$selectminbits'
25150 selecttype='$selecttype'
25151 sendmail='$sendmail'
25152 setgrent_r_proto='$setgrent_r_proto'
25153 sethostent_r_proto='$sethostent_r_proto'
25154 setlocale_r_proto='$setlocale_r_proto'
25155 setnetent_r_proto='$setnetent_r_proto'
25156 setprotoent_r_proto='$setprotoent_r_proto'
25157 setpwent_r_proto='$setpwent_r_proto'
25158 setservent_r_proto='$setservent_r_proto'
25159 sh='$sh'
25160 shar='$shar'
25161 sharpbang='$sharpbang'
25162 shmattype='$shmattype'
25163 shortsize='$shortsize'
25164 shrpenv='$shrpenv'
25165 shsharp='$shsharp'
25166 sig_count='$sig_count'
25167 sig_name='$sig_name'
25168 sig_name_init='$sig_name_init'
25169 sig_num='$sig_num'
25170 sig_num_init='$sig_num_init'
25171 sig_size='$sig_size'
25172 signal_t='$signal_t'
25173 sitearch='$sitearch'
25174 sitearchexp='$sitearchexp'
25175 sitebin='$sitebin'
25176 sitebinexp='$sitebinexp'
25177 sitehtml1dir='$sitehtml1dir'
25178 sitehtml1direxp='$sitehtml1direxp'
25179 sitehtml3dir='$sitehtml3dir'
25180 sitehtml3direxp='$sitehtml3direxp'
25181 sitelib='$sitelib'
25182 sitelib_stem='$sitelib_stem'
25183 sitelibexp='$sitelibexp'
25184 siteman1dir='$siteman1dir'
25185 siteman1direxp='$siteman1direxp'
25186 siteman3dir='$siteman3dir'
25187 siteman3direxp='$siteman3direxp'
25188 siteprefix='$siteprefix'
25189 siteprefixexp='$siteprefixexp'
25190 sitescript='$sitescript'
25191 sitescriptexp='$sitescriptexp'
25192 sizesize='$sizesize'
25193 sizetype='$sizetype'
25194 sleep='$sleep'
25195 smail='$smail'
25196 so='$so'
25197 sockethdr='$sockethdr'
25198 socketlib='$socketlib'
25199 socksizetype='$socksizetype'
25200 sort='$sort'
25201 spackage='$spackage'
25202 spitshell='$spitshell'
25203 srand48_r_proto='$srand48_r_proto'
25204 srandom_r_proto='$srandom_r_proto'
25205 src='$src'
25206 ssizetype='$ssizetype'
25207 st_ino_sign='$st_ino_sign'
25208 st_ino_size='$st_ino_size'
25209 startperl='$startperl'
25210 startsh='$startsh'
25211 static_ext='$static_ext'
25212 stdchar='$stdchar'
25213 stdio_base='$stdio_base'
25214 stdio_bufsiz='$stdio_bufsiz'
25215 stdio_cnt='$stdio_cnt'
25216 stdio_filbuf='$stdio_filbuf'
25217 stdio_ptr='$stdio_ptr'
25218 stdio_stream_array='$stdio_stream_array'
25219 strerror_r_proto='$strerror_r_proto'
25220 strings='$strings'
25221 submit='$submit'
25222 subversion='$subversion'
25223 sysman='$sysman'
25224 sysroot='$sysroot'
25225 tail='$tail'
25226 tar='$tar'
25227 targetarch='$targetarch'
25228 targetdir='$targetdir'
25229 targetenv='$targetenv'
25230 targethost='$targethost'
25231 targetmkdir='$targetmkdir'
25232 targetport='$targetport'
25233 targetsh='$targetsh'
25234 tbl='$tbl'
25235 tee='$tee'
25236 test='$test'
25237 timeincl='$timeincl'
25238 timetype='$timetype'
25239 tmpnam_r_proto='$tmpnam_r_proto'
25240 to='$to'
25241 touch='$touch'
25242 tr='$tr'
25243 trnl='$trnl'
25244 troff='$troff'
25245 ttyname_r_proto='$ttyname_r_proto'
25246 u16size='$u16size'
25247 u16type='$u16type'
25248 u32size='$u32size'
25249 u32type='$u32type'
25250 u64size='$u64size'
25251 u64type='$u64type'
25252 u8size='$u8size'
25253 u8type='$u8type'
25254 uidformat='$uidformat'
25255 uidsign='$uidsign'
25256 uidsize='$uidsize'
25257 uidtype='$uidtype'
25258 uname='$uname'
25259 uniq='$uniq'
25260 uquadtype='$uquadtype'
25261 use5005threads='$use5005threads'
25262 use64bitall='$use64bitall'
25263 use64bitint='$use64bitint'
25264 usecbacktrace='$usecbacktrace'
25265 usecrosscompile='$usecrosscompile'
25266 usedevel='$usedevel'
25267 usedl='$usedl'
25268 usedtrace='$usedtrace'
25269 usefaststdio='$usefaststdio'
25270 useithreads='$useithreads'
25271 usekernprocpathname='$usekernprocpathname'
25272 uselargefiles='$uselargefiles'
25273 uselongdouble='$uselongdouble'
25274 usemallocwrap='$usemallocwrap'
25275 usemorebits='$usemorebits'
25276 usemultiplicity='$usemultiplicity'
25277 usemymalloc='$usemymalloc'
25278 usenm='$usenm'
25279 usensgetexecutablepath='$usensgetexecutablepath'
25280 useopcode='$useopcode'
25281 useperlio='$useperlio'
25282 useposix='$useposix'
25283 usequadmath='$usequadmath'
25284 usereentrant='$usereentrant'
25285 userelocatableinc='$userelocatableinc'
25286 useshrplib='$useshrplib'
25287 usesitecustomize='$usesitecustomize'
25288 usesocks='$usesocks'
25289 usethreads='$usethreads'
25290 usevendorprefix='$usevendorprefix'
25291 useversionedarchname='$useversionedarchname'
25292 usevfork='$usevfork'
25293 usrinc='$usrinc'
25294 uuname='$uuname'
25295 uvXUformat='$uvXUformat'
25296 uvoformat='$uvoformat'
25297 uvsize='$uvsize'
25298 uvtype='$uvtype'
25299 uvuformat='$uvuformat'
25300 uvxformat='$uvxformat'
25301 vaproto='$vaproto'
25302 vendorarch='$vendorarch'
25303 vendorarchexp='$vendorarchexp'
25304 vendorbin='$vendorbin'
25305 vendorbinexp='$vendorbinexp'
25306 vendorhtml1dir='$vendorhtml1dir'
25307 vendorhtml1direxp='$vendorhtml1direxp'
25308 vendorhtml3dir='$vendorhtml3dir'
25309 vendorhtml3direxp='$vendorhtml3direxp'
25310 vendorlib='$vendorlib'
25311 vendorlib_stem='$vendorlib_stem'
25312 vendorlibexp='$vendorlibexp'
25313 vendorman1dir='$vendorman1dir'
25314 vendorman1direxp='$vendorman1direxp'
25315 vendorman3dir='$vendorman3dir'
25316 vendorman3direxp='$vendorman3direxp'
25317 vendorprefix='$vendorprefix'
25318 vendorprefixexp='$vendorprefixexp'
25319 vendorscript='$vendorscript'
25320 vendorscriptexp='$vendorscriptexp'
25321 version='$version'
25322 version_patchlevel_string='$version_patchlevel_string'
25323 versiononly='$versiononly'
25324 vi='$vi'
25325 xlibpth='$xlibpth'
25326 yacc='$yacc'
25327 yaccflags='$yaccflags'
25328 zcat='$zcat'
25329 zip='$zip'
25330 EOT
25331
25332 : add special variables
25333 $test -f $src/patchlevel.h && \
25334 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25335 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25336 echo "PERL_CONFIG_SH=true" >>config.sh
25337
25338 : propagate old symbols
25339 if $test -f UU/config.sh; then
25340         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25341         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25342                 config.sh config.sh UU/oldconfig.sh |\
25343                 $sort | $uniq -u >UU/oldsyms
25344         set X `$cat UU/oldsyms`
25345         shift
25346         case $# in
25347         0) ;;
25348         *)
25349                 $cat <<EOM
25350 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25351 EOM
25352                 echo ": Variables propagated from previous config.sh file." >>config.sh
25353                 for sym in `$cat UU/oldsyms`; do
25354                         echo "    Propagating $hint variable "'$'"$sym..."
25355                         eval 'tmp="$'"${sym}"'"'
25356                         echo "$tmp" | \
25357                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25358                 done
25359                 ;;
25360         esac
25361 fi
25362
25363 : preserve RCS keywords in files with variable substitution, grrr
25364 Id='$Id'
25365
25366 : Finish up by extracting the .SH files
25367 case "$alldone" in
25368 exit)
25369         $rm -rf UU
25370         echo "Extraction done."
25371         exit 0
25372         ;;
25373 cont)
25374         ;;
25375 '')
25376         dflt=''
25377         nostick=true
25378         $cat <<EOM
25379
25380 If you'd like to make any changes to the config.sh file before I begin
25381 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25382
25383 EOM
25384         rp="Press return or use a shell escape to edit config.sh:"
25385         . UU/myread
25386         nostick=''
25387         case "$ans" in
25388         '') ;;
25389         *) : in case they cannot read
25390                 sh 1>&4 -c "$ans";;
25391         esac
25392         ;;
25393 esac
25394
25395 : if this fails, just run all the .SH files by hand
25396 . ./config.sh
25397
25398 echo " "
25399 exec 1>&4
25400 pwd=`pwd`
25401 . ./UU/extract
25402 cd "$pwd"
25403
25404 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25405         dflt=y
25406         case "$silent" in
25407         true) ;;
25408         *)
25409                 $cat <<EOM
25410
25411 Now you need to generate make dependencies by running "$make depend".
25412 You might prefer to run it in background: "$make depend > makedepend.out &"
25413 It can take a while, so you might not want to run it right now.
25414
25415 EOM
25416                 ;;
25417         esac
25418         rp="Run $make depend now?"
25419         . UU/myread
25420         case "$ans" in
25421         y*)
25422                 $make depend && echo "Now you must run '$make'."
25423                 ;;
25424         *)
25425                 echo "You must run '$make depend' then '$make'."
25426                 ;;
25427         esac
25428 elif test -f [Mm]akefile; then
25429         echo " "
25430         echo "Now you must run a $make."
25431 else
25432         echo "Configure done."
25433 fi
25434
25435 if $test -f Policy.sh; then
25436     $cat <<EOM
25437
25438 If you compile $package on a different machine or from a different object
25439 directory, copy the Policy.sh file from this object directory to the
25440 new one before you run Configure -- this will help you with most of
25441 the policy defaults.
25442
25443 EOM
25444 fi
25445 if $test -f config.msg; then
25446     echo "Hmm.  I also noted the following information while running:"
25447     echo " "
25448     $cat config.msg >&4
25449     $rm -f config.msg
25450 fi
25451 $rm -f kit*isdone ark*isdone
25452 $rm -rf UU
25453
25454 : End of Configure
25455