This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Configure: mixed-endian double-doubles
[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_fdim=''
479 d_fegetround=''
480 d_fgetpos=''
481 d_finite=''
482 d_finitel=''
483 d_flexfnam=''
484 d_flock=''
485 d_flockproto=''
486 d_fma=''
487 d_fmax=''
488 d_fmin=''
489 d_fork=''
490 d_fp_class=''
491 d_fp_classl=''
492 d_fpclass=''
493 d_fp_classify=''
494 d_fpclassify=''
495 d_fpclassl=''
496 d_fpgetround=''
497 d_fpos64_t=''
498 d_frexpl=''
499 d_fs_data_s=''
500 d_fseeko=''
501 d_fsetpos=''
502 d_fstatfs=''
503 d_fsync=''
504 d_ftello=''
505 d_ftime=''
506 d_gettimeod=''
507 d_futimes=''
508 d_Gconvert=''
509 d_getaddrinfo=''
510 d_getcwd=''
511 d_getespwnam=''
512 d_getfsstat=''
513 d_getgrent=''
514 d_getgrent_r=''
515 getgrent_r_proto=''
516 d_getgrgid_r=''
517 getgrgid_r_proto=''
518 d_getgrnam_r=''
519 getgrnam_r_proto=''
520 d_getgrps=''
521 d_gethbyaddr=''
522 d_gethbyname=''
523 d_gethent=''
524 aphostname=''
525 d_gethname=''
526 d_phostname=''
527 d_uname=''
528 d_gethostbyaddr_r=''
529 gethostbyaddr_r_proto=''
530 d_gethostbyname_r=''
531 gethostbyname_r_proto=''
532 d_gethostent_r=''
533 gethostent_r_proto=''
534 d_gethostprotos=''
535 d_getitimer=''
536 d_getlogin=''
537 d_getlogin_r=''
538 getlogin_r_proto=''
539 d_getmnt=''
540 d_getmntent=''
541 d_getnameinfo=''
542 d_getnbyaddr=''
543 d_getnbyname=''
544 d_getnent=''
545 d_getnetbyaddr_r=''
546 getnetbyaddr_r_proto=''
547 d_getnetbyname_r=''
548 getnetbyname_r_proto=''
549 d_getnetent_r=''
550 getnetent_r_proto=''
551 d_getnetprotos=''
552 d_getpagsz=''
553 d_getpent=''
554 d_getpgid=''
555 d_getpgrp2=''
556 d_bsdgetpgrp=''
557 d_getpgrp=''
558 d_getppid=''
559 d_getprior=''
560 d_getpbyname=''
561 d_getpbynumber=''
562 d_getprotobyname_r=''
563 getprotobyname_r_proto=''
564 d_getprotobynumber_r=''
565 getprotobynumber_r_proto=''
566 d_getprotoent_r=''
567 getprotoent_r_proto=''
568 d_getprotoprotos=''
569 d_getprpwnam=''
570 d_getpwent=''
571 d_getpwent_r=''
572 getpwent_r_proto=''
573 d_getpwnam_r=''
574 getpwnam_r_proto=''
575 d_getpwuid_r=''
576 getpwuid_r_proto=''
577 d_getsent=''
578 d_getservbyname_r=''
579 getservbyname_r_proto=''
580 d_getservbyport_r=''
581 getservbyport_r_proto=''
582 d_getservent_r=''
583 getservent_r_proto=''
584 d_getservprotos=''
585 d_getspnam=''
586 d_getspnam_r=''
587 getspnam_r_proto=''
588 d_getsbyname=''
589 d_getsbyport=''
590 d_gmtime_r=''
591 gmtime_r_proto=''
592 d_gnulibc=''
593 gnulibc_version=''
594 d_hasmntopt=''
595 d_htonl=''
596 d_hypot=''
597 d_ilogb=''
598 d_ilogbl=''
599 d_inetaton=''
600 d_inetntop=''
601 d_inetpton=''
602 d_int64_t=''
603 d_isascii=''
604 d_isblank=''
605 d_isfinite=''
606 d_isfinitel=''
607 d_isinf=''
608 d_isinfl=''
609 d_isless=''
610 d_isnan=''
611 d_isnanl=''
612 d_isnormal=''
613 d_j0=''
614 d_j0l=''
615 d_killpg=''
616 d_lc_monetary_2008=''
617 d_lchown=''
618 d_ldbl_dig=''
619 d_lgamma=''
620 d_lgamma_r=''
621 d_libm_lib_version=''
622 d_link=''
623 d_llrint=''
624 d_llrintl=''
625 d_llround=''
626 d_llroundl=''
627 d_localtime_r=''
628 d_localtime_r_needs_tzset=''
629 localtime_r_proto=''
630 d_locconv=''
631 d_lockf=''
632 d_log1p=''
633 d_log2=''
634 d_logb=''
635 d_ldexpl=''
636 d_longdbl=''
637 longdblkind=''
638 longdblsize=''
639 d_longlong=''
640 longlongsize=''
641 d_lrint=''
642 d_lrintl=''
643 d_lround=''
644 d_lroundl=''
645 d_lseekproto=''
646 d_lstat=''
647 d_madvise=''
648 d_malloc_good_size=''
649 d_malloc_size=''
650 d_mblen=''
651 d_mbstowcs=''
652 d_mbtowc=''
653 d_memchr=''
654 d_memcmp=''
655 d_memcpy=''
656 d_memmove=''
657 d_memset=''
658 d_mkdir=''
659 d_mkdtemp=''
660 d_mkfifo=''
661 d_mkstemp=''
662 d_mkstemps=''
663 d_mktime=''
664 d_mmap=''
665 mmaptype=''
666 d_modfl=''
667 d_modfl_pow32_bug=''
668 d_modflproto=''
669 d_mprotect=''
670 d_msg=''
671 d_msgctl=''
672 d_msgget=''
673 d_msghdr_s=''
674 d_msgrcv=''
675 d_msgsnd=''
676 d_msync=''
677 d_munmap=''
678 d_nan=''
679 d_nearbyint=''
680 d_nextafter=''
681 d_nexttoward=''
682 d_nice=''
683 d_nl_langinfo=''
684 d_off64_t=''
685 d_open3=''
686 d_fpathconf=''
687 d_pathconf=''
688 d_pause=''
689 d_pipe=''
690 d_poll=''
691 d_portable=''
692 d_prctl=''
693 d_prctl_set_name=''
694 d_procselfexe=''
695 procselfexe=''
696 d_old_pthread_create_joinable=''
697 old_pthread_create_joinable=''
698 d_pthread_atfork=''
699 d_pthread_attr_setscope=''
700 d_pthread_yield=''
701 d_sched_yield=''
702 sched_yield=''
703 d_ptrdiff_t=''
704 d_qgcvt=''
705 d_random_r=''
706 random_r_proto=''
707 d_readdir64_r=''
708 readdir64_r_proto=''
709 d_readdir=''
710 d_rewinddir=''
711 d_seekdir=''
712 d_telldir=''
713 d_readdir_r=''
714 readdir_r_proto=''
715 d_readlink=''
716 d_readv=''
717 d_recvmsg=''
718 d_re_comp=''
719 d_regcmp=''
720 d_regcomp=''
721 d_remainder=''
722 d_remquo=''
723 d_rename=''
724 d_rint=''
725 d_rmdir=''
726 d_round=''
727 d_safebcpy=''
728 d_safemcpy=''
729 d_sanemcmp=''
730 d_sbrkproto=''
731 d_scalbn=''
732 d_scalbnl=''
733 d_select=''
734 d_sem=''
735 d_semctl=''
736 d_semget=''
737 d_semop=''
738 d_sendmsg=''
739 d_setegid=''
740 d_seteuid=''
741 d_setgrent=''
742 d_setgrent_r=''
743 setgrent_r_proto=''
744 d_setgrps=''
745 d_sethent=''
746 d_sethostent_r=''
747 sethostent_r_proto=''
748 d_setitimer=''
749 d_setlinebuf=''
750 d_setlocale=''
751 d_setlocale_r=''
752 setlocale_r_proto=''
753 d_setnent=''
754 d_setnetent_r=''
755 setnetent_r_proto=''
756 d_setpent=''
757 d_setpgid=''
758 d_setpgrp2=''
759 d_bsdsetpgrp=''
760 d_setpgrp=''
761 d_setprior=''
762 d_setproctitle=''
763 d_setprotoent_r=''
764 setprotoent_r_proto=''
765 d_setpwent=''
766 d_setpwent_r=''
767 setpwent_r_proto=''
768 d_setregid=''
769 d_setresgid=''
770 d_setresuid=''
771 d_setreuid=''
772 d_setrgid=''
773 d_setruid=''
774 d_setsent=''
775 d_setservent_r=''
776 setservent_r_proto=''
777 d_setsid=''
778 d_setvbuf=''
779 d_shm=''
780 d_shmat=''
781 d_shmatprototype=''
782 shmattype=''
783 d_shmctl=''
784 d_shmdt=''
785 d_shmget=''
786 d_sigaction=''
787 d_signbit=''
788 d_sigprocmask=''
789 d_sigsetjmp=''
790 usesitecustomize=''
791 d_snprintf=''
792 d_vsnprintf=''
793 d_sockatmark=''
794 d_sockatmarkproto=''
795 d_ip_mreq=''
796 d_ip_mreq_source=''
797 d_ipv6_mreq=''
798 d_ipv6_mreq_source=''
799 d_msg_ctrunc=''
800 d_msg_dontroute=''
801 d_msg_oob=''
802 d_msg_peek=''
803 d_msg_proxy=''
804 d_oldsock=''
805 d_scm_rights=''
806 d_sin6_scope_id=''
807 d_sockaddr_in6=''
808 d_sockaddr_sa_len=''
809 d_socket=''
810 d_sockpair=''
811 sockethdr=''
812 socketlib=''
813 d_socklen_t=''
814 d_socks5_init=''
815 d_sprintf_returns_strlen=''
816 d_sqrtl=''
817 d_srand48_r=''
818 srand48_r_proto=''
819 d_srandom_r=''
820 srandom_r_proto=''
821 d_sresgproto=''
822 d_sresuproto=''
823 d_stat=''
824 d_statblks=''
825 d_statfs_f_flags=''
826 d_statfs_s=''
827 d_static_inline=''
828 perl_static_inline=''
829 d_fstatvfs=''
830 d_statvfs=''
831 d_stdio_cnt_lval=''
832 d_stdio_ptr_lval=''
833 d_stdio_ptr_lval_nochange_cnt=''
834 d_stdio_ptr_lval_sets_cnt=''
835 d_stdiobase=''
836 d_stdstdio=''
837 stdio_base=''
838 stdio_bufsiz=''
839 stdio_cnt=''
840 stdio_filbuf=''
841 stdio_ptr=''
842 d_index=''
843 d_strchr=''
844 d_strcoll=''
845 d_strctcpy=''
846 d_strerrm=''
847 d_strerror=''
848 d_sysernlst=''
849 d_syserrlst=''
850 d_strerror_r=''
851 strerror_r_proto=''
852 d_strftime=''
853 d_strlcat=''
854 d_strlcpy=''
855 d_strtod=''
856 d_strtol=''
857 d_strtold=''
858 d_strtoll=''
859 d_strtoq=''
860 d_strtoul=''
861 d_strtoull=''
862 d_strtouq=''
863 d_strxfrm=''
864 d_symlink=''
865 d_syscall=''
866 d_syscallproto=''
867 d_sysconf=''
868 d_system=''
869 d_tcgetpgrp=''
870 d_tcsetpgrp=''
871 d_telldirproto=''
872 d_tgamma=''
873 d_time=''
874 timetype=''
875 d_asctime64=''
876 d_ctime64=''
877 d_difftime64=''
878 d_gmtime64=''
879 d_localtime64=''
880 d_mktime64=''
881 d_timegm=''
882 clocktype=''
883 d_times=''
884 d_tmpnam_r=''
885 tmpnam_r_proto=''
886 d_trunc=''
887 d_truncate=''
888 d_truncl=''
889 d_ttyname_r=''
890 ttyname_r_proto=''
891 d_tzname=''
892 d_u32align=''
893 d_ualarm=''
894 d_umask=''
895 d_semctl_semid_ds=''
896 d_semctl_semun=''
897 d_union_semun=''
898 d_unordered=''
899 d_unsetenv=''
900 d_usleep=''
901 d_usleepproto=''
902 d_ustat=''
903 d_pseudofork=''
904 d_vfork=''
905 usevfork=''
906 d_voidsig=''
907 signal_t=''
908 d_volatile=''
909 d_charvspr=''
910 d_vprintf=''
911 d_wait4=''
912 d_waitpid=''
913 d_wcscmp=''
914 d_wcstombs=''
915 d_wcsxfrm=''
916 d_wctomb=''
917 d_writev=''
918 dlext=''
919 bin_ELF=''
920 cccdlflags=''
921 ccdlflags=''
922 dlsrc=''
923 ld=''
924 ld_can_script=''
925 lddlflags=''
926 usedl=''
927 doublesize=''
928 ebcdic=''
929 fflushNULL=''
930 fflushall=''
931 fpossize=''
932 fpostype=''
933 gccansipedantic=''
934 gccosandvers=''
935 gccversion=''
936 gidformat=''
937 gidsign=''
938 gidsize=''
939 gidtype=''
940 groupstype=''
941 h_fcntl=''
942 h_sysfile=''
943 html1dir=''
944 html1direxp=''
945 installhtml1dir=''
946 html3dir=''
947 html3direxp=''
948 installhtml3dir=''
949 i_arpainet=''
950 i_assert=''
951 i_bfd=''
952 i_crypt=''
953 db_hashtype=''
954 db_prefixtype=''
955 db_version_major=''
956 db_version_minor=''
957 db_version_patch=''
958 i_db=''
959 i_dbm=''
960 i_rpcsvcdbm=''
961 d_dirnamlen=''
962 direntrytype=''
963 i_dirent=''
964 i_dlfcn=''
965 i_execinfo=''
966 i_fcntl=''
967 i_fenv=''
968 i_float=''
969 i_fp=''
970 i_fp_class=''
971 i_gdbm=''
972 d_grpasswd=''
973 i_grp=''
974 i_ieeefp=''
975 i_inttypes=''
976 i_langinfo=''
977 i_libutil=''
978 i_limits=''
979 i_locale=''
980 i_machcthr=''
981 i_malloc=''
982 i_mallocmalloc=''
983 i_math=''
984 i_memory=''
985 i_mntent=''
986 d_gdbm_ndbm_h_uses_prototypes=''
987 d_gdbmndbm_h_uses_prototypes=''
988 d_ndbm=''
989 d_ndbm_h_uses_prototypes=''
990 i_gdbm_ndbm=''
991 i_gdbmndbm=''
992 i_ndbm=''
993 i_netdb=''
994 i_neterrno=''
995 i_netinettcp=''
996 i_niin=''
997 i_sysin=''
998 i_poll=''
999 i_prot=''
1000 i_pthread=''
1001 d_pwage=''
1002 d_pwchange=''
1003 d_pwclass=''
1004 d_pwcomment=''
1005 d_pwexpire=''
1006 d_pwgecos=''
1007 d_pwpasswd=''
1008 d_pwquota=''
1009 i_pwd=''
1010 i_quadmath=''
1011 i_shadow=''
1012 i_socks=''
1013 i_stdbool=''
1014 i_stddef=''
1015 i_stdint=''
1016 i_stdlib=''
1017 i_string=''
1018 strings=''
1019 i_sunmath=''
1020 i_sysaccess=''
1021 i_sysdir=''
1022 i_sysfile=''
1023 d_voidtty=''
1024 i_bsdioctl=''
1025 i_sysfilio=''
1026 i_sysioctl=''
1027 i_syssockio=''
1028 i_syslog=''
1029 i_sysmman=''
1030 i_sysmode=''
1031 i_sysmount=''
1032 i_sysndir=''
1033 i_sysparam=''
1034 i_syspoll=''
1035 i_sysresrc=''
1036 i_syssecrt=''
1037 i_sysselct=''
1038 i_sysstat=''
1039 i_sysstatfs=''
1040 i_sysstatvfs=''
1041 i_systimes=''
1042 i_systypes=''
1043 i_sysuio=''
1044 i_sysun=''
1045 i_sysutsname=''
1046 i_sysvfs=''
1047 i_syswait=''
1048 i_sgtty=''
1049 i_termio=''
1050 i_termios=''
1051 d_tm_tm_gmtoff=''
1052 d_tm_tm_zone=''
1053 i_systime=''
1054 i_systimek=''
1055 i_time=''
1056 timeincl=''
1057 i_unistd=''
1058 i_ustat=''
1059 i_utime=''
1060 i_values=''
1061 i_stdarg=''
1062 i_varargs=''
1063 i_varhdr=''
1064 i_vfork=''
1065 d_inc_version_list=''
1066 inc_version_list=''
1067 inc_version_list_init=''
1068 doubleinfbytes=''
1069 doublenanbytes=''
1070 longdblinfbytes=''
1071 longdblnanbytes=''
1072 installprefix=''
1073 installprefixexp=''
1074 installstyle=''
1075 installusrbinperl=''
1076 intsize=''
1077 longsize=''
1078 shortsize=''
1079 issymlink=''
1080 libc=''
1081 ldlibpthname=''
1082 libperl=''
1083 shrpenv=''
1084 useshrplib=''
1085 glibpth=''
1086 incpth=''
1087 libpth=''
1088 loclibpth=''
1089 plibpth=''
1090 xlibpth=''
1091 ignore_versioned_solibs=''
1092 libs=''
1093 libsdirs=''
1094 libsfiles=''
1095 libsfound=''
1096 libspath=''
1097 lns=''
1098 d_PRIEUldbl=''
1099 d_PRIFUldbl=''
1100 d_PRIGUldbl=''
1101 d_PRIeldbl=''
1102 d_PRIfldbl=''
1103 d_PRIgldbl=''
1104 d_SCNfldbl=''
1105 doublekind=''
1106 sPRIEUldbl=''
1107 sPRIFUldbl=''
1108 sPRIGUldbl=''
1109 sPRIeldbl=''
1110 sPRIfldbl=''
1111 sPRIgldbl=''
1112 sSCNfldbl=''
1113 lseeksize=''
1114 lseektype=''
1115 make_set_make=''
1116 d_mymalloc=''
1117 freetype=''
1118 mallocobj=''
1119 mallocsrc=''
1120 malloctype=''
1121 usemallocwrap=''
1122 usemymalloc=''
1123 installman1dir=''
1124 man1dir=''
1125 man1direxp=''
1126 man1ext=''
1127 installman3dir=''
1128 man3dir=''
1129 man3direxp=''
1130 man3ext=''
1131 doublemantbits=''
1132 longdblmantbits=''
1133 nvmantbits=''
1134 modetype=''
1135 multiarch=''
1136 mydomain=''
1137 myhostname=''
1138 phostname=''
1139 c=''
1140 n=''
1141 d_eofnblk=''
1142 eagain=''
1143 o_nonblock=''
1144 rd_nodata=''
1145 need_va_copy=''
1146 netdb_hlen_type=''
1147 netdb_host_type=''
1148 netdb_name_type=''
1149 netdb_net_type=''
1150 groupcat=''
1151 hostcat=''
1152 passcat=''
1153 orderlib=''
1154 ranlib=''
1155 d_perl_otherlibdirs=''
1156 otherlibdirs=''
1157 package=''
1158 spackage=''
1159 pager=''
1160 api_revision=''
1161 api_subversion=''
1162 api_version=''
1163 api_versionstring=''
1164 patchlevel=''
1165 perl_patchlevel=''
1166 revision=''
1167 subversion=''
1168 version=''
1169 version_patchlevel_string=''
1170 perl5=''
1171 perladmin=''
1172 perlpath=''
1173 d_nv_preserves_uv=''
1174 d_nv_zero_is_allbits_zero=''
1175 i16size=''
1176 i16type=''
1177 i32size=''
1178 i32type=''
1179 i64size=''
1180 i64type=''
1181 i8size=''
1182 i8type=''
1183 ivsize=''
1184 ivtype=''
1185 nv_overflows_integers_at=''
1186 nv_preserves_uv_bits=''
1187 nvsize=''
1188 nvtype=''
1189 u16size=''
1190 u16type=''
1191 u32size=''
1192 u32type=''
1193 u64size=''
1194 u64type=''
1195 u8size=''
1196 u8type=''
1197 uvsize=''
1198 uvtype=''
1199 ivdformat=''
1200 nvEUformat=''
1201 nvFUformat=''
1202 nvGUformat=''
1203 nveformat=''
1204 nvfformat=''
1205 nvgformat=''
1206 uvXUformat=''
1207 uvoformat=''
1208 uvuformat=''
1209 uvxformat=''
1210 pidtype=''
1211 prefix=''
1212 prefixexp=''
1213 installprivlib=''
1214 privlib=''
1215 privlibexp=''
1216 prototype=''
1217 ptrsize=''
1218 d_PRIXU64=''
1219 d_PRId64=''
1220 d_PRIi64=''
1221 d_PRIo64=''
1222 d_PRIu64=''
1223 d_PRIx64=''
1224 sPRIXU64=''
1225 sPRId64=''
1226 sPRIi64=''
1227 sPRIo64=''
1228 sPRIu64=''
1229 sPRIx64=''
1230 d_quad=''
1231 quadkind=''
1232 quadtype=''
1233 uquadtype=''
1234 drand01=''
1235 randbits=''
1236 randfunc=''
1237 randseedtype=''
1238 seedfunc=''
1239 installscript=''
1240 scriptdir=''
1241 scriptdirexp=''
1242 selectminbits=''
1243 selecttype=''
1244 sh=''
1245 targetsh=''
1246 sig_count=''
1247 sig_name=''
1248 sig_name_init=''
1249 sig_num=''
1250 sig_num_init=''
1251 sig_size=''
1252 d_sitearch=''
1253 installsitearch=''
1254 sitearch=''
1255 sitearchexp=''
1256 installsitebin=''
1257 sitebin=''
1258 sitebinexp=''
1259 installsitehtml1dir=''
1260 sitehtml1dir=''
1261 sitehtml1direxp=''
1262 installsitehtml3dir=''
1263 sitehtml3dir=''
1264 sitehtml3direxp=''
1265 installsitelib=''
1266 sitelib=''
1267 sitelib_stem=''
1268 sitelibexp=''
1269 installsiteman1dir=''
1270 siteman1dir=''
1271 siteman1direxp=''
1272 installsiteman3dir=''
1273 siteman3dir=''
1274 siteman3direxp=''
1275 siteprefix=''
1276 siteprefixexp=''
1277 installsitescript=''
1278 sitescript=''
1279 sitescriptexp=''
1280 sizesize=''
1281 sizetype=''
1282 d_libname_unique=''
1283 so=''
1284 socksizetype=''
1285 sharpbang=''
1286 shsharp=''
1287 spitshell=''
1288 src=''
1289 ssizetype=''
1290 st_ino_sign=''
1291 st_ino_size=''
1292 startperl=''
1293 startsh=''
1294 stdchar=''
1295 d_stdio_stream_array=''
1296 stdio_stream_array=''
1297 sysman=''
1298 sGMTIME_max=''
1299 sGMTIME_min=''
1300 sLOCALTIME_max=''
1301 sLOCALTIME_min=''
1302 trnl=''
1303 uidformat=''
1304 uidsign=''
1305 uidsize=''
1306 uidtype=''
1307 archname64=''
1308 use64bitall=''
1309 use64bitint=''
1310 usecbacktrace=''
1311 dtrace=''
1312 usedtrace=''
1313 usefaststdio=''
1314 usekernprocpathname=''
1315 ccflags_uselargefiles=''
1316 ldflags_uselargefiles=''
1317 libswanted_uselargefiles=''
1318 uselargefiles=''
1319 uselongdouble=''
1320 usemorebits=''
1321 usemultiplicity=''
1322 nm_opt=''
1323 nm_so_opt=''
1324 runnm=''
1325 usenm=''
1326 usensgetexecutablepath=''
1327 useperlio=''
1328 usequadmath=''
1329 usesocks=''
1330 d_oldpthreads=''
1331 use5005threads=''
1332 useithreads=''
1333 usereentrant=''
1334 usethreads=''
1335 incpath=''
1336 mips_type=''
1337 usrinc=''
1338 vaproto=''
1339 d_vendorarch=''
1340 installvendorarch=''
1341 vendorarch=''
1342 vendorarchexp=''
1343 d_vendorbin=''
1344 installvendorbin=''
1345 vendorbin=''
1346 vendorbinexp=''
1347 installvendorhtml1dir=''
1348 vendorhtml1dir=''
1349 vendorhtml1direxp=''
1350 installvendorhtml3dir=''
1351 vendorhtml3dir=''
1352 vendorhtml3direxp=''
1353 d_vendorlib=''
1354 installvendorlib=''
1355 vendorlib=''
1356 vendorlib_stem=''
1357 vendorlibexp=''
1358 installvendorman1dir=''
1359 vendorman1dir=''
1360 vendorman1direxp=''
1361 installvendorman3dir=''
1362 vendorman3dir=''
1363 vendorman3direxp=''
1364 usevendorprefix=''
1365 vendorprefix=''
1366 vendorprefixexp=''
1367 d_vendorscript=''
1368 installvendorscript=''
1369 vendorscript=''
1370 vendorscriptexp=''
1371 versiononly=''
1372 yacc=''
1373 yaccflags=''
1374 CONFIG=''
1375
1376 : Detect odd OSs
1377 define='define'
1378 undef='undef'
1379 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1380 rmlist=''
1381
1382 : We must find out about Eunice early
1383 eunicefix=':'
1384 if test -f /etc/unixtovms; then
1385         eunicefix=/etc/unixtovms
1386 fi
1387 if test -f /etc/unixtovms.exe; then
1388         eunicefix=/etc/unixtovms.exe
1389 fi
1390
1391 : Set executable suffix now -- needed before hints available
1392 if test -f "/libs/version.library"; then
1393 : Amiga OS
1394     _exe=""
1395 elif test -f "/system/gnu_library/bin/ar.pm"; then
1396 : Stratus VOS
1397     _exe=".pm"
1398 elif test -n "$DJGPP"; then
1399 : DOS DJGPP
1400     _exe=".exe"
1401 elif test -f /kern/cookiejar; then
1402 : MiNT
1403     _exe=""
1404 elif test -d c:/. -o -n "$is_os2" ; then
1405 : OS/2 or cygwin
1406     _exe=".exe"
1407 fi
1408
1409 groupstype=''
1410 i_whoami=''
1411 : Trailing extension.  Override this in a hint file, if needed.
1412 : Extra object files, if any, needed on this platform.
1413 archobjs=''
1414 archname=''
1415 : Possible local include directories to search.
1416 : Set locincpth to "" in a hint file to defeat local include searches.
1417 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1418 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1419 :
1420 : no include file wanted by default
1421 inclwanted=''
1422
1423 : Enable -DEBUGGING and -DDEBUGGING from the command line
1424 EBUGGING=''
1425 DEBUGGING=''
1426
1427 libnames=''
1428 : change the next line if compiling for Xenix/286 on Xenix/386
1429 xlibpth='/usr/lib/386 /lib/386'
1430 : Possible local library directories to search.
1431 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1432 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1433
1434 : general looking path for locating libraries
1435 glibpth="/lib /usr/lib $xlibpth"
1436 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1437 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1438 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1439 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1440
1441 : Private path used by Configure to find libraries.  Its value
1442 : is prepended to libpth. This variable takes care of special
1443 : machines, like the mips.  Usually, it should be empty.
1444 plibpth=''
1445
1446 : default library list
1447 libswanted=''
1448 : some systems want to use only the non-versioned libso:s
1449 ignore_versioned_solibs=''
1450 : set usethreads on the Configure command line to enable threads.
1451 usereentrant='undef'
1452 ccname=''
1453 ccversion=''
1454 perllibs=''
1455 : set useposix=false in your hint file to disable the POSIX extension.
1456 useposix=true
1457 : set useopcode=false in your hint file to disable the Opcode extension.
1458 useopcode=true
1459 archname64=''
1460 ccflags_uselargefiles=''
1461 ldflags_uselargefiles=''
1462 libswanted_uselargefiles=''
1463 : set usemultiplicity on the Configure command line to enable multiplicity.
1464 : set usesocks on the Configure command line to enable socks.
1465 : List of libraries we want.
1466 : If anyone needs extra -lxxx, put those in a hint file.
1467 libswanted="cl pthread socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld"
1468 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1469 : We probably want to search /usr/shlib before most other libraries.
1470 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1471 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1472 glibpth="/usr/shlib $glibpth"
1473 : Do not use vfork unless overridden by a hint file.
1474 usevfork=false
1475
1476 : Find the basic shell for Bourne shell scripts
1477 case "$sh" in
1478 '')
1479         case "$SYSTYPE" in
1480         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1481         *) xxx='/bin/sh';;
1482         esac
1483         if test -f "$xxx"; then
1484                 sh="$xxx"
1485         else
1486                 : Build up a list and do a single loop so we can 'break' out.
1487                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1488                 for xxx in sh bash ksh pdksh ash; do
1489                         for p in $pth; do
1490                                 try="$try ${p}/${xxx}"
1491                         done
1492                 done
1493                 for xxx in $try; do
1494                         if test -f "$xxx"; then
1495                                 sh="$xxx";
1496                                 break
1497                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1498                                 sh="$xxx";
1499                                 break
1500                         elif test -f "$xxx.exe"; then
1501                                 sh="$xxx";
1502                                 break
1503                         fi
1504                 done
1505         fi
1506         ;;
1507 esac
1508
1509 case "$sh" in
1510 '')     cat >&2 <<EOM
1511 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1512
1513 Usually it's in /bin/sh.  How did you even get this far?
1514 Please contact me (Perl Maintainers) at perlbug@perl.org and
1515 we'll try to straighten this all out.
1516 EOM
1517         exit 1
1518         ;;
1519 esac
1520
1521 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1522 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1523 targetsh=$sh
1524
1525 : see if sh knows # comments
1526 if `$sh -c '#' >/dev/null 2>&1`; then
1527         shsharp=true
1528         spitshell=cat
1529         xcat=/bin/cat
1530         test -f $xcat$_exe || xcat=/usr/bin/cat
1531         if test ! -f $xcat$_exe; then
1532                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1533                         if test -f $p/cat$_exe; then
1534                                 xcat=$p/cat
1535                                 break
1536                         fi
1537                 done
1538                 if test ! -f $xcat$_exe; then
1539                         echo "Can't find cat anywhere!"
1540                         exit 1
1541                 fi
1542         fi
1543         echo "#!$xcat" >sharp
1544         $eunicefix sharp
1545         chmod +x sharp
1546         ./sharp > today 2>/dev/null
1547         if test -s today; then
1548                 sharpbang='#!'
1549         else
1550                 echo "#! $xcat" > sharp
1551                 $eunicefix sharp
1552                 chmod +x sharp
1553                 ./sharp > today 2>/dev/null
1554                 if test -s today; then
1555                         sharpbang='#! '
1556                 else
1557                         sharpbang=': use '
1558                 fi
1559         fi
1560 else
1561         echo " "
1562         echo "Your $sh doesn't grok # comments--I will strip them later on."
1563         shsharp=false
1564         cd ..
1565         echo "exec grep -v '^[  ]*#'" >spitshell
1566         chmod +x spitshell
1567         $eunicefix spitshell
1568         spitshell=`pwd`/spitshell
1569         cd UU
1570         echo "I presume that if # doesn't work, #! won't work either!"
1571         sharpbang=': use '
1572 fi
1573 rm -f sharp today
1574
1575 : figure out how to guarantee sh startup
1576 case "$startsh" in
1577 '') startsh=${sharpbang}${sh} ;;
1578 *)
1579 esac
1580 cat >sharp <<EOSS
1581 $startsh
1582 set abc
1583 test "$?abc" != 1
1584 EOSS
1585
1586 chmod +x sharp
1587 $eunicefix sharp
1588 if ./sharp; then
1589         : echo "Yup, it does."
1590 else
1591         echo "Hmm... '$startsh' does not guarantee sh startup..."
1592         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1593 fi
1594 rm -f sharp
1595
1596 : Save command line options in file UU/cmdline.opt for later use in
1597 : generating config.sh.
1598 cat > cmdline.opt <<EOSH
1599 : Configure command line arguments.
1600 config_arg0='$0'
1601 config_args='$*'
1602 config_argc=$#
1603 EOSH
1604 argn=1
1605 args_exp=''
1606 args_sep=''
1607 for arg in "$@"; do
1608         cat >>cmdline.opt <<EOSH
1609 config_arg$argn='$arg'
1610 EOSH
1611         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1612 $arg
1613 EOC
1614         arg_exp=`cat cmdl.opt`
1615         args_exp="$args_exp$args_sep'$arg_exp'"
1616         argn=`expr $argn + 1`
1617         args_sep=' '
1618 done
1619 rm -f cmdl.opt
1620
1621 : produce awk script to parse command line options
1622 cat >options.awk <<'EOF'
1623 BEGIN {
1624         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1625
1626         len = length(optstr);
1627         for (i = 1; i <= len; i++) {
1628                 c = substr(optstr, i, 1);
1629                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1630                 if (a == ":") {
1631                         arg[c] = 1;
1632                         i++;
1633                 }
1634                 opt[c] = 1;
1635         }
1636 }
1637 {
1638         expect = 0;
1639         str = $0;
1640         if (substr(str, 1, 1) != "-") {
1641                 printf("'%s'\n", str);
1642                 next;
1643         }
1644         len = length($0);
1645         for (i = 2; i <= len; i++) {
1646                 c = substr(str, i, 1);
1647                 if (!opt[c]) {
1648                         printf("-%s\n", substr(str, i));
1649                         next;
1650                 }
1651                 printf("-%s\n", c);
1652                 if (arg[c]) {
1653                         if (i < len)
1654                                 printf("'%s'\n", substr(str, i + 1));
1655                         else
1656                                 expect = 1;
1657                         next;
1658                 }
1659         }
1660 }
1661 END {
1662         if (expect)
1663                 print "?";
1664 }
1665 EOF
1666
1667 : process the command line options
1668 set X `for arg in "$@"; do echo "X$arg"; done |
1669         sed -e s/X// | awk -f options.awk`
1670 eval "set $*"
1671 shift
1672 rm -f options.awk
1673
1674 : set up default values
1675 fastread=''
1676 reuseval=false
1677 config_sh=''
1678 alldone=''
1679 error=''
1680 silent=''
1681 extractsh=''
1682 knowitall=''
1683 rm -f optdef.sh posthint.sh
1684 cat >optdef.sh <<EOS
1685 $startsh
1686 EOS
1687
1688
1689 : option parsing
1690 while test $# -gt 0; do
1691         case "$1" in
1692         -d) shift; fastread=yes;;
1693         -e) shift; alldone=cont;;
1694         -f)
1695                 shift
1696                 cd ..
1697                 if test -r "$1"; then
1698                         config_sh="$1"
1699                 else
1700                         echo "$me: cannot read config file $1." >&2
1701                         error=true
1702                 fi
1703                 cd UU
1704                 shift;;
1705         --help|\
1706         -h) shift; error=true;;
1707         -r) shift; reuseval=true;;
1708         -s) shift; silent=true; realsilent=true;;
1709         -E) shift; alldone=exit;;
1710         -K) shift; knowitall=true;;
1711         -O) shift;;
1712         -S) shift; silent=true; extractsh=true;;
1713         -D)
1714                 shift
1715                 case "$1" in
1716                 *=)
1717                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1718                         echo "$me: ignoring -D $1" >&2
1719                         ;;
1720                 *=*) echo "$1" | \
1721                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1722                 *) echo "$1='define'" >> optdef.sh;;
1723                 esac
1724                 shift
1725                 ;;
1726         -U)
1727                 shift
1728                 case "$1" in
1729                 *=) echo "$1" >> optdef.sh;;
1730                 *=*)
1731                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1732                         echo "$me: ignoring -U $1" >&2
1733                         ;;
1734                 *) echo "$1='undef'" >> optdef.sh;;
1735                 esac
1736                 shift
1737                 ;;
1738         -A)
1739             shift
1740             xxx=''
1741             yyy="$1"
1742             zzz=''
1743             uuu=undef
1744             case "$yyy" in
1745             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1746                  case "$zzz" in
1747                  *:*) zzz='' ;;
1748                  *)   xxx=append
1749                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1750                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1751                  esac
1752                  ;;
1753             esac
1754             case "$xxx" in
1755             '')  case "$yyy" in
1756                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1757                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1758                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1759                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1760                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1761                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1762                  esac
1763                  ;;
1764             esac
1765             case "$xxx" in
1766             append)
1767                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1768             clear)
1769                 echo "$yyy=''"                  >> posthint.sh ;;
1770             define)
1771                 case "$zzz" in
1772                 '') zzz=define ;;
1773                 esac
1774                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1775             eval)
1776                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1777             prepend)
1778                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1779             undef)
1780                 case "$zzz" in
1781                 '') zzz="$uuu" ;;
1782                 esac
1783                 echo "$yyy=$zzz"                >> posthint.sh ;;
1784             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1785             esac
1786             shift
1787             ;;
1788         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1789             exit 0;;
1790         --) break;;
1791         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1792         *) break;;
1793         esac
1794 done
1795
1796 case "$error" in
1797 true)
1798         cat >&2 <<EOM
1799 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1800                  [-U symbol] [-U symbol=] [-A command:symbol...]
1801   -d : use defaults for all answers.
1802   -e : go on without questioning past the production of config.sh.
1803   -f : specify an alternate default configuration file.
1804   -h : print this help message and exit (with an error status).
1805   -r : reuse C symbols value if possible (skips costly nm extraction).
1806   -s : silent mode, only echoes questions and essential information.
1807   -D : define symbol to have some value:
1808          -D symbol         symbol gets the value 'define'
1809          -D symbol=value   symbol gets the value 'value'
1810        common used examples (see INSTALL for more info):
1811          -Duse64bitint            use 64bit integers
1812          -Duse64bitall            use 64bit integers and pointers
1813          -Dusethreads             use thread support
1814          -Dinc_version_list=none  do not include older perl trees in @INC
1815          -DEBUGGING=none          DEBUGGING options
1816          -Dcc=gcc                 choose your compiler
1817          -Dprefix=/opt/perl5      choose your destination
1818   -E : stop at the end of questions, after having produced config.sh.
1819   -K : do not use unless you know what you are doing.
1820   -O : ignored for backward compatibility
1821   -S : perform variable substitutions on all .SH files (can mix with -f)
1822   -U : undefine symbol:
1823          -U symbol    symbol gets the value 'undef'
1824          -U symbol=   symbol gets completely empty
1825        e.g.:  -Uversiononly
1826   -A : manipulate symbol after the platform specific hints have been applied:
1827          -A append:symbol=value   append value to symbol
1828          -A symbol=value          like append:, but with a separating space
1829          -A define:symbol=value   define symbol to have value
1830          -A clear:symbol          define symbol to be ''
1831          -A define:symbol         define symbol to be 'define'
1832          -A eval:symbol=value     define symbol to be eval of value
1833          -A prepend:symbol=value  prepend value to symbol
1834          -A undef:symbol          define symbol to be 'undef'
1835          -A undef:symbol=         define symbol to be ''
1836        e.g.:  -A prepend:libswanted='cl pthread '
1837               -A ccflags=-DSOME_MACRO
1838   -V : print version number and exit (with a zero status).
1839 EOM
1840         exit 1
1841         ;;
1842 esac
1843
1844 : Sanity checks
1845 case "$fastread$alldone" in
1846 yescont|yesexit) ;;
1847 *)
1848         case "$extractsh" in
1849         true) ;;
1850         *)
1851                 if test ! -t 0; then
1852                         echo "Say 'sh Configure', not 'sh <Configure'"
1853                         exit 1
1854                 fi
1855                 ;;
1856         esac
1857         ;;
1858 esac
1859
1860 exec 4>&1
1861 case "$silent" in
1862 true) exec 1>/dev/null;;
1863 esac
1864
1865 : run the defines and the undefines, if any, but leave the file out there...
1866 touch optdef.sh
1867 grep -q '\\' optdef.sh
1868 if test $? = 0; then
1869     echo "Configure does not support \\ in -D arguments"
1870     exit 1
1871 fi
1872 . ./optdef.sh
1873 : create the posthint manipulation script and leave the file out there...
1874 touch posthint.sh
1875
1876 : set package name
1877 package='perl5'
1878 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1879 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1880 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1881 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1882 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1883 esac
1884
1885 : Some greps do not return status, grrr.
1886 echo "grimblepritz" >grimble
1887 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1888         contains=contains
1889 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1890         contains=grep
1891 else
1892         contains=contains
1893 fi
1894 rm -f grimble
1895 : the following should work in any shell
1896 case "$contains" in
1897 contains*)
1898         echo " "
1899         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1900         cat >contains <<'EOSS'
1901 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1902 EOSS
1903 chmod +x contains
1904 esac
1905
1906 : Find the path to the source tree
1907 case "$src" in
1908 '') case "$0" in
1909     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1910          case "$src" in
1911          /*)    ;;
1912          .)     ;;
1913          *)     src=`cd ../$src && pwd` ;;
1914          esac
1915          ;;
1916     *)   src='.';;
1917     esac;;
1918 esac
1919 case "$src" in
1920 '')     src=/
1921         rsrc=/
1922         ;;
1923 /*)     rsrc="$src";;
1924 *)      rsrc="../$src";;
1925 esac
1926 if test -f $rsrc/Configure && \
1927         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1928 then
1929    : found it, so we are ok.
1930 else
1931         rsrc=''
1932         for src in . .. ../.. ../../.. ../../../..; do
1933                 if test -f ../$src/Configure && \
1934                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1935                 then
1936                         rsrc=../$src
1937                         break
1938                 fi
1939         done
1940 fi
1941 case "$rsrc" in
1942 '')
1943         cat <<EOM >&4
1944
1945 Sorry, I can't seem to locate the source dir for $package.  Please start
1946 Configure with an explicit path -- i.e. /some/path/Configure.
1947
1948 EOM
1949         exit 1
1950         ;;
1951 ../.)   rsrc='..';;
1952 *)
1953         echo " "
1954         echo "Sources for $package found in \"$src\"." >&4
1955         ;;
1956 esac
1957
1958 : script used to extract .SH files with variable substitutions
1959 cat >extract <<'EOS'
1960 PERL_CONFIG_SH=true
1961 echo "Doing variable substitutions on .SH files..."
1962 if test -f MANIFEST; then
1963         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1964 else
1965         echo "(Looking for .SH files under the source directory.)"
1966         set x `(cd "$src"; find . -name "*.SH" -print)`
1967 fi
1968 shift
1969 case $# in
1970 0) set x `(cd "$src"; echo *.SH)`; shift;;
1971 esac
1972 if test ! -f "$src/$1"; then
1973         shift
1974 fi
1975 mkdir_p='
1976 name=$1;
1977 create="";
1978 while test $name; do
1979         if test ! -d "$name"; then
1980                 create="$name $create";
1981                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1982                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1983         else
1984                 name="";
1985         fi;
1986 done;
1987 for file in $create; do
1988         mkdir $file;
1989 done
1990 '
1991 for file in $*; do
1992         case "$src" in
1993         ".")
1994                 case "$file" in
1995                 */*)
1996                         dir=`expr X$file : 'X\(.*\)/'`
1997                         file=`expr X$file : 'X.*/\(.*\)'`
1998                         (cd "$dir" && . ./$file)
1999                         ;;
2000                 *)
2001                         . ./$file
2002                         ;;
2003                 esac
2004                 ;;
2005         *)
2006                 case "$file" in
2007                 */*)
2008                         dir=`expr X$file : 'X\(.*\)/'`
2009                         file=`expr X$file : 'X.*/\(.*\)'`
2010                         (set x $dir; shift; eval $mkdir_p)
2011                         sh <"$src/$dir/$file"
2012                         ;;
2013                 *)
2014                         sh <"$src/$file"
2015                         ;;
2016                 esac
2017                 ;;
2018         esac
2019 done
2020 if test -f "$src/config_h.SH"; then
2021         if test ! -f config.h; then
2022         : oops, they left it out of MANIFEST, probably, so do it anyway.
2023         . "$src/config_h.SH"
2024         fi
2025 fi
2026 EOS
2027
2028 : extract files and exit if asked to do so
2029 case "$extractsh" in
2030 true)
2031         case "$realsilent" in
2032         true) ;;
2033         *) exec 1>&4;;
2034         esac
2035         case "$config_sh" in
2036         '') config_sh='config.sh';;
2037         esac
2038         echo " "
2039         echo "Fetching answers from $config_sh..."
2040         cd ..
2041         . $config_sh
2042         . UU/optdef.sh
2043         echo " "
2044         . UU/extract
2045         rm -rf UU
2046         echo "Extraction done."
2047         exit 0
2048         ;;
2049 esac
2050
2051 : Eunice requires " " instead of "", can you believe it
2052 echo " "
2053 : Here we go...
2054 echo "Beginning of configuration questions for $package."
2055
2056 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2057
2058 : first determine how to suppress newline on echo command
2059 echo " "
2060 echo "Checking echo to see how to suppress newlines..."
2061 (echo "hi there\c" ; echo " ") >.echotmp
2062 if $contains c .echotmp >/dev/null 2>&1 ; then
2063         echo "...using -n."
2064         n='-n'
2065         c=''
2066 else
2067         cat <<'EOM'
2068 ...using \c
2069 EOM
2070         n=''
2071         c='\c'
2072 fi
2073 echo $n "The star should be here-->$c"
2074 echo '*'
2075 rm -f .echotmp
2076
2077 : Now test for existence of everything in MANIFEST
2078 echo " "
2079 if test -f "$rsrc/MANIFEST"; then
2080         echo "First let's make sure your kit is complete.  Checking..." >&4
2081         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2082                 (split -l 50 2>/dev/null || split -50)
2083         rm -f missing
2084         tmppwd=`pwd`
2085         for filelist in x??; do
2086                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2087                         >/dev/null 2>>"$tmppwd/missing")
2088         done
2089         if test -s missing; then
2090                 cat missing >&4
2091                 cat >&4 <<'EOM'
2092
2093 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2094
2095 You have the option of continuing the configuration process, despite the
2096 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2097 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2098 and contact the author (perlbug@perl.org).
2099
2100 EOM
2101                 echo $n "Continue? [n] $c" >&4
2102                 read ans
2103                 case "$ans" in
2104                 y*)
2105                         echo "Continuing..." >&4
2106                         rm -f missing
2107                         ;;
2108                 *)
2109                         echo "ABORTING..." >&4
2110                         kill $$
2111                         ;;
2112                 esac
2113         else
2114                 echo "Looks good..."
2115         fi
2116 else
2117         echo "There is no MANIFEST file.  I hope your kit is complete !"
2118 fi
2119 rm -f missing x??
2120
2121 : Find the appropriate value for a newline for tr
2122 echo " "
2123 if test -n "$DJGPP"; then
2124        trnl='\012'
2125 fi
2126 if test X"$trnl" = X; then
2127         case "`echo foo|tr '\n' x 2>/dev/null`" in
2128         foox) trnl='\n' ;;
2129         esac
2130 fi
2131 if test X"$trnl" = X; then
2132         case "`echo foo|tr '\012' x 2>/dev/null`" in
2133         foox) trnl='\012' ;;
2134         esac
2135 fi
2136 if test X"$trnl" = X; then
2137        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2138        fooxy) trnl='\n\r' ;;
2139        esac
2140 fi
2141 if test X"$trnl" = X; then
2142         cat <<EOM >&2
2143
2144 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2145
2146 EOM
2147         exit 1
2148 fi
2149
2150 : compute the number of columns on the terminal for proper question formatting
2151 case "$COLUMNS" in
2152 '') COLUMNS='80';;
2153 esac
2154
2155 : set up the echo used in my read
2156 myecho="case \"\$xxxm\" in
2157 '') echo $n \"\$rp $c\" >&4;;
2158 *) case \"\$rp\" in
2159         '') echo $n \"[\$xxxm] $c\";;
2160         *)
2161                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2162                         echo \"\$rp\" >&4
2163                         echo $n \"[\$xxxm] $c\" >&4
2164                 else
2165                         echo $n \"\$rp [\$xxxm] $c\" >&4
2166                 fi
2167                 ;;
2168         esac;;
2169 esac"
2170
2171 : now set up to do reads with possible shell escape and default assignment
2172 cat <<EOSC >myread
2173 $startsh
2174 xxxm=\$dflt
2175 $myecho
2176 ans='!'
2177 case "\$fastread" in
2178 yes) case "\$dflt" in
2179         '') ;;
2180         *) ans='';
2181                 case "\$silent-\$rp" in
2182                 true-) ;;
2183                 *) echo " " >&4;;
2184                 esac;;
2185         esac;;
2186 *) case "\$silent" in
2187         true) case "\$rp" in
2188                 '') ans='';;
2189                 esac;;
2190         esac;;
2191 esac
2192 while expr "X\$ans" : "X!" >/dev/null; do
2193         read answ
2194         set x \$xxxm
2195         shift
2196         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2197         case  "\$answ" in
2198         "!")
2199                 sh 1>&4
2200                 echo " "
2201                 $myecho
2202                 ;;
2203         !*)
2204                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2205                 shift
2206                 sh 1>&4 -c "\$*"
2207                 echo " "
2208                 $myecho
2209                 ;;
2210         "\$ans")
2211                 case "\$ans" in
2212                 \\&*)
2213                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2214                         shift
2215                         case "\$1" in
2216                         -d)
2217                                 fastread=yes
2218                                 echo "(OK, I'll run with -d after this question.)" >&4
2219                                 ;;
2220                         -*)
2221                                 echo "*** Sorry, \$1 not supported yet." >&4
2222                                 ;;
2223                         esac
2224                         $myecho
2225                         ans=!
2226                         ;;
2227                 esac;;
2228         *)
2229                 case "\$aok" in
2230                 y)
2231                         echo "*** Substitution done -- please confirm."
2232                         xxxm="\$ans"
2233                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2234                         xxxm="\$ans"
2235                         ans=!
2236                         ;;
2237                 *)
2238                         echo "*** Error -- try again."
2239                         ans=!
2240                         ;;
2241                 esac
2242                 $myecho
2243                 ;;
2244         esac
2245         case "\$ans\$xxxm\$nostick" in
2246         '')
2247                 ans=!
2248                 $myecho
2249                 ;;
2250         esac
2251 done
2252 case "\$ans" in
2253 '') ans="\$xxxm";;
2254 esac
2255 EOSC
2256
2257 : create .config dir to save info across Configure sessions
2258 test -d ../.config || mkdir ../.config
2259 cat >../.config/README <<EOF
2260 This directory created by Configure to save information that should
2261 persist across sessions for $package.
2262
2263 You may safely delete it if you wish.
2264 EOF
2265
2266 : See if we are using a devel version and want that
2267 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2268 case "$usedevel" in
2269 $define|true|[yY]*)
2270     usedevel="$define" ;;
2271 *) case "$xversion" in
2272    *[13579])
2273         cat >&4 <<EOH
2274 *** WHOA THERE!!! ***
2275
2276     This is an UNSTABLE DEVELOPMENT release.
2277     The version of this $package distribution is $xversion, that is, odd,
2278     (as opposed to even) and that signifies a development release.
2279     If you want a maintenance release, you want an even-numbered version.
2280
2281     Do ***NOT*** install this into production use.
2282     Data corruption and crashes are possible.
2283
2284     It is most seriously suggested that you do not continue any further
2285     unless you want to help in developing and debugging Perl.
2286
2287     If you *still* want to build perl, you can answer 'y' now,
2288     or pass -Dusedevel to Configure.
2289
2290 EOH
2291         rp='Do you really want to continue?'
2292         dflt='n'
2293         . ./myread
2294         case "$ans" in
2295         [yY]) echo >&4 "Okay, continuing."
2296               usedevel="$define" ;;
2297         *) echo >&4 "Okay, bye."
2298            exit 1
2299            ;;
2300         esac
2301         ;;
2302     esac
2303     usedevel="$undef"
2304     ;;
2305 esac
2306 case "$usedevel" in
2307 $define|true|[yY]*)
2308         case "$versiononly" in
2309         '') versiononly="$define" ;;
2310         esac
2311         case "$installusrbinperl" in
2312         '') installusrbinperl="$undef" ;;
2313         esac
2314         ;;
2315 esac
2316
2317 : general instructions
2318 needman=true
2319 firsttime=true
2320 user=`(logname) 2>/dev/null`
2321 case "$user" in
2322 '') user=`whoami 2>&1`;;
2323 esac
2324 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2325         firsttime=false
2326         echo " "
2327         rp='Would you like to see the instructions?'
2328         dflt=n
2329         . ./myread
2330         case "$ans" in
2331         [yY]*) ;;
2332         *) needman=false;;
2333         esac
2334 fi
2335 if $needman; then
2336         cat <<EOH
2337
2338 This installation shell script will examine your system and ask you questions
2339 to determine how the perl5 package should be installed. If you get
2340 stuck on a question, you may use a ! shell escape to start a subshell or
2341 execute a command.  Many of the questions will have default answers in square
2342 brackets; typing carriage return will give you the default.
2343
2344 On some of the questions which ask for file or directory names you are allowed
2345 to use the ~name construct to specify the login directory belonging to "name",
2346 even if you don't have a shell which knows about that.  Questions where this is
2347 allowed will be marked "(~name ok)".
2348
2349 EOH
2350         rp=''
2351         dflt='Type carriage return to continue'
2352         . ./myread
2353         cat <<'EOH'
2354
2355 The prompter used in this script allows you to use shell variables and
2356 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2357 in the default answer, as if the default line was a set of arguments given to a
2358 script shell.  This means you may also use $* to repeat the whole default line,
2359 so you do not have to re-type everything to add something to the default.
2360
2361 Every time there is a substitution, you will have to confirm.  If there is an
2362 error (e.g. an unmatched backtick), the default answer will remain unchanged
2363 and you will be prompted again.
2364
2365 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2366 the questions and use the computed defaults (or the previous answers if there
2367 was already a config.sh file). Type 'Configure -h' for a list of options.
2368 You may also start interactively and then answer '& -d' at any prompt to turn
2369 on the non-interactive behaviour for the remainder of the execution.
2370
2371 EOH
2372         . ./myread
2373         cat <<EOH
2374
2375 Much effort has been expended to ensure that this shell script will run on any
2376 Unix system.  If despite that it blows up on yours, your best bet is to edit
2377 Configure and run it again.  If you can't run Configure for some reason,
2378 you'll have to generate a config.sh file by hand.  Whatever problems you
2379 have, let me (perlbug@perl.org) know how I blew it.
2380
2381 This installation script affects things in two ways:
2382
2383 1) it may do direct variable substitutions on some of the files included
2384    in this kit.
2385 2) it builds a config.h file for inclusion in C programs.  You may edit
2386    any of these files as the need arises after running this script.
2387
2388 If you make a mistake on a question, there is no easy way to back up to it
2389 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2390 files.  Configure will offer to let you do this before it runs the SH files.
2391
2392 EOH
2393         dflt='Type carriage return to continue'
2394         . ./myread
2395         case "$firsttime" in
2396         true) echo $user >>../.config/instruct;;
2397         esac
2398 fi
2399
2400 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2401 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2402 if test "X$sysroot" = X; then
2403     sysroot=""
2404 else
2405     case "$cc" in
2406         *gcc*|*g++*)
2407             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2408             # _sysroot is used in places where we need --sysroot=foo
2409             # but using the rest of the flags could cause issues.
2410             _sysroot="--sysroot=$sysroot";
2411             case "$ccflags" in
2412                 *sysroot*) ;;
2413                 'undef'|*)
2414                 ccflags="$ccflags $_sysroot"
2415             esac
2416             case "$ldflags" in
2417                 *sysroot*) ;;
2418                 'undef'|*)
2419                 ldflags="$ldflags $_sysroot"
2420             esac
2421             case "$cppflags" in
2422                 *sysroot*) ;;
2423                 'undef'|*)
2424                 cppflags="$cppflags $_sysroot"
2425             esac
2426             # lddlflags updated below in lddlflags section;
2427             # same with cccdlflags
2428             ;;
2429     esac
2430
2431     # Adjust some defaults to also use $sysroot
2432     for var in xlibpth loclibpth locincpth glibpth; do
2433         eval xxx=\$$var
2434         eval $var=''
2435         for path in $xxx; do
2436             eval $var=\"\$$var $sysroot$path\"
2437         done
2438     done
2439
2440 fi
2441
2442 : find out where common programs are
2443 echo " "
2444 echo "Locating common programs..." >&4
2445 cat <<EOSC >loc
2446 $startsh
2447 case \$# in
2448 0) exit 1;;
2449 esac
2450 thing=\$1
2451 shift
2452 dflt=\$1
2453 shift
2454 for dir in \$*; do
2455         case "\$thing" in
2456         .)
2457         if test -d \$dir/\$thing; then
2458                 echo \$dir
2459                 exit 0
2460         fi
2461         ;;
2462         *)
2463         for thisthing in \$dir/\$thing; do
2464                 : just loop through to pick last item
2465         done
2466         if test -f \$thisthing; then
2467                 echo \$thisthing
2468                 exit 0
2469         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2470                 echo \$thisthing
2471                 exit 0
2472         elif test -f \$dir/\$thing.exe; then
2473                 if test -n "$DJGPP"; then
2474                         echo \$dir/\$thing.exe
2475                 elif test "$eunicefix" != ":"; then
2476                         : on Eunice apparently
2477                         echo \$dir/\$thing
2478                 fi
2479                 exit 0
2480         fi
2481         ;;
2482         esac
2483 done
2484 echo \$dflt
2485 exit 1
2486 EOSC
2487 chmod +x loc
2488 $eunicefix loc
2489 loclist="
2490 awk
2491 cat
2492 chmod
2493 comm
2494 cp
2495 echo
2496 expr
2497 grep
2498 ls
2499 mkdir
2500 rm
2501 sed
2502 sort
2503 touch
2504 tr
2505 uniq
2506 "
2507 trylist="
2508 ar
2509 bison
2510 byacc
2511 cpp
2512 csh
2513 date
2514 egrep
2515 gmake
2516 gzip
2517 less
2518 ln
2519 make
2520 more
2521 nm
2522 nroff
2523 perl
2524 pg
2525 test
2526 uname
2527 zip
2528 "
2529 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2530 pth="$pth $sysroot/lib $sysroot/usr/lib"
2531 for file in $loclist; do
2532         eval xxx=\$$file
2533         case "$xxx" in
2534         /*|?:[\\/]*)
2535                 if test -f "$xxx"; then
2536                         : ok
2537                 else
2538                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2539                         xxx=`./loc $file $file $pth`
2540                 fi
2541                 ;;
2542         '') xxx=`./loc $file $file $pth`;;
2543         *) xxx=`./loc $xxx $xxx $pth`;;
2544         esac
2545         eval $file=$xxx$_exe
2546         eval _$file=$xxx
2547         case "$xxx" in
2548         /*)
2549                 echo $file is in $xxx.
2550                 ;;
2551         ?:[\\/]*)
2552                 echo $file is in $xxx.
2553                 ;;
2554         *)
2555                 echo "I don't know where '$file' is, and my life depends on it." >&4
2556                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2557                 exit 1
2558                 ;;
2559         esac
2560 done
2561 echo " "
2562 echo "Don't worry if any of the following aren't found..."
2563 say=offhand
2564 for file in $trylist; do
2565         eval xxx=\$$file
2566         case "$xxx" in
2567         /*|?:[\\/]*)
2568                 if test -f "$xxx"; then
2569                         : ok
2570                 else
2571                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2572                         xxx=`./loc $file $file $pth`
2573                 fi
2574                 ;;
2575         '') xxx=`./loc $file $file $pth`;;
2576         *) xxx=`./loc $xxx $xxx $pth`;;
2577         esac
2578         eval $file=$xxx$_exe
2579         eval _$file=$xxx
2580         case "$xxx" in
2581         /*)
2582                 echo $file is in $xxx.
2583                 ;;
2584         ?:[\\/]*)
2585                 echo $file is in $xxx.
2586                 ;;
2587         *)
2588                 echo "I don't see $file out there, $say."
2589                 say=either
2590                 ;;
2591         esac
2592 done
2593 case "$egrep" in
2594 egrep)
2595         echo "Substituting grep for egrep."
2596         egrep=$grep
2597         _egrep=$grep
2598         ;;
2599 esac
2600 case "$less" in
2601 '')     ;;
2602 *)      if $less -R </dev/null >/dev/null 2>&1; then
2603                echo "Substituting less -R for less."
2604                less="$less -R"
2605                _less=$less
2606         fi
2607         ;;
2608 esac
2609 case "$ln" in
2610 ln)
2611         echo "Substituting cp for ln."
2612         ln=$cp
2613         _ln=$cp
2614         ;;
2615 esac
2616 case "$make" in
2617 make)
2618         case "$gmake" in
2619         gmake)
2620         echo "I can't find make or gmake, and my life depends on it." >&4
2621         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2622         exit 1
2623         ;;
2624         esac
2625         ;;
2626 esac
2627 case "$gmake" in
2628 gmake)  ;;
2629 *)      # We can't have osname yet.
2630         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2631                 # Assume that gmake, if found, is definitely GNU make
2632                 # and prefer it over the system make.
2633                 echo "Substituting gmake for make."
2634                 make=$gmake
2635                 _make=$gmake
2636         fi
2637         ;;
2638 esac
2639 case "$test" in
2640 test)
2641         echo "Hopefully test is built into your sh."
2642         ;;
2643 *)
2644         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2645                 echo "Using the test built into your sh."
2646                 test=test
2647                 _test=test
2648         fi
2649         ;;
2650 esac
2651 case "$echo" in
2652 echo)
2653         echo "Hopefully echo is built into your sh."
2654         ;;
2655 '') ;;
2656 *)
2657         echo " "
2658 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2659         $echo $n "hi there$c" >foo1
2660         echo $n "hi there$c" >foo2
2661         if cmp foo1 foo2 >/dev/null 2>&1; then
2662                 echo "They are compatible.  In fact, they may be identical."
2663         else
2664                 case "$n" in
2665                 '-n') n='' c='\c';;
2666                 *) n='-n' c='';;
2667                 esac
2668                 cat <<FOO
2669 They are not compatible!  You are probably running ksh on a non-USG system.
2670 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2671 have echo built in and we may have to run some Bourne shell scripts.  That
2672 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2673
2674 FOO
2675                 $echo $n "The star should be here-->$c"
2676                 $echo "*"
2677         fi
2678         $rm -f foo1 foo2
2679         ;;
2680 esac
2681
2682 # This question was auctioned at YAPC::Europe-2007 in Vienna
2683 # I never promised you could answer it. I only auctioned the question.
2684 cat <<FOO
2685 The following message is sponsored by
2686
2687   Dresden.pm<--The stars should be here.
2688
2689 Dear Perl user, system administrator or package
2690 maintainer, the Perl community sends greetings to
2691 you. Do you (emblematical) greet back [Y/n]? n
2692
2693 FOO
2694
2695 : Check what type of C compiler we use
2696 cat <<EOS >trygcc
2697 $startsh
2698 EOS
2699 cat <<'EOSC' >>trygcc
2700 case "$cc" in
2701 '') ;;
2702 *)  $rm -f try try.*
2703     $cat >try.c <<EOM
2704 int main(int argc, char *argv[]) {
2705   return 0;
2706 }
2707 EOM
2708     if $cc -o try $ccflags $ldflags try.c; then
2709        :
2710     else
2711         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2712         despair=yes
2713         trygcc=yes
2714         case "$cc" in
2715         *gcc*) trygcc=no ;;
2716         esac
2717         # Skip this test because it gives a false match on output like:
2718         #    ./trygcc: line 23: cc: command not found
2719         # case "`$cc -v -c try.c 2>&1`" in
2720         # *gcc*) trygcc=no ;;
2721         # esac
2722         if $test X"$trygcc" = Xyes; then
2723             if gcc -o try -c try.c; then
2724                 echo " "
2725                 echo "You seem to have a working gcc, though." >&4
2726                 # Switching compilers may undo the work of hints files.
2727                 # The most common problem is -D_REENTRANT for threads.
2728                 # This heuristic catches that case, but gets false positives
2729                 # if -Dusethreads was not actually specified.  Better to
2730                 # bail out here with a useful message than fail
2731                 # mysteriously later. Should we perhaps just try to
2732                 # re-invoke Configure -Dcc=gcc config_args ?
2733                 if $test -f usethreads.cbu; then
2734                         $cat >&4 <<EOM
2735
2736 *** However, any setting of the C compiler flags (e.g. for thread support)
2737 *** will be lost.  It may be necessary for you to restart Configure and
2738 *** add -Dcc=gcc to your Configure command line.
2739
2740 EOM
2741                         rp="Would you like to go ahead and try gcc anyway?"
2742                         dflt=n
2743                 else
2744                         rp="Would you like to use it?"
2745                         dflt=y
2746                 fi
2747                 if $test -f myread; then
2748                     . ./myread
2749                 else
2750                     if $test -f UU/myread; then
2751                         . ./UU/myread
2752                     else
2753                         echo "Cannot find myread, sorry.  Aborting." >&2
2754                         exit 1
2755                     fi
2756                 fi
2757                 case "$ans" in
2758                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2759                 esac
2760             fi
2761         fi
2762     fi
2763     $rm -f try try.*
2764     ;;
2765 esac
2766 EOSC
2767
2768 cat <<EOS >checkcc
2769 $startsh
2770 EOS
2771 cat <<'EOSC' >>checkcc
2772 case "$cc" in
2773 '') ;;
2774 *)  $rm -f try try.*
2775     $cat >try.c <<EOM
2776 int main(int argc, char *argv[]) {
2777   return 0;
2778 }
2779 EOM
2780     if $cc -o try $ccflags $ldflags try.c; then
2781        :
2782     else
2783         if $test X"$despair" = Xyes; then
2784            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2785         fi
2786         $cat >&4 <<EOM
2787 You need to find a working C compiler.
2788 Either (purchase and) install the C compiler supplied by your OS vendor,
2789 or for a free C compiler try http://gcc.gnu.org/
2790 I cannot continue any further, aborting.
2791 EOM
2792         exit 1
2793     fi
2794     $rm -f try try.*
2795     ;;
2796 esac
2797 EOSC
2798
2799 : determine whether symbolic links are supported
2800 echo " "
2801 $touch blurfl
2802 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2803         echo "Symbolic links are supported." >&4
2804         lns="$ln -s"
2805 else
2806         echo "Symbolic links are NOT supported." >&4
2807         lns="$ln"
2808 fi
2809 $rm -f blurfl sym
2810
2811 : determine whether symbolic links are supported
2812 echo " "
2813 case "$lns" in
2814 *"ln"*" -s")
2815         echo "Checking how to test for symbolic links..." >&4
2816         $lns blurfl sym
2817         if $test "X$issymlink" = X; then
2818                 case "$newsh" in
2819                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2820                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2821                 esac
2822                 if test $? = 0; then
2823                         issymlink="test -h"
2824                 else
2825                         echo "Your builtin 'test -h' may be broken." >&4
2826                         case "$test" in
2827                         /*)     ;;
2828                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2829                                 for p in $pth
2830                                 do
2831                                         if test -f "$p/$test"; then
2832                                                 test="$p/$test"
2833                                                 break
2834                                         fi
2835                                 done
2836                                 ;;
2837                         esac
2838                         case "$test" in
2839                         /*)
2840                                 echo "Trying external '$test -h'." >&4
2841                                 issymlink="$test -h"
2842                                 if $test ! -h sym >/dev/null 2>&1; then
2843                                         echo "External '$test -h' is broken, too." >&4
2844                                         issymlink=''
2845                                 fi
2846                                 ;;
2847                         *)      issymlink='' ;;
2848                         esac
2849                 fi
2850         fi
2851         if $test "X$issymlink" = X; then
2852                 if $test -L sym 2>/dev/null; then
2853                         issymlink="$test -L"
2854                         echo "The builtin '$test -L' worked." >&4
2855                 fi
2856         fi
2857         if $test "X$issymlink" != X; then
2858                 echo "You can test for symbolic links with '$issymlink'." >&4
2859         else
2860                 echo "I do not know how you can test for symbolic links." >&4
2861         fi
2862         $rm -f blurfl sym
2863         ;;
2864 *)      echo "No symbolic links, so not testing for their testing..." >&4
2865         ;;
2866 esac
2867 echo " "
2868
2869 : Make symlinks util
2870 case "$mksymlinks" in
2871 $define|true|[yY]*)
2872         case "$src" in
2873         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2874                 exit 1
2875                 ;;
2876         *)      case "$lns:$issymlink" in
2877                 *"ln"*" -s:"*"test -"?)
2878                         echo "Creating the symbolic links..." >&4
2879                         cd ..
2880                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2881                         awk 'NF == 1 {
2882                                 dir=".";
2883                                 file=$1 "";
2884                              }
2885                              NF == 2 {
2886                                 dir=$1 "";
2887                                 file=$2 "";
2888                              }
2889                              {
2890                                  print "# dir = ", dir, "file = ", file
2891                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2892                              } END {
2893                                  for (d in mf) {
2894                                      if (d != ".") { print("mkdir -p "d) }
2895                                      print("ln -sf "mf[d]" "d);
2896                                  }
2897                              }' source="$src" > UU/mksymlinks.$$
2898                         sh UU/mksymlinks.$$
2899                         rm UU/mksymlinks.$$
2900                         # Sanity check 1.
2901                         if test ! -d t/base; then
2902                                 echo "Failed to create the subdirectories.  Aborting." >&4
2903                                 exit 1
2904                         fi
2905                         # Sanity check 2.
2906                         if test ! -f t/base/lex.t; then
2907                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2908                                 exit 1
2909                         fi
2910                         if test ! -f win32/win32.c; then
2911                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2912                                 exit 1
2913                         fi
2914                         cd UU
2915                         ;;
2916                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2917                         ;;
2918                 esac
2919                 ;;
2920         esac
2921         ;;
2922 esac
2923
2924 : Check for Cross-Compilation
2925 if $test "X$targethost" = "X"; then
2926     targethost=""
2927 fi
2928 if $test "X$targetenv" = "X"; then
2929     targetenv=""
2930 fi
2931 case "$usecrosscompile" in
2932 $define|true|[yY]*)
2933         $echo "Cross-compiling..."
2934         croak=''
2935         case "$cc" in
2936         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2937             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2938             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2939             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2940             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2941             # leave out ld, choosing it is more complex
2942             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2943             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2944             # We are in a weird spot. Just before us, some values
2945             # were 'saved', to be restored after the hints are
2946             # run.  This means that the changes we made to ar,
2947             # nm and ranlib will get reverted.
2948             # To avoid that, we hijack the saving mechanism and
2949             # have it save our new values.
2950             for file in ar nm ranlib; do
2951                 eval xxx=\$$file
2952                 eval $file=$xxx$_exe
2953                 eval _$file=$xxx
2954             done
2955         ;;
2956         esac
2957         case "$targetarch" in
2958         '') echo "Targetarch not defined." >&4; croak=y ;;
2959         *)  echo "Using targetarch $targetarch." >&4 ;;
2960         esac
2961         case "$targethost" in
2962         '') echo "Targethost not defined." >&4; croak=y ;;
2963         *)  echo "Using targethost $targethost." >&4
2964         esac
2965         locincpth=' '
2966         loclibpth=' '
2967         case "$croak" in
2968         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2969         esac
2970     : compile a host miniperl and generate_uudmap, unless we got passed them
2971     if $test "X$hostperl" = X; then
2972       echo "Building host miniperl and generate_uudmap binaries" >&4
2973       before_host=`pwd`
2974       cd ..
2975       cd $src
2976       src=`pwd`
2977       rm -rf $src/host
2978       mkdir $src/host
2979       cd $src/host
2980       $src/Configure -des -Dusedevel -Dmksymlinks
2981       $make miniperl
2982       case "$hostgenerate" in
2983       '') $make generate_uudmap
2984           hostgenerate=$src/host/generate_uudmap
2985           ;;
2986        "$undef") hostgenerate=''
2987           ;;
2988       esac
2989       hostperl=$src/host/miniperl
2990       cd $before_host
2991     fi
2992     hostosname=`$hostperl -le 'print $^O'`
2993     ;;
2994 *)
2995     usecrosscompile="$undef"
2996     ;;
2997 esac
2998
2999 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3000 case "$targethost" in
3001     '') echo "Checking for cross-compile" >&4
3002     case "$usecrosscompile$multiarch" in
3003        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3004          if [ -f Makefile ]; then
3005            echo " "
3006            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3007          else
3008            echo "Configure done."
3009          fi
3010        exit 0
3011        ;;
3012      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3013         run=''
3014         to=:
3015         from=:
3016         ;;
3017     esac
3018     ;;
3019     *) echo "Using targethost $targethost." >&4
3020         case "$src" in
3021         /*) run=$src/Cross/run
3022             targetmkdir=$src/Cross/mkdir
3023             to=$src/Cross/to
3024             from=$src/Cross/from
3025             ;;
3026         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3027             run=$pwd/Cross/run
3028             targetmkdir=$pwd/Cross/mkdir
3029             to=$pwd/Cross/to
3030             from=$pwd/Cross/from
3031             ;;
3032         esac
3033         case "$targetrun" in
3034         '') targetrun=ssh ;;
3035         esac
3036         case "$targetto" in
3037         '') targetto=scp ;;
3038         esac
3039         case "$targetfrom" in
3040         '') targetfrom=scp ;;
3041         esac
3042         run=$run-$targetrun
3043         to=$to-$targetto
3044         from=$from-$targetfrom
3045         case "$targetdir" in
3046         '')  targetdir=/tmp
3047              echo "Guessing targetdir $targetdir." >&4
3048              ;;
3049         esac
3050         case "$targetuser" in
3051         '')  targetuser=root
3052              echo "Guessing targetuser $targetuser." >&4
3053              ;;
3054         esac
3055         case "$targetport" in
3056         '')  targetport=22
3057              echo "Guessing targetport $targetport." >&4
3058              ;;
3059         esac
3060         case "$targetfrom" in
3061         scp)    q=-q ;;
3062         *)      q='' ;;
3063         esac
3064         case "$targetrun" in
3065         ssh|rsh)
3066             cat >$run <<EOF
3067 #!/bin/sh
3068 env=''
3069 case "\$1" in
3070 -cwd)
3071   shift
3072   cwd=\$1
3073   shift
3074   ;;
3075 esac
3076 case "\$1" in
3077 -env)
3078   shift
3079   env=\$1
3080   shift
3081   ;;
3082 esac
3083 case "\$cwd" in
3084 '') cwd=$targetdir ;;
3085 esac
3086 exe=\$1
3087 shift
3088 $to \$exe
3089 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3090 EOF
3091             ;;
3092         adb)
3093             $touch $run
3094             ;;
3095         *)  echo "Unknown targetrun '$targetrun'" >&4
3096             exit 1
3097             ;;
3098         esac
3099         case "$targetmkdir" in
3100         */Cross/mkdir)
3101             cat >$targetmkdir <<EOF
3102 #!/bin/sh
3103 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3104 EOF
3105             $chmod a+rx $targetmkdir
3106             ;;
3107         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3108             exit 1
3109             ;;
3110         esac
3111         case "$targetto" in
3112         scp|rcp)
3113             cat >$to <<EOF
3114 #!/bin/sh
3115 for f in \$@
3116 do
3117   case "\$f" in
3118   /*)
3119     $targetmkdir \`dirname \$f\`
3120     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3121     ;;
3122   *)
3123     $targetmkdir $targetdir/\`dirname \$f\`
3124     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3125     ;;
3126   esac
3127 done
3128 exit 0
3129 EOF
3130             ;;
3131         cp) cat >$to <<EOF
3132 #!/bin/sh
3133 for f in \$@
3134 do
3135   case "\$f" in
3136   /*)
3137     $mkdir -p $targetdir/\`dirname \$f\`
3138     $cp \$f $targetdir/\$f || exit 1
3139     ;;
3140   *)
3141     $targetmkdir $targetdir/\`dirname \$f\`
3142     $cp \$f $targetdir/\$f || exit 1
3143     ;;
3144   esac
3145 done
3146 exit 0
3147 EOF
3148             ;;
3149         *)  echo "Unknown targetto '$targetto'" >&4
3150             exit 1
3151             ;;
3152         esac
3153         case "$targetfrom" in
3154         scp|rcp)
3155           cat >$from <<EOF
3156 #!/bin/sh
3157 for f in \$@
3158 do
3159   $rm -f \$f
3160   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3161 done
3162 exit 0
3163 EOF
3164             ;;
3165         cp) cat >$from <<EOF
3166 #!/bin/sh
3167 for f in \$@
3168 do
3169   $rm -f \$f
3170   cp $targetdir/\$f . || exit 1
3171 done
3172 exit 0
3173 EOF
3174             ;;
3175         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3176             exit 1
3177             ;;
3178         esac
3179         if $test ! -f $run; then
3180             echo "Target 'run' script '$run' not found." >&4
3181         else
3182             $chmod a+rx $run
3183         fi
3184         if $test ! -f $to; then
3185             echo "Target 'to' script '$to' not found." >&4
3186         else
3187             $chmod a+rx $to
3188         fi
3189         if $test ! -f $from; then
3190             echo "Target 'from' script '$from' not found." >&4
3191         else
3192             $chmod a+rx $from
3193         fi
3194         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3195             exit 1
3196         fi
3197         cat >&4 <<EOF
3198 Using '$run' for remote execution,
3199 and '$from' and '$to'
3200 for remote file transfer.
3201 EOF
3202         ;;
3203 *)      run=''
3204         to=:
3205         from=:
3206         usecrosscompile="$undef"
3207         targetarch=''
3208         ;;
3209 esac
3210
3211 : see whether [:lower:] and [:upper:] are supported character classes
3212 echo " "
3213 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3214 ABYZ-abyz)
3215         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3216         up='[:upper:]'
3217         low='[:lower:]'
3218         ;;
3219 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3220         # (0xd9 and 0xe2), therefore that is a nice testing point.
3221         if test "X$up" = X -o "X$low" = X; then
3222             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3223             rs) up='[A-Z]'
3224                 low='[a-z]'
3225                 ;;
3226             esac
3227         fi
3228         if test "X$up" = X -o "X$low" = X; then
3229             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3230             rs) up='A-Z'
3231                 low='a-z'
3232                 ;;
3233             esac
3234         fi
3235         if test "X$up" = X -o "X$low" = X; then
3236             case "`echo RS | od -x 2>/dev/null`" in
3237             *D9E2*|*d9e2*)
3238                 echo "Hey, this might be EBCDIC." >&4
3239                 if test "X$up" = X -o "X$low" = X; then
3240                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3241                     rs) up='[A-IJ-RS-Z]'
3242                         low='[a-ij-rs-z]'
3243                         ;;
3244                     esac
3245                 fi
3246                 if test "X$up" = X -o "X$low" = X; then
3247                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3248                     rs) up='A-IJ-RS-Z'
3249                         low='a-ij-rs-z'
3250                         ;;
3251                     esac
3252                 fi
3253                 ;;
3254             esac
3255         fi
3256 esac
3257 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3258 rs)
3259     echo "Using $up and $low to convert case." >&4
3260     ;;
3261 *)
3262     echo "I don't know how to translate letters from upper to lower case." >&4
3263     echo "Your tr is not acting any way I know of." >&4
3264     exit 1
3265     ;;
3266 esac
3267 : set up the translation script tr, must be called with ./tr of course
3268 cat >tr <<EOSC
3269 $startsh
3270 case "\$1\$2" in
3271 '[A-Z][a-z]') exec $tr '$up' '$low';;
3272 '[a-z][A-Z]') exec $tr '$low' '$up';;
3273 esac
3274 exec $tr "\$@"
3275 EOSC
3276 chmod +x tr
3277 $eunicefix tr
3278
3279 : Try to determine whether config.sh was made on this system
3280 case "$config_sh" in
3281 '')
3282 myuname=`$uname -a 2>/dev/null`
3283 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3284 # Downcase everything to avoid ambiguity.
3285 # Remove slashes and single quotes so we can use parts of this in
3286 # directory and file names.
3287 # Remove newlines so myuname is sane to use elsewhere.
3288 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3289 # because the A-Z/a-z are not consecutive.
3290 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3291         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3292 newmyuname="$myuname"
3293 dflt=n
3294 case "$knowitall" in
3295 '')
3296         if test -f ../config.sh; then
3297                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3298                         eval "`grep myuname= ../config.sh`"
3299                 fi
3300                 if test "X$myuname" = "X$newmyuname"; then
3301                         dflt=y
3302                 fi
3303         fi
3304         ;;
3305 *) dflt=y;;
3306 esac
3307
3308 : Get old answers from old config file if Configure was run on the
3309 : same system, otherwise use the hints.
3310 hint=default
3311 cd ..
3312 if test -f config.sh; then
3313         echo " "
3314         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3315         . UU/myread
3316         case "$ans" in
3317         n*|N*) echo "OK, I'll ignore it."
3318                 mv config.sh config.sh.old
3319                 myuname="$newmyuname"
3320                 ;;
3321         *)  echo "Fetching default answers from your old config.sh file..." >&4
3322                 tmp_n="$n"
3323                 tmp_c="$c"
3324                 tmp_sh="$sh"
3325                 . ./config.sh
3326                 cp config.sh UU
3327                 n="$tmp_n"
3328                 c="$tmp_c"
3329                 : Older versions did not always set $sh.  Catch re-use of such
3330                 : an old config.sh.
3331                 case "$sh" in
3332                 '') sh="$tmp_sh" ;;
3333                 esac
3334                 hint=previous
3335                 ;;
3336         esac
3337 fi
3338 . ./UU/checkcc
3339 if test ! -f config.sh; then
3340         $cat <<EOM
3341
3342 First time through, eh?  I have some defaults handy for some systems
3343 that need some extra help getting the Configure answers right:
3344
3345 EOM
3346         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3347         dflt=''
3348         : Half the following guesses are probably wrong... If you have better
3349         : tests or hints, please send them to perlbug@perl.org
3350         : The metaconfig authors would also appreciate a copy...
3351         $test -f /irix && osname=irix
3352         $test -f /xenix && osname=sco_xenix
3353         $test -f /dynix && osname=dynix
3354         $test -f /dnix && osname=dnix
3355         $test -f /lynx.os && osname=lynxos
3356         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3357         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3358         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3359         $test -f /bin/mips && /bin/mips && osname=mips
3360         $test -d /usr/apollo/bin && osname=apollo
3361         $test -f /etc/saf/_sactab && osname=svr4
3362         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3363         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3364         $test -f /sys/utilities/MultiView && osname=amigaos
3365         if $test -d /MachTen -o -d /MachTen_Folder; then
3366                 osname=machten
3367                 if $test -x /sbin/version; then
3368                         osvers=`/sbin/version | $awk '{print $2}' |
3369                         $sed -e 's/[A-Za-z]$//'`
3370                 elif $test -x /usr/etc/version; then
3371                         osvers=`/usr/etc/version | $awk '{print $2}' |
3372                         $sed -e 's/[A-Za-z]$//'`
3373                 else
3374                         osvers="$2.$3"
3375                 fi
3376         fi
3377
3378         $test -f /sys/posix.dll &&
3379                 $test -f /usr/bin/what &&
3380                 set X `/usr/bin/what /sys/posix.dll` &&
3381                 $test "$3" = UWIN &&
3382                 osname=uwin &&
3383                 osvers="$5"
3384
3385         if $test -f $uname; then
3386                 set X $myuname
3387                 shift
3388
3389                 case "$5" in
3390                 fps*) osname=fps ;;
3391                 mips*)
3392                         case "$4" in
3393                         umips) osname=umips ;;
3394                         *) osname=mips ;;
3395                         esac;;
3396                 [23]100) osname=mips ;;
3397                 i386*)
3398                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3399                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3400                                 osname='sco'
3401                                 osvers=$tmp
3402                         elif $test -f /etc/kconfig; then
3403                                 osname=isc
3404                                 if test "$lns" = "$ln -s"; then
3405                                         osvers=4
3406                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3407                                         osvers=3
3408                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3409                                         osvers=2
3410                                 fi
3411                         fi
3412                         tmp=''
3413                         ;;
3414                 pc*)
3415                         if test -n "$DJGPP"; then
3416                                 osname=dos
3417                                 osvers=djgpp
3418                         fi
3419                         ;;
3420                 esac
3421
3422                 case "$1" in
3423                 aix) osname=aix
3424                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3425                         case "$tmp" in
3426                         # oslevel can fail with:
3427                         # oslevel: Unable to acquire lock.
3428                         *not\ found) osvers="$4"."$3" ;;
3429                         '<3240'|'<>3240') osvers=3.2.0 ;;
3430                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3431                         '=3250'|'>3250') osvers=3.2.5 ;;
3432                         *) osvers=$tmp;;
3433                         esac
3434                         ;;
3435                 bitrig) osname=bitrig
3436                         osvers="$3"
3437                         ;;
3438                 bsd386) osname=bsd386
3439                         osvers=`$uname -r`
3440                         ;;
3441                 cygwin*) osname=cygwin
3442                         osvers="$3"
3443                         ;;
3444                 *dc.osx) osname=dcosx
3445                         osvers="$3"
3446                         ;;
3447                 dnix) osname=dnix
3448                         osvers="$3"
3449                         ;;
3450                 domainos) osname=apollo
3451                         osvers="$3"
3452                         ;;
3453                 dgux)   osname=dgux
3454                         osvers="$3"
3455                         ;;
3456                 dragonfly) osname=dragonfly
3457                         osvers="$3"
3458                         ;;
3459                 dynixptx*) osname=dynixptx
3460                         osvers=`echo "$4"|sed 's/^v//'`
3461                         ;;
3462                 freebsd) osname=freebsd
3463                         osvers="$3" ;;
3464                 genix)  osname=genix ;;
3465                 gnu)    osname=gnu
3466                         osvers="$3" ;;
3467                 hp*)    osname=hpux
3468                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3469                         ;;
3470                 irix*)  osname=irix
3471                         case "$3" in
3472                         4*) osvers=4 ;;
3473                         5*) osvers=5 ;;
3474                         *)      osvers="$3" ;;
3475                         esac
3476                         ;;
3477                 linux)  osname=linux
3478                         case "$3" in
3479                         *)      osvers="$3" ;;
3480                         esac
3481                         $test -f /system/lib/libandroid.so && osname=linux-android
3482                         ;;
3483                 MiNT)   osname=mint
3484                         ;;
3485                 netbsd*) osname=netbsd
3486                         osvers="$3"
3487                         ;;
3488                 news-os) osvers="$3"
3489                         case "$3" in
3490                         4*) osname=newsos4 ;;
3491                         *) osname=newsos ;;
3492                         esac
3493                         ;;
3494                 nonstop-ux) osname=nonstopux ;;
3495                 openbsd) osname=openbsd
3496                         osvers="$3"
3497                         ;;
3498                 os2)    osname=os2
3499                         osvers="$4"
3500                         ;;
3501                 POSIX-BC | posix-bc ) osname=posix-bc
3502                         osvers="$3"
3503                         ;;
3504                 powerux | power_ux | powermax_os | powermaxos | \
3505                 powerunix | power_unix) osname=powerux
3506                         osvers="$3"
3507                         ;;
3508                 qnx) osname=qnx
3509                         osvers="$4"
3510                         ;;
3511                 solaris) osname=solaris
3512                         case "$3" in
3513                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3514                         *)      osvers="$3" ;;
3515                         esac
3516                         ;;
3517                 sunos) osname=sunos
3518                         case "$3" in
3519                         5*) osname=solaris
3520                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3521                         *)      osvers="$3" ;;
3522                         esac
3523                         ;;
3524                 titanos) osname=titanos
3525                         case "$3" in
3526                         1*) osvers=1 ;;
3527                         2*) osvers=2 ;;
3528                         3*) osvers=3 ;;
3529                         4*) osvers=4 ;;
3530                         *)      osvers="$3" ;;
3531                         esac
3532                         ;;
3533                 ultrix) osname=ultrix
3534                         osvers="$3"
3535                         ;;
3536                 osf1|mls+)      case "$5" in
3537                                 alpha)
3538                                         osname=dec_osf
3539                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3540                                         case "$osvers" in
3541                                         [1-9].[0-9]*) ;;
3542                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3543                                         esac
3544                                         ;;
3545                         hp*)    osname=hp_osf1  ;;
3546                         mips)   osname=mips_osf1 ;;
3547                         esac
3548                         ;;
3549                 # UnixWare 7.1.2 is known as Open UNIX 8
3550                 openunix|unixware) osname=svr5
3551                         osvers="$4"
3552                         ;;
3553                 uts)    osname=uts
3554                         osvers="$3"
3555                         ;;
3556                 vos) osvers="$3"
3557                         ;;
3558                 $2) case "$osname" in
3559                         *isc*) ;;
3560                         *freebsd*) ;;
3561                         svr*)
3562                                 : svr4.x or possibly later
3563                                 case "svr$3" in
3564                                 ${osname}*)
3565                                         osname=svr$3
3566                                         osvers=$4
3567                                         ;;
3568                                 esac
3569                                 case "$osname" in
3570                                 svr4.0)
3571                                         : Check for ESIX
3572                                         if test -f /stand/boot ; then
3573                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3574                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3575                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3576                                                         if test -n "$isesix"; then
3577                                                                 osname=esix4
3578                                                         fi
3579                                                 fi
3580                                         fi
3581                                         ;;
3582                                 esac
3583                                 ;;
3584                         *)      if test -f /etc/systemid; then
3585                                         osname=sco
3586                                         set `echo $3 | $sed 's/\./ /g'` $4
3587                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3588                                                 osvers=$1.$2.$3
3589                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3590                                                 osvers=$1.$2
3591                                         elif $test -f $src/hints/sco_$1.sh; then
3592                                                 osvers=$1
3593                                         fi
3594                                 else
3595                                         case "$osname" in
3596                                         '') : Still unknown.  Probably a generic Sys V.
3597                                                 osname="sysv"
3598                                                 osvers="$3"
3599                                                 ;;
3600                                         esac
3601                                 fi
3602                                 ;;
3603                         esac
3604                         ;;
3605                 *)      case "$osname" in
3606                         '') : Still unknown.  Probably a generic BSD.
3607                                 osname="$1"
3608                                 osvers="$3"
3609                                 ;;
3610                         esac
3611                         ;;
3612                 esac
3613         else
3614                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3615                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3616                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3617                                 osname=news_os
3618                         fi
3619                         $rm -f UU/kernel.what
3620                 elif test -d c:/. -o -n "$is_os2" ; then
3621                         set X $myuname
3622                         osname=os2
3623                         osvers="$5"
3624                 fi
3625         fi
3626
3627         case "$targetarch" in
3628         '') ;;
3629         *)  hostarch=$osname
3630             case "$targetarch" in
3631                 nto*|*-nto-*)
3632                     # Will load qnx.sh, which should change osname to nto
3633                     osname=qnx
3634                     osvers=''
3635                     ;;
3636                 *linux-android*)
3637                     # Catch arm-linux-androideabi, mipsel-linux-android,
3638                     # and i686-linux-android
3639                     osname=linux-android
3640                     osvers=''
3641                     ;;
3642                 *linux*)
3643                     # Something like arm-linux-gnueabihf is really just
3644                     # plain linux.
3645                     osname=linux
3646                     osvers=''
3647                     ;;
3648                 *solaris*|*sunos*)
3649                     osname=solaris
3650                     # XXX perhaps we should just assume
3651                     # osvers to be 2, or maybe take the value
3652                     # from targetarch. Using $run before the
3653                     # hints are run is somewhat icky.
3654                     set X `$run $uname -a 2>/dev/null`
3655                     shift
3656                     case "$3" in
3657                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3658                         *)  osvers="$3" ;;
3659                     esac
3660                     ;;
3661                 *)
3662                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3663                     osvers=''
3664                 ;;
3665             esac
3666             ;;
3667         esac
3668
3669         : Now look for a hint file osname_osvers, unless one has been
3670         : specified already.
3671         case "$hintfile" in
3672         ''|' ')
3673                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3674                 : Also try without trailing minor version numbers.
3675                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3676                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3677                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3678                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3679                 case "$file" in
3680                 '') dflt=none ;;
3681                 *)  case "$osvers" in
3682                         '') dflt=$file
3683                                 ;;
3684                         *)  if $test -f $src/hints/$file.sh ; then
3685                                         dflt=$file
3686                                 elif $test -f $src/hints/$xfile.sh ; then
3687                                         dflt=$xfile
3688                                 elif $test -f $src/hints/$xxfile.sh ; then
3689                                         dflt=$xxfile
3690                                 elif $test -f $src/hints/$xxxfile.sh ; then
3691                                         dflt=$xxxfile
3692                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3693                                         dflt=$xxxxfile
3694                                 elif $test -f "$src/hints/${osname}.sh" ; then
3695                                         dflt="${osname}"
3696                                 else
3697                                         dflt=none
3698                                 fi
3699                                 ;;
3700                         esac
3701                         ;;
3702                 esac
3703                 if $test -f Policy.sh ; then
3704                         case "$dflt" in
3705                         *Policy*) ;;
3706                         none) dflt="Policy" ;;
3707                         *) dflt="Policy $dflt" ;;
3708                         esac
3709                 fi
3710                 ;;
3711         *)
3712                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3713                 ;;
3714         esac
3715
3716         if $test -f Policy.sh ; then
3717                 $cat <<EOM
3718
3719 There's also a Policy hint file available, which should make the
3720 site-specific (policy) questions easier to answer.
3721 EOM
3722
3723         fi
3724
3725         $cat <<EOM
3726
3727 You may give one or more space-separated answers, or "none" if appropriate.
3728 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3729 previous run of Configure, you may specify it as well as or instead of
3730 OS-specific hints.  If hints are provided for your OS, you should use them:
3731 although Perl can probably be built without hints on many platforms, using
3732 hints often improve performance and may enable features that Configure can't
3733 set up on its own. If there are no hints that match your OS, specify "none";
3734 DO NOT give a wrong version or a wrong OS.
3735
3736 EOM
3737
3738         rp="Which of these apply, if any?"
3739         . UU/myread
3740         tans=$ans
3741         for file in $tans; do
3742                 if $test X$file = XPolicy -a -f Policy.sh; then
3743                         . Policy.sh
3744                         $cat Policy.sh >> UU/config.sh
3745                 elif $test -f $src/hints/$file.sh; then
3746                         . $src/hints/$file.sh
3747                         $cat $src/hints/$file.sh >> UU/config.sh
3748                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3749                         : nothing
3750                 else
3751                         : Give one chance to correct a possible typo.
3752                         echo "$file.sh does not exist"
3753                         dflt=$file
3754                         rp="hint to use instead?"
3755                         . UU/myread
3756                         for file in $ans; do
3757                                 if $test -f "$src/hints/$file.sh"; then
3758                                         . $src/hints/$file.sh
3759                                         $cat $src/hints/$file.sh >> UU/config.sh
3760                                 elif $test X$ans = X -o X$ans = Xnone ; then
3761                                         : nothing
3762                                 else
3763                                         echo "$file.sh does not exist -- ignored."
3764                                 fi
3765                         done
3766                 fi
3767         done
3768
3769         hint=recommended
3770         : Remember our hint file for later.
3771         if $test -f "$src/hints/$file.sh" ; then
3772                 hintfile="$file"
3773         else
3774                 hintfile=''
3775         fi
3776 fi
3777 cd UU
3778 ;;
3779 *)
3780         echo " "
3781         echo "Fetching default answers from $config_sh..." >&4
3782         tmp_n="$n"
3783         tmp_c="$c"
3784         cd ..
3785         cp $config_sh config.sh 2>/dev/null
3786         chmod +w config.sh
3787         . ./config.sh
3788         cd UU
3789         cp ../config.sh .
3790         n="$tmp_n"
3791         c="$tmp_c"
3792         hint=previous
3793         ;;
3794 esac
3795 . ./optdef.sh
3796
3797 : Restore computed paths
3798 for file in $loclist $trylist; do
3799         eval $file="\$_$file"
3800 done
3801
3802 cat << EOM
3803
3804 Configure uses the operating system name and version to set some defaults.
3805 The default value is probably right if the name rings a bell. Otherwise,
3806 since spelling matters for me, either accept the default or answer "none"
3807 to leave it blank.
3808
3809 EOM
3810 case "$osname" in
3811         ''|' ')
3812                 case "$hintfile" in
3813                 ''|' '|none) dflt=none ;;
3814                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3815                 esac
3816                 ;;
3817         *) dflt="$osname" ;;
3818 esac
3819 rp="Operating system name?"
3820 . ./myread
3821 case "$ans" in
3822 none)  osname='' ;;
3823 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3824 esac
3825 echo " "
3826 case "$osvers" in
3827         ''|' ')
3828                 case "$hintfile" in
3829                 ''|' '|none) dflt=none ;;
3830                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3831                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3832                         case "$dflt" in
3833                         ''|' ') dflt=none ;;
3834                         esac
3835                         ;;
3836                 esac
3837                 ;;
3838         *) dflt="$osvers" ;;
3839 esac
3840 rp="Operating system version?"
3841 . ./myread
3842 case "$ans" in
3843 none)  osvers='' ;;
3844 *) osvers="$ans" ;;
3845 esac
3846
3847
3848 . ./posthint.sh
3849
3850 : who configured the system
3851 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3852 case "$cf_by" in
3853 "")
3854         cf_by=`(logname) 2>/dev/null`
3855         case "$cf_by" in
3856         "")
3857                 cf_by=`(whoami) 2>/dev/null`
3858                 case "$cf_by" in
3859                 "") cf_by=unknown ;;
3860                 esac ;;
3861         esac ;;
3862 esac
3863
3864 : decide how portable to be.  Allow command line overrides.
3865 case "$d_portable" in
3866 "$undef") ;;
3867 *)      d_portable="$define" ;;
3868 esac
3869
3870 : set up shell script to do ~ expansion
3871 cat >filexp <<EOSS
3872 $startsh
3873 : expand filename
3874 case "\$1" in
3875  \~/*|\~)
3876         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3877         ;;
3878  \~*)
3879         if $test -f /bin/csh; then
3880                 /bin/csh -f -c "glob \$1"
3881                 failed=\$?
3882                 echo ""
3883                 exit \$failed
3884         else
3885                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3886                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3887                 if $test ! -d "\$dir"; then
3888                         me=\`basename \$0\`
3889                         echo "\$me: can't locate home directory for: \$name" >&2
3890                         exit 1
3891                 fi
3892                 case "\$1" in
3893                 */*)
3894                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3895                         ;;
3896                 *)
3897                         echo \$dir
3898                         ;;
3899                 esac
3900         fi
3901         ;;
3902 *)
3903         echo \$1
3904         ;;
3905 esac
3906 EOSS
3907 chmod +x filexp
3908 $eunicefix filexp
3909
3910 : now set up to get a file name
3911 cat <<EOS >getfile
3912 $startsh
3913 EOS
3914 cat <<'EOSC' >>getfile
3915 tilde=''
3916 fullpath=''
3917 already=''
3918 skip=''
3919 none_ok=''
3920 exp_file=''
3921 nopath_ok=''
3922 orig_rp="$rp"
3923 orig_dflt="$dflt"
3924 case "$gfpth" in
3925 '') gfpth='.' ;;
3926 esac
3927
3928 case "$fn" in
3929 *\(*)
3930         : getfile will accept an answer from the comma-separated list
3931         : enclosed in parentheses even if it does not meet other criteria.
3932         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3933         fn=`echo $fn | sed 's/(.*)//'`
3934         ;;
3935 esac
3936
3937 case "$fn" in
3938 *:*)
3939         loc_file=`expr $fn : '.*:\(.*\)'`
3940         fn=`expr $fn : '\(.*\):.*'`
3941         ;;
3942 esac
3943
3944 case "$fn" in
3945 *~*) tilde=true;;
3946 esac
3947 case "$fn" in
3948 */*) fullpath=true;;
3949 esac
3950 case "$fn" in
3951 *+*) skip=true;;
3952 esac
3953 case "$fn" in
3954 *n*) none_ok=true;;
3955 esac
3956 case "$fn" in
3957 *e*) exp_file=true;;
3958 esac
3959 case "$fn" in
3960 *p*) nopath_ok=true;;
3961 esac
3962
3963 case "$fn" in
3964 *f*) type='File';;
3965 *d*) type='Directory';;
3966 *l*) type='Locate';;
3967 esac
3968
3969 what="$type"
3970 case "$what" in
3971 Locate) what='File';;
3972 esac
3973
3974 case "$exp_file" in
3975 '')
3976         case "$d_portable" in
3977         "$define") ;;
3978         *) exp_file=true;;
3979         esac
3980         ;;
3981 esac
3982
3983 cd ..
3984 while test "$type"; do
3985         redo=''
3986         rp="$orig_rp"
3987         dflt="$orig_dflt"
3988         case "$tilde" in
3989         true) rp="$rp (~name ok)";;
3990         esac
3991         . UU/myread
3992         if test -f UU/getfile.ok && \
3993                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3994         then
3995                 value="$ans"
3996                 ansexp="$ans"
3997                 break
3998         fi
3999         case "$ans" in
4000         none)
4001                 value=''
4002                 ansexp=''
4003                 case "$none_ok" in
4004                 true) type='';;
4005                 esac
4006                 ;;
4007         *)
4008                 case "$tilde" in
4009                 '') value="$ans"
4010                         ansexp="$ans";;
4011                 *)
4012                         value=`UU/filexp $ans`
4013                         case $? in
4014                         0)
4015                                 if test "$ans" != "$value"; then
4016                                         echo "(That expands to $value on this system.)"
4017                                 fi
4018                                 ;;
4019                         *) value="$ans";;
4020                         esac
4021                         ansexp="$value"
4022                         case "$exp_file" in
4023                         '') value="$ans";;
4024                         esac
4025                         ;;
4026                 esac
4027                 case "$fullpath" in
4028                 true)
4029                         case "$ansexp" in
4030                         /*) value="$ansexp" ;;
4031                         [a-zA-Z]:/*) value="$ansexp" ;;
4032                         *)
4033                                 redo=true
4034                                 case "$already" in
4035                                 true)
4036                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4037                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4038                                         ;;
4039                                 *)
4040                                 echo "Please give a full path name, starting with slash." >&4
4041                                         case "$tilde" in
4042                                         true)
4043                                 echo "Note that using ~name is ok provided it expands well." >&4
4044                                                 already=true
4045                                                 ;;
4046                                         esac
4047                                 esac
4048                                 ;;
4049                         esac
4050                         ;;
4051                 esac
4052                 case "$redo" in
4053                 '')
4054                         case "$type" in
4055                         File)
4056                                 for fp in $gfpth; do
4057                                         if test "X$fp" = X.; then
4058                                             pf="$ansexp"
4059                                         else    
4060                                             pf="$fp/$ansexp"
4061                                         fi
4062                                         if test -f "$pf"; then
4063                                                 type=''
4064                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4065                                         then
4066                                                 echo "($value is not a plain file, but that's ok.)"
4067                                                 type=''
4068                                         fi
4069                                         if test X"$type" = X; then
4070                                             value="$pf"
4071                                             break
4072                                         fi
4073                                 done
4074                                 ;;
4075                         Directory)
4076                                 for fp in $gfpth; do
4077                                         if test "X$fp" = X.; then
4078                                             dir="$ans"
4079                                             direxp="$ansexp"
4080                                         else    
4081                                             dir="$fp/$ansexp"
4082                                             direxp="$fp/$ansexp"
4083                                         fi
4084                                         if test -d "$direxp"; then
4085                                                 type=''
4086                                                 value="$dir"
4087                                                 break
4088                                         fi
4089                                 done
4090                                 ;;
4091                         Locate)
4092                                 if test -d "$ansexp"; then
4093                                         echo "(Looking for $loc_file in directory $value.)"
4094                                         value="$value/$loc_file"
4095                                         ansexp="$ansexp/$loc_file"
4096                                 fi
4097                                 if test -f "$ansexp"; then
4098                                         type=''
4099                                 fi
4100                                 case "$nopath_ok" in
4101                                 true)   case "$value" in
4102                                         */*) ;;
4103                                         *)      echo "Assuming $value will be in people's path."
4104                                                 type=''
4105                                                 ;;
4106                                         esac
4107                                         ;;
4108                                 esac
4109                                 ;;
4110                         esac
4111
4112                         case "$skip" in
4113                         true) type='';
4114                         esac
4115
4116                         case "$type" in
4117                         '') ;;
4118                         *)
4119                                 if test "$fastread" = yes; then
4120                                         dflt=y
4121                                 else
4122                                         dflt=n
4123                                 fi
4124                                 rp="$what $value doesn't exist.  Use that name anyway?"
4125                                 . UU/myread
4126                                 dflt=''
4127                                 case "$ans" in
4128                                 y*) type='';;
4129                                 *) echo " ";;
4130                                 esac
4131                                 ;;
4132                         esac
4133                         ;;
4134                 esac
4135                 ;;
4136         esac
4137 done
4138 cd UU
4139 ans="$value"
4140 rp="$orig_rp"
4141 dflt="$orig_dflt"
4142 rm -f getfile.ok
4143 test "X$gfpthkeep" != Xy && gfpth=""
4144 EOSC
4145
4146 : determine root of directory hierarchy where package will be installed.
4147 case "$prefix" in
4148 '')
4149         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4150         ;;
4151 *?/)
4152         dflt=`echo "$prefix" | sed 's/.$//'`
4153         ;;
4154 *)
4155         dflt="$prefix"
4156         ;;
4157 esac
4158 $cat <<EOM
4159
4160 By default, $package will be installed in $dflt/bin, manual pages
4161 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4162 installation directories. Typically this is something like /usr/local.
4163 If you wish to have binaries under /usr/bin but other parts of the
4164 installation under /usr/local, that's ok: you will be prompted
4165 separately for each of the installation directories, the prefix being
4166 only used to set the defaults.
4167
4168 EOM
4169 fn=d~
4170 rp='Installation prefix to use?'
4171 . ./getfile
4172 oldprefix=''
4173 case "$prefix" in
4174 '') ;;
4175 *)
4176         case "$ans" in
4177         "$prefix") ;;
4178         *) oldprefix="$prefix";;
4179         esac
4180         ;;
4181 esac
4182 prefix="$ans"
4183 prefixexp="$ansexp"
4184
4185 : allow them to override the AFS root
4186 case "$afsroot" in
4187 '')     afsroot=/afs ;;
4188 *)      afsroot=$afsroot ;;
4189 esac
4190
4191 : is AFS running?
4192 echo " "
4193 case "$afs" in
4194 $define|true)   afs=true ;;
4195 $undef|false)   afs=false ;;
4196 *)      if $test -d $afsroot; then
4197                 afs=true
4198         else
4199                 afs=false
4200         fi
4201         ;;
4202 esac
4203 if $afs; then
4204         echo "AFS may be running... I'll be extra cautious then..." >&4
4205 else
4206         echo "AFS does not seem to be running..." >&4
4207 fi
4208
4209 : determine installation prefix for where package is to be installed.
4210 if $afs; then
4211 $cat <<EOM
4212
4213 Since you are running AFS, I need to distinguish the directory in which
4214 files will reside from the directory in which they are installed (and from
4215 which they are presumably copied to the former directory by occult means).
4216
4217 EOM
4218         case "$installprefix" in
4219         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4220         *) dflt="$installprefix";;
4221         esac
4222 else
4223 $cat <<EOM
4224
4225 In some special cases, particularly when building $package for distribution,
4226 it is convenient to distinguish the directory in which files should be
4227 installed from the directory ($prefix) in which they will
4228 eventually reside.  For most users, these two directories are the same.
4229
4230 EOM
4231         case "$installprefix" in
4232         '') dflt=$prefix ;;
4233         *) dflt=$installprefix;;
4234         esac
4235 fi
4236 fn=d~
4237 rp='What installation prefix should I use for installing files?'
4238 . ./getfile
4239 installprefix="$ans"
4240 installprefixexp="$ansexp"
4241
4242 : Perform the prefixexp/installprefixexp correction if necessary
4243 cat <<EOS >installprefix
4244 $startsh
4245 EOS
4246 cat <<'EOSC' >>installprefix
4247 : Change installation prefix, if necessary.
4248 if $test X"$prefix" != X"$installprefix"; then
4249     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4250 else
4251     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4252 fi
4253 EOSC
4254 chmod +x installprefix
4255 $eunicefix installprefix
4256
4257 : Set variables such as privlib and privlibexp from the output of ./getfile
4258 : performing the prefixexp/installprefixexp correction if necessary.
4259 cat <<EOS >setprefixvar
4260 $startsh
4261 EOS
4262 cat <<'EOSC' >>setprefixvar
4263 eval "${prefixvar}=\"\$ans\""
4264 eval "${prefixvar}exp=\"\$ansexp\""
4265 . ./installprefix
4266 EOSC
4267 chmod +x setprefixvar
4268 $eunicefix setprefixvar
4269
4270 : set up the script used to warn in case of inconsistency
4271 cat <<EOS >whoa
4272 $startsh
4273 EOS
4274 cat <<'EOSC' >>whoa
4275 dflt=y
4276 case "$hint" in
4277     recommended)
4278         case "$hintfile" in
4279         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4280                 ;;
4281         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4282                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4283                 ;;
4284         esac
4285         ;;
4286     *)  echo " "
4287         echo "*** WHOA THERE!!! ***" >&4
4288         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4289         ;;
4290 esac
4291 rp="    Keep the $hint value?"
4292 . ./myread
4293 case "$ans" in
4294 y) td=$was; tu=$was;;
4295 esac
4296 EOSC
4297
4298 : function used to set '$1' to '$val'
4299 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4300 case "$val$was" in
4301 $define$undef) . ./whoa; eval "$var=\$td";;
4302 $undef$define) . ./whoa; eval "$var=\$tu";;
4303 *) eval "$var=$val";;
4304 esac'
4305
4306 : get the patchlevel
4307 echo " "
4308 echo "Getting the current patchlevel..." >&4
4309 if $test -r $rsrc/patchlevel.h;then
4310         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4311         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4312         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4313         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4314         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4315         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4316         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4317 else
4318         revision=0
4319         patchlevel=0
4320         subversion=0
4321         api_revision=0
4322         api_version=0
4323         api_subversion=0
4324         perl_patchlevel=0
4325         $echo "(You do not have patchlevel.h.  Eek.)"
4326 fi
4327 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4328 version_patchlevel_string="version $patchlevel subversion $subversion"
4329 case "$perl_patchlevel" in
4330 0|'') ;;
4331 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4332     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4333     ;;
4334 esac
4335
4336 $echo "(You have $package $version_patchlevel_string.)"
4337
4338 case "$osname" in
4339 dos|vms)
4340         : XXX Should be a Configure test for double-dots in filenames.
4341         version=`echo $revision $patchlevel $subversion | \
4342                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4343         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4344                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
4345         ;;
4346 *)
4347         version=`echo $revision $patchlevel $subversion | \
4348                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4349         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4350                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
4351         ;;
4352 esac
4353 : Special case the 5.005_xx maintenance series, which used 5.005
4354 : without any subversion label as a subdirectory in $sitelib
4355 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4356         api_versionstring='5.005'
4357 fi
4358
4359 : Do we want threads support and if so, what type
4360 case "$usethreads" in
4361 $define|true|[yY]*)     dflt='y';;
4362 *)     # Catch case where user specified ithreads or 5005threads but
4363        # forgot -Dusethreads (A.D. 4/2002)
4364        case "$useithreads$use5005threads" in
4365        *$define*)       dflt='y';;
4366        *)               dflt='n';;
4367        esac
4368        ;;
4369 esac
4370 cat <<EOM
4371
4372 Perl can be built to offer a form of threading support on some systems
4373 To do so, Configure can be run with -Dusethreads.
4374
4375 Note that Perl built with threading support runs slightly slower
4376 and uses slightly more memory than plain Perl.
4377
4378 If this doesn't make any sense to you, just accept the default '$dflt'.
4379 EOM
4380 rp='Build a threading Perl?'
4381 . ./myread
4382 case "$ans" in
4383 y|Y)    val="$define" ;;
4384 *)      val="$undef" ;;
4385 esac
4386 set usethreads
4387 eval $setvar
4388
4389 if $test $patchlevel -lt 9; then
4390     case "$usethreads" in
4391     $define)
4392         : Default to ithreads unless overridden on command line or with
4393         : old config.sh
4394         dflt='y'
4395         case "$use5005threads" in
4396                 $define|true|[yY]*)
4397                         echo "5.005 threads are no longer supported"
4398                         exit 1
4399                 ;;
4400         esac
4401         case "$useithreads" in
4402                 $undef|false|[nN]*) dflt='n';;
4403         esac
4404         rp='Use the newer interpreter-based ithreads?'
4405         . ./myread
4406         case "$ans" in
4407         y|Y)    val="$define" ;;
4408         *)      val="$undef" ;;
4409         esac
4410         set useithreads
4411         eval $setvar
4412         : Now set use5005threads to the opposite value.
4413         case "$useithreads" in
4414         $define) val="$undef" ;;
4415         *) val="$define" ;;
4416         esac
4417         set use5005threads
4418         eval $setvar
4419         ;;
4420     *)
4421         useithreads="$undef"
4422         use5005threads="$undef"
4423         ;;
4424     esac
4425
4426     case "$useithreads$use5005threads" in
4427     "$define$define")
4428         $cat >&4 <<EOM
4429
4430 You cannot have both the ithreads and the 5.005 threads enabled
4431 at the same time.  Disabling the 5.005 threads since they are
4432 much less stable than the ithreads.
4433
4434 EOM
4435         use5005threads="$undef"
4436         ;;
4437     esac
4438
4439 else
4440 : perl-5.9.x and later
4441
4442     if test X"$usethreads" = "X$define"; then
4443         case "$use5005threads" in
4444             $define|true|[yY]*)
4445                 $cat >&4 <<EOM
4446
4447 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4448
4449 EOM
4450             ;;
4451         esac
4452     fi
4453
4454     use5005threads="$undef"
4455     useithreads="$usethreads"
4456 fi
4457
4458 case "$d_oldpthreads" in
4459 '')     : Configure tests would be welcome here.  For now, assume undef.
4460         val="$undef" ;;
4461 *)      val="$d_oldpthreads" ;;
4462 esac
4463 set d_oldpthreads
4464 eval $setvar
4465
4466
4467 : Look for a hint-file generated 'call-back-unit'.  If the
4468 : user has specified that a threading perl is to be built,
4469 : we may need to set or change some other defaults.
4470 if $test -f usethreads.cbu; then
4471     echo "Your platform has some specific hints regarding threaded builds, using them..."
4472     . ./usethreads.cbu
4473 else
4474     case "$usethreads" in
4475         "$define"|true|[yY]*)
4476                 $cat <<EOM
4477 (Your platform does not have any specific hints for threaded builds.
4478  Assuming POSIX threads, then.)
4479 EOM
4480         ;;
4481     esac
4482 fi
4483
4484 : Check if multiplicity is required
4485 cat <<EOM
4486
4487 Perl can be built so that multiple Perl interpreters can coexist
4488 within the same Perl executable.
4489 EOM
4490
4491 case "$useithreads" in
4492 $define)
4493         cat <<EOM
4494 This multiple interpreter support is required for interpreter-based threads.
4495 EOM
4496         val="$define"
4497         ;;
4498 *)      case "$usemultiplicity" in
4499         $define|true|[yY]*)     dflt='y';;
4500         *) dflt='n';;
4501         esac
4502         echo " "
4503         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4504         rp='Build Perl for multiplicity?'
4505         . ./myread
4506         case "$ans" in
4507         y|Y)    val="$define" ;;
4508         *)      val="$undef" ;;
4509         esac
4510         ;;
4511 esac
4512 set usemultiplicity
4513 eval $setvar
4514
4515 : Check if morebits is requested
4516 case "$usemorebits" in
4517 "$define"|true|[yY]*)
4518         use64bitint="$define"
4519         uselongdouble="$define"
4520         usemorebits="$define"
4521         ;;
4522 *)      usemorebits="$undef"
4523         ;;
4524 esac
4525
4526 : Determine the C compiler to be used
4527 echo " "
4528 case "$cc" in
4529 '') dflt=cc;;
4530 *) dflt="$cc";;
4531 esac
4532 rp="Use which C compiler?"
4533 . ./myread
4534 cc="$ans"
4535
4536 : See whether they have no cc but they do have gcc
4537 . ./trygcc
4538 if $test -f cc.cbu; then
4539     . ./cc.cbu
4540 fi
4541 . ./checkcc
4542
4543 : make some quick guesses about what we are up against
4544 echo " "
4545 $echo $n "Hmm...  $c"
4546 echo exit 1 >bsd
4547 echo exit 1 >usg
4548 echo exit 1 >v7
4549 echo exit 1 >osf1
4550 echo exit 1 >eunice
4551 echo exit 1 >xenix
4552 echo exit 1 >venix
4553 echo exit 1 >os2
4554 d_bsd="$undef"
4555 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4556 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4557 then
4558         echo "Looks kind of like an OSF/1 system, but we'll see..."
4559         echo exit 0 >osf1
4560 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4561         xxx=`./loc addbib blurfl $pth`
4562         if $test -f $xxx; then
4563         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4564                 echo exit 0 >bsd
4565                 echo exit 0 >usg
4566         else
4567                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4568                         echo "Looks kind of like an extended USG system, but we'll see..."
4569                 else
4570                         echo "Looks kind of like a USG system, but we'll see..."
4571                 fi
4572                 echo exit 0 >usg
4573         fi
4574 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4575         echo "Looks kind of like a BSD system, but we'll see..."
4576         d_bsd="$define"
4577         echo exit 0 >bsd
4578 else
4579         echo "Looks kind of like a Version 7 system, but we'll see..."
4580         echo exit 0 >v7
4581 fi
4582 case "$eunicefix" in
4583 *unixtovms*)
4584         $cat <<'EOI'
4585 There is, however, a strange, musty smell in the air that reminds me of
4586 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4587 EOI
4588         echo exit 0 >eunice
4589         d_eunice="$define"
4590 : it so happens the Eunice I know will not run shell scripts in Unix format
4591         ;;
4592 *)
4593         echo " "
4594         echo "Congratulations.  You aren't running Eunice."
4595         d_eunice="$undef"
4596         ;;
4597 esac
4598 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4599 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4600 : semicolon as a patch separator
4601 case "$p_" in
4602 :) ;;
4603 *)
4604         $cat <<'EOI'
4605 I have the feeling something is not exactly right, however...don't tell me...
4606 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4607 (Or you may be running DOS with DJGPP.)
4608 EOI
4609         echo exit 0 >os2
4610         ;;
4611 esac
4612 if test -f /xenix; then
4613         echo "Actually, this looks more like a XENIX system..."
4614         echo exit 0 >xenix
4615         d_xenix="$define"
4616 else
4617         echo " "
4618         echo "It's not Xenix..."
4619         d_xenix="$undef"
4620 fi
4621 chmod +x xenix
4622 $eunicefix xenix
4623 if test -f /venix; then
4624         echo "Actually, this looks more like a VENIX system..."
4625         echo exit 0 >venix
4626 else
4627         echo " "
4628         if ./xenix; then
4629                 : null
4630         else
4631                 echo "Nor is it Venix..."
4632         fi
4633 fi
4634 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4635 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4636 $rm -f foo
4637
4638 : Check if we are using GNU gcc and what its version is
4639 echo " "
4640 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4641 $cat >try.c <<EOM
4642 #include <stdio.h>
4643 int main() {
4644 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4645 #ifdef __VERSION__
4646         printf("%s\n", __VERSION__);
4647 #else
4648         printf("%s\n", "1");
4649 #endif
4650 #endif
4651         return(0);
4652 }
4653 EOM
4654 if $cc -o try $ccflags $ldflags try.c; then
4655         gccversion=`$run ./try`
4656         case "$gccversion" in
4657         '') echo "You are not using GNU cc." ;;
4658         *)  echo "You are using GNU cc $gccversion."
4659             ccname=gcc
4660             ;;
4661         esac
4662 else
4663         echo " "
4664         echo "*** WHOA THERE!!! ***" >&4
4665         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4666         case "$knowitall" in
4667         '')
4668         echo "    You'd better start hunting for one and let me know about it." >&4
4669                 exit 1
4670                 ;;
4671         esac
4672 fi
4673 $rm -f try try.*
4674 case "$gccversion" in
4675 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4676 esac
4677 case "$gccversion" in
4678 '') gccosandvers='' ;;
4679 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4680    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4681    gccshortvers=''
4682    case "$gccosandvers" in
4683    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4684    $osname$osvers) ;; # looking good
4685    $osname*) cat <<EOM >&4
4686
4687 *** WHOA THERE!!! ***
4688
4689     Your gcc has not been compiled for the exact release of
4690     your operating system ($gccosandvers versus $osname$osvers).
4691
4692     In general it is a good idea to keep gcc synchronized with
4693     the operating system because otherwise serious problems
4694     may ensue when trying to compile software, like Perl.
4695
4696     I'm trying to be optimistic here, though, and will continue.
4697     If later during the configuration and build icky compilation
4698     problems appear (headerfile conflicts being the most common
4699     manifestation), I suggest reinstalling the gcc to match
4700     your operating system release.
4701
4702 EOM
4703       ;;
4704    *) gccosandvers='' ;; # failed to parse, better be silent
4705    esac
4706    ;;
4707 esac
4708 case "$ccname" in
4709 '') ccname="$cc" ;;
4710 esac
4711
4712 # gcc 3.* complain about adding -Idirectories that they already know about,
4713 # so we will take those off from locincpth.
4714 case "$gccversion" in
4715 3*)
4716     echo "main(){}">try.c
4717     for incdir in $locincpth; do
4718        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4719              grep '^c[cp]p*[01]: warning: changing search order '`
4720        if test "X$warn" != X; then
4721            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4722        fi
4723     done
4724     $rm -f try try.*
4725 esac
4726
4727 # gcc 4.9 by default does some optimizations that break perl.
4728 # see ticket 121505.
4729 #
4730 # The -fwrapv disables those optimizations (and probably others,) so
4731 # for gcc 4.9 (and later, since the optimizations probably won't go
4732 # away), add -fwrapv unless the user requests -fno-wrapv, which
4733 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4734 # which turns the overflows -fwrapv ignores into runtime errors.
4735 case "$gccversion" in
4736 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4737     case "$ccflags" in
4738     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4739     *) ccflags="$ccflags -fwrapv" ;;
4740     esac
4741 esac
4742
4743 : What should the include directory be ?
4744 : Use sysroot if set, so findhdr looks in the right place.
4745 echo " "
4746 $echo $n "Hmm...  $c"
4747 dflt="$sysroot/usr/include"
4748 incpath=''
4749 mips_type=''
4750 if $test -f /bin/mips && /bin/mips; then
4751         echo "Looks like a MIPS system..."
4752         $cat >usr.c <<'EOCP'
4753 #ifdef SYSTYPE_BSD43
4754 /bsd43
4755 #endif
4756 EOCP
4757         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4758                 dflt='/bsd43/usr/include'
4759                 incpath='/bsd43'
4760                 mips_type='BSD 4.3'
4761         else
4762                 mips_type='System V'
4763         fi
4764         $rm -f usr.c usr.out
4765         echo "and you're compiling with the $mips_type compiler and libraries."
4766         xxx_prompt=y
4767         echo "exit 0" >mips
4768 else
4769         echo "Doesn't look like a MIPS system."
4770         xxx_prompt=n
4771         echo "exit 1" >mips
4772 fi
4773 chmod +x mips
4774 $eunicefix mips
4775 case "$usrinc" in
4776 '') ;;
4777 *) dflt="$usrinc";;
4778 esac
4779 case "$xxx_prompt" in
4780 y)      fn=d/
4781         echo " "
4782         rp='Where are the include files you want to use?'
4783         . ./getfile
4784         usrinc="$ans"
4785         ;;
4786 *)      usrinc="$dflt"
4787         ;;
4788 esac
4789
4790 : see how we invoke the C preprocessor
4791 echo " "
4792 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4793 cat <<'EOT' >testcpp.c
4794 #define ABC abc
4795 #define XYZ xyz
4796 ABC.XYZ
4797 EOT
4798 cd ..
4799 if test ! -f cppstdin; then
4800         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4801                 # AIX cc -E doesn't show the absolute headerfile
4802                 # locations but we'll cheat by using the -M flag.
4803                 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
4804         else
4805                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4806         fi
4807 else
4808         echo "Keeping your $hint cppstdin wrapper."
4809 fi
4810 chmod 755 cppstdin
4811 wrapper=`pwd`/cppstdin
4812 ok='false'
4813 cd UU
4814
4815 if $test "X$cppstdin" != "X" && \
4816         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4817         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4818 then
4819         echo "You used to use $cppstdin $cppminus so we'll use that again."
4820         case "$cpprun" in
4821         '') echo "But let's see if we can live without a wrapper..." ;;
4822         *)
4823                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4824                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4825                 then
4826                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4827                         ok='true'
4828                 else
4829                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4830                 fi
4831                 ;;
4832         esac
4833 else
4834         case "$cppstdin" in
4835         '') ;;
4836         *)
4837                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4838                 ;;
4839         esac
4840 fi
4841
4842 if $ok; then
4843         : nothing
4844 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4845         $cc -E <testcpp.c >testcpp.out 2>&1; \
4846         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4847         echo "Yup, it does."
4848         x_cpp="$cc $cppflags -E"
4849         x_minus='';
4850 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4851         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4852         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4853         echo "Yup, it does."
4854         x_cpp="$cc $cppflags -E"
4855         x_minus='-';
4856 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4857         $cc -P <testcpp.c >testcpp.out 2>&1; \
4858         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4859         echo "Yipee, that works!"
4860         x_cpp="$cc $cppflags -P"
4861         x_minus='';
4862 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4863         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4864         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4865         echo "At long last!"
4866         x_cpp="$cc $cppflags -P"
4867         x_minus='-';
4868 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4869         $cpp <testcpp.c >testcpp.out 2>&1; \
4870         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4871         echo "It works!"
4872         x_cpp="$cpp $cppflags"
4873         x_minus='';
4874 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4875         $cpp - <testcpp.c >testcpp.out 2>&1; \
4876         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4877         echo "Hooray, it works!  I was beginning to wonder."
4878         x_cpp="$cpp $cppflags"
4879         x_minus='-';
4880 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4881         $wrapper <testcpp.c >testcpp.out 2>&1; \
4882         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4883         x_cpp="$wrapper"
4884         x_minus=''
4885         echo "Eureka!"
4886 else
4887         dflt=''
4888         rp="No dice.  I can't find a C preprocessor.  Name one:"
4889         . ./myread
4890         x_cpp="$ans"
4891         x_minus=''
4892         $x_cpp <testcpp.c >testcpp.out 2>&1
4893         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4894                 echo "OK, that will do." >&4
4895         else
4896 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4897                 exit 1
4898         fi
4899 fi
4900
4901 case "$ok" in
4902 false)
4903         cppstdin="$x_cpp"
4904         cppminus="$x_minus"
4905         cpprun="$x_cpp"
4906         cpplast="$x_minus"
4907         set X $x_cpp
4908         shift
4909         case "$1" in
4910         "$cpp")
4911                 echo "Perhaps can we force $cc -E using a wrapper..."
4912                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4913                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4914                 then
4915                         echo "Yup, we can."
4916                         cppstdin="$wrapper"
4917                         cppminus='';
4918                 else
4919                         echo "Nope, we'll have to live without it..."
4920                 fi
4921                 ;;
4922         esac
4923         case "$cpprun" in
4924         "$wrapper")
4925                 cpprun=''
4926                 cpplast=''
4927                 ;;
4928         esac
4929         ;;
4930 esac
4931
4932 case "$cppstdin" in
4933 "$wrapper"|'cppstdin') ;;
4934 *) $rm -f $wrapper;;
4935 esac
4936 $rm -f testcpp.c testcpp.out
4937
4938 : Adjust cppfilter for path component separator
4939 case "$osname" in
4940 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4941 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4942 *)   cppfilter='' ;;
4943 esac
4944
4945 : Use gcc to determine libpth and incpth
4946 # If using gcc or clang, we can get better values for libpth, incpth
4947 # and usrinc directly from the compiler.
4948 # Note that ccname for clang is also gcc.
4949 case "$ccname" in
4950     gcc)
4951         $echo 'extern int foo;' > try.c
4952         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4953         shift
4954         if $test $# -gt 0; then
4955             incpth="$incpth $*"
4956             incpth="`$echo $incpth|$sed 's/^ //'`"
4957             for i in $*; do
4958                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4959                 if $test -d $j; then
4960                     libpth="$libpth $j"
4961                 fi
4962             done
4963             libpth="`$echo $libpth|$sed 's/^ //'`"
4964             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4965                 if $test -d $xxx; then
4966                     case " $libpth " in
4967                     *" $xxx "*) ;;
4968                     *) libpth="$libpth $xxx";;
4969                     esac
4970                 fi
4971             done
4972         fi
4973         $rm -f try.c
4974         case "$usrinc" in
4975         '') for i in $incpth; do
4976                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4977                     usrinc="$i"
4978                     break
4979                 fi
4980             done
4981             ;;
4982         esac
4983
4984         case "$usecrosscompile" in
4985         $define|true|[yY]*)
4986             case "$incpth" in
4987                 '') echo "Incpth not defined." >&4; croak=y ;;
4988                 *)  echo "Using incpth '$incpth'." >&4 ;;
4989             esac
4990             case "$libpth" in
4991                 '') echo "Libpth not defined." >&4; croak=y ;;
4992                 *)  echo "Using libpth '$libpth'." >&4 ;;
4993             esac
4994             case "$usrinc" in
4995                 '') echo "Usrinc not defined." >&4; croak=y ;;
4996                 *)  echo "Using usrinc $usrinc." >&4 ;;
4997             esac
4998             case "$croak" in
4999                 y)
5000                 if test "X$sysroot" = X; then
5001                     echo "Cannot continue, aborting." >&4; exit 1
5002                 else
5003                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5004                 fi
5005                 ;;
5006             esac
5007             ;;
5008         esac
5009     ;;
5010 esac
5011
5012 : Default value for incpth is just usrinc
5013 case "$incpth" in
5014 '') incpth="$usrinc";;
5015 esac
5016
5017 : Set private lib path
5018 case "$plibpth" in
5019 '') if ./mips; then
5020         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5021     fi;;
5022 esac
5023 case "$libpth" in
5024 ' ') dlist='';;
5025 '') dlist="$loclibpth $plibpth $glibpth";;
5026 *) dlist="$libpth";;
5027 esac
5028
5029 : Now check and see which directories actually exist, avoiding duplicates
5030 for xxx in $dlist
5031 do
5032     if $test -d $xxx; then
5033                 case " $libpth " in
5034                 *" $xxx "*) ;;
5035                 *) libpth="$libpth $xxx";;
5036                 esac
5037     fi
5038 done
5039 $cat <<'EOM'
5040
5041 Some systems have incompatible or broken versions of libraries.  Among
5042 the directories listed in the question below, please remove any you
5043 know not to be holding relevant libraries, and add any that are needed.
5044 Say "none" for none.
5045
5046 EOM
5047
5048 if test "X$sysroot" != X; then
5049     $cat <<EOM
5050 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5051
5052 EOM
5053 fi
5054
5055 case "$libpth" in
5056 '') dflt='none';;
5057 *)
5058         set X $libpth
5059         shift
5060         dflt=${1+"$@"}
5061         ;;
5062 esac
5063 rp="Directories to use for library searches?"
5064 . ./myread
5065 case "$ans" in
5066 none) libpth=' ';;
5067 *) libpth="$ans";;
5068 esac
5069
5070 : compute shared library extension
5071 case "$so" in
5072 '')
5073         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5074                 dflt='sl'
5075         else
5076                 dflt='so'
5077         fi
5078         ;;
5079 *) dflt="$so";;
5080 esac
5081 $cat <<EOM
5082
5083 On some systems, shared libraries may be available.  Answer 'none' if
5084 you want to suppress searching of shared libraries for the remainder
5085 of this configuration.
5086
5087 EOM
5088 rp='What is the file extension used for shared libraries?'
5089 . ./myread
5090 so="$ans"
5091
5092 : Does target system insist that shared library basenames are unique
5093 $cat << EOM
5094
5095 Some dynamic loaders assume that the *basename* of shared library filenames
5096 are globally unique.  We'll default this to undef as we assume your system
5097 is not this weird. Set to defined if you're on one of them.
5098
5099 EOM
5100
5101 dflt='n'
5102 rp='Make shared library basenames unique?'
5103 . ./myread
5104 case "$ans" in
5105 y|Y) val="$define" ;;
5106 *)   val="$undef"  ;;
5107 esac
5108 set d_libname_unique
5109 eval $setvar
5110
5111 : Define several unixisms.
5112 : Hints files or command line option can be used to override them.
5113 : The convoluted testing is in case hints files set either the old
5114 : or the new name.
5115 case "$_exe" in
5116 '')     case "$exe_ext" in
5117         '')     ;;
5118         *)      _exe="$exe_ext" ;;
5119         esac
5120         ;;
5121 esac
5122 case "$_a" in
5123 '')     case "$lib_ext" in
5124     '') _a='.a';;
5125         *)      _a="$lib_ext" ;;
5126         esac
5127         ;;
5128 esac
5129 case "$_o" in
5130 '') case "$obj_ext" in
5131         '')     _o='.o';;
5132         *)      _o="$obj_ext";;
5133         esac
5134         ;;
5135 esac
5136 case "$p_" in
5137 '') case "$path_sep" in
5138         '')     p_=':';;
5139         *)      p_="$path_sep";;
5140         esac
5141         ;;
5142 esac
5143 exe_ext=$_exe
5144 lib_ext=$_a
5145 obj_ext=$_o
5146 path_sep=$p_
5147
5148 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5149
5150 : Which makefile gets called first.  This is used by make depend.
5151 case "$firstmakefile" in
5152 '') firstmakefile='makefile';;
5153 esac
5154
5155 : Check is we will use socks
5156 case "$usesocks" in
5157 $define|true|[yY]*)     dflt='y';;
5158 *) dflt='n';;
5159 esac
5160 cat <<EOM
5161
5162 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5163 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5164 to use the PerlIO abstraction layer, this will be implicitly selected.
5165
5166 If this doesn't make any sense to you, just accept the default '$dflt'.
5167 EOM
5168 rp='Build Perl for SOCKS?'
5169 . ./myread
5170 case "$ans" in
5171 y|Y)    val="$define" ;;
5172 *)      val="$undef" ;;
5173 esac
5174 set usesocks
5175 eval $setvar
5176
5177 : Check for uselongdouble support
5178 case "$ccflags" in
5179 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5180 esac
5181
5182 case "$uselongdouble" in
5183 $define|true|[yY]*)     dflt='y';;
5184 *) dflt='n';;
5185 esac
5186 cat <<EOM
5187
5188 Perl can be built to take advantage of long doubles which
5189 (if available) may give more accuracy and range for floating point numbers.
5190
5191 If this doesn't make any sense to you, just accept the default '$dflt'.
5192 EOM
5193 rp='Try to use long doubles if available?'
5194 . ./myread
5195 case "$ans" in
5196 y|Y)    val="$define"   ;;
5197 *)      val="$undef"    ;;
5198 esac
5199 set uselongdouble
5200 eval $setvar
5201
5202 case "$uselongdouble" in
5203 true|[yY]*) uselongdouble="$define" ;;
5204 esac
5205
5206 : Look for a hint-file generated 'call-back-unit'.  If the
5207 : user has specified that long doubles should be used,
5208 : we may need to set or change some other defaults.
5209 if $test -f uselongdouble.cbu; then
5210     echo "Your platform has some specific hints regarding long doubles, using them..."
5211     . ./uselongdouble.cbu
5212 else
5213     case "$uselongdouble" in
5214         $define)
5215                 $cat <<EOM
5216 (Your platform does not have any specific hints for long doubles.)
5217 EOM
5218         ;;
5219     esac
5220 fi
5221
5222 : Check if quadmath is requested
5223 case "$usequadmath" in
5224 "$define"|true|[yY]*) usequadmath="$define" ;;
5225 *)                    usequadmath="$undef"  ;;
5226 esac
5227
5228 : Looking for optional libraries
5229 echo " "
5230 echo "Checking for optional libraries..." >&4
5231 case "$libs" in
5232 ' '|'') dflt='';;
5233 *) dflt="$libs";;
5234 esac
5235 case "$libswanted" in
5236 '') libswanted='c_s';;
5237 esac
5238 case "$usesocks" in
5239 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5240 esac
5241 case "$usecbacktrace" in
5242 "$define") libswanted="$libswanted bfd" ;;
5243 esac
5244 case "$usequadmath" in
5245 "$define") libswanted="$libswanted quadmath" ;;
5246 esac
5247 libsfound=''
5248 libsfiles=''
5249 libsdirs=''
5250 libspath=''
5251 for thisdir in $libpth $xlibpth; do
5252   test -d $thisdir && libspath="$libspath $thisdir"
5253 done
5254 for thislib in $libswanted; do
5255         for thisdir in $libspath; do
5256             xxx=''
5257             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5258                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5259                 $test -f "$xxx" && eval $libscheck
5260                 $test -f "$xxx" && libstyle=shared
5261                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5262                 $test -f "$xxx" && eval $libscheck
5263                 $test -f "$xxx" && libstyle=shared
5264             fi
5265             if test ! -f "$xxx"; then
5266                 xxx=$thisdir/lib$thislib.$so
5267                 $test -f "$xxx" && eval $libscheck
5268                 $test -f "$xxx" && libstyle=shared
5269             fi
5270             if test ! -f "$xxx"; then
5271                 xxx=$thisdir/lib$thislib$_a
5272                 $test -f "$xxx" && eval $libscheck
5273                 $test -f "$xxx" && libstyle=static
5274             fi
5275             if test ! -f "$xxx"; then
5276                 xxx=$thisdir/$thislib$_a
5277                 $test -f "$xxx" && eval $libscheck
5278                 $test -f "$xxx" && libstyle=static
5279             fi
5280             if test ! -f "$xxx"; then
5281                 xxx=$thisdir/lib${thislib}_s$_a
5282                 $test -f "$xxx" && eval $libscheck
5283                 $test -f "$xxx" && libstyle=static
5284                 $test -f "$xxx" && thislib=${thislib}_s
5285             fi
5286             if test ! -f "$xxx"; then
5287                 xxx=$thisdir/Slib$thislib$_a
5288                 $test -f "$xxx" && eval $libscheck
5289                 $test -f "$xxx" && libstyle=static
5290             fi
5291             if $test -f "$xxx"; then
5292                 case "$libstyle" in
5293                 shared) echo "Found -l$thislib (shared)." ;;
5294                 static) echo "Found -l$thislib." ;;
5295                 *)      echo "Found -l$thislib ($libstyle)." ;;
5296                 esac
5297                 case " $dflt " in
5298                 *"-l$thislib "*);;
5299                 *) dflt="$dflt -l$thislib"
5300                    libsfound="$libsfound $xxx"
5301                    yyy=`basename $xxx`
5302                    libsfiles="$libsfiles $yyy"
5303                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5304                    case " $libsdirs " in
5305                    *" $yyy "*) ;;
5306                    *) libsdirs="$libsdirs $yyy" ;;
5307                    esac
5308                    ;;
5309                 esac
5310                 break
5311             fi
5312         done
5313         if $test ! -f "$xxx"; then
5314             echo "No -l$thislib."
5315         fi
5316 done
5317 set X $dflt
5318 shift
5319 dflt="$*"
5320 case "$libs" in
5321 '') dflt="$dflt";;
5322 *) dflt="$libs";;
5323 esac
5324 case "$dflt" in
5325 ' '|'') dflt='none';;
5326 esac
5327
5328 $cat <<EOM
5329
5330 In order to compile $package on your machine, a number of libraries
5331 are usually needed.  Include any other special libraries here as well.
5332 Say "none" for none.  The default list is almost always right.
5333 EOM
5334
5335 echo " "
5336 rp="What libraries to use?"
5337 . ./myread
5338 case "$ans" in
5339 none) libs=' ';;
5340 *) libs="$ans";;
5341 esac
5342
5343 : determine optimization, if desired, or use for debug flag also
5344 case "$optimize" in
5345 ' '|$undef) dflt='none';;
5346 '') dflt='-O';;
5347 *) dflt="$optimize";;
5348 esac
5349 $cat <<EOH
5350
5351 By default, $package compiles with the -O flag to use the optimizer.
5352 Alternately, you might want to use the symbolic debugger, which uses
5353 the -g flag (on traditional Unix systems).  Either flag can be
5354 specified here.  To use neither flag, specify the word "none".
5355
5356 EOH
5357 rp="What optimizer/debugger flag should be used?"
5358 . ./myread
5359 optimize="$ans"
5360 case "$optimize" in
5361 'none') optimize=" ";;
5362 esac
5363
5364 : Check what DEBUGGING is required from the command line
5365 : -DEBUGGING      or -DDEBUGGING or
5366 : -DEBUGGING=both                       = -g + -DDEBUGGING
5367 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5368 : -DEBUGGING=none or -UDEBUGGING        =
5369 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5370 case "$EBUGGING" in
5371 '')     ;;
5372 *)      DEBUGGING=$EBUGGING ;;
5373 esac
5374
5375 case "$DEBUGGING" in
5376 -g|both|$define)
5377     case "$optimize" in
5378         *-g*) ;;
5379         *)    optimize="$optimize -g" ;;
5380     esac ;;
5381 none|$undef)
5382     case "$optimize" in
5383         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5384                 shift
5385                 optimize="$*"
5386                 ;;
5387     esac ;;
5388 esac
5389
5390 dflt=''
5391 case "$DEBUGGING" in
5392 both|$define) dflt='-DDEBUGGING'
5393 esac
5394
5395 : argument order is deliberate, as the flag will start with - which set could
5396 : think is an option
5397 checkccflag='check=$1; flag=$2; callback=$3;
5398 echo " ";
5399 echo "Checking if your compiler accepts $flag" 2>&1;
5400 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5401 echo "int main(void) { return 0; }" > gcctest.c;
5402 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5403     echo "Yes, it does." 2>&1;
5404     if $test -s gcctest.out ; then
5405         echo "But your platform does not like it:";
5406         cat gcctest.out;
5407     else
5408         case "$ccflags" in
5409         *$check*)
5410             echo "Leaving current flags $ccflags alone." 2>&1
5411             ;;
5412         *) dflt="$dflt $flag";
5413             eval $callback
5414             ;;
5415         esac
5416     fi
5417 else
5418     echo "Nope, it does not, but that is ok." 2>&1;
5419 fi
5420 '
5421
5422 : We will not override a previous value, but we might want to
5423 : augment a hint file
5424 case "$hint" in
5425 default|recommended)
5426         case "$gccversion" in
5427         1*) dflt="$dflt -fpcc-struct-return" ;;
5428         esac
5429         case "$optimize:$DEBUGGING" in
5430         *-g*:old) dflt="$dflt -DDEBUGGING";;
5431         esac
5432         case "$gccversion" in
5433         2*) if $test -d /etc/conf/kconfig.d &&
5434                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5435                 then
5436                         # Interactive Systems (ISC) POSIX mode.
5437                         dflt="$dflt -posix"
5438                 fi
5439                 ;;
5440         esac
5441         case "$gccversion" in
5442         1*) ;;
5443         2.[0-8]*) ;;
5444         ?*)     set strict-aliasing -fno-strict-aliasing
5445                 eval $checkccflag
5446                 ;;
5447         esac
5448         # For gcc, adding -pipe speeds up compilations for some, but apparently
5449         # some assemblers can't read from stdin.  (It also slows down compilations
5450         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5451         case "$gccversion" in
5452         ?*)     set pipe -pipe
5453                 eval $checkccflag
5454                 ;;
5455         esac
5456
5457         # on x86_64 (at least) we require an extra library (libssp) in the
5458         # link command line. This library is not named, so I infer that it is
5459         # an implementation detail that may change. Hence the safest approach
5460         # is to add the flag to the flags passed to the compiler at link time,
5461         # as that way the compiler can do the right implementation dependant
5462         # thing. (NWC)
5463         case "$osname" in
5464         amigaos) ;; # -fstack-protector builds but doesn't work
5465         *)      case "$gccversion" in
5466                 ?*)     set stack-protector-strong -fstack-protector-strong
5467                         eval $checkccflag
5468                         case "$dflt" in
5469                         *-fstack-protector-strong*) ;; # It got added.
5470                         *) # Try the plain/older -fstack-protector.
5471                            set stack-protector -fstack-protector
5472                            eval $checkccflag
5473                            ;;
5474                         esac
5475                         ;;
5476                 esac
5477                 ;;
5478         esac
5479         ;;
5480 esac
5481
5482 case "$mips_type" in
5483 *BSD*|'') inclwanted="$locincpth $usrinc";;
5484 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5485 esac
5486 for thisincl in $inclwanted; do
5487         if $test -d $thisincl; then
5488                 if $test x$thisincl != x$usrinc; then
5489                         case "$dflt" in
5490                         *" -I$thisincl "*);;
5491                         *) dflt="$dflt -I$thisincl ";;
5492                         esac
5493                 fi
5494         fi
5495 done
5496
5497 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5498         xxx=true;
5499 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5500         xxx=true;
5501 else
5502         xxx=false;
5503 fi;
5504 if $xxx; then
5505         case "$dflt" in
5506         *$2*);;
5507         *) dflt="$dflt -D$2";;
5508         esac;
5509 fi'
5510
5511 set signal.h LANGUAGE_C; eval $inctest
5512
5513 case "$usesocks" in
5514 $define)
5515         ccflags="$ccflags -DSOCKS"
5516         ;;
5517 esac
5518
5519 case "$hint" in
5520 default|recommended) dflt="$ccflags $dflt" ;;
5521 *) dflt="$ccflags";;
5522 esac
5523
5524 case "$dflt" in
5525 ''|' ') dflt=none;;
5526 esac
5527
5528 $cat <<EOH
5529
5530 Your C compiler may want other flags.  For this question you should include
5531 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5532 but you should NOT include libraries or ld flags like -lwhatever.  If you
5533 want $package to honor its debug switch, you should include -DDEBUGGING here.
5534 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5535
5536 To use no flags, specify the word "none".
5537
5538 EOH
5539 set X $dflt
5540 shift
5541 dflt=${1+"$@"}
5542 rp="Any additional cc flags?"
5543 . ./myread
5544 case "$ans" in
5545 none) ccflags='';;
5546 *) ccflags="$ans";;
5547 esac
5548
5549 : the following weeds options from ccflags that are of no interest to cpp
5550 case "$cppflags" in
5551 '') cppflags="$ccflags" ;;
5552 *)  set X $ccflags; shift
5553     case " $cppflags " in
5554     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5555     *) cppflags="$cppflags $ccflags" ;;
5556     esac
5557     ;;
5558 esac
5559 case "$gccversion" in
5560 1*) cppflags="$cppflags -D__GNUC__"
5561 esac
5562 case "$mips_type" in
5563 '');;
5564 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5565 esac
5566 case "$cppflags" in
5567 '');;
5568 *)
5569         echo " "
5570         echo "Let me guess what the preprocessor flags are..." >&4
5571         set X $cppflags
5572         shift
5573         cppflags=''
5574         $cat >cpp.c <<'EOM'
5575 #define BLURFL foo
5576
5577 BLURFL xx LFRULB
5578 EOM
5579         previous=''
5580         for flag in $*
5581         do
5582                 case "$flag" in
5583                 -*) ftry="$flag";;
5584                 *) ftry="$previous $flag";;
5585                 esac
5586                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5587                         >cpp1.out 2>/dev/null && \
5588                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5589                         >cpp2.out 2>/dev/null && \
5590                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5591                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5592                 then
5593                         cppflags="$cppflags $ftry"
5594                         previous=''
5595                 else
5596                         previous="$flag"
5597                 fi
5598         done
5599         set X $cppflags
5600         shift
5601         cppflags=${1+"$@"}
5602         case "$cppflags" in
5603         *-*)  echo "They appear to be: $cppflags";;
5604         esac
5605         $rm -f cpp.c cpp?.out
5606         ;;
5607 esac
5608
5609 : flags used in final linking phase
5610 case "$ldflags" in
5611 '') if ./venix; then
5612                 dflt='-i -z'
5613         else
5614                 dflt=''
5615         fi
5616         case "$ccflags" in
5617         *-posix*) dflt="$dflt -posix" ;;
5618         esac
5619         ;;
5620 *) dflt="$ldflags";;
5621 esac
5622 # See note above about -fstack-protector
5623 case "$ccflags" in
5624 *-fstack-protector-strong*)
5625         case "$dflt" in
5626         *-fstack-protector-strong*) ;; # Don't add it again
5627         *) dflt="$dflt -fstack-protector-strong" ;;
5628         esac
5629         ;;
5630 *-fstack-protector*)
5631         case "$dflt" in
5632         *-fstack-protector*) ;; # Don't add it again
5633         *) dflt="$dflt -fstack-protector" ;;
5634         esac
5635         ;;
5636 esac
5637
5638 : Try to guess additional flags to pick up local libraries.
5639 for thislibdir in $libpth; do
5640         case " $loclibpth " in
5641         *" $thislibdir "*)
5642                 case "$dflt " in
5643                 *"-L$thislibdir "*) ;;
5644                 *)  dflt="$dflt -L$thislibdir" ;;
5645                 esac
5646                 ;;
5647         esac
5648 done
5649
5650 case "$dflt" in
5651 '') dflt='none' ;;
5652 esac
5653
5654 $cat <<EOH
5655
5656 Your C linker may need flags.  For this question you should
5657 include -L/whatever and any other flags used by the C linker, but you
5658 should NOT include libraries like -lwhatever.
5659
5660 Make sure you include the appropriate -L/path flags if your C linker
5661 does not normally search all of the directories you specified above,
5662 namely
5663         $libpth
5664 To use no flags, specify the word "none".
5665
5666 EOH
5667
5668 rp="Any additional ld flags (NOT including libraries)?"
5669 . ./myread
5670 case "$ans" in
5671 none) ldflags='';;
5672 *) ldflags="$ans";;
5673 esac
5674 rmlist="$rmlist pdp11"
5675
5676 : coherency check
5677 echo " "
5678 echo "Checking your choice of C compiler and flags for coherency..." >&4
5679 $cat > try.c <<'EOF'
5680 #include <stdio.h>
5681 int main() { printf("Ok\n"); return(0); }
5682 EOF
5683 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5684 shift
5685 $cat >try.msg <<'EOM'
5686 I've tried to compile and run the following simple program:
5687
5688 EOM
5689 $cat try.c >> try.msg
5690
5691 $cat >> try.msg <<EOM
5692
5693 I used the command:
5694
5695         $*
5696         $run ./try
5697
5698 and I got the following output:
5699
5700 EOM
5701 dflt=y
5702 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5703         if $sh -c "$run ./try " >>try.msg 2>&1; then
5704                 xxx=`$run ./try`
5705                 case "$xxx" in
5706                 "Ok") dflt=n ;;
5707                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5708                 esac
5709         else
5710                 echo "The program compiled OK, but exited with status $?." >>try.msg
5711                 rp="You have a problem.  Shall I abort Configure"
5712                 dflt=y
5713         fi
5714 else
5715         echo "I can't compile the test program." >>try.msg
5716         rp="You have a BIG problem.  Shall I abort Configure"
5717         dflt=y
5718 fi
5719 case "$dflt" in
5720 y)
5721         $cat try.msg >&4
5722         case "$knowitall" in
5723         '')
5724                 echo "(The supplied flags or libraries might be incorrect.)"
5725                 ;;
5726         *) dflt=n;;
5727         esac
5728         echo " "
5729         . ./myread
5730         case "$ans" in
5731         n*|N*) ;;
5732         *)      echo "Ok.  Stopping Configure." >&4
5733                 exit 1
5734                 ;;
5735         esac
5736         ;;
5737 n) echo "OK, that should do.";;
5738 esac
5739 $rm_try gcctest gcctest.out
5740
5741 : define a shorthand compile call
5742 compile='
5743 mc_file=$1;
5744 shift;
5745 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5746 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5747 exit 1;
5748 fi;
5749 esac;
5750 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5751 : define a shorthand compile call for compilations that should be ok.
5752 compile_ok='
5753 mc_file=$1;
5754 shift;
5755 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5756
5757 : determine filename position in cpp output
5758 echo " "
5759 echo "Computing filename position in cpp output for #include directives..." >&4
5760 case "$osname" in
5761 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5762 esac
5763 case "$fieldn" in
5764 '')
5765 case "$osname" in
5766 vos) testaccess=-e ;;
5767 *)   testaccess=-r ;;
5768 esac
5769 echo '#include <stdio.h>' > foo.c
5770 $cat >fieldn <<EOF
5771 $startsh
5772 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5773 $grep '^[       ]*#.*stdio\.h' | \
5774 while read cline; do
5775         pos=1
5776         set \$cline
5777         while $test \$# -gt 0; do
5778                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5779                         echo "\$pos"
5780                         exit 0
5781                 fi
5782                 shift
5783                 pos=\`expr \$pos + 1\`
5784         done
5785 done
5786 EOF
5787 chmod +x fieldn
5788 fieldn=`./fieldn`
5789 $rm -f foo.c fieldn
5790 ;;
5791 esac
5792 case $fieldn in
5793 '') pos='???';;
5794 1) pos=first;;
5795 2) pos=second;;
5796 3) pos=third;;
5797 *) pos="${fieldn}th";;
5798 esac
5799 echo "Your cpp writes the filename in the $pos field of the line."
5800
5801 : locate header file
5802 $cat >findhdr <<EOF
5803 $startsh
5804 wanted=\$1
5805 name=''
5806 for usrincdir in $incpth
5807 do
5808         if test -f \$usrincdir/\$wanted; then
5809                 echo "\$usrincdir/\$wanted"
5810                 exit 0
5811         fi
5812 done
5813 awkprg='{ print \$$fieldn }'
5814 echo "#include <\$wanted>" > foo\$\$.c
5815 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5816 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5817 while read cline; do
5818         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5819         case "\$name" in
5820         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5821         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5822         *) exit 2;;
5823         esac;
5824 done;
5825 #
5826 # status = 0: grep returned 0 lines, case statement not executed
5827 # status = 1: headerfile found
5828 # status = 2: while loop executed, no headerfile found
5829 #
5830 status=\$?
5831 $rm -f foo\$\$.c;
5832 if test \$status -eq 1; then
5833         exit 0;
5834 fi
5835 exit 1
5836 EOF
5837 chmod +x findhdr
5838
5839 : define an alternate in-header-list? function
5840 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5841 cont=true; xxf="echo \"<\$1> found.\" >&4";
5842 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5843 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5844 esac;
5845 case $# in 4) instead=instead;; *) instead="at last";; esac;
5846 while $test "$cont"; do
5847         xxx=`./findhdr $1`
5848         var=$2; eval "was=\$$2";
5849         if $test "$xxx" && $test -r "$xxx";
5850         then eval $xxf;
5851         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5852                 cont="";
5853         else eval $xxnf;
5854         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5855         set $yyy; shift; shift; yyy=$@;
5856         case $# in 0) cont="";;
5857         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5858                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5859         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5860                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5861         esac;
5862 done;
5863 while $test "$yyy";
5864 do set $yyy; var=$2; eval "was=\$$2";
5865         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5866         set $yyy; shift; shift; yyy=$@;
5867 done'
5868
5869 : see if stdlib is available
5870 set stdlib.h i_stdlib
5871 eval $inhdr
5872
5873 : check for lengths of integral types
5874 echo " "
5875 case "$intsize" in
5876 '')
5877         echo "Checking to see how big your integers are..." >&4
5878         $cat >try.c <<EOCP
5879 #include <stdio.h>
5880 #$i_stdlib I_STDLIB
5881 #ifdef I_STDLIB
5882 #include <stdlib.h>
5883 #endif
5884 int main()
5885 {
5886         printf("intsize=%d;\n", (int)sizeof(int));
5887         printf("longsize=%d;\n", (int)sizeof(long));
5888         printf("shortsize=%d;\n", (int)sizeof(short));
5889         exit(0);
5890 }
5891 EOCP
5892         set try
5893         if eval $compile_ok && $run ./try > /dev/null; then
5894                 eval `$run ./try`
5895                 echo "Your integers are $intsize bytes long."
5896                 echo "Your long integers are $longsize bytes long."
5897                 echo "Your short integers are $shortsize bytes long."
5898         else
5899                 $cat >&4 <<EOM
5900 !
5901 Help! I can't compile and run the intsize test program: please enlighten me!
5902 (This is probably a misconfiguration in your system or libraries, and
5903 you really ought to fix it.  Still, I'll try anyway.)
5904 !
5905 EOM
5906                 dflt=4
5907                 rp="What is the size of an integer (in bytes)?"
5908                 . ./myread
5909                 intsize="$ans"
5910                 dflt=$intsize
5911                 rp="What is the size of a long integer (in bytes)?"
5912                 . ./myread
5913                 longsize="$ans"
5914                 dflt=2
5915                 rp="What is the size of a short integer (in bytes)?"
5916                 . ./myread
5917                 shortsize="$ans"
5918         fi
5919         ;;
5920 esac
5921 $rm_try
5922
5923 : check for long long
5924 echo " "
5925 echo "Checking to see if you have long long..." >&4
5926 echo 'int main() { long long x = 7; return 0; }' > try.c
5927 set try
5928 if eval $compile; then
5929         val="$define"
5930         echo "You have long long."
5931 else
5932         val="$undef"
5933         echo "You do not have long long."
5934 fi
5935 $rm_try
5936 set d_longlong
5937 eval $setvar
5938
5939 : check for length of long long
5940 case "${d_longlong}${longlongsize}" in
5941 $define)
5942         echo " "
5943         echo "Checking to see how big your long longs are..." >&4
5944         $cat >try.c <<'EOCP'
5945 #include <stdio.h>
5946 int main()
5947 {
5948     printf("%d\n", (int)sizeof(long long));
5949     return(0);
5950 }
5951 EOCP
5952         set try
5953         if eval $compile_ok; then
5954                 longlongsize=`$run ./try`
5955                 echo "Your long longs are $longlongsize bytes long."
5956         else
5957                 dflt='8'
5958                 echo " "
5959                 echo "(I can't seem to compile the test program.  Guessing...)"
5960                 rp="What is the size of a long long (in bytes)?"
5961                 . ./myread
5962                 longlongsize="$ans"
5963         fi
5964         if $test "X$longsize" = "X$longlongsize"; then
5965                 echo "(That isn't any different from an ordinary long.)"
5966         fi
5967         ;;
5968 esac
5969 $rm_try
5970
5971 : see if inttypes.h is available
5972 : we want a real compile instead of Inhdr because some systems
5973 : have an inttypes.h which includes non-existent headers
5974 echo " "
5975 $cat >try.c <<EOCP
5976 #include <inttypes.h>
5977 int main() {
5978         static int32_t foo32 = 0x12345678;
5979 }
5980 EOCP
5981 set try
5982 if eval $compile; then
5983         echo "<inttypes.h> found." >&4
5984         val="$define"
5985 else
5986         echo "<inttypes.h> NOT found." >&4
5987         val="$undef"
5988 fi
5989 $rm_try
5990 set i_inttypes
5991 eval $setvar
5992
5993 : check for int64_t
5994 echo " "
5995 echo "Checking to see if you have int64_t..." >&4
5996 $cat >try.c <<EOCP
5997 #include <sys/types.h>
5998 #$i_inttypes I_INTTYPES
5999 #ifdef I_INTTYPES
6000 #include <inttypes.h>
6001 #endif
6002 int main() { int64_t x = 7; }
6003 EOCP
6004 set try
6005 if eval $compile; then
6006         val="$define"
6007         echo "You have int64_t."
6008 else
6009         val="$undef"
6010         echo "You do not have int64_t."
6011 fi
6012 $rm_try
6013 set d_int64_t
6014 eval $setvar
6015
6016 : Check if 64bit ints have a quad type
6017 echo " "
6018 echo "Checking which 64-bit integer type we could use..." >&4
6019
6020 case "$intsize" in
6021 8) val=int
6022    set quadtype
6023    eval $setvar
6024    val='"unsigned int"'
6025    set uquadtype
6026    eval $setvar
6027    quadkind=1
6028    ;;
6029 *) case "$longsize" in
6030    8) val=long
6031       set quadtype
6032       eval $setvar
6033       val='"unsigned long"'
6034       set uquadtype
6035       eval $setvar
6036       quadkind=2
6037       ;;
6038    *) case "$d_longlong:$longlongsize" in
6039       define:8)
6040         val='"long long"'
6041         set quadtype
6042         eval $setvar
6043         val='"unsigned long long"'
6044         set uquadtype
6045         eval $setvar
6046         quadkind=3
6047         ;;
6048       *) case "$d_int64_t" in
6049          define)
6050            val=int64_t
6051            set quadtype
6052            eval $setvar
6053            val=uint64_t
6054            set uquadtype
6055            eval $setvar
6056            quadkind=4
6057            ;;
6058          esac
6059          ;;
6060       esac
6061       ;;
6062    esac
6063    ;;
6064 esac
6065
6066 case "$quadtype" in
6067 '')     echo "Alas, no 64-bit integer types in sight." >&4
6068         d_quad="$undef"
6069         ;;
6070 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6071         d_quad="$define"
6072         ;;
6073 esac
6074
6075 : Do we want 64bit support
6076 case "$uselonglong" in
6077 "$define"|true|[yY]*)
6078         cat <<EOM >&4
6079
6080 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6081 EOM
6082         use64bitint="$define"
6083         ;;
6084 esac
6085 case "$use64bits" in
6086 "$define"|true|[yY]*)
6087         cat <<EOM >&4
6088
6089 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6090 EOM
6091         use64bitint="$define"
6092         ;;
6093 esac
6094 case "$use64bitints" in
6095 "$define"|true|[yY]*)
6096         cat <<EOM >&4
6097
6098 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6099 EOM
6100         use64bitint="$define"
6101         ;;
6102 esac
6103 case "$use64bitsint" in
6104 "$define"|true|[yY]*)
6105         cat <<EOM >&4
6106
6107 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6108 EOM
6109         use64bitint="$define"
6110         ;;
6111 esac
6112 case "$uselonglongs" in
6113 "$define"|true|[yY]*)
6114         cat <<EOM >&4
6115
6116 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6117 EOM
6118         use64bitint="$define"
6119         ;;
6120 esac
6121 case "$use64bitsall" in
6122 "$define"|true|[yY]*)
6123         cat <<EOM >&4
6124
6125 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6126 EOM
6127         use64bitall="$define"
6128         ;;
6129 esac
6130
6131 case "$ccflags" in
6132 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6133 esac
6134 case "$use64bitall" in
6135 "$define"|true|[yY]*) use64bitint="$define" ;;
6136 esac
6137
6138 case "$longsize" in
6139 8) cat <<EOM
6140
6141 You have natively 64-bit long integers.
6142 EOM
6143    val="$define"
6144    ;;
6145 *) case "$use64bitint" in
6146    "$define"|true|[yY]*) dflt='y';;
6147    *) dflt='n';;
6148    esac
6149    case "$d_quad" in
6150    "$define") ;;
6151    *) dflt='n' ;;
6152    esac
6153    cat <<EOM
6154
6155 Perl can be built to take advantage of 64-bit integer types
6156 on some systems.  To do so, Configure can be run with -Duse64bitint.
6157 Choosing this option will most probably introduce binary incompatibilities.
6158
6159 If this doesn't make any sense to you, just accept the default '$dflt'.
6160 (The default has been chosen based on your configuration.)
6161 EOM
6162    rp='Try to use 64-bit integers, if available?'
6163    . ./myread
6164    case "$ans" in
6165    [yY]*) val="$define" ;;
6166    *)     val="$undef"  ;;
6167    esac
6168    ;;
6169 esac
6170 set use64bitint
6171 eval $setvar
6172
6173 case "$use64bitall" in
6174 "$define"|true|[yY]*) dflt='y' ;;
6175 *) case "$longsize" in
6176    8) dflt='y' ;;
6177    *) dflt='n' ;;
6178    esac
6179    ;;
6180 esac
6181 cat <<EOM
6182
6183 You may also choose to try maximal 64-bitness.  It means using as much
6184 64-bitness as possible on the platform.  This in turn means even more
6185 binary incompatibilities.  On the other hand, your platform may not
6186 have any more 64-bitness available than what you already have chosen.
6187
6188 If this doesn't make any sense to you, just accept the default '$dflt'.
6189 (The default has been chosen based on your configuration.)
6190 EOM
6191 rp='Try to use maximal 64-bit support, if available?'
6192 . ./myread
6193 case "$ans" in
6194 [yY]*) val="$define" ;;
6195 *)     val="$undef"  ;;
6196 esac
6197 set use64bitall
6198 eval $setvar
6199 case "$use64bitall" in
6200 "$define")
6201         case "$use64bitint" in
6202         "$undef")
6203                 cat <<EOM
6204
6205 Since you have chosen a maximally 64-bit build, I'm also turning on
6206 the use of 64-bit integers.
6207 EOM
6208                 use64bitint="$define" ;;
6209         esac
6210         ;;
6211 esac
6212
6213 : Look for a hint-file generated 'call-back-unit'.  If the
6214 : user has specified that a 64-bit perl is to be built,
6215 : we may need to set or change some other defaults.
6216 if $test -f use64bitint.cbu; then
6217         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6218         . ./use64bitint.cbu
6219 fi
6220 case "$use64bitint" in
6221 "$define"|true|[yY]*)
6222         : This test was common to all the OpenBSD forks, and seems harmless for
6223         : other platforms:
6224         echo " "
6225         echo "Checking if your C library has broken 64-bit functions..." >&4
6226         cat >try.c <<EOCP
6227 #include <stdio.h>
6228 typedef $uquadtype myULL;
6229 int main (void)
6230 {
6231     struct {
6232         double d;
6233         myULL  u;
6234     } *p, test[] = {
6235         {4294967303.15, 4294967303ULL},
6236         {4294967294.2,  4294967294ULL},
6237         {4294967295.7,  4294967295ULL},
6238         {0.0, 0ULL}
6239     };
6240     for (p = test; p->u; p++) {
6241         myULL x = (myULL)p->d;
6242         if (x != p->u) {
6243             printf("buggy\n");
6244             return 0;
6245         }
6246     }
6247     printf("ok\n");
6248     return 0;
6249 }
6250 EOCP
6251         set try
6252         if eval $compile_ok; then
6253             libcquad=`$run ./try`
6254             echo "Your C library's 64-bit functions are $libcquad."
6255         else
6256             echo "(I can't seem to compile the test program.)"
6257             echo "Assuming that your C library's 64-bit functions are ok."
6258             libcquad="ok"
6259         fi
6260         $rm_try
6261
6262         case "$libcquad" in
6263             buggy*)
6264                 cat >&4 <<EOM
6265
6266 *** You have a C library with broken 64-bit functions.
6267 *** 64-bit support does not work reliably in this configuration.
6268 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6269 *** Cannot continue, aborting.
6270
6271 EOM
6272                 exit 1
6273                 ;;
6274         esac
6275         case "$longsize" in
6276         4) case "$archname64" in
6277            '') archname64=64int ;;
6278            esac
6279            ;;
6280         esac
6281         ;;
6282 esac
6283
6284 : Look for a hint-file generated 'call-back-unit'.  If the
6285 : user has specified that a maximally 64-bit perl is to be built,
6286 : we may need to set or change some other defaults.
6287 if $test -f use64bitall.cbu; then
6288         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6289         . ./use64bitall.cbu
6290 fi
6291 case "$use64bitall" in
6292 "$define"|true|[yY]*)
6293         case "$longsize" in
6294         4) case "$archname64" in
6295            ''|64int) archname64=64all ;;
6296            esac
6297            ;;
6298         esac
6299         ;;
6300 esac
6301
6302 case "$d_quad:$use64bitint" in
6303 $undef:$define)
6304         cat >&4 <<EOF
6305
6306 *** You have chosen to use 64-bit integers,
6307 *** but none can be found.
6308 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6309 *** Cannot continue, aborting.
6310
6311 EOF
6312         exit 1
6313         ;;
6314 esac
6315
6316 : Check if we are using the GNU C library
6317 echo " "
6318 echo "Checking for GNU C Library..." >&4
6319 cat >try.c <<'EOCP'
6320 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6321    alone are insufficient to distinguish different versions, such as
6322    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6323    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6324 */
6325 #include <stdio.h>
6326 int main(void)
6327 {
6328 #ifdef __GLIBC__
6329 #   ifdef __GLIBC_MINOR__
6330 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6331 #           include <gnu/libc-version.h>
6332             printf("%s\n",  gnu_get_libc_version());
6333 #       else
6334             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6335 #       endif
6336 #   else
6337         printf("%d\n",  __GLIBC__);
6338 #   endif
6339     return 0;
6340 #else
6341     return 1;
6342 #endif
6343 }
6344 EOCP
6345 set try
6346 if eval $compile_ok && $run ./try > glibc.ver; then
6347         val="$define"
6348         gnulibc_version=`$cat glibc.ver`
6349         echo "You are using the GNU C Library version $gnulibc_version"
6350 else
6351         val="$undef"
6352         gnulibc_version=''
6353         echo "You are not using the GNU C Library"
6354 fi
6355 $rm_try glibc.ver
6356 set d_gnulibc
6357 eval $setvar
6358
6359 : see if nm is to be used to determine whether a symbol is defined or not
6360 case "$usenm" in
6361 '')
6362         dflt=''
6363         case "$d_gnulibc" in
6364         "$define")
6365                 echo " "
6366                 echo "nm probably won't work on the GNU C Library." >&4
6367                 dflt=n
6368                 ;;
6369         esac
6370         case "$dflt" in
6371         '')
6372                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6373                         echo " "
6374                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6375                         echo "'nm' won't be sufficient on this system." >&4
6376                         dflt=n
6377                 fi
6378                 ;;
6379         esac
6380         case "$dflt" in
6381         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6382                 if $test $dflt -gt 20; then
6383                         dflt=y
6384                 else
6385                         dflt=n
6386                 fi
6387                 ;;
6388         esac
6389         ;;
6390 *)
6391         case "$usenm" in
6392         true|$define) dflt=y;;
6393         *) dflt=n;;
6394         esac
6395         ;;
6396 esac
6397 $cat <<EOM
6398
6399 I can use $nm to extract the symbols from your C libraries. This
6400 is a time consuming task which may generate huge output on the disk (up
6401 to 3 megabytes) but that should make the symbols extraction faster. The
6402 alternative is to skip the 'nm' extraction part and to compile a small
6403 test program instead to determine whether each symbol is present. If
6404 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6405 this may be the best solution.
6406
6407 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6408
6409 EOM
6410 rp="Shall I use $nm to extract C symbols from the libraries?"
6411 . ./myread
6412 case "$ans" in
6413 [Nn]*) usenm=false;;
6414 *) usenm=true;;
6415 esac
6416
6417 runnm=$usenm
6418 case "$reuseval" in
6419 true) runnm=false;;
6420 esac
6421
6422 : nm options which may be necessary
6423 case "$nm_opt" in
6424 '') if $test -f /mach_boot; then
6425                 nm_opt=''       # Mach
6426         elif $test -d /usr/ccs/lib; then
6427                 nm_opt='-p'     # Solaris (and SunOS?)
6428         elif $test -f /dgux; then
6429                 nm_opt='-p'     # DG-UX
6430         elif $test -f /lib64/rld; then
6431                 nm_opt='-p'     # 64-bit Irix
6432         else
6433                 nm_opt=''
6434         fi;;
6435 esac
6436
6437 : nm options which may be necessary for shared libraries but illegal
6438 : for archive libraries.  Thank you, Linux.
6439 case "$nm_so_opt" in
6440 '')     case "$myuname" in
6441         *linux*|gnu*)
6442                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6443                         nm_so_opt='--dynamic'
6444                 fi
6445                 ;;
6446         esac
6447         ;;
6448 esac
6449
6450 : Figure out where the libc is located
6451 case "$runnm" in
6452 true)
6453 : get list of predefined functions in a handy place
6454 echo " "
6455 case "$libc" in
6456 '') libc=unknown
6457         case "$libs" in
6458         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6459         esac
6460         ;;
6461 esac
6462 case "$libs" in
6463 '') ;;
6464 *)  for thislib in $libs; do
6465         case "$thislib" in
6466         -lc|-lc_s)
6467                 : Handle C library specially below.
6468                 ;;
6469         -l*)
6470                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6471                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6472                         :
6473                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6474                         :
6475                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6476                         :
6477                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6478                         :
6479                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6480                         :
6481                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6482                         :
6483                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6484                         :
6485                 else
6486                         try=''
6487                 fi
6488                 libnames="$libnames $try"
6489                 ;;
6490         *) libnames="$libnames $thislib" ;;
6491         esac
6492         done
6493         ;;
6494 esac
6495 xxx=normal
6496 case "$libc" in
6497 unknown)
6498         set /lib/libc.$so
6499         for xxx in $libpth; do
6500                 $test -r $1 || set $xxx/libc.$so
6501                 : The messy sed command sorts on library version numbers.
6502                 $test -r $1 || \
6503                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6504                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6505                                 h
6506                                 s/[0-9][0-9]*/0000&/g
6507                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6508                                 G
6509                                 s/\n/ /' | \
6510                          $sort | $sed -e 's/^.* //'`
6511                 eval set \$$#
6512         done
6513         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6514         $test -r $1 || set $sysroot/lib/libsys_s$_a
6515         ;;
6516 *)
6517         set blurfl
6518         ;;
6519 esac
6520 if $test -r "$1"; then
6521         echo "Your (shared) C library seems to be in $1."
6522         libc="$1"
6523 elif $test -r /lib/libc && $test -r /lib/clib; then
6524         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6525         xxx=apollo
6526         libc='/lib/clib /lib/libc'
6527         if $test -r /lib/syslib; then
6528                 echo "(Your math library is in /lib/syslib.)"
6529                 libc="$libc /lib/syslib"
6530         fi
6531 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6532         echo "Your C library seems to be in $libc, as you said before."
6533 elif $test -r $incpath/usr/lib/libc$_a; then
6534         libc=$incpath/usr/lib/libc$_a;
6535         echo "Your C library seems to be in $libc.  That's fine."
6536 elif $test -r /lib/libc$_a; then
6537         libc=/lib/libc$_a;
6538         echo "Your C library seems to be in $libc.  You're normal."
6539 else
6540         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6541                 :
6542         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6543                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6544         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6545                 :
6546         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6547                 :
6548         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6549                 :
6550         else
6551                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6552         fi
6553         if $test -r "$tans"; then
6554                 echo "Your C library seems to be in $tans, of all places."
6555                 libc=$tans
6556         else
6557                 libc='blurfl'
6558         fi
6559 fi
6560 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6561         dflt="$libc"
6562         cat <<EOM
6563
6564 If the guess above is wrong (which it might be if you're using a strange
6565 compiler, or your machine supports multiple models), you can override it here.
6566
6567 EOM
6568 else
6569         dflt=''
6570         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6571         cat >&4 <<EOM
6572 I can't seem to find your C library.  I've looked in the following places:
6573
6574 EOM
6575         $sed 's/^/      /' libpath
6576         cat <<EOM
6577
6578 None of these seems to contain your C library. I need to get its name...
6579
6580 EOM
6581 fi
6582 fn=f
6583 rp='Where is your C library?'
6584 . ./getfile
6585 libc="$ans"
6586
6587 echo " "
6588 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6589 set X `cat libnames`
6590 shift
6591 xxx=files
6592 case $# in 1) xxx=file; esac
6593 echo "Extracting names from the following $xxx for later perusal:" >&4
6594 echo " "
6595 $sed 's/^/      /' libnames >&4
6596 echo " "
6597 $echo $n "This may take a while...$c" >&4
6598
6599 for file in $*; do
6600         case $file in
6601         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6602         *) $nm $nm_opt $file 2>/dev/null;;
6603         esac
6604 done >libc.tmp
6605
6606 $echo $n ".$c"
6607 $grep fprintf libc.tmp > libc.ptf
6608 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6609 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6610 xxx='[ADTSIWi]'
6611 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6612         eval $xscan;\
6613         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6614                 eval $xrun
6615 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6616         eval $xscan;\
6617         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6618                 eval $xrun
6619 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6620         eval $xscan;\
6621         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6622                 eval $xrun
6623 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6624         eval $xscan;\
6625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6626                 eval $xrun
6627 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6628         eval $xscan;\
6629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6630                 eval $xrun
6631 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6632         eval $xscan;\
6633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6634                 eval $xrun
6635 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6636                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6637         eval $xscan;\
6638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6639                 eval $xrun
6640 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6641         eval $xscan;\
6642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6643                 eval $xrun
6644 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6645         eval $xscan;\
6646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6647                 eval $xrun
6648 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6649         eval $xscan;\
6650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6651                 eval $xrun
6652 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6653         eval $xscan;\
6654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6655                 eval $xrun
6656 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6657         eval $xscan;\
6658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6659                 eval $xrun
6660 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6661         eval $xscan;\
6662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6663                 eval $xrun
6664 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6665         eval $xscan;\
6666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6667                 eval $xrun
6668 else
6669         $nm -p $* 2>/dev/null >libc.tmp
6670         $grep fprintf libc.tmp > libc.ptf
6671         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6672                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6673         then
6674                 nm_opt='-p'
6675                 eval $xrun
6676         else
6677                 echo " "
6678                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6679                 com=''
6680                 if $ar t $libc > libc.tmp && \
6681                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6682                 then
6683                         for thisname in $libnames $libc; do
6684                                 $ar t $thisname >>libc.tmp
6685                         done
6686                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6687                         echo "Ok." >&4
6688                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6689                         for thisname in $libnames $libc; do
6690                                 $ar tv $thisname >>libc.tmp
6691                                 emximp -o tmp.imp $thisname \
6692                                     2>/dev/null && \
6693                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6694                                     < tmp.imp >>libc.tmp
6695                                 $rm -f tmp.imp
6696                         done
6697                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6698                         echo "Ok." >&4
6699                 else
6700                         echo "$ar didn't seem to work right." >&4
6701                         echo "Maybe this is a Cray...trying bld instead..." >&4
6702                         if  bld t $libc | \
6703                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6704                                 $test -s libc.list
6705                         then
6706                                 for thisname in $libnames; do
6707                                         bld t $libnames | \
6708                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6709                                         $ar t $thisname >>libc.tmp
6710                                 done
6711                                 echo "Ok." >&4
6712                         else
6713                                 echo "That didn't work either.  Giving up." >&4
6714                                 exit 1
6715                         fi
6716                 fi
6717         fi
6718 fi
6719 nm_extract="$com"
6720 case "$PASE" in
6721 define)
6722     echo " "
6723     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6724     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6725     ;;
6726 *)  if $test -f /lib/syscalls.exp; then
6727         echo " "
6728         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6729         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6730                 /lib/syscalls.exp >>libc.list
6731     fi
6732     ;;
6733 esac
6734 ;;
6735 esac
6736 $rm -f libnames libpath
6737
6738 : Check if we are using C++
6739 echo " "
6740 echo "Checking for C++..." >&4
6741 $cat >try.c <<'EOCP'
6742 #include <stdio.h>
6743 int main(void)
6744 {
6745 #ifdef __cplusplus
6746     return 0;
6747 #else
6748     return 1;
6749 #endif
6750 }
6751 EOCP
6752 set try
6753 if eval $compile_ok && $run ./try; then
6754         val="$define"
6755         echo "You are using a C++ compiler."
6756 else
6757         val="$undef"
6758         echo "You are not using a C++ compiler."
6759 fi
6760 $rm_try cplusplus$$
6761 set d_cplusplus
6762 eval $setvar
6763
6764 : is a C symbol defined?
6765 csym='tlook=$1;
6766 case "$3" in
6767 -v) tf=libc.tmp; tdc="";;
6768 -a) tf=libc.tmp; tdc="[]";;
6769 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6770 esac;
6771 case "$d_cplusplus" in
6772     $define)    extern_C="extern \"C\"" ;;
6773     *)          extern_C="extern"       ;;
6774 esac;
6775 tx=yes;
6776 case "$reuseval-$4" in
6777 true-) ;;
6778 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6779 esac;
6780 case "$tx" in
6781 yes)
6782         tval=false;
6783         if $test "$runnm" = true; then
6784                 if $contains $tlook $tf >/dev/null 2>&1; then
6785                         tval=true;
6786                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6787                         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;
6788                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6789                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6790                         $rm_try;
6791                 fi;
6792         else
6793                 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;
6794                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6795                 $rm_try;
6796         fi;
6797         ;;
6798 *)
6799         case "$tval" in
6800         $define) tval=true;;
6801         *) tval=false;;
6802         esac;
6803         ;;
6804 esac;
6805 eval "$2=$tval"'
6806
6807 : define an is-in-libc? function
6808 inlibc='echo " "; td=$define; tu=$undef;
6809 sym=$1; var=$2; eval "was=\$$2";
6810 tx=yes;
6811 case "$reuseval$was" in
6812 true) ;;
6813 true*) tx=no;;
6814 esac;
6815 case "$tx" in
6816 yes)
6817         set $sym tres -f;
6818         eval $csym;
6819         case "$tres" in
6820         true)
6821                 echo "$sym() found." >&4;
6822                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6823         *)
6824                 echo "$sym() NOT found." >&4;
6825                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6826         esac;;
6827 *)
6828         case "$was" in
6829         $define) echo "$sym() found." >&4;;
6830         *) echo "$sym() NOT found." >&4;;
6831         esac;;
6832 esac'
6833
6834 : check for length of double
6835 echo " "
6836 case "$doublesize" in
6837 '')
6838         echo "Checking to see how big your double precision numbers are..." >&4
6839         $cat >try.c <<EOCP
6840 #include <stdio.h>
6841 #$i_stdlib I_STDLIB
6842 #ifdef I_STDLIB
6843 #include <stdlib.h>
6844 #endif
6845 int main()
6846 {
6847     printf("%d\n", (int)sizeof(double));
6848     exit(0);
6849 }
6850 EOCP
6851         set try
6852         if eval $compile_ok; then
6853                 doublesize=`$run ./try`
6854                 echo "Your double is $doublesize bytes long."
6855         else
6856                 dflt='8'
6857                 echo "(I can't seem to compile the test program.  Guessing...)"
6858                 rp="What is the size of a double precision number (in bytes)?"
6859                 . ./myread
6860                 doublesize="$ans"
6861         fi
6862         ;;
6863 esac
6864 $rm_try
6865
6866 : see if this is a float.h system
6867 set float.h i_float
6868 eval $inhdr
6869
6870 : check for long doubles
6871 echo " "
6872 echo "Checking to see if you have long double..." >&4
6873 echo 'int main() { long double x = 7.0; }' > try.c
6874 set try
6875 if eval $compile; then
6876         val="$define"
6877         echo "You have long double."
6878 else
6879         val="$undef"
6880         echo "You do not have long double."
6881 fi
6882 $rm_try
6883 set d_longdbl
6884 eval $setvar
6885
6886 : see if ldexpl exists
6887 set ldexpl d_ldexpl
6888 eval $inlibc
6889
6890 : check for length of long double
6891 case "${d_longdbl}${longdblsize}" in
6892 $define)
6893         echo " "
6894         echo "Checking to see how big your long doubles are..." >&4
6895         $cat >try.c <<'EOCP'
6896 #include <stdio.h>
6897 int main()
6898 {
6899         printf("%d\n", sizeof(long double));
6900 }
6901 EOCP
6902         set try
6903         set try
6904         if eval $compile; then
6905                 longdblsize=`$run ./try`
6906                 echo "Your long doubles are $longdblsize bytes long."
6907         else
6908                 dflt='8'
6909                 echo " "
6910                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6911                 rp="What is the size of a long double (in bytes)?"
6912                 . ./myread
6913                 longdblsize="$ans"
6914         fi
6915         if $test "X$doublesize" = "X$longdblsize"; then
6916                 echo "That isn't any different from an ordinary double."
6917                 echo "I'll keep your setting anyway, but you may see some"
6918                 echo "harmless compilation warnings."
6919         fi
6920         ;;
6921 esac
6922 $rm_try
6923
6924 $echo "Checking the kind of long doubles you have..." >&4
6925 case "$d_longdbl" in
6926 define)
6927 $cat <<EOP >try.c
6928 #$i_float I_FLOAT
6929 #$i_stdlib I_STDLIB
6930 #define LONGDBLSIZE $longdblsize
6931 #define DOUBLESIZE $doublesize
6932 #ifdef I_FLOAT
6933 #include <float.h>
6934 #endif
6935 #ifdef I_STDLIB
6936 #include <stdlib.h>
6937 #endif
6938 #include <stdio.h>
6939 static const long double d = -0.1L;
6940 int main() {
6941   unsigned const char* b = (unsigned const char*)(&d);
6942 #if DOUBLESIZE == LONGDBLSIZE
6943   printf("0\n"); /* if it floats like double */
6944   exit(0);
6945 #endif
6946 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6947   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6948     /* IEEE 754 128-bit little-endian */
6949     printf("1\n");
6950     exit(0);
6951   }
6952   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6953     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6954     printf("2\n");
6955     exit(0);
6956   }
6957 #endif
6958 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6959  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6960  * cannot be trusted. */
6961 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6962   if (b[0] == 0xCD && b[9] == 0xBF) {
6963     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6964      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6965      * Also known as "extended precision". */
6966     printf("3\n");
6967     exit(0);
6968   }
6969   if (b[0] == 0xBF && b[9] == 0xCD) {
6970     /* is there ever big-endian 80-bit, really? */
6971     printf("4\n");
6972     exit(0);
6973   }
6974 #endif
6975 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6976   /* software "double double", the 106 is 53+53.
6977    * but irix thinks it is 107. */
6978   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6979     /* double double 128-bit fully little-endian,
6980      * little-endian doubles in little-endian order,
6981      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6982     printf("5\n");
6983     exit(0);
6984   }
6985   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
6986     /* double double 128-bit fully big-endian,
6987      * big-endian doubles in big-endian order,
6988      * e.g. PPC/Power and MIPS:
6989      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
6990     printf("6\n");
6991     exit(0);
6992   }
6993   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
6994     /* double double 128-bit mixed endian.
6995      * little-endian doubles in big-endian order,
6996      * e.g. ppc64el,
6997      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
6998     printf("7\n");
6999     exit(0);
7000   }
7001   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7002     /* double double 128-bit mixed endian,
7003      * big-endian doubles in little-endian order,
7004      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7005     printf("8\n");
7006     exit(0);
7007   }
7008 #endif
7009   printf("-1\n"); /* unknown */
7010   exit(0);
7011 }
7012 EOP
7013 set try
7014 if eval $compile; then
7015     longdblkind=`$run ./try`
7016 else
7017     longdblkind=-1
7018 fi
7019 ;;
7020 *) longdblkind=0 ;;
7021 esac
7022 case "$longdblkind" in
7023 0) echo "Your long doubles are doubles." >&4 ;;
7024 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7025 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7026 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7027 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7028 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >& 4 ;;
7029 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >& 4 ;;
7030 7) echo "You have 128-bit mixed double-double long doubles (64-bit LEs in BE)." >& 4 ;;
7031 8) echo "You have 128-bit mixed double-double long doubles (64-bit BEs in LE)." >& 4 ;;
7032 *) echo "Cannot figure out your long double." >&4 ;;
7033 esac
7034 $rm_try
7035
7036 : determine the architecture name
7037 echo " "
7038 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7039         tarch=`arch`"-$osname"
7040 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7041         if uname -m > tmparch 2>&1 ; then
7042                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7043                         -e 's/$/'"-$osname/" tmparch`
7044         else
7045                 tarch="$osname"
7046         fi
7047         $rm -f tmparch
7048 else
7049         tarch="$osname"
7050 fi
7051 case "$myarchname" in
7052 ''|"$tarch") ;;
7053 *)
7054         echo "(Your architecture name used to be $myarchname.)"
7055         archname=''
7056         ;;
7057 esac
7058 case "$targetarch" in
7059 '') ;;
7060 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7061 esac
7062 myarchname="$tarch"
7063 case "$archname" in
7064 '') dflt="$tarch";;
7065 *) dflt="$archname";;
7066 esac
7067 rp='What is your architecture name'
7068 . ./myread
7069 archname="$ans"
7070
7071 : optionally add API version to the architecture for versioned archlibs
7072 case "$useversionedarchname" in
7073 $define|true|[yY]*) dflt='y';;
7074 *)                  dflt='n';;
7075 esac
7076 rp='Add the Perl API version to your archname?'
7077 . ./myread
7078 case "$ans" in
7079 y|Y)    useversionedarchname="$define" ;;
7080 *)      useversionedarchname="$undef" ;;
7081 esac
7082 case "$useversionedarchname" in
7083 $define)
7084         case "$archname" in
7085         *-$api_versionstring)
7086                 echo "...and architecture name already has -$api_versionstring" >&4
7087                 ;;
7088         *)
7089                 archname="$archname-$api_versionstring"
7090                 echo "...setting architecture name to $archname." >&4
7091                 ;;
7092         esac
7093         ;;
7094 esac
7095
7096 case "$usethreads" in
7097 $define)
7098         echo "Threads selected." >&4
7099         case "$archname" in
7100         *-thread*) echo "...and architecture name already has -thread." >&4
7101                 ;;
7102         *)      archname="$archname-thread"
7103                 echo "...setting architecture name to $archname." >&4
7104                 ;;
7105         esac
7106         ;;
7107 esac
7108 case "$usemultiplicity" in
7109 $define)
7110         echo "Multiplicity selected." >&4
7111         case "$archname" in
7112         *-multi*) echo "...and architecture name already has -multi." >&4
7113                 ;;
7114         *)      archname="$archname-multi"
7115                 echo "...setting architecture name to $archname." >&4
7116                 ;;
7117         esac
7118         ;;
7119 esac
7120 case "$use64bitint$use64bitall" in
7121 *"$define"*)
7122         case "$archname64" in
7123         '')
7124                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7125                 ;;
7126         *)
7127                 case "$use64bitint" in
7128                 "$define") echo "64 bit integers selected." >&4 ;;
7129                 esac
7130                 case "$use64bitall" in
7131                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7132                 esac
7133                 case "$archname" in
7134                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7135                         ;;
7136                 *)      archname="$archname-$archname64"
7137                         echo "...setting architecture name to $archname." >&4
7138                         ;;
7139                 esac
7140                 ;;
7141         esac
7142 esac
7143 case "$uselongdouble" in
7144 $define)
7145         echo "Long doubles selected." >&4
7146         case "$longdblsize" in
7147         $doublesize)
7148                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7149                 ;;
7150         *)
7151                 case "$archname" in
7152                 *-ld*) echo "...and architecture name already has -ld." >&4
7153                         ;;
7154                 *)      archname="$archname-ld"
7155                         echo "...setting architecture name to $archname." >&4
7156                         ;;
7157                 esac
7158                 ;;
7159         esac
7160         ;;
7161 esac
7162 case "$usequadmath" in
7163 $define)
7164         echo "quadmath selected." >&4
7165         case "$archname" in
7166         *-ld*) echo "...and architecture name already has -quadmath." >&4
7167                 ;;
7168         *)      archname="$archname-quadmath"
7169                 echo "...setting architecture name to $archname." >&4
7170                 ;;
7171         esac
7172         ;;
7173 esac
7174 if $test -f archname.cbu; then
7175         echo "Your platform has some specific hints for architecture name, using them..."
7176         . ./archname.cbu
7177 fi
7178
7179 : set the prefixit variable, to compute a suitable default value
7180 prefixit='case "$3" in
7181 ""|none)
7182         case "$oldprefix" in
7183         "") eval "$1=\"\$$2\"";;
7184         *)
7185                 case "$3" in
7186                 "") eval "$1=";;
7187                 none)
7188                         eval "tp=\"\$$2\"";
7189                         case "$tp" in
7190                         ""|" ") eval "$1=\"\$$2\"";;
7191                         *) eval "$1=";;
7192                         esac;;
7193                 esac;;
7194         esac;;
7195 *)
7196         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7197         case "$tp" in
7198         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7199         /*-$oldprefix/*|\~*-$oldprefix/*)
7200                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7201         *) eval "$1=\"\$$2\"";;
7202         esac;;
7203 esac'
7204
7205 : determine installation style
7206 : For now, try to deduce it from prefix unless it is already set.
7207 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7208 case "$installstyle" in
7209 '')     case "$prefix" in
7210                 *perl*) dflt='lib';;
7211                 *) dflt='lib/perl5' ;;
7212         esac
7213         ;;
7214 *)      dflt="$installstyle" ;;
7215 esac
7216 : Probably not worth prompting for this since we prompt for all
7217 : the directories individually, and the prompt would be too long and
7218 : confusing anyway.
7219 installstyle=$dflt
7220
7221 : determine where public executables go
7222 echo " "
7223 set dflt bin bin
7224 eval $prefixit
7225 fn=d~
7226 rp='Pathname where the public executables will reside?'
7227 . ./getfile
7228 if $test "X$ansexp" != "X$binexp"; then
7229         installbin=''
7230 fi
7231 prefixvar=bin
7232 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7233 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7234 :     this via initialinstalllocation
7235 . ./setprefixvar
7236
7237 case "$userelocatableinc" in
7238 $define|true|[yY]*)     dflt='y' ;;
7239 *)                      dflt='n' ;;
7240 esac
7241 cat <<EOM
7242
7243 Would you like to build Perl so that the installation is relocatable, so that
7244 library paths in @INC are determined relative to the path of the perl binary?
7245 This is not advised for system Perl installs, or if you need to run setid
7246 scripts or scripts under taint mode.
7247
7248 If this doesn't make any sense to you, just accept the default '$dflt'.
7249 EOM
7250 rp='Use relocatable @INC?'
7251 . ./myread
7252 case "$ans" in
7253 y|Y)    val="$define" ;;
7254 *)      val="$undef"  ;;
7255 esac
7256 set userelocatableinc
7257 eval $setvar
7258
7259 initialinstalllocation="$binexp"
7260 : Default prefix is now "up one level from where the binaries are"
7261 case "$userelocatableinc" in
7262 $define|true|[yY]*)
7263     bin=".../"
7264     binexp=".../"
7265     prefix=".../.."
7266     prefixexp=".../.."
7267     installprefixexp=".../.."
7268     ;;
7269 esac
7270
7271 : determine where private library files go
7272 : Usual default is /usr/local/lib/perl5/$version.
7273 : Also allow things like /opt/perl/lib/$version, since
7274 : /opt/perl/lib/perl5... would be redundant.
7275 : The default "style" setting is made in installstyle.U
7276 case "$installstyle" in
7277 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7278 *)       set dflt privlib lib/$version ;;
7279 esac
7280 eval $prefixit
7281 $cat <<EOM
7282
7283 There are some auxiliary files for $package that need to be put into a
7284 private library directory that is accessible by everyone.
7285
7286 EOM
7287 fn=$binexp
7288 fn=d~+
7289 rp='Pathname where the private library files will reside?'
7290 . ./getfile
7291 prefixvar=privlib
7292 . ./setprefixvar
7293
7294 : set the prefixup variable, to restore leading tilda escape
7295 prefixup='case "$prefixexp" in
7296 "$prefix") ;;
7297 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7298 esac'
7299
7300 : determine where public architecture dependent libraries go
7301 set archlib archlib
7302 eval $prefixit
7303 : privlib default is /usr/local/lib/$package/$version
7304 : archlib default is /usr/local/lib/$package/$version/$archname
7305 : privlib may have an optional trailing /share.
7306 tdflt=`echo $privlib | $sed 's,/share$,,'`
7307 tdflt=$tdflt/$archname
7308 case "$archlib" in
7309 '')     dflt=$tdflt
7310         ;;
7311 *)      dflt="$archlib"
7312     ;;
7313 esac
7314 $cat <<EOM
7315
7316 $spackage contains architecture-dependent library files.  If you are
7317 sharing libraries in a heterogeneous environment, you might store
7318 these files in a separate location.  Otherwise, you can just include
7319 them with the rest of the public library files.
7320
7321 EOM
7322 fn=$binexp
7323 fn=d+~
7324 rp='Where do you want to put the public architecture-dependent libraries?'
7325 . ./getfile
7326 prefixvar=archlib
7327 . ./setprefixvar
7328 if $test X"$archlib" = X"$privlib"; then
7329         d_archlib="$undef"
7330 else
7331         d_archlib="$define"
7332 fi
7333
7334 : see if setuid scripts can be secure
7335 $cat <<EOM
7336
7337 Some kernels have a bug that prevents setuid #! scripts from being
7338 secure.  Some sites have disabled setuid #! scripts because of this.
7339
7340 First let's decide if your kernel supports secure setuid #! scripts.
7341 (If setuid #! scripts would be secure but have been disabled anyway,
7342 don't say that they are secure if asked.)
7343
7344 EOM
7345
7346 val="$undef"
7347 if $test -d /dev/fd; then
7348         echo "#!$ls" >reflect
7349         chmod +x,u+s reflect
7350         ./reflect >flect 2>&1
7351         if $contains "/dev/fd" flect >/dev/null; then
7352                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7353                 val="$define"
7354         else
7355                 $cat <<EOM
7356 If you are not sure if they are secure, I can check but I'll need a
7357 username and password different from the one you are using right now.
7358 If you don't have such a username or don't want me to test, simply
7359 enter 'none'.
7360
7361 EOM
7362                 rp='Other username to test security of setuid scripts with?'
7363                 dflt='none'
7364                 . ./myread
7365                 case "$ans" in
7366                 n|none)
7367                         case "$d_suidsafe" in
7368                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7369                                 dflt=n;;
7370                         "$undef")
7371                                 echo "Well, the $hint value is *not* secure." >&4
7372                                 dflt=n;;
7373                         *)      echo "Well, the $hint value *is* secure." >&4
7374                                 dflt=y;;
7375                         esac
7376                         ;;
7377                 *)
7378                         $rm -f reflect flect
7379                         echo "#!$ls" >reflect
7380                         chmod +x,u+s reflect
7381                         echo >flect
7382                         chmod a+w flect
7383                         echo '"su" will (probably) prompt you for '"$ans's password."
7384                         su $ans -c './reflect >flect'
7385                         if $contains "/dev/fd" flect >/dev/null; then
7386                                 echo "Okay, it looks like setuid scripts are secure." >&4
7387                                 dflt=y
7388                         else
7389                                 echo "I don't think setuid scripts are secure." >&4
7390                                 dflt=n
7391                         fi
7392                         ;;
7393                 esac
7394                 rp='Does your kernel have *secure* setuid scripts?'
7395                 . ./myread
7396                 case "$ans" in
7397                 [yY]*)  val="$define";;
7398                 *)      val="$undef";;
7399                 esac
7400         fi
7401 else
7402         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7403         echo "(That's for file descriptors, not floppy disks.)"
7404         val="$undef"
7405 fi
7406 set d_suidsafe
7407 eval $setvar
7408
7409 $rm -f reflect flect
7410
7411 : now see if they want to do setuid emulation
7412 if $test $patchlevel -lt 11; then
7413 echo " "
7414 val="$undef"
7415 case "$d_suidsafe" in
7416 "$define")
7417         val="$undef"
7418         echo "No need to emulate SUID scripts since they are secure here." >&4
7419         ;;
7420 *)
7421         $cat <<EOM
7422 Some systems have disabled setuid scripts, especially systems where
7423 setuid scripts cannot be secure.  On systems where setuid scripts have
7424 been disabled, the setuid/setgid bits on scripts are currently
7425 useless.  It is possible for $package to detect those bits and emulate
7426 setuid/setgid in a secure fashion.  This emulation will only work if
7427 setuid scripts have been disabled in your kernel.
7428
7429 EOM
7430         case "$d_dosuid" in
7431         "$define") dflt=y ;;
7432         *) dflt=n ;;
7433         esac
7434         rp="Do you want to do setuid/setgid emulation?"
7435         . ./myread
7436         case "$ans" in
7437         [yY]*)  val="$define";;
7438         *)      val="$undef";;
7439         esac
7440         ;;
7441 esac
7442 set d_dosuid
7443 eval $setvar
7444 else
7445     case "$d_dosuid" in
7446         "$define")
7447         cat >&4 <<EOH
7448
7449 SUID emulation has been removed for 5.12
7450 Please re-run Configure without -Dd_dosuid
7451
7452 EOH
7453         exit 1;
7454         ;;
7455     esac
7456     d_dosuid=undef
7457 fi
7458
7459 : Find perl5.005 or later.
7460 echo "Looking for a previously installed perl5.005 or later... "
7461 case "$perl5" in
7462 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7463                 : Check if this perl is recent and can load a simple module
7464                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7465                         perl5=$tdir/perl
7466                         break;
7467                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7468                         perl5=$tdir/perl5
7469                         break;
7470                 fi
7471         done
7472         ;;
7473 *)      perl5="$perl5"
7474         ;;
7475 esac
7476 case "$perl5" in
7477 '')     echo "None found.  That's ok.";;
7478 *)      echo "Using $perl5." ;;
7479 esac
7480
7481 : Set the siteprefix variables
7482 $cat <<EOM
7483
7484 After $package is installed, you may wish to install various
7485 add-on modules and utilities.  Typically, these add-ons will
7486 be installed under $prefix with the rest
7487 of this package.  However, you may wish to install such add-ons
7488 elsewhere under a different prefix.
7489
7490 If you do not wish to put everything under a single prefix, that's
7491 ok.  You will be prompted for the individual locations; this siteprefix
7492 is only used to suggest the defaults.
7493
7494 The default should be fine for most people.
7495
7496 EOM
7497 fn=d~+
7498 rp='Installation prefix to use for add-on modules and utilities?'
7499 : XXX Here might be another good place for an installstyle setting.
7500 case "$siteprefix" in
7501 '') dflt=$prefix ;;
7502 *)  dflt=$siteprefix ;;
7503 esac
7504 . ./getfile
7505 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7506 oldsiteprefix=''
7507 case "$siteprefix" in
7508 '') ;;
7509 *)      case "$ans" in
7510         "$prefix") ;;
7511         *) oldsiteprefix="$prefix";;
7512         esac
7513         ;;
7514 esac
7515 siteprefix="$ans"
7516 siteprefixexp="$ansexp"
7517
7518 : determine where site specific libraries go.
7519 : Usual default is /usr/local/lib/perl5/site_perl/$version
7520 : The default "style" setting is made in installstyle.U
7521 : XXX No longer works with Prefixit stuff.
7522 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7523 case "$sitelib" in
7524 '') case "$installstyle" in
7525         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7526         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7527         esac
7528         ;;
7529 *)      dflt="$sitelib"
7530         ;;
7531 esac
7532 $cat <<EOM
7533
7534 The installation process will create a directory for
7535 site-specific extensions and modules.  Most users find it convenient
7536 to place all site-specific files in this directory rather than in the
7537 main distribution directory.
7538
7539 EOM
7540 fn=d~+
7541 rp='Pathname for the site-specific library files?'
7542 . ./getfile
7543 prefixvar=sitelib
7544 . ./setprefixvar
7545 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7546
7547 : Determine list of previous versions to include in @INC
7548 $cat > getverlist <<EOPL
7549 #!$perl5 -w
7550 use File::Basename;
7551 \$api_versionstring = "$api_versionstring";
7552 \$version = "$version";
7553 \$stem = "$sitelib_stem";
7554 \$archname = "$archname";
7555 EOPL
7556         $cat >> getverlist <<'EOPL'
7557 # The list found is store twice for each entry: the original name, and
7558 # the binary broken down version as pack "sss", so sorting is easy and
7559 # unambiguous. This will work for all versions that have a maximum of
7560 # three digit groups, separate by '.'s or '_'s. Names are extended with
7561 # ".0.0" to ensure at least three elements for the pack.
7562 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7563
7564 # Can't have leading @ because metaconfig interprets it as a command!
7565 ;@inc_version_list=();
7566 # XXX Redo to do opendir/readdir?
7567 if (-d $stem) {
7568     chdir($stem);
7569     ;@candidates = map {
7570         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7571     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7572 }
7573 else {
7574     ;@candidates = ();
7575 }
7576
7577 ($pversion, $aversion, $vsn5005) = map {
7578     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7579 foreach $d (@candidates) {
7580     if ($d->[1] lt $pversion) {
7581         if ($d->[1] ge $aversion) {
7582             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7583         }
7584         elsif ($d->[1] ge $vsn5005) {
7585             unshift(@inc_version_list, grep { -d } $d->[0]);
7586         }
7587     }
7588     else {
7589         # Skip newer version.  I.e. don't look in
7590         # 5.7.0 if we're installing 5.6.1.
7591     }
7592 }
7593
7594 if (@inc_version_list) {
7595     print join(' ', @inc_version_list);
7596 }
7597 else {
7598     # Blank space to preserve value for next Configure run.
7599     print " ";
7600 }
7601 EOPL
7602 chmod +x getverlist
7603 case "$inc_version_list" in
7604 '')     if test -x "$perl5$exe_ext"; then
7605                 dflt=`$perl5 getverlist`
7606         else
7607                 dflt='none'
7608         fi
7609         ;;
7610 $undef) dflt='none' ;;
7611 *)  eval dflt=\"$inc_version_list\" ;;
7612 esac
7613 case "$dflt" in
7614 ''|' ') dflt=none ;;
7615 esac
7616 case "$dflt" in
7617 5.005) dflt=none ;;
7618 esac
7619 $cat <<EOM
7620
7621 In order to ease the process of upgrading, this version of perl
7622 can be configured to use modules built and installed with earlier
7623 versions of perl that were installed under $prefix.  Specify here
7624 the list of earlier versions that this version of perl should check.
7625 If Configure detected no earlier versions of perl installed under
7626 $prefix, then the list will be empty.  Answer 'none' to tell perl
7627 to not search earlier versions.
7628
7629 The default should almost always be sensible, so if you're not sure,
7630 just accept the default.
7631 EOM
7632
7633 rp='List of earlier versions to include in @INC?'
7634 . ./myread
7635 case "$ans" in
7636 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7637 *) inc_version_list="$ans" ;;
7638 esac
7639 case "$inc_version_list" in
7640 ''|' ')
7641         inc_version_list_init='0'
7642         d_inc_version_list="$undef"
7643         ;;
7644 *)      inc_version_list_init=`echo $inc_version_list |
7645                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7646         d_inc_version_list="$define"
7647         ;;
7648 esac
7649 $rm -f getverlist
7650
7651 : see if malloc/malloc.h has to be included
7652 set malloc/malloc.h i_mallocmalloc
7653 eval $inhdr
7654
7655 : see if this is a malloc.h system
7656 : we want a real compile instead of Inhdr because some systems have a
7657 : malloc.h that just gives a compile error saying to use stdlib.h instead
7658 echo " "
7659 $cat >try.c <<EOCP
7660 #include <stdlib.h>
7661 #include <malloc.h>
7662 #$i_mallocmalloc I_MALLOCMALLOC
7663 #ifdef I_MALLOCMALLOC
7664 # include <malloc/malloc.h>
7665 #endif
7666
7667 int main () { return 0; }
7668 EOCP
7669 set try
7670 if eval $compile; then
7671     echo "<malloc.h> found." >&4
7672     val="$define"
7673 else
7674     echo "<malloc.h> NOT found." >&4
7675     val="$undef"
7676 fi
7677 $rm_try
7678 set i_malloc
7679 eval $setvar
7680
7681 : check for length of pointer
7682 echo " "
7683 case "$ptrsize" in
7684 '')
7685         echo "Checking to see how big your pointers are..." >&4
7686         $cat >try.c <<EOCP
7687 #include <stdio.h>
7688 #$i_stdlib I_STDLIB
7689 #ifdef I_STDLIB
7690 #include <stdlib.h>
7691 #endif
7692 int main()
7693 {
7694     printf("%d\n", (int)sizeof(void *));
7695     exit(0);
7696 }
7697 EOCP
7698         set try
7699         if eval $compile_ok; then
7700                 ptrsize=`$run ./try`
7701                 echo "Your pointers are $ptrsize bytes long."
7702         else
7703                 dflt='4'
7704                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7705                 rp="What is the size of a pointer (in bytes)?"
7706                 . ./myread
7707                 ptrsize="$ans"
7708         fi
7709         ;;
7710 esac
7711 $rm_try
7712 case "$use64bitall" in
7713 "$define"|true|[yY]*)
7714         case "$ptrsize" in
7715         4)      cat <<EOM >&4
7716
7717 *** You have chosen a maximally 64-bit build,
7718 *** but your pointers are only 4 bytes wide.
7719 *** Please rerun Configure without -Duse64bitall.
7720 EOM
7721                 case "$d_quad" in
7722                 define)
7723                         cat <<EOM >&4
7724 *** Since you have quads, you could possibly try with -Duse64bitint.
7725 EOM
7726                         ;;
7727                 esac
7728                 cat <<EOM >&4
7729 *** Cannot continue, aborting.
7730
7731 EOM
7732
7733                 exit 1
7734                 ;;
7735         esac
7736         ;;
7737 esac
7738
7739
7740 : determine whether to use malloc wrapping
7741 echo " "
7742 case "$usemallocwrap" in
7743 [yY]*|true|$define)     dflt='y' ;;
7744 [nN]*|false|$undef)     dflt='n' ;;
7745 *)      case "$usedevel" in
7746         [yY]*|true|$define)     dflt='y' ;;
7747         *) dflt='n' ;;
7748         esac
7749         ;;
7750 esac
7751 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7752 . ./myread
7753 usemallocwrap="$ans"
7754 case "$ans" in
7755 y*|true)
7756         usemallocwrap="$define" ;;
7757 *)
7758         usemallocwrap="$undef" ;;
7759 esac
7760
7761 : determine which malloc to compile in
7762 echo " "
7763 case "$usemymalloc" in
7764 [yY]*|true|$define)     dflt='y' ;;
7765 [nN]*|false|$undef)     dflt='n' ;;
7766 *)      case "$ptrsize" in
7767         4) dflt='y' ;;
7768         *) dflt='n' ;;
7769         esac
7770         if test "$useithreads" = "$define"; then dflt='n'; fi
7771         ;;
7772 esac
7773 rp="Do you wish to attempt to use the malloc that comes with $package?"
7774 . ./myread
7775 usemymalloc="$ans"
7776 case "$ans" in
7777 y*|true)
7778         usemymalloc='y'
7779         mallocsrc='malloc.c'
7780         mallocobj="malloc$_o"
7781         d_mymalloc="$define"
7782         case "$libs" in
7783         *-lmalloc*)
7784                 : Remove malloc from list of libraries to use
7785                 echo "Removing unneeded -lmalloc from library list" >&4
7786                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7787                 shift
7788                 libs="$*"
7789                 echo "libs = $libs" >&4
7790                 ;;
7791         esac
7792         ;;
7793 *)
7794         usemymalloc='n'
7795         mallocsrc=''
7796         mallocobj=''
7797         d_mymalloc="$undef"
7798         ;;
7799 esac
7800
7801 : compute the return types of malloc and free
7802 echo " "
7803 $cat >malloc.c <<END
7804 #$i_malloc I_MALLOC
7805 #$i_stdlib I_STDLIB
7806 #include <stdio.h>
7807 #include <sys/types.h>
7808 #ifdef I_MALLOC
7809 #include <malloc.h>
7810 #endif
7811 #ifdef I_STDLIB
7812 #include <stdlib.h>
7813 #endif
7814 #ifdef TRY_MALLOC
7815 void *malloc();
7816 #endif
7817 #ifdef TRY_FREE
7818 void free();
7819 #endif
7820 END
7821 case "$malloctype" in
7822 '')
7823         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7824                 malloctype='void *'
7825         else
7826                 malloctype='char *'
7827         fi
7828         ;;
7829 esac
7830 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7831
7832 case "$freetype" in
7833 '')
7834         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7835                 freetype='void'
7836         else
7837                 freetype='int'
7838         fi
7839         ;;
7840 esac
7841 echo "Your system uses $freetype free(), it would seem." >&4
7842 $rm -f malloc.[co]
7843 : determine where site specific architecture-dependent libraries go.
7844 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7845 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7846 : sitelib may have an optional trailing /share.
7847 case "$sitearch" in
7848 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7849         dflt="$dflt/$archname"
7850         ;;
7851 *)      dflt="$sitearch"
7852         ;;
7853 esac
7854 set sitearch sitearch none
7855 eval $prefixit
7856 $cat <<EOM
7857
7858 The installation process will also create a directory for
7859 architecture-dependent site-specific extensions and modules.
7860
7861 EOM
7862 fn=d~+
7863 rp='Pathname for the site-specific architecture-dependent library files?'
7864 . ./getfile
7865 prefixvar=sitearch
7866 . ./setprefixvar
7867 if $test X"$sitearch" = X"$sitelib"; then
7868         d_sitearch="$undef"
7869 else
7870         d_sitearch="$define"
7871 fi
7872
7873 : Set the vendorprefix variables
7874 $cat <<EOM
7875
7876 The installation process will also create a directory for
7877 vendor-supplied add-ons.  Vendors who supply perl with their system
7878 may find it convenient to place all vendor-supplied files in this
7879 directory rather than in the main distribution directory.  This will
7880 ease upgrades between binary-compatible maintenance versions of perl.
7881
7882 Of course you may also use these directories in whatever way you see
7883 fit.  For example, you might use them to access modules shared over a
7884 company-wide network.
7885
7886 The default answer should be fine for most people.
7887 This causes further questions about vendor add-ons to be skipped
7888 and no vendor-specific directories will be configured for perl.
7889
7890 EOM
7891 rp='Do you want to configure vendor-specific add-on directories?'
7892 case "$usevendorprefix" in
7893 define|true|[yY]*) dflt=y ;;
7894 *)      : User may have set vendorprefix directly on Configure command line.
7895         case "$vendorprefix" in
7896         ''|' ') dflt=n ;;
7897         *)      dflt=y ;;
7898         esac
7899         ;;
7900 esac
7901 . ./myread
7902 case "$ans" in
7903 [yY]*)  fn=d~+
7904         rp='Installation prefix to use for vendor-supplied add-ons?'
7905         case "$vendorprefix" in
7906         '') dflt="$prefix" ;;
7907         *)  dflt=$vendorprefix ;;
7908         esac
7909         . ./getfile
7910         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7911         oldvendorprefix=''
7912         case "$vendorprefix" in
7913         '') ;;
7914         *)      case "$ans" in
7915                 "$prefix") ;;
7916                 *) oldvendorprefix="$prefix";;
7917                 esac
7918                 ;;
7919         esac
7920         usevendorprefix="$define"
7921         vendorprefix="$ans"
7922         vendorprefixexp="$ansexp"
7923         ;;
7924 *)      usevendorprefix="$undef"
7925         vendorprefix=''
7926         vendorprefixexp=''
7927         ;;
7928 esac
7929
7930 : Set the vendorlib variables
7931 case "$vendorprefix" in
7932 '')     d_vendorlib="$undef"
7933         vendorlib=''
7934         vendorlibexp=''
7935         ;;
7936 *)      d_vendorlib="$define"
7937         : determine where vendor-supplied modules go.
7938         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7939         case "$vendorlib" in
7940         '')
7941                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7942                 case "$installstyle" in
7943                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7944                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7945                 esac
7946                 ;;
7947         *)      dflt="$vendorlib"
7948                 ;;
7949         esac
7950         fn=d~+
7951         rp='Pathname for the vendor-supplied library files?'
7952         . ./getfile
7953         vendorlib="$ans"
7954         vendorlibexp="$ansexp"
7955         ;;
7956 esac
7957 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7958 prefixvar=vendorlib
7959 . ./installprefix
7960
7961 : Set the vendorarch variables
7962 case "$vendorprefix" in
7963 '')     d_vendorarch="$undef"
7964         vendorarch=''
7965         vendorarchexp=''
7966         ;;
7967 *)      d_vendorarch="$define"
7968         : determine where vendor-supplied architecture-dependent libraries go.
7969         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7970         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7971         : vendorlib may have an optional trailing /share.
7972         case "$vendorarch" in
7973         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7974                 dflt="$dflt/$archname"
7975                 ;;
7976         *)      dflt="$vendorarch" ;;
7977         esac
7978         fn=d~+
7979         rp='Pathname for vendor-supplied architecture-dependent files?'
7980         . ./getfile
7981         vendorarch="$ans"
7982         vendorarchexp="$ansexp"
7983         ;;
7984 esac
7985 prefixvar=vendorarch
7986 . ./installprefix
7987 if $test X"$vendorarch" = X"$vendorlib"; then
7988         d_vendorarch="$undef"
7989 else
7990         d_vendorarch="$define"
7991 fi
7992
7993 : Final catch-all directories to search
7994 $cat <<EOM
7995
7996 Lastly, you can have perl look in other directories for extensions and
7997 modules in addition to those already specified.
7998 These directories will be searched after
7999         $sitearch
8000         $sitelib
8001 EOM
8002 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8003 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8004 echo ' '
8005 case "$otherlibdirs" in
8006 ''|' ') dflt='none' ;;
8007 *)      dflt="$otherlibdirs" ;;
8008 esac
8009 $cat <<EOM
8010 Enter a colon-separated set of extra paths to include in perl's @INC
8011 search path, or enter 'none' for no extra paths.
8012
8013 EOM
8014
8015 rp='Colon-separated list of additional directories for perl to search?'
8016 . ./myread
8017 case "$ans" in
8018 ' '|''|none)    otherlibdirs=' ' ;;
8019 *)      otherlibdirs="$ans" ;;
8020 esac
8021 case "$otherlibdirs" in
8022 ' ') val=$undef ;;
8023 *)      val=$define ;;
8024 esac
8025 set d_perl_otherlibdirs
8026 eval $setvar
8027
8028 : Cruising for prototypes
8029 echo " "
8030 echo "Checking out function prototypes..." >&4
8031 $cat >prototype.c <<EOCP
8032 #$i_stdlib I_STDLIB
8033 #ifdef I_STDLIB
8034 #include <stdlib.h>
8035 #endif
8036 int main(int argc, char *argv[]) {
8037         exit(0);}
8038 EOCP
8039 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8040         echo "Your C compiler appears to support function prototypes."
8041         val="$define"
8042 else
8043         echo "Your C compiler doesn't seem to understand function prototypes."
8044         val="$undef"
8045 fi
8046 set prototype
8047 eval $setvar
8048 $rm -f prototype*
8049
8050 : Check if ansi2knr is required
8051 case "$prototype" in
8052 "$define") ;;
8053 *)      ansi2knr='ansi2knr'
8054         echo " "
8055         cat <<EOM >&4
8056
8057 $me:  FATAL ERROR:
8058 This version of $package can only be compiled by a compiler that
8059 understands function prototypes.  Unfortunately, your C compiler
8060         $cc $ccflags
8061 doesn't seem to understand them.  Sorry about that.
8062
8063 If GNU cc is available for your system, perhaps you could try that instead.
8064
8065 Eventually, we hope to support building Perl with pre-ANSI compilers.
8066 If you would like to help in that effort, please contact <perlbug@perl.org>.
8067
8068 Aborting Configure now.
8069 EOM
8070         exit 2
8071         ;;
8072 esac
8073
8074 : DTrace support
8075 dflt_dtrace='/usr/sbin/dtrace'
8076 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8077
8078 cat <<EOM
8079
8080 Perl can be built to support DTrace on platforms that support it.
8081 DTrace is a diagnosis and performance analysis tool from Sun.
8082
8083 If this doesn't make any sense to you, just accept the default.
8084 EOM
8085
8086 while $test 1 ; do
8087         case "$usedtrace" in
8088         $define|true|[yY]*)
8089                 dflt='y'
8090                 ;;
8091         ?*)
8092                 dflt='y'
8093                 dflt_dtrace=$usedtrace
8094                 ;;
8095         *)
8096                 dflt='n'
8097                 ;;
8098         esac
8099
8100         rp='Support DTrace if available?'
8101         . ./myread
8102         case "$ans" in
8103         y|Y)    val="$define" ;;
8104         *)      val="$undef" ;;
8105         esac
8106         set usedtrace
8107         eval $setvar
8108
8109         test "X$usedtrace" != "X$define" && break
8110
8111         echo " "
8112         rp='Where is the dtrace executable?'
8113         dflt=$dflt_dtrace
8114         . ./getfile
8115         val="$ans"
8116         set dtrace
8117         eval $setvar
8118
8119         if $test -f $dtrace
8120         then
8121                 if $dtrace -h -s ../perldtrace.d \
8122                         -o perldtrace.tmp >/dev/null 2>&1 \
8123                         && rm -f perldtrace.tmp
8124                 then
8125                         echo " "
8126                         echo "Good: your $dtrace knows about the -h flag."
8127                 else
8128                         cat >&2 <<EOM
8129
8130 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8131 ***
8132 *** Your installed dtrace doesn't support the -h switch to compile a D
8133 *** program into a C header. Can't continue.
8134
8135 EOM
8136                         exit 1
8137                 fi
8138                 break;
8139         fi
8140
8141         case "$fastread" in
8142         yes)
8143                 cat >&2 <<EOM
8144
8145 *** $me:  Fatal Error:  $dtrace not found.
8146 *** Can't continue.
8147
8148 EOM
8149                 exit 1
8150                 ;;
8151         *)
8152                 echo "*** $dtrace was not found."
8153                 echo " "
8154                 ;;
8155         esac
8156 done
8157
8158 : See if we want extra modules installed
8159 echo " "
8160 case "$extras" in
8161 '') dflt='n';;
8162 *) dflt='y';;
8163 esac
8164 cat <<EOM
8165 Perl can be built with extra modules or bundles of modules which
8166 will be fetched from the CPAN and installed alongside Perl.
8167
8168 Notice that you will need access to the CPAN; either via the Internet,
8169 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8170 be asked later to configure the CPAN.pm module which will in turn do
8171 the installation of the rest of the extra modules or bundles.)
8172
8173 Notice also that if the modules require any external software such as
8174 libraries and headers (the libz library and the zlib.h header for the
8175 Compress::Zlib module, for example) you MUST have any such software
8176 already installed, this configuration process will NOT install such
8177 things for you.
8178
8179 If this doesn't make any sense to you, just accept the default '$dflt'.
8180 EOM
8181 rp='Install any extra modules (y or n)?'
8182 . ./myread
8183 case "$ans" in
8184 y|Y)
8185         cat <<EOM
8186
8187 Please list any extra modules or bundles to be installed from CPAN,
8188 with spaces between the names.  The names can be in any format the
8189 'install' command of CPAN.pm will understand.  (Answer 'none',
8190 without the quotes, to install no extra modules or bundles.)
8191 EOM
8192         rp='Extras?'
8193         dflt="$extras"
8194         . ./myread
8195         extras="$ans"
8196 esac
8197 case "$extras" in
8198 ''|'none')
8199         val=''
8200         $rm -f ../extras.lst
8201         ;;
8202 *)      echo "(Saving the list of extras for later...)"
8203         echo "$extras" > ../extras.lst
8204         val="'$extras'"
8205         ;;
8206 esac
8207 set extras
8208 eval $setvar
8209 echo " "
8210
8211 : determine where html pages for programs go
8212 set html1dir html1dir none
8213 eval $prefixit
8214 $cat <<EOM
8215
8216 If you wish to install html files for programs in $spackage, indicate
8217 the appropriate directory here.  To skip installing html files,
8218 answer "none".
8219 EOM
8220 case "$html1dir" in
8221 ''|none|$undef|' ') dflt=none ;;
8222 *) dflt=$html1dir ;;
8223 esac
8224 fn=dn+~
8225 rp="Directory for the main $spackage html pages?"
8226 . ./getfile
8227 prefixvar=html1dir
8228 . ./setprefixvar
8229 : Use ' ' for none so value is preserved next time through Configure
8230 $test X"$html1dir" = "X" && html1dir=' '
8231
8232 : determine where html pages for libraries and modules go
8233 set html3dir html3dir none
8234 eval $prefixit
8235 $cat <<EOM
8236
8237 If you wish to install html files for modules associated with $spackage,
8238 indicate the appropriate directory here.  To skip installing html files,
8239 answer "none".
8240 EOM
8241 : There is no obvious default.  If they have specified html1dir, then
8242 : try to key off that, possibly changing .../html1 into .../html3.
8243 case "$html3dir" in
8244 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8245 *) dflt=$html3dir ;;
8246 esac
8247 fn=dn+~
8248 rp="Directory for the $spackage module html pages?"
8249 . ./getfile
8250 prefixvar=html3dir
8251 . ./setprefixvar
8252 : Use ' ' for none so value is preserved next time through Configure
8253 $test X"$html3dir" = "X" && html3dir=' '
8254
8255 : determine whether to install perl also as /usr/bin/perl
8256
8257 echo " "
8258 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8259         $cat <<EOM
8260 Many scripts expect perl to be installed as /usr/bin/perl.
8261
8262 If you want to, I can install the perl you are about to compile
8263 as /usr/bin/perl (in addition to $bin/perl).
8264 EOM
8265         if test -f /usr/bin/perl; then
8266             $cat <<EOM
8267
8268 However, please note that because you already have a /usr/bin/perl,
8269 overwriting that with a new Perl would very probably cause problems.
8270 Therefore I'm assuming you don't want to do that (unless you insist).
8271
8272 EOM
8273             case "$installusrbinperl" in
8274             "$define"|[yY]*)    dflt='y';;
8275             *)                  dflt='n';;
8276             esac
8277         else
8278             $cat <<EOM
8279
8280 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8281
8282 EOM
8283             case "$installusrbinperl" in
8284             "$undef"|[nN]*)     dflt='n';;
8285             *)                  dflt='y';;
8286             esac
8287         fi
8288         rp="Do you want to install perl as /usr/bin/perl?"
8289         . ./myread
8290         case "$ans" in
8291         [yY]*)  val="$define";;
8292         *)      val="$undef" ;;
8293         esac
8294 else
8295         val="$undef"
8296 fi
8297 set installusrbinperl
8298 eval $setvar
8299
8300 : see if dlopen exists
8301 xxx_runnm="$runnm"
8302 xxx_ccflags="$ccflags"
8303 runnm=false
8304 : with g++ one needs -shared to get is-in-libc to work for dlopen
8305 case "$gccversion" in
8306 '')     ;;
8307 *Clang*)        ;;
8308 *)      case "$d_cplusplus" in
8309         "$define") ccflags="$ccflags -shared" ;;
8310         esac
8311         ;;
8312 esac
8313 set dlopen d_dlopen
8314 eval $inlibc
8315 runnm="$xxx_runnm"
8316 ccflags="$xxx_ccflags"
8317
8318 : see if this is a unistd.h system
8319 set unistd.h i_unistd
8320 eval $inhdr
8321
8322 : determine which dynamic loading, if any, to compile in
8323 echo " "
8324 dldir="ext/DynaLoader"
8325 case "$usedl" in
8326     $define|y|true)
8327         dflt='y'
8328         usedl="$define"
8329         ;;
8330     $undef|n|false)
8331         dflt='n'
8332         usedl="$undef"
8333         ;;
8334     *)
8335         dflt='n'
8336         case "$d_dlopen" in
8337             $define) dflt='y' ;;
8338         esac
8339         : Does a dl_xxx.xs file exist for this operating system
8340         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8341         ;;
8342 esac
8343 rp="Do you wish to use dynamic loading?"
8344 . ./myread
8345 usedl="$ans"
8346 bin_ELF="$undef"
8347 case "$ans" in
8348     y*) usedl="$define"
8349         case "$dlsrc" in
8350             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8351                     dflt="$dldir/dl_${osname}.xs"
8352                 elif $test "$d_dlopen" = "$define" ; then
8353                     dflt="$dldir/dl_dlopen.xs"
8354                 else
8355                     dflt=''
8356                 fi
8357                 ;;
8358             *)  dflt="$dldir/$dlsrc"
8359                 ;;
8360         esac
8361         echo "The following dynamic loading files are available:"
8362         : Can not go over to $dldir because getfile has path hard-coded in.
8363         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8364         rp="Source file to use for dynamic loading"
8365         fn="fne"
8366         gfpth="$src"
8367         . ./getfile
8368         usedl="$define"
8369         : emulate basename
8370         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8371
8372         $cat << EOM
8373
8374 Some systems may require passing special flags to $cc -c to
8375 compile modules that will be used to create a shared library.
8376 To use no flags, say "none".
8377
8378 EOM
8379         case "$cccdlflags" in
8380             '') case "$gccversion" in
8381                 '') case "$osname" in
8382                         hpux)   dflt='+z' ;;
8383                         irix*)  dflt='-KPIC' ;;
8384                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8385                         sunos)  dflt='-pic' ;;
8386                         *)      dflt='none' ;;
8387                     esac
8388                     ;;
8389                 *)  case "$osname" in
8390                         darwin) dflt='none' ;;
8391                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8392                         *)      dflt='-fpic' ;;
8393                     esac ;;
8394                 esac ;;
8395             ' ') dflt='none' ;;
8396             *)   dflt="$cccdlflags" ;;
8397         esac
8398
8399         case "$dflt" in
8400             none) dflt='' ;;
8401         esac
8402
8403         # If -Dsysroot was specified, now's the time to add it
8404         # to cccdlflags
8405         if test "X$sysroot" != X; then
8406             case "$gccversion" in
8407                 '') ;;
8408                 *)  case "$dflt" in
8409                         *sysroot*) ;;
8410                         'undef'|*)
8411                             dflt="$dflt --sysroot=$sysroot" ;;
8412                     esac
8413                     ;;
8414             esac
8415         fi
8416
8417         case "$dflt" in
8418             '') dflt='none';;
8419         esac
8420
8421         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8422         . ./myread
8423         case "$ans" in
8424             none) cccdlflags=' ' ;;
8425             *)    cccdlflags="$ans" ;;
8426         esac
8427
8428         cat << EOM
8429
8430 Some systems use ld to create libraries that can be dynamically loaded,
8431 while other systems (such as those using ELF) use $cc.
8432
8433 EOM
8434
8435 : Determine if this is ELF
8436         $cat >try.c <<EOM
8437 /* Test for whether ELF binaries are produced */
8438 #include <fcntl.h>
8439 #$i_stdlib I_STDLIB
8440 #ifdef I_STDLIB
8441 #include <stdlib.h>
8442 #endif
8443 #$i_unistd I_UNISTD
8444 #ifdef I_UNISTD
8445 #include <unistd.h>
8446 #endif
8447 int main() {
8448     char b[4];
8449     int i = open("a.out",O_RDONLY);
8450     if(i == -1)
8451         exit(1); /* fail */
8452     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8453         exit(0); /* succeed (yes, it is ELF) */
8454     exit(1); /* fail */
8455 }
8456 EOM
8457         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8458             bin_ELF="$define"
8459         fi
8460         $rm_try
8461
8462         case "$ld" in
8463             '') if $test $bin_ELF = "$define"; then
8464                     cat <<EOM
8465 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8466 EOM
8467                     dflt="$cc"
8468                 else
8469                     echo "I'll use ld to build dynamic libraries."
8470                     dflt='ld'
8471                 fi
8472                 ;;
8473             *)  dflt="$ld"
8474                 ;;
8475         esac
8476
8477         rp="What command should be used to create dynamic libraries?"
8478         . ./myread
8479         ld="$ans"
8480
8481         cat << EOM
8482
8483 Some systems may require passing special flags to $ld to create a
8484 library that can be dynamically loaded.  If your ld flags include
8485 -L/other/path options to locate libraries outside your loader's normal
8486 search path, you may need to specify those -L options here as well.  To
8487 use no flags, say "none".
8488
8489 EOM
8490         case "$lddlflags" in
8491             '') case "$osname" in
8492                     haiku) dflt='-shared' ;;
8493                     hpux) dflt='-b';
8494                           case "$gccversion" in
8495                               '') dflt="$dflt +vnocompatwarnings" ;;
8496                           esac
8497                           ;;
8498                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8499                     solaris) # See [perl #66604].
8500                             # On Solaris 11, gcc -m64 on amd64
8501                             # appears not to understand -G.  gcc versions at
8502                             # least as old as 3.4.3 support -shared, so just
8503                             # use that with Solaris 11 and later, but keep
8504                             # the old behavior for older Solaris versions.
8505                             case "$gccversion" in
8506                                 '') dflt='-G' ;;
8507                                 *)  case "$osvers" in
8508                                         2.?|2.10) dflt='-G' ;;
8509                                         *) dflt='-shared' ;;
8510                                     esac
8511                                     ;;
8512                             esac
8513                             ;;
8514                     sunos) dflt='-assert nodefinitions' ;;
8515                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8516                     *)     dflt='none' ;;
8517                 esac
8518                 ;;
8519             *) dflt="$lddlflags" ;;
8520         esac
8521
8522         : Only do this for gcc, since, for example, qcc has no concept
8523         : of --sysroot.
8524         if $test "X$sysroot" != X; then
8525             case "$gccversion" in
8526                 '') ;;
8527                 *)  dflt="$dflt --sysroot $sysroot" ;;
8528             esac
8529         fi
8530
8531         : Try to guess additional flags to pick up local libraries.
8532         : Be careful not to append to a plain 'none'
8533         case "$dflt" in
8534             none) dflt='' ;;
8535         esac
8536         for thisflag in $ldflags; do
8537             case "$thisflag" in
8538                 -L*|-R*|-Wl,-R*)
8539                     case " $dflt " in
8540                         *" $thisflag "*) ;;
8541                         *) dflt="$dflt $thisflag" ;;
8542                     esac
8543                     ;;
8544             esac
8545         done
8546
8547         case "$dflt" in
8548             ''|' ') dflt='none' ;;
8549         esac
8550
8551         case "$ldflags" in
8552             *-fstack-protector-strong*)
8553                 case "$dflt" in
8554                     *-fstack-protector-strong*) ;; # Don't add it again
8555                     *) dflt="$dflt -fstack-protector-strong" ;;
8556                 esac
8557                 ;;
8558             *-fstack-protector*)
8559                 case "$dflt" in
8560                     *-fstack-protector*) ;; # Don't add it again
8561                     *) dflt="$dflt -fstack-protector" ;;
8562                 esac
8563                 ;;
8564         esac
8565
8566         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8567         . ./myread
8568         case "$ans" in
8569             none) lddlflags=' ' ;;
8570             *) lddlflags="$ans" ;;
8571         esac
8572
8573         cat <<EOM
8574
8575 Some systems may require passing special flags to $cc to indicate that
8576 the resulting executable will use dynamic linking.  To use no flags,
8577 say "none".
8578
8579 EOM
8580         case "$ccdlflags" in
8581             '') case "$osname" in
8582                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8583                     sunos)             dflt='none'   ;;
8584                     *)                 dflt='none'   ;;
8585                 esac ;;
8586             ' ') dflt='none' ;;
8587             *)   dflt="$ccdlflags" ;;
8588         esac
8589         rp="Any special flags to pass to $cc to use dynamic linking?"
8590         . ./myread
8591         case "$ans" in
8592             none) ccdlflags=' ' ;;
8593             *)    ccdlflags="$ans" ;;
8594         esac
8595         ;;
8596
8597     *)  usedl="$undef"
8598         ld='ld'
8599         dlsrc='dl_none.xs'
8600         lddlflags=''
8601         ccdlflags=''
8602         ;;
8603 esac
8604
8605 ld_can_script="$undef"
8606 case "$bin_ELF$usedl" in
8607     $define$define)
8608         # Abuse try.h and a.out names for neat cleanup
8609         $cat >try.c <<EOM
8610 void foo() {}
8611 void bar() {}
8612 EOM
8613         $cat >try.h <<EOM
8614 LIBTEST_42 {
8615  global:
8616   foo;
8617  local: *;
8618  };
8619 EOM
8620         if $cc $cccdlflags $ccdlflags $ccflags \
8621                $ldflags $lddlflags -o a.out try.c \
8622                -Wl,--version-script=try.h >/dev/null 2>&1 \
8623            &&  $test -s a.out ; then
8624             echo "ld supports scripting" >&4
8625             ld_can_script="$define"
8626         else
8627             echo "ld does not support scripting" >&4
8628         fi
8629         $rm_try
8630         ;;
8631 esac
8632
8633 : Do we want a shared libperl?
8634 also=''
8635 case "$usedl" in
8636 $undef)
8637         # No dynamic loading being used, so don't bother even to prompt.
8638         useshrplib='false'
8639         ;;
8640 *)      case "$useshrplib" in
8641         '')     case "$osname" in
8642                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8643                         dflt=y
8644                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8645                         ;;
8646                 *)      dflt=n
8647                         ;;
8648                 esac
8649                 ;;
8650         $define|true|[Yy]*)
8651                 dflt=y
8652                 ;;
8653         *)      dflt=n
8654                 ;;
8655         esac
8656         $cat << EOM
8657
8658 The perl executable is normally obtained by linking perlmain.c with
8659 libperl${_a}, any static extensions (usually just DynaLoader), and
8660 any other libraries needed on this system (such as -lm, etc.).  Since
8661 your system supports dynamic loading, it is probably possible to build
8662 a shared libperl.$so.  If you will have more than one executable linked
8663 to libperl.$so, this will significantly reduce the size of each
8664 executable, but it may have a noticeable effect on performance.  The
8665 default is probably sensible for your system.
8666 $also
8667
8668 EOM
8669         rp="Build a shared libperl.$so (y/n)"
8670         . ./myread
8671         case "$ans" in
8672         true|$define|[Yy]*)
8673                 useshrplib='true'  ;;
8674         *)      useshrplib='false' ;;
8675         esac
8676         ;;
8677 esac
8678
8679 case "$useshrplib" in
8680 true)
8681         case "$userelocatableinc" in
8682         true|define)
8683                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8684                 echo "See INSTALL for an explanation why that won't work." >&4
8685                 exit 4
8686                 ;;
8687         esac
8688         case "$libperl" in
8689         '')
8690                 # Figure out a good name for libperl.so.  Since it gets stored in
8691                 # a version-specific architecture-dependent library, the version
8692                 # number isn't really that important, except for making cc/ld happy.
8693                 #
8694                 # A name such as libperl.so.10.1
8695                 majmin="libperl.$so.$patchlevel.$subversion"
8696                 # A name such as libperl.so.100
8697                 majonly=`echo $patchlevel $subversion |
8698                         $awk '{printf "%d%02d", $1, $2}'`
8699                 majonly=libperl.$so.$majonly
8700                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8701                 # rely on figuring it out from the naming of libc.
8702                 case "${osname}${osvers}" in
8703                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8704                         dflt=libperl.$so
8705                         ;;
8706                 cygwin*) # ld links now against the dll directly
8707                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8708                         majonly=`echo $patchlevel $subversion |
8709                                 $awk '{printf "%03d%03d", $1, $2}'`
8710                         majonly=cygperl5.$majonly.$so
8711                         dflt=$majmin
8712                         ;;
8713                 *)      # Try to guess based on whether libc has major.minor.
8714                         case "$libc" in
8715                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8716                         *libc.$so.[0-9]*) dflt=$majonly ;;
8717                         *)      dflt=libperl.$so ;;
8718                         esac
8719                         ;;
8720                 esac
8721                 ;;
8722         *)      dflt=$libperl
8723                 ;;
8724         esac
8725         cat << EOM
8726
8727 I need to select a good name for the shared libperl.  If your system uses
8728 library names with major and minor numbers, then you might want something
8729 like $majmin.  Alternatively, if your system uses a single version
8730 number for shared libraries, then you might want to use $majonly.
8731 Or, your system might be quite happy with a simple libperl.$so.
8732
8733 Since the shared libperl will get installed into a version-specific
8734 architecture-dependent directory, the version number of the shared perl
8735 library probably isn't important, so the default should be o.k.
8736
8737 EOM
8738         rp='What name do you want to give to the shared libperl?'
8739         . ./myread
8740         libperl=$ans
8741         echo "Ok, I'll use $libperl"
8742         ;;
8743 *)
8744         libperl="libperl${_a}"
8745         ;;
8746 esac
8747
8748 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8749 case "$shrpdir" in
8750 '') ;;
8751 *)      $cat >&4 <<EOM
8752 WARNING:  Use of the shrpdir variable for the installation location of
8753 the shared $libperl is not supported.  It was never documented and
8754 will not work in this version.  Let me (perlbug@perl.org)
8755 know of any problems this may cause.
8756
8757 EOM
8758         case "$shrpdir" in
8759         "$archlibexp/CORE")
8760                 $cat >&4 <<EOM
8761 But your current setting of $shrpdir is
8762 the default anyway, so it's harmless.
8763 EOM
8764                 ;;
8765         *)
8766                 $cat >&4 <<EOM
8767 Further, your current attempted setting of $shrpdir
8768 conflicts with the value of $archlibexp/CORE
8769 that installperl will use.
8770 EOM
8771                 ;;
8772         esac
8773         ;;
8774 esac
8775
8776 # How will the perl executable find the installed shared $libperl?
8777 # Add $xxx to ccdlflags.
8778 # If we can't figure out a command-line option, use $shrpenv to
8779 # set env LD_RUN_PATH.  The main perl makefile uses this.
8780 shrpdir=$archlibexp/CORE
8781 xxx=''
8782 tmp_shrpenv=''
8783 if "$useshrplib"; then
8784     case "$osname" in
8785         aix)
8786                 # We'll set it in Makefile.SH...
8787                 ;;
8788         solaris)
8789                 xxx="-R $shrpdir"
8790                 ;;
8791         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8792                 xxx="-Wl,-R$shrpdir"
8793                 ;;
8794         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8795                 xxx="-Wl,-rpath,$shrpdir"
8796                 ;;
8797         hpux*)
8798                 # hpux doesn't like the default, either.
8799                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8800                 ;;
8801         cygwin)
8802                 # cygwin needs only ldlibpth
8803                 ;;
8804         *)
8805                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8806                 ;;
8807         esac
8808         case "$xxx" in
8809         '') ;;
8810         *)
8811                 # Only add $xxx if it isn't already in ccdlflags.
8812                 case " $ccdlflags " in
8813                 *" $xxx "*)     ;;
8814                 *)      ccdlflags="$ccdlflags $xxx"
8815                         cat <<EOM >&4
8816
8817 Adding $xxx to the flags
8818 passed to $ld so that the perl executable will find the
8819 installed shared $libperl.
8820
8821 EOM
8822                         ;;
8823                 esac
8824                 ;;
8825         esac
8826 fi
8827 # Fix ccdlflags in AIX for building external extensions.
8828 # (For building Perl itself bare -bE:perl.exp is needed,
8829 #  Makefile.SH takes care of this.)
8830 case "$osname" in
8831 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8832 esac
8833 # Respect a hint or command-line value.
8834 case "$shrpenv" in
8835 '') shrpenv="$tmp_shrpenv" ;;
8836 esac
8837 case "$ldlibpthname" in
8838 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8839 none)   ldlibpthname='' ;;
8840 esac
8841
8842 : determine where manual pages are on this system
8843 echo " "
8844 case "$sysman" in
8845 '')
8846         syspath='/usr/share/man/man1 /usr/man/man1'
8847         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8848         syspath="$syspath /usr/man/u_man/man1"
8849         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8850         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8851         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8852         sysman=`./loc . /usr/man/man1 $syspath`
8853         ;;
8854 esac
8855 if $test -d "$sysman"; then
8856         echo "System manual is in $sysman." >&4
8857 else
8858         echo "Could not find manual pages in source form." >&4
8859 fi
8860
8861 : determine where manual pages go
8862 set man1dir man1dir none
8863 eval $prefixit
8864 $cat <<EOM
8865
8866 $spackage has manual pages available in source form.
8867 EOM
8868 case "$nroff" in
8869 nroff)
8870         echo "However, you don't have nroff, so they're probably useless to you."
8871         case "$man1dir" in
8872         '') man1dir="none";;
8873         esac;;
8874 esac
8875 echo "If you don't want the manual sources installed, answer 'none'."
8876 case "$man1dir" in
8877 ' ') dflt=none
8878         ;;
8879 '')
8880         lookpath="$prefixexp/share/man/man1"
8881         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8882         lookpath="$lookpath $prefixexp/man/p_man/man1"
8883         lookpath="$lookpath $prefixexp/man/u_man/man1"
8884         lookpath="$lookpath $prefixexp/man/man.1"
8885         case "$sysman" in
8886         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8887         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8888         esac
8889         set dflt
8890         eval $prefixup
8891         ;;
8892 *)  dflt="$man1dir"
8893         ;;
8894 esac
8895 echo " "
8896 fn=dn+~
8897 rp="Where do the main $spackage manual pages (source) go?"
8898 . ./getfile
8899 if $test "X$man1direxp" != "X$ansexp"; then
8900         installman1dir=''
8901 fi
8902 prefixvar=man1dir
8903 . ./setprefixvar
8904
8905 case "$man1dir" in
8906 '')     man1dir=' '
8907         installman1dir='';;
8908 esac
8909
8910 : What suffix to use on installed man pages
8911
8912 case "$man1dir" in
8913 ' ')
8914         man1ext='0'
8915         ;;
8916 *)
8917         rp="What suffix should be used for the main $spackage man pages?"
8918         case "$man1ext" in
8919         '')     case "$man1dir" in
8920                 *1)  dflt=1 ;;
8921                 *1p) dflt=1p ;;
8922                 *1pm) dflt=1pm ;;
8923                 *l) dflt=l;;
8924                 *n) dflt=n;;
8925                 *o) dflt=o;;
8926                 *p) dflt=p;;
8927                 *C) dflt=C;;
8928                 *L) dflt=L;;
8929                 *L1) dflt=L1;;
8930                 *) dflt=1;;
8931                 esac
8932                 ;;
8933         *)      dflt="$man1ext";;
8934         esac
8935         . ./myread
8936         man1ext="$ans"
8937         ;;
8938 esac
8939
8940 : see if we can have long filenames
8941 echo " "
8942 first=123456789abcdef
8943 $rm -f $first
8944 if (echo hi >$first) 2>/dev/null; then
8945         if $test -f 123456789abcde; then
8946                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8947                 val="$undef"
8948         else
8949                 echo 'You can have filenames longer than 14 characters.'>&4
8950                 val="$define"
8951         fi
8952 else
8953         $cat <<'EOM'
8954 You can't have filenames longer than 14 chars.
8955 You can't even think about them!
8956 EOM
8957         val="$undef"
8958 fi
8959 set d_flexfnam
8960 eval $setvar
8961 $rm -rf 123456789abcde*
8962
8963 : determine where library module manual pages go
8964 set man3dir man3dir none
8965 eval $prefixit
8966 $cat <<EOM
8967
8968 $spackage has manual pages for many of the library modules.
8969 EOM
8970
8971 case "$nroff" in
8972 nroff)
8973         $cat <<'EOM'
8974 However, you don't have nroff, so they're probably useless to you.
8975 EOM
8976         case "$man3dir" in
8977         '') man3dir="none";;
8978         esac;;
8979 esac
8980
8981 case "$d_flexfnam" in
8982 undef)
8983         $cat <<'EOM'
8984 However, your system can't handle the long file names like File::Basename.3.
8985 EOM
8986         case "$man3dir" in
8987         '') man3dir="none";;
8988         esac;;
8989 esac
8990
8991 echo "If you don't want the manual sources installed, answer 'none'."
8992 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8993 case "$man3dir" in
8994 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8995         if $test -d "$privlib/man/man3"; then
8996                 cat <<EOM >&4
8997
8998 WARNING:  Previous versions of perl installed man3 pages into
8999 $privlib/man/man3.  This version will suggest a
9000 new default of $dflt.
9001 EOM
9002                 tdflt=$dflt
9003                 dflt='n'
9004                 rp='Do you wish to preserve the old behavior?(y/n)'
9005                 . ./myread
9006                 case "$ans" in
9007                 y*) dflt="$privlib/man/man3" ;;
9008                 *)  dflt=$tdflt ;;
9009                 esac
9010     fi
9011         ;;
9012 *)      dflt="$man3dir" ;;
9013 esac
9014 case "$dflt" in
9015 ' ') dflt=none ;;
9016 esac
9017 echo " "
9018 fn=dn+~
9019 rp="Where do the $package library man pages (source) go?"
9020 . ./getfile
9021 prefixvar=man3dir
9022 . ./setprefixvar
9023
9024 case "$man3dir" in
9025 '')     man3dir=' '
9026         installman3dir='';;
9027 esac
9028
9029 : What suffix to use on installed man pages
9030 case "$man3dir" in
9031 ' ')
9032         man3ext='0'
9033         ;;
9034 *)
9035         rp="What suffix should be used for the $package library man pages?"
9036         case "$man3ext" in
9037         '')     case "$man3dir" in
9038                 *3)  dflt=3 ;;
9039                 *3p) dflt=3p ;;
9040                 *3pm) dflt=3pm ;;
9041                 *l) dflt=l;;
9042                 *n) dflt=n;;
9043                 *o) dflt=o;;
9044                 *p) dflt=p;;
9045                 *C) dflt=C;;
9046                 *L) dflt=L;;
9047                 *L3) dflt=L3;;
9048                 *) dflt=3;;
9049                 esac
9050                 ;;
9051         *)      dflt="$man3ext";;
9052         esac
9053         . ./myread
9054         man3ext="$ans"
9055         ;;
9056 esac
9057
9058 : see if we have to deal with yellow pages, now NIS.
9059 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9060         case "$hostcat" in
9061         nidump*) ;;
9062         *)
9063                 case "$hostcat" in
9064                 *ypcat*) dflt=y;;
9065                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9066                                 dflt=y
9067                         else
9068                                 dflt=n
9069                         fi;;
9070                 *) dflt=n;;
9071                 esac
9072                 echo " "
9073                 rp='Are you getting the hosts file via yellow pages?'
9074                 . ./myread
9075                 case "$ans" in
9076                 y*) hostcat='ypcat hosts';;
9077                 *) hostcat='cat /etc/hosts';;
9078                 esac
9079                 ;;
9080         esac
9081 fi
9082 case "$hostcat" in
9083 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9084 esac
9085 case "$groupcat" in
9086 '') test -f /etc/group && groupcat='cat /etc/group';;
9087 esac
9088 case "$passcat" in
9089 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9090 esac
9091
9092 : now get the host name
9093 echo " "
9094 echo "Figuring out host name..." >&4
9095 case "$myhostname" in
9096 '') cont=true
9097         echo 'Maybe "hostname" will work...'
9098         if tans=`sh -c hostname 2>&1` ; then
9099                 myhostname=$tans
9100                 phostname=hostname
9101                 cont=''
9102         fi
9103         ;;
9104 *) cont='';;
9105 esac
9106 if $test "$cont"; then
9107         if ./xenix; then
9108                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9109                 if tans=`cat /etc/systemid 2>&1` ; then
9110                         myhostname=$tans
9111                         phostname='cat /etc/systemid'
9112                         echo "Whadyaknow.  Xenix always was a bit strange..."
9113                         cont=''
9114                 fi
9115         elif $test -r /etc/systemid; then
9116                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9117         fi
9118 fi
9119 if $test "$cont"; then
9120         echo 'No, maybe "uuname -l" will work...'
9121         if tans=`sh -c 'uuname -l' 2>&1` ; then
9122                 myhostname=$tans
9123                 phostname='uuname -l'
9124         else
9125                 echo 'Strange.  Maybe "uname -n" will work...'
9126                 if tans=`sh -c 'uname -n' 2>&1` ; then
9127                         myhostname=$tans
9128                         phostname='uname -n'
9129                 else
9130                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9131                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9132                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9133                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9134                         else
9135                                 case "$myhostname" in
9136                                 '') echo "Does this machine have an identity crisis or something?"
9137                                         phostname='';;
9138                                 *)
9139                                         echo "Well, you said $myhostname before..."
9140                                         phostname='echo $myhostname';;
9141                                 esac
9142                         fi
9143                 fi
9144         fi
9145 fi
9146 case "$myhostname" in
9147 '') myhostname=noname ;;
9148 esac
9149 : you do not want to know about this
9150 set $myhostname
9151 myhostname=$1
9152
9153 : verify guess
9154 if $test "$myhostname" ; then
9155         dflt=y
9156         rp='Your host name appears to be "'$myhostname'".'" Right?"
9157         . ./myread
9158         case "$ans" in
9159         y*) ;;
9160         *) myhostname='';;
9161         esac
9162 fi
9163
9164 : bad guess or no guess
9165 while $test "X$myhostname" = X ; do
9166         dflt=''
9167         rp="Please type the (one word) name of your host:"
9168         . ./myread
9169         myhostname="$ans"
9170 done
9171
9172 : translate upper to lower if necessary
9173 case "$myhostname" in
9174 *[A-Z]*)
9175         echo "(Normalizing case in your host name)"
9176         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9177         ;;
9178 esac
9179
9180 case "$myhostname" in
9181 *.*)
9182         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9183         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9184         echo "(Trimming domain name from host name--host name is now $myhostname)"
9185         ;;
9186 *) case "$mydomain" in
9187         '')
9188                 {
9189                         test "X$hostcat" = "Xypcat hosts" &&
9190                         ypmatch "$myhostname" hosts 2>/dev/null |\
9191                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9192                         $test -s hosts
9193                 } || {
9194                         test "X$hostcat" != "X" &&
9195                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9196                                         /[       ]$myhostname[  . ]/p" > hosts
9197                 }
9198                 tmp_re="[       . ]"
9199                 if $test -f hosts; then
9200                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9201                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9202                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9203                                 hosts | $sort | $uniq | \
9204                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9205                         case `$echo X$dflt` in
9206                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9207                                 dflt=.
9208                                 ;;
9209                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9210                                 ;;
9211                         esac
9212                 else
9213                         echo "(I cannot locate a hosts database anywhere)"
9214                         dflt=.
9215                 fi
9216                 case "$dflt" in
9217                 .)
9218                         tans=`./loc resolv.conf X /etc /usr/etc`
9219                         if $test -f "$tans"; then
9220                                 echo "(Attempting domain name extraction from $tans)"
9221                                 dflt=.`$sed -n -e 's/   / /g' \
9222                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9223                                   -e 1q 2>/dev/null`
9224                                 case "$dflt" in
9225                                 .) dflt=.`$sed -n -e 's/        / /g' \
9226                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9227                                      -e 1q 2>/dev/null`
9228                                         ;;
9229                                 esac
9230                         fi
9231                         ;;
9232                 esac
9233                 case "$dflt" in
9234                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9235                         dflt=.`sh -c domainname 2>/dev/null`
9236                         case "$dflt" in
9237                         '') dflt='.';;
9238                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9239                         esac
9240                         ;;
9241                 esac
9242                 case "$dflt$osname" in
9243                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9244                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9245                         ;;
9246                 esac
9247                 case "$dflt" in
9248                 .) echo "(Lost all hope -- silly guess then)"
9249                         dflt='.nonet'
9250                         ;;
9251                 esac
9252                 $rm -f hosts
9253                 ;;
9254         *) dflt="$mydomain";;
9255         esac;;
9256 esac
9257 echo " "
9258 rp="What is your domain name?"
9259 . ./myread
9260 tans="$ans"
9261 case "$ans" in
9262 '') ;;
9263 .*) ;;
9264 *) tans=".$tans";;
9265 esac
9266 mydomain="$tans"
9267
9268 : translate upper to lower if necessary
9269 case "$mydomain" in
9270 *[A-Z]*)
9271         echo "(Normalizing case in your domain name)"
9272         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9273         ;;
9274 esac
9275
9276 : a little sanity check here
9277 case "$phostname" in
9278 '') ;;
9279 *)
9280         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9281         $myhostname$mydomain|$myhostname) ;;
9282         *)
9283                 case "$phostname" in
9284                 sed*)
9285                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9286                         ;;
9287                 *)
9288                         echo "(That doesn't agree with your $phostname command, by the way.)"
9289                         ;;
9290                 esac
9291         ;;
9292         esac
9293         ;;
9294 esac
9295
9296 : determine the e-mail address of the user who is running us
9297 $cat <<EOM
9298
9299 I need to get your e-mail address in Internet format if possible, i.e.
9300 something like user@host.domain. Please answer accurately since I have
9301 no easy means to double check it. The default value provided below
9302 is most probably close to reality but may not be valid from outside
9303 your organization...
9304
9305 EOM
9306 cont=x
9307 while test "$cont"; do
9308         case "$MAILDOMAIN" in
9309         '')
9310                 if $test -s /etc/mailname; then
9311                         maildomain=`$cat /etc/mailname`
9312                 else
9313                         maildomain="$myhostname$mydomain"
9314                 fi
9315                 ;;
9316         *)  maildomain="$MAILDOMAIN";;
9317         esac
9318         case "$cf_email" in
9319         '') dflt="$cf_by@$maildomain";;
9320         *)  dflt="$cf_email";;
9321         esac
9322         rp='What is your e-mail address?'
9323         . ./myread
9324         cf_email="$ans"
9325         case "$cf_email" in
9326         *@*.*) cont='' ;;
9327         *)
9328                 rp='Address does not look like an Internet one.  Use it anyway?'
9329                 case "$fastread" in
9330                 yes) dflt=y ;;
9331                 *) dflt=n ;;
9332                 esac
9333                 . ./myread
9334                 case "$ans" in
9335                 y*) cont='' ;;
9336                 *) echo " " ;;
9337                 esac
9338                 ;;
9339         esac
9340 done
9341
9342 : Ask e-mail of administrator
9343 $cat <<EOM
9344
9345 If you or somebody else will be maintaining perl at your site, please
9346 fill in the correct e-mail address here so that they may be contacted
9347 if necessary. Currently, the "perlbug" program included with perl
9348 will send mail to this address in addition to perlbug@perl.org. You may
9349 enter "none" for no administrator.
9350
9351 EOM
9352 case "$perladmin" in
9353 '') dflt="$cf_email";;
9354 *) dflt="$perladmin";;
9355 esac
9356 rp='Perl administrator e-mail address'
9357 . ./myread
9358 perladmin="$ans"
9359
9360 : determine whether to only install version-specific parts.
9361 echo " "
9362 $cat <<EOM
9363 Do you want to install only the version-specific parts of the perl
9364 distribution?  Usually you do *not* want to do this.
9365 EOM
9366 case "$versiononly" in
9367 "$define"|[Yy]*|true) dflt='y' ;;
9368 *) dflt='n';
9369 esac
9370 rp="Do you want to install only the version-specific parts of perl?"
9371 . ./myread
9372 case "$ans" in
9373 [yY]*)  val="$define";;
9374 *)      val="$undef" ;;
9375 esac
9376 set versiononly
9377 eval $setvar
9378
9379 case "$versiononly" in
9380 "$define") inc_version_list=''
9381            inc_version_list_init=0
9382            ;;
9383 esac
9384
9385 : figure out how to guarantee perl startup
9386 : XXX Note that this currently takes advantage of the bug that binexp ignores
9387 :     the Configure -Dinstallprefix setting, which in turn means that under
9388 :     relocatable @INC, initialinstalllocation is what binexp started as.
9389 case "$startperl" in
9390 '')
9391         case "$sharpbang" in
9392         *!)
9393                 $cat <<EOH
9394
9395 I can use the #! construct to start perl on your system. This will
9396 make startup of perl scripts faster, but may cause problems if you
9397 want to share those scripts and perl is not in a standard place
9398 ($initialinstalllocation/perl) on all your platforms. The alternative
9399 is to force a shell by starting the script with a single ':' character.
9400
9401 EOH
9402                 case "$versiononly" in
9403                 "$define")      dflt="$initialinstalllocation/perl$version";;
9404                 *)              dflt="$initialinstalllocation/perl";;
9405                 esac
9406                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9407                 . ./myread
9408                 case "$ans" in
9409                 none)   startperl=": # use perl";;
9410                 *)      startperl="#!$ans"
9411                         if $test 30 -lt `echo "$ans" | wc -c`; then
9412                                 $cat >&4 <<EOM
9413
9414 WARNING:  Some systems limit the #! command to 32 characters.
9415 If you experience difficulty running Perl scripts with #!, try
9416 installing Perl in a directory with a shorter pathname.
9417
9418 EOM
9419                         fi ;;
9420                 esac
9421                 ;;
9422         *) startperl=": # use perl"
9423                 ;;
9424         esac
9425         ;;
9426 esac
9427 echo "I'll use $startperl to start perl scripts."
9428
9429 : figure best path for perl in scripts
9430 case "$perlpath" in
9431 '')
9432         case "$versiononly" in
9433         "$define")      perlpath="$initialinstalllocation/perl$version";;
9434         *)              perlpath="$initialinstalllocation/perl";;
9435         esac
9436         case "$startperl" in
9437         *!*) ;;
9438         *)
9439                 $cat <<EOH
9440
9441 I will use the "eval 'exec'" idiom to start Perl on your system.
9442 I can use the full path of your Perl binary for this purpose, but
9443 doing so may cause problems if you want to share those scripts and
9444 Perl is not always in a standard place ($initialinstalllocation/perl).
9445
9446 EOH
9447                 dflt="$initialinstalllocation/perl"
9448                 rp="What path shall I use in \"eval 'exec'\"?"
9449                 . ./myread
9450                 perlpath="$ans"
9451                 ;;
9452         esac
9453         ;;
9454 esac
9455 case "$startperl" in
9456 *!*)    ;;
9457 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9458 esac
9459
9460 : determine where public executable scripts go
9461 set scriptdir scriptdir
9462 eval $prefixit
9463 case "$scriptdir" in
9464 '')
9465         dflt="$bin"
9466         : guess some guesses
9467         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9468         $test -d /usr/share/bin     && dflt=/usr/share/bin
9469         $test -d /usr/local/script  && dflt=/usr/local/script
9470         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9471         $test -d $prefixexp/script  && dflt=$prefixexp/script
9472         set dflt
9473         eval $prefixup
9474         ;;
9475 *)  dflt="$scriptdir"
9476         ;;
9477 esac
9478 $cat <<EOM
9479
9480 Some installations have a separate directory just for executable scripts so
9481 that they can mount it across multiple architectures but keep the scripts in
9482 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9483 Or you might just lump your scripts in with all your other executables.
9484
9485 EOM
9486 fn=d~
9487 rp='Where do you keep publicly executable scripts?'
9488 . ./getfile
9489 if $test "X$ansexp" != "X$scriptdirexp"; then
9490         installscript=''
9491 fi
9492 installscriptdir=''
9493 prefixvar=scriptdir
9494 . ./setprefixvar
9495 : A little fix up for an irregularly named variable.
9496 installscript="$installscriptdir"
9497
9498 : determine where add-on public executables go
9499 case "$sitebin" in
9500 '')     dflt=$siteprefix/bin ;;
9501 *)      dflt=$sitebin ;;
9502 esac
9503 fn=d~
9504 rp='Pathname where the add-on public executables should be installed?'
9505 . ./getfile
9506 prefixvar=sitebin
9507 . ./setprefixvar
9508
9509 : determine where add-on html pages go
9510 : There is no standard location, so try to copy the previously-selected
9511 : directory structure for the core html pages.
9512 case "$sitehtml1dir" in
9513 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9514 *)     dflt=$sitehtml1dir ;;
9515 esac
9516 case "$dflt" in
9517 ''|' ') dflt=none ;;
9518 esac
9519 fn=dn+~
9520 rp='Pathname where the site-specific html pages should be installed?'
9521 . ./getfile
9522 prefixvar=sitehtml1dir
9523 . ./setprefixvar
9524
9525 : determine where add-on library html pages go
9526 : There is no standard location, so try to copy the previously-selected
9527 : directory structure for the core html pages.
9528 case "$sitehtml3dir" in
9529 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9530 *)     dflt=$sitehtml3dir ;;
9531 esac
9532 case "$dflt" in
9533 ''|' ') dflt=none ;;
9534 esac
9535 fn=dn+~
9536 rp='Pathname where the site-specific library html pages should be installed?'
9537 . ./getfile
9538 prefixvar=sitehtml3dir
9539 . ./setprefixvar
9540
9541 : determine where add-on manual pages go
9542 case "$siteman1dir" in
9543 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9544 *)      dflt=$siteman1dir ;;
9545 esac
9546 case "$dflt" in
9547 ''|' ') dflt=none ;;
9548 esac
9549 fn=dn+~
9550 rp='Pathname where the site-specific manual pages should be installed?'
9551 . ./getfile
9552 prefixvar=siteman1dir
9553 . ./setprefixvar
9554
9555 : determine where add-on library man pages go
9556 case "$siteman3dir" in
9557 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9558 *)      dflt=$siteman3dir ;;
9559 esac
9560 case "$dflt" in
9561 ''|' ') dflt=none ;;
9562 esac
9563 fn=dn+~
9564 rp='Pathname where the site-specific library manual pages should be installed?'
9565 . ./getfile
9566 prefixvar=siteman3dir
9567 . ./setprefixvar
9568
9569 : determine where add-on public executable scripts go
9570 case "$sitescript" in
9571 '')     dflt=$siteprefix/script
9572         $test -d $dflt || dflt=$sitebin ;;
9573 *)  dflt="$sitescript" ;;
9574 esac
9575 fn=d~+
9576 rp='Pathname where add-on public executable scripts should be installed?'
9577 . ./getfile
9578 prefixvar=sitescript
9579 . ./setprefixvar
9580
9581 : see if backtrace exists
9582 set backtrace d_backtrace
9583 eval $inlibc
9584
9585 : add flags if using c backtrace
9586 case "$usecbacktrace" in
9587   "") usecbacktrace=$undef ;;
9588   [yY]*|true|$define)
9589     case "$d_backtrace" in
9590       [yY]*|true|$define)
9591         case " $ccflags " in
9592           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9593           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9594           esac
9595         ;;
9596       *)
9597         echo "This system does not support backtrace" >&4
9598         usecbacktrace=$undef
9599         ;;
9600       esac
9601     ;;
9602   esac
9603
9604 : Check if faststdio is requested and available
9605 case "$usefaststdio" in
9606 $define|true|[yY]*|'')
9607         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9608         case "$xversion" in
9609         [68])   dflt='y' ;;
9610         *)      dflt='n' ;;
9611         esac
9612         ;;
9613 *) dflt='n';;
9614 esac
9615 cat <<EOM
9616
9617 Perl can be built to use 'fast stdio', which means using the stdio
9618 library but also directly manipulating the stdio buffers to enable
9619 faster I/O.  Using stdio is better for backward compatibility (especially
9620 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9621 interface has been preferred instead of stdio.
9622
9623 If this doesn't make any sense to you, just accept the default '$dflt'.
9624 EOM
9625 rp='Use the "fast stdio" if available?'
9626 . ./myread
9627 case "$ans" in
9628 y|Y)    val="$define" ;;
9629 *)      val="$undef" ;;
9630 esac
9631 set usefaststdio
9632 eval $setvar
9633
9634
9635 : define an is-a-typedef? function
9636 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9637 case "$inclist" in
9638 "") inclist="sys/types.h";;
9639 esac;
9640 eval "varval=\$$var";
9641 case "$varval" in
9642 "")
9643         $rm -f temp.c;
9644         for inc in $inclist; do
9645                 echo "#include <$inc>" >>temp.c;
9646         done;
9647         echo "#ifdef $type" >> temp.c;
9648         echo "printf(\"We have $type\");" >> temp.c;
9649         echo "#endif" >> temp.c;
9650         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9651         if $contains $type temp.E >/dev/null 2>&1; then
9652                 eval "$var=\$type";
9653         else
9654                 eval "$var=\$def";
9655         fi;
9656         $rm -f temp.?;;
9657 *) eval "$var=\$varval";;
9658 esac'
9659
9660 : define an is-a-typedef? function that prompts if the type is not available.
9661 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9662 case "$inclist" in
9663 "") inclist="sys/types.h";;
9664 esac;
9665 eval "varval=\$$var";
9666 case "$varval" in
9667 "")
9668         $rm -f temp.c;
9669         for inc in $inclist; do
9670                 echo "#include <$inc>" >>temp.c;
9671         done;
9672         echo "#ifdef $type" >> temp.c;
9673         echo "printf(\"We have $type\");" >> temp.c;
9674         echo "#endif" >> temp.c;
9675         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9676         echo " " ;
9677         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9678         if $contains $type temp.E >/dev/null 2>&1; then
9679                 echo "$type found." >&4;
9680                 eval "$var=\$type";
9681         else
9682                 echo "$type NOT found." >&4;
9683                 dflt="$def";
9684                 . ./myread ;
9685                 eval "$var=\$ans";
9686         fi;
9687         $rm -f temp.?;;
9688 *) eval "$var=\$varval";;
9689 esac'
9690
9691 : see what type lseek is declared as in the kernel
9692 rp="What is the type used for lseek's offset on this system?"
9693 set off_t lseektype long stdio.h sys/types.h
9694 eval $typedef_ask
9695
9696 echo " "
9697 echo "Checking to see how big your file offsets are..." >&4
9698 $cat >try.c <<EOCP
9699 #include <sys/types.h>
9700 #include <stdio.h>
9701 int main()
9702 {
9703     printf("%d\n", (int)sizeof($lseektype));
9704     return(0);
9705 }
9706 EOCP
9707 set try
9708 if eval $compile_ok; then
9709         lseeksize=`$run ./try`
9710         echo "Your file offsets are $lseeksize bytes long."
9711 else
9712         dflt=$longsize
9713         echo " "
9714         echo "(I can't seem to compile the test program.  Guessing...)"
9715         rp="What is the size of your file offsets (in bytes)?"
9716         . ./myread
9717         lseeksize="$ans"
9718 fi
9719 $rm_try
9720
9721 : see what type file positions are declared as in the library
9722 rp="What is the type for file position used by fsetpos()?"
9723 set fpos_t fpostype long stdio.h sys/types.h
9724 eval $typedef_ask
9725
9726 : Check size for Fpos_t
9727 echo " "
9728 case "$fpostype" in
9729 *_t) zzz="$fpostype"    ;;
9730 *)   zzz="fpos_t"       ;;
9731 esac
9732 echo "Checking the size of $zzz..." >&4
9733 cat > try.c <<EOCP
9734 #include <sys/types.h>
9735 #include <stdio.h>
9736 #$i_stdlib I_STDLIB
9737 #ifdef I_STDLIB
9738 #include <stdlib.h>
9739 #endif
9740 int main() {
9741     printf("%d\n", (int)sizeof($fpostype));
9742     exit(0);
9743 }
9744 EOCP
9745 set try
9746 if eval $compile_ok; then
9747         yyy=`$run ./try`
9748         case "$yyy" in
9749         '')     fpossize=4
9750                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9751                 ;;
9752         *)      fpossize=$yyy
9753                 echo "Your $zzz is $fpossize bytes long."
9754                 ;;
9755         esac
9756 else
9757         dflt="$longsize"
9758         echo " " >&4
9759         echo "(I can't compile the test program.  Guessing...)" >&4
9760         rp="What is the size of your file positions (in bytes)?"
9761         . ./myread
9762         fpossize="$ans"
9763 fi
9764
9765 : Check for large file support
9766 # Backward compatibility (uselfs is deprecated).
9767 case "$uselfs" in
9768 "$define"|true|[yY]*)
9769         cat <<EOM >&4
9770
9771 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9772 EOM
9773         uselargefiles="$define"
9774         ;;
9775 esac
9776
9777 case "$lseeksize:$fpossize" in
9778 8:8) cat <<EOM
9779
9780 You can have files larger than 2 gigabytes.
9781 EOM
9782    val="$define" ;;
9783 *)    case "$uselargefiles" in
9784    "$undef"|false|[nN]*) dflt='n' ;;
9785    *)   dflt='y' ;;
9786    esac
9787    cat <<EOM
9788
9789 Perl can be built to understand large files (files larger than 2 gigabytes)
9790 on some systems.  To do so, Configure can be run with -Duselargefiles.
9791
9792 If this doesn't make any sense to you, just accept the default '$dflt'.
9793 EOM
9794    rp='Try to understand large files, if available?'
9795    . ./myread
9796    case "$ans" in
9797    y|Y)         val="$define" ;;
9798    *)           val="$undef"  ;;
9799    esac
9800    ;;
9801 esac
9802 set uselargefiles
9803 eval $setvar
9804 : Look for a hint-file generated 'call-back-unit'.  If the
9805 : user has specified that a large files perl is to be built,
9806 : we may need to set or change some other defaults.
9807 if $test -f uselargefiles.cbu; then
9808         echo "Your platform has some specific hints regarding large file builds, using them..."
9809         . ./uselargefiles.cbu
9810 fi
9811 case "$uselargefiles" in
9812 "$define")
9813         if $test -f uselargefiles.cbu; then
9814                 echo " "
9815                 echo "Rechecking to see how big your file offsets are..." >&4
9816                 $cat >try.c <<EOCP
9817 #include <sys/types.h>
9818 #include <stdio.h>
9819 int main()
9820 {
9821     printf("%d\n", (int)sizeof($lseektype));
9822     return(0);
9823 }
9824 EOCP
9825                 set try
9826                 if eval $compile_ok; then
9827                         lseeksize=`$run ./try`
9828                         $echo "Your file offsets are now $lseeksize bytes long."
9829                 else
9830                         dflt="$lseeksize"
9831                         echo " "
9832                         echo "(I can't seem to compile the test program.  Guessing...)"
9833                         rp="What is the size of your file offsets (in bytes)?"
9834                         . ./myread
9835                         lseeksize="$ans"
9836                 fi
9837                 case "$fpostype" in
9838                 *_t) zzz="$fpostype"    ;;
9839                 *)   zzz="fpos_t"       ;;
9840                 esac
9841                 $echo $n "Rechecking the size of $zzz...$c" >&4
9842                 $cat > try.c <<EOCP
9843 #include <sys/types.h>
9844 #include <stdio.h>
9845 #$i_stdlib I_STDLIB
9846 #ifdef I_STDLIB
9847 #include <stdlib.h>
9848 #endif
9849 int main() {
9850     printf("%d\n", (int)sizeof($fpostype));
9851     return(0);
9852 }
9853 EOCP
9854                 set try
9855                 if eval $compile_ok; then
9856                         yyy=`$run ./try`
9857                         dflt="$lseeksize"
9858                         case "$yyy" in
9859                         '')     echo " "
9860                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9861                                 ;;
9862                         *)      fpossize=$yyy
9863                                 echo " $fpossize bytes." >&4
9864                                 ;;
9865                         esac
9866                 else
9867                         dflt="$fpossize"
9868                         echo " "
9869                         echo "(I can't compile the test program.  Guessing...)" >&4
9870                         rp="What is the size of your file positions (in bytes)?"
9871                         . ./myread
9872                         fpossize="$ans"
9873                 fi
9874                 $rm_try
9875         fi
9876         ;;
9877 esac
9878
9879 : Check if we want perlio
9880 useperlio="$define"
9881
9882 : Set the vendorbin variables
9883 case "$vendorprefix" in
9884 '')     d_vendorbin="$undef"
9885         vendorbin=''
9886         vendorbinexp=''
9887         ;;
9888 *)      d_vendorbin="$define"
9889         : determine where vendor-supplied executables go.
9890         case "$vendorbin" in
9891         '') dflt=$vendorprefix/bin ;;
9892         *)      dflt="$vendorbin" ;;
9893         esac
9894         fn=d~+
9895         rp='Pathname for the vendor-supplied executables directory?'
9896         . ./getfile
9897         vendorbin="$ans"
9898         vendorbinexp="$ansexp"
9899         ;;
9900 esac
9901 prefixvar=vendorbin
9902 . ./installprefix
9903
9904 : Set the vendorhtml1dir variables
9905 case "$vendorprefix" in
9906 '')     vendorhtml1dir=''
9907         vendorhtml1direxp=''
9908         ;;
9909 *)      : determine where vendor-supplied html pages go.
9910         : There is no standard location, so try to copy the previously-selected
9911         : directory structure for the core html pages.
9912         : XXX Better default suggestions would be welcome.
9913         case "$vendorhtml1dir" in
9914         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9915         *)      dflt=$vendorhtml1dir ;;
9916         esac
9917         case "$dflt" in
9918         ''|' ') dflt=none ;;
9919         esac
9920         fn=dn+~
9921         rp='Pathname for the vendor-supplied html pages?'
9922         . ./getfile
9923         vendorhtml1dir="$ans"
9924         vendorhtml1direxp="$ansexp"
9925         ;;
9926 esac
9927 : Use ' ' for none so value is preserved next time through Configure
9928 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9929 prefixvar=vendorhtml1dir
9930 . ./installprefix
9931
9932 : Set the vendorhtml3dir variables
9933 case "$vendorprefix" in
9934 '')     vendorhtml3dir=''
9935         vendorhtml3direxp=''
9936         ;;
9937 *)      : determine where vendor-supplied module html pages go.
9938         : There is no standard location, so try to copy the previously-selected
9939         : directory structure for the core html pages.
9940         : XXX Better default suggestions would be welcome.
9941         case "$vendorhtml3dir" in
9942         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9943         *)      dflt=$vendorhtml3dir ;;
9944         esac
9945         case "$dflt" in
9946         ''|' ') dflt=none ;;
9947         esac
9948         fn=dn+~
9949         rp='Pathname for the vendor-supplied html pages?'
9950         . ./getfile
9951         vendorhtml3dir="$ans"
9952         vendorhtml3direxp="$ansexp"
9953         ;;
9954 esac
9955 : Use ' ' for none so value is preserved next time through Configure
9956 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9957 prefixvar=vendorhtml3dir
9958 . ./installprefix
9959
9960 : Set the vendorman1dir variables
9961 case "$vendorprefix" in
9962 '')     vendorman1dir=''
9963         vendorman1direxp=''
9964         ;;
9965 *)      : determine where vendor-supplied manual pages go.
9966         case "$vendorman1dir" in
9967         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9968         *)      dflt=$vendorman1dir ;;
9969         esac
9970         case "$dflt" in
9971         ''|' ') dflt=none ;;
9972         esac
9973         fn=nd~+
9974         rp='Pathname for the vendor-supplied manual section 1 pages?'
9975         . ./getfile
9976         vendorman1dir="$ans"
9977         vendorman1direxp="$ansexp"
9978         ;;
9979 esac
9980 : Use ' ' for none so value is preserved next time through Configure
9981 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9982 prefixvar=vendorman1dir
9983 . ./installprefix
9984
9985 : Set the vendorman3dir variables
9986 case "$vendorprefix" in
9987 '')     vendorman3dir=''
9988         vendorman3direxp=''
9989         ;;
9990 *)      : determine where vendor-supplied module manual pages go.
9991         case "$vendorman3dir" in
9992         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9993         *)      dflt=$vendorman3dir ;;
9994         esac
9995         case "$dflt" in
9996         ''|' ') dflt=none ;;
9997         esac
9998         fn=nd~+
9999         rp='Pathname for the vendor-supplied manual section 3 pages?'
10000         . ./getfile
10001         vendorman3dir="$ans"
10002         vendorman3direxp="$ansexp"
10003         ;;
10004 esac
10005 : Use ' ' for none so value is preserved next time through Configure
10006 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10007 prefixvar=vendorman3dir
10008 . ./installprefix
10009
10010 : Set the vendorscript variables
10011 case "$vendorprefix" in
10012 '')     d_vendorscript="$undef"
10013         vendorscript=''
10014         vendorscriptexp=''
10015         ;;
10016 *)      d_vendorscript="$define"
10017         : determine where vendor-supplied scripts go.
10018         case "$vendorscript" in
10019         '')     dflt=$vendorprefix/script
10020                 $test -d $dflt || dflt=$vendorbin ;;
10021         *)  dflt="$vendorscript" ;;
10022         esac
10023         $cat <<EOM
10024
10025 The installation process will create a directory for
10026 vendor-supplied scripts.
10027
10028 EOM
10029         fn=d~+
10030         rp='Pathname for the vendor-supplied scripts directory?'
10031         . ./getfile
10032         vendorscript="$ans"
10033         vendorscriptexp="$ansexp"
10034         ;;
10035 esac
10036 prefixvar=vendorscript
10037 . ./installprefix
10038
10039 : script used to emit important warnings
10040 cat >warn <<EOS
10041 $startsh
10042 if test \$# -gt 0; then
10043         echo "\$@" >msg
10044 else
10045         cat >msg
10046 fi
10047 echo "*** WARNING:" >&4
10048 sed -e 's/^/*** /' <msg >&4
10049 echo "*** " >&4
10050 cat msg >>config.msg
10051 echo " " >>config.msg
10052 rm -f msg
10053 EOS
10054 chmod +x warn
10055 $eunicefix warn
10056
10057 : see which of string.h or strings.h is needed
10058 echo " "
10059 strings=`./findhdr string.h`
10060 if $test "$strings" && $test -r "$strings"; then
10061         echo "Using <string.h> instead of <strings.h>." >&4
10062         val="$define"
10063 else
10064         val="$undef"
10065         strings=`./findhdr strings.h`
10066         if $test "$strings" && $test -r "$strings"; then
10067                 echo "Using <strings.h> instead of <string.h>." >&4
10068         else
10069                 ./warn "No string header found -- You'll surely have problems."
10070         fi
10071 fi
10072 set i_string
10073 eval $setvar
10074 case "$i_string" in
10075 "$undef") strings=`./findhdr strings.h`;;
10076 *)        strings=`./findhdr string.h`;;
10077 esac
10078
10079 : see if qgcvt exists
10080 set qgcvt d_qgcvt
10081 eval $inlibc
10082
10083 : Check what kind of doubles your system has
10084 $echo "Checking the kind of doubles you have..." >&4
10085 $cat >try.c <<EOP
10086 #$i_stdlib I_STDLIB
10087 #define DOUBLESIZE $doublesize
10088 #ifdef I_STDLIB
10089 #include <stdlib.h>
10090 #endif
10091 #include <stdio.h>
10092 static const double d = -0.1;
10093 int main() {
10094   unsigned const char* b = (unsigned const char*)(&d);
10095 #if DOUBLESIZE == 4
10096   if (b[0] == 0xCD && b[3] == 0xBD) {
10097     /* IEEE 754 32-bit little-endian */
10098     printf("1\n");
10099     exit(0);
10100   }
10101   if (b[0] == 0xBD && b[3] == 0xCD) {
10102     /* IEEE 754 32-bit big-endian */
10103     printf("2\n");
10104     exit(0);
10105   }
10106 #endif
10107 #if DOUBLESIZE == 8
10108   if (b[0] == 0x9A && b[7] == 0xBF) {
10109     /* IEEE 754 64-bit little-endian */
10110     printf("3\n");
10111     exit(0);
10112   }
10113   if (b[0] == 0xBF && b[7] == 0x9A) {
10114     /* IEEE 754 64-bit big-endian */
10115     printf("4\n");
10116     exit(0);
10117   }
10118   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10119    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10120     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10121     * 99 99 b9 bf 9a 99 99 99 */
10122     printf("7\n");
10123     exit(0);
10124   }
10125   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10126    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10127     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10128     * 99 99 99 9a bf b9 99 99 */
10129     printf("8\n");
10130     exit(0);
10131   }
10132 #endif
10133 #if DOUBLESIZE == 16
10134   if (b[0] == 0x9A && b[15] == 0xBF) {
10135     /* IEEE 754 128-bit little-endian */
10136     printf("5\n");
10137     exit(0);
10138   }
10139   if (b[0] == 0xBF && b[15] == 0x9A) {
10140     /* IEEE 754 128-bit big-endian */
10141     printf("6\n");
10142     exit(0);
10143   }
10144 #endif
10145   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
10146    * Whether those environments can still build Perl is debatable. */
10147   printf("-1\n"); /* unknown */
10148   exit(0);
10149 }
10150 EOP
10151 set try
10152 if eval $compile; then
10153     doublekind=`$run ./try`
10154 else
10155     doublekind=-1
10156 fi
10157 case "$doublekind" in
10158 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10159 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10160 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10161 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10162 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10163 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10164 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10165 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10166 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
10167 esac
10168 $rm_try
10169
10170 : Check print/scan long double stuff
10171 echo " "
10172
10173 if $test X"$d_longdbl" = X"$define"; then
10174
10175 echo "Checking how to print long doubles..." >&4
10176
10177 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10178         $cat >try.c <<'EOCP'
10179 #include <sys/types.h>
10180 #include <stdio.h>
10181 int main() {
10182   double d = 123.456;
10183   printf("%.3f\n", d);
10184 }
10185 EOCP
10186         set try
10187         if eval $compile; then
10188                 yyy=`$run ./try`
10189                 case "$yyy" in
10190                 123.456)
10191                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10192                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10193                         echo "We will use %f."
10194                         ;;
10195                 esac
10196         fi
10197 fi
10198
10199 if $test X"$sPRIfldbl" = X; then
10200         $cat >try.c <<'EOCP'
10201 #include <sys/types.h>
10202 #include <stdio.h>
10203 int main() {
10204   long double d = 123.456;
10205   printf("%.3Lf\n", d);
10206 }
10207 EOCP
10208         set try
10209         if eval $compile; then
10210                 yyy=`$run ./try`
10211                 case "$yyy" in
10212                 123.456)
10213                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10214                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10215                         echo "We will use %Lf."
10216                         ;;
10217                 esac
10218         fi
10219 fi
10220
10221 if $test X"$sPRIfldbl" = X; then
10222         $cat >try.c <<'EOCP'
10223 #include <sys/types.h>
10224 #include <stdio.h>
10225 int main() {
10226   long double d = 123.456;
10227   printf("%.3llf\n", d);
10228 }
10229 EOCP
10230         set try
10231         if eval $compile; then
10232                 yyy=`$run ./try`
10233                 case "$yyy" in
10234                 123.456)
10235                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10236                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10237                         echo "We will use %llf."
10238                         ;;
10239                 esac
10240         fi
10241 fi
10242
10243 if $test X"$sPRIfldbl" = X; then
10244         $cat >try.c <<'EOCP'
10245 #include <sys/types.h>
10246 #include <stdio.h>
10247 int main() {
10248   long double d = 123.456;
10249   printf("%.3lf\n", d);
10250 }
10251 EOCP
10252         set try
10253         if eval $compile; then
10254                 yyy=`$run ./try`
10255                 case "$yyy" in
10256                 123.456)
10257                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10258                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10259                         echo "We will use %lf."
10260                         ;;
10261                 esac
10262         fi
10263 fi
10264
10265 if $test X"$sPRIfldbl" = X; then
10266         echo "Cannot figure out how to print long doubles." >&4
10267 else
10268         sSCNfldbl=$sPRIfldbl    # expect consistency
10269 fi
10270
10271 $rm_try
10272
10273 fi # d_longdbl
10274
10275 case "$sPRIfldbl" in
10276 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10277         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10278         d_SCNfldbl="$undef";
10279         ;;
10280 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10281         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10282         d_SCNfldbl="$define";
10283         ;;
10284 esac
10285
10286 : Before committing on uselongdouble, see whether that looks sane.
10287 if $test "$uselongdouble" = "$define"; then
10288     message=""
10289     echo " "
10290     echo "Checking if your long double math functions work right..." >&4
10291     $cat > try.c <<EOF
10292 #include <math.h>
10293 #include <stdio.h>
10294 int main() {
10295   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10296 }
10297 EOF
10298     case "$osname:$gccversion" in
10299     aix:)       saveccflags="$ccflags"
10300                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10301     esac
10302     set try
10303     if eval $compile_ok; then
10304       yyy=`$run ./try`
10305     fi
10306     case "$yyy" in
10307     3) echo "Your long double math functions are working correctly." >&4 ;;
10308     *) echo "Your long double math functions are broken, not using long doubles." >&4
10309        uselongdouble=$undef
10310        ;;
10311     esac
10312     $rm_try
10313     case "$osname:$gccversion" in
10314     aix:)       ccflags="$saveccflags" ;; # restore
10315     esac
10316 fi
10317
10318 : Check how to convert floats to strings.
10319
10320 if test "X$d_Gconvert" = X; then
10321
10322 echo " "
10323 echo "Checking for an efficient way to convert floats to strings."
10324 echo " " > try.c
10325 case "$uselongdouble" in
10326 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10327 esac
10328 case "$d_longdbl" in
10329 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10330 esac
10331 case "$d_PRIgldbl" in
10332 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10333 esac
10334 $cat >>try.c <<EOP
10335 #ifdef TRY_gconvert
10336 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10337 char *myname = "gconvert";
10338 #endif
10339 #ifdef TRY_gcvt
10340 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10341 char *myname = "gcvt";
10342 #endif
10343 #ifdef TRY_qgcvt
10344 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10345 char *myname = "qgcvt";
10346 #define DOUBLETYPE long double
10347 #endif
10348 #ifdef TRY_sprintf
10349 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10350 #ifdef HAS_PRIgldbl
10351 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10352 #else
10353 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10354 #endif
10355 #else
10356 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10357 #endif
10358 char *myname = "sprintf";
10359 #endif
10360
10361 #ifndef DOUBLETYPE
10362 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10363 #define DOUBLETYPE long double
10364 #else
10365 #define DOUBLETYPE double
10366 #endif
10367 #endif
10368
10369 #include <stdio.h>
10370
10371 #$i_stdlib I_STDLIB
10372 #ifdef I_STDLIB
10373 #include <stdlib.h>
10374 #endif
10375 #$i_string I_STRING
10376 #ifdef I_STRING
10377 #  include <string.h>
10378 #else
10379 #  include <strings.h>
10380 #endif
10381
10382 int checkit(char *expect, char *got)
10383 {
10384     if (strcmp(expect, got)) {
10385                 printf("%s oddity:  Expected %s, got %s\n",
10386                         myname, expect, got);
10387                 exit(1);
10388         }
10389 }
10390
10391 int main()
10392 {
10393         char buf[64];
10394         buf[63] = '\0';
10395
10396         /* This must be 1st test on (which?) platform */
10397         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10398         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10399         checkit("0.1", buf);
10400
10401         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10402         checkit("0.01", buf);
10403
10404         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10405         checkit("0.001", buf);
10406
10407         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10408         checkit("0.0001", buf);
10409
10410         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10411         if (strlen(buf) > 5)
10412             checkit("9e-005", buf); /* for Microsoft ?? */
10413         else
10414             checkit("9e-05", buf);
10415
10416         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10417         checkit("1", buf);
10418
10419         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10420         checkit("1.1", buf);
10421
10422         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10423         checkit("1.01", buf);
10424
10425         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10426         checkit("1.001", buf);
10427
10428         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10429         checkit("1.0001", buf);
10430
10431         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10432         checkit("1.00001", buf);
10433
10434         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10435         checkit("1.000001", buf);
10436
10437         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10438         checkit("0", buf);
10439
10440         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10441         checkit("-1", buf);
10442
10443         /* Some Linux gcvt's give 1.e+5 here. */
10444         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10445         checkit("100000", buf);
10446
10447         /* Some Linux gcvt's give -1.e+5 here. */
10448         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10449         checkit("-100000", buf);
10450
10451         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10452         checkit("123.456", buf);
10453
10454         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10455         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10456         /* 34 should be enough to scare even long double
10457          * places into using the e notation. */
10458         if (strlen(buf) > 5)
10459             checkit("1e+034", buf); /* for Microsoft */
10460         else
10461             checkit("1e+34", buf);
10462
10463         /* For Perl, if you add additional tests here, also add them to
10464          * t/base/num.t for benefit of platforms not using Configure or
10465          * overriding d_Gconvert */
10466
10467         exit(0);
10468 }
10469 EOP
10470 : first add preferred functions to our list
10471 xxx_list=""
10472 for xxx_convert in $gconvert_preference; do
10473     case $xxx_convert in
10474     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10475     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10476     esac
10477 done
10478 : then add any others
10479 for xxx_convert in gconvert gcvt sprintf; do
10480     case "$xxx_list" in
10481     *$xxx_convert*) ;;
10482     *) xxx_list="$xxx_list $xxx_convert" ;;
10483     esac
10484 done
10485
10486 case "$d_longdbl$uselongdouble" in
10487 "$define$define")
10488     : again, add preferred functions to our list first
10489     xxx_ld_list=""
10490     for xxx_convert in $gconvert_ld_preference; do
10491         case $xxx_convert in
10492         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10493         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10494         esac
10495     done
10496     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10497     for xxx_convert in qgcvt sprintf $xxx_list; do
10498         case "$xxx_ld_list" in
10499         $xxx_convert*|*" $xxx_convert"*) ;;
10500         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10501         esac
10502     done
10503     : if sprintf cannot do long doubles, move it to the end
10504     if test "$d_PRIgldbl" != "$define"; then
10505         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10506     fi
10507     : if no qgcvt, remove it
10508     if test "$d_qgcvt" != "$define"; then
10509         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10510     fi
10511     : use the ld_list
10512     xxx_list="$xxx_ld_list"
10513     ;;
10514 esac
10515
10516 for xxx_convert in $xxx_list; do
10517         echo "Trying $xxx_convert..."
10518         $rm -f try try$_o core
10519         set try -DTRY_$xxx_convert
10520         if eval $compile; then
10521                 echo "$xxx_convert() found." >&4
10522                 if $run ./try; then
10523                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10524                         break;
10525                 else
10526                         echo "...But $xxx_convert didn't work as I expected."
10527                         xxx_convert=''
10528                 fi
10529         else
10530                 echo "$xxx_convert NOT found." >&4
10531         fi
10532 done
10533
10534 if test X$xxx_convert = X; then
10535     echo "*** WHOA THERE!!! ***" >&4
10536     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10537     xxx_convert=sprintf
10538 fi
10539
10540 case "$xxx_convert" in
10541 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10542 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10543 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10544 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10545    "$define$define$define")
10546       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10547    "$define$define$undef")
10548       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10549    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10550    esac
10551    ;;
10552 esac
10553
10554 fi
10555 $rm_try
10556
10557 : see if _fwalk exists
10558 set fwalk d__fwalk
10559 eval $inlibc
10560
10561 : Initialize h_fcntl
10562 h_fcntl=false
10563
10564 : Initialize h_sysfile
10565 h_sysfile=false
10566
10567 : access call always available on UNIX
10568 set access d_access
10569 eval $inlibc
10570
10571 : locate the flags for 'access()'
10572 case "$d_access" in
10573 "$define")
10574         echo " "
10575         $cat >access.c <<EOCP
10576 #include <sys/types.h>
10577 #ifdef I_FCNTL
10578 #include <fcntl.h>
10579 #endif
10580 #ifdef I_SYS_FILE
10581 #include <sys/file.h>
10582 #endif
10583 #ifdef I_UNISTD
10584 #include <unistd.h>
10585 #endif
10586 #$i_stdlib I_STDLIB
10587 #ifdef I_STDLIB
10588 #include <stdlib.h>
10589 #endif
10590 int main() {
10591         exit(R_OK);
10592 }
10593 EOCP
10594         : check sys/file.h first, no particular reason here
10595         if $test `./findhdr sys/file.h` && \
10596                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10597                 h_sysfile=true;
10598                 echo "<sys/file.h> defines the *_OK access constants." >&4
10599         elif $test `./findhdr fcntl.h` && \
10600                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10601                 h_fcntl=true;
10602                 echo "<fcntl.h> defines the *_OK access constants." >&4
10603         elif $test `./findhdr unistd.h` && \
10604                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10605                 echo "<unistd.h> defines the *_OK access constants." >&4
10606         else
10607                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10608         fi
10609         ;;
10610 esac
10611 $rm -f access*
10612
10613 : see if accessx exists
10614 set accessx d_accessx
10615 eval $inlibc
10616
10617 : see if acosh exists
10618 set acosh d_acosh
10619 eval $inlibc
10620
10621 : see if aintl exists
10622 set aintl d_aintl
10623 eval $inlibc
10624
10625 : see if alarm exists
10626 set alarm d_alarm
10627 eval $inlibc
10628
10629 : see if 64bit time functions exists
10630
10631 set ctime64 d_ctime64
10632 eval $inlibc
10633
10634 set localtime64 d_localtime64
10635 eval $inlibc
10636
10637 set gmtime64 d_gmtime64
10638 eval $inlibc
10639
10640 set mktime64 d_mktime64
10641 eval $inlibc
10642
10643 set difftime64 d_difftime64
10644 eval $inlibc
10645
10646 set asctime64 d_asctime64
10647 eval $inlibc
10648
10649 : see if POSIX threads are available
10650 set pthread.h i_pthread
10651 eval $inhdr
10652
10653 : define a function to check prototypes
10654 $cat > protochk <<EOSH
10655 $startsh
10656 cc="$cc"
10657 optimize="$optimize"
10658 ccflags="$ccflags"
10659 prototype="$prototype"
10660 define="$define"
10661 rm_try="$rm_try"
10662 usethreads=$usethreads
10663 i_pthread=$i_pthread
10664 pthread_h_first=$pthread_h_first
10665 EOSH
10666
10667 $cat >> protochk <<'EOSH'
10668
10669 $rm_try
10670 foo="$1"
10671 shift
10672 while test $# -ge 2; do
10673         case "$1" in
10674                 $define) echo "#include <$2>" >> try.c ;;
10675                 literal) echo "$2" >> try.c ;;
10676         esac
10677     # Extra magic for the benefit of systems that need pthread.h
10678     # to be included early to correctly detect threadsafe functions.
10679     # Such functions must guarantee themselves, though, that the usethreads
10680     # and i_pthread have been defined, before calling protochk.
10681     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10682         echo "#include <pthread.h>" >> try.c
10683         pthread_h_done=yes
10684     fi
10685     shift 2
10686 done
10687 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10688 cat >> try.c <<'EOCP'
10689 #ifdef CAN_PROTOTYPE
10690 #define _(args) args
10691 #else
10692 #define _(args) ()
10693 #endif
10694 EOCP
10695 echo "$foo" >> try.c
10696 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10697 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10698 status=$?
10699 $rm_try
10700 exit $status
10701 EOSH
10702 chmod +x protochk
10703 $eunicefix protochk
10704
10705 : Define hasproto macro for Configure internal use
10706 hasproto='varname=$1; func=$2; shift; shift;
10707 while $test $# -ge 2; do
10708         case "$1" in
10709         $define) echo "#include <$2>";;
10710         esac ;
10711     shift 2;
10712 done > try.c;
10713 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10714 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10715         echo "$func() prototype found.";
10716         val="$define";
10717 else
10718         echo "$func() prototype NOT found.";
10719         val="$undef";
10720 fi;
10721 set $varname;
10722 eval $setvar;
10723 $rm_try tryout.c'
10724
10725 : see if sys/types.h has to be included
10726 set sys/types.h i_systypes
10727 eval $inhdr
10728
10729 : see if sys/select.h has to be included
10730 set sys/select.h i_sysselct
10731 eval $inhdr
10732
10733 : Define hasfield macro for Configure internal use
10734 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10735 while $test $# -ge 2; do
10736         case "$1" in
10737         $define) echo "#include <$2>";;
10738         esac ;
10739     shift 2;
10740 done > try.c;
10741 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10742 set try;
10743 if eval $compile; then
10744         val="$define";
10745 else
10746         val="$undef";
10747 fi;
10748 set $varname;
10749 eval $setvar;
10750 $rm_try'
10751
10752 : see if we should include time.h, sys/time.h, or both
10753 echo " "
10754 if test "X$timeincl" = X; then
10755         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10756         $echo $n "I'm now running the test program...$c"
10757         $cat >try.c <<EOCP
10758 #include <sys/types.h>
10759 #ifdef I_TIME
10760 #include <time.h>
10761 #endif
10762 #ifdef I_SYSTIME
10763 #ifdef SYSTIMEKERNEL
10764 #define KERNEL
10765 #endif
10766 #include <sys/time.h>
10767 #endif
10768 #ifdef I_SYSSELECT
10769 #include <sys/select.h>
10770 #endif
10771 #$i_stdlib I_STDLIB
10772 #ifdef I_STDLIB
10773 #include <stdlib.h>
10774 #endif
10775 int main()
10776 {
10777         struct tm foo;
10778 #ifdef S_TIMEVAL
10779         struct timeval bar;
10780 #endif
10781 #ifdef S_TIMEZONE
10782         struct timezone tzp;
10783 #endif
10784         if (foo.tm_sec == foo.tm_sec)
10785                 exit(0);
10786 #ifdef S_TIMEVAL
10787         if (bar.tv_sec == bar.tv_sec)
10788                 exit(0);
10789 #endif
10790         exit(1);
10791 }
10792 EOCP
10793         flags=''
10794         for s_timezone in '-DS_TIMEZONE' ''; do
10795         sysselect=''
10796         for s_timeval in '-DS_TIMEVAL' ''; do
10797         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10798         for i_time in '' '-DI_TIME'; do
10799         for i_systime in '-DI_SYSTIME' ''; do
10800                 case "$flags" in
10801                 '') $echo $n ".$c"
10802                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10803                         if eval $compile; then
10804                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10805                                 shift
10806                                 flags="$*"
10807                                 echo " "
10808                                 $echo $n "Succeeded with $flags$c"
10809                         fi
10810                         ;;
10811                 esac
10812         done
10813         done
10814         done
10815         done
10816         done
10817         timeincl=''
10818         echo " "
10819         case "$flags" in
10820         *SYSTIMEKERNEL*) i_systimek="$define"
10821                 timeincl=`./findhdr sys/time.h`
10822                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10823         *) i_systimek="$undef";;
10824         esac
10825         case "$flags" in
10826         *I_TIME*) i_time="$define"
10827                 timeincl=`./findhdr time.h`" $timeincl"
10828                 echo "We'll include <time.h>." >&4;;
10829         *) i_time="$undef";;
10830         esac
10831         case "$flags" in
10832         *I_SYSTIME*) i_systime="$define"
10833                 timeincl=`./findhdr sys/time.h`" $timeincl"
10834                 echo "We'll include <sys/time.h>." >&4;;
10835         *) i_systime="$undef";;
10836         esac
10837         $rm_try
10838 fi
10839 : see if struct tm knows about tm_zone
10840 case "$i_systime$i_time" in
10841 *$define*)
10842         echo " "
10843         echo "Checking to see if your struct tm has tm_zone field..." >&4
10844         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10845         eval $hasfield
10846         ;;
10847 *)      val="$undef"
10848         set d_tm_tm_zone
10849         eval $setvar
10850         ;;
10851 esac
10852 case "$d_tm_tm_zone" in
10853 "$define")      echo "Yes, it does."   ;;
10854 *)              echo "No, it doesn't." ;;
10855 esac
10856 : see if struct tm knows about tm_gmtoff
10857 case "$i_systime$i_time" in
10858 *$define*)
10859         echo " "
10860         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10861         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10862         eval $hasfield
10863         ;;
10864 *)      val="$undef"
10865         set d_tm_tm_gmtoff
10866         eval $setvar
10867         ;;
10868 esac
10869 case "$d_tm_tm_gmtoff" in
10870 "$define")      echo "Yes, it does."   ;;
10871 *)              echo "No, it doesn't." ;;
10872 esac
10873
10874 : see if asctime_r exists
10875 set asctime_r d_asctime_r
10876 eval $inlibc
10877 case "$d_asctime_r" in
10878 "$define")
10879         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10880         case "$d_asctime_r_proto:$usethreads" in
10881         ":define")      d_asctime_r_proto=define
10882                 set d_asctime_r_proto asctime_r $hdrs
10883                 eval $hasproto ;;
10884         *)      ;;
10885         esac
10886         case "$d_asctime_r_proto" in
10887         define)
10888         case "$asctime_r_proto" in
10889         ''|0) try='char* asctime_r(const struct tm*, char*);'
10890         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10891         esac
10892         case "$asctime_r_proto" in
10893         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10894         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10895         esac
10896         case "$asctime_r_proto" in
10897         ''|0) try='int asctime_r(const struct tm*, char*);'
10898         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10899         esac
10900         case "$asctime_r_proto" in
10901         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10902         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10903         esac
10904         case "$asctime_r_proto" in
10905         ''|0)   d_asctime_r=undef
10906                 asctime_r_proto=0
10907                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10908         * )     case "$asctime_r_proto" in
10909                 REENTRANT_PROTO*) ;;
10910                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10911                 esac
10912                 echo "Prototype: $try" ;;
10913         esac
10914         ;;
10915         *)      case "$usethreads" in
10916                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10917                 esac
10918                 d_asctime_r=undef
10919                 asctime_r_proto=0
10920                 ;;
10921         esac
10922         ;;
10923 *)      asctime_r_proto=0
10924         ;;
10925 esac
10926
10927 : see if asinh exists
10928 set asinh d_asinh
10929 eval $inlibc
10930
10931 : see if atanh exists
10932 set atanh d_atanh
10933 eval $inlibc
10934
10935 : see if atolf exists
10936 set atolf d_atolf
10937 eval $inlibc
10938
10939 : see if atoll exists
10940 set atoll d_atoll
10941 eval $inlibc
10942
10943 : Look for GCC-style attribute format
10944 case "$d_attribute_format" in
10945 '')
10946 echo " "
10947 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10948 $cat >attrib.c <<'EOCP'
10949 #include <stdio.h>
10950 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10951 EOCP
10952 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10953         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10954                 echo "Your C compiler doesn't support __attribute__((format))."
10955                 val="$undef"
10956         else
10957                 echo "Your C compiler supports __attribute__((format))."
10958                 val="$define"
10959         fi
10960 else
10961         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10962         val="$undef"
10963 fi
10964 ;;
10965 *) val="$d_attribute_format" ;;
10966 esac
10967 set d_attribute_format
10968 eval $setvar
10969 $rm -f attrib*
10970
10971 : Look for GCC-style attribute format with null format allowed
10972 case "$d_printf_format_null" in
10973 '') case "$d_attribute_format" in
10974     $define)
10975         echo " "
10976         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10977 $cat >attrib.c <<EOCP
10978 #include <stdio.h>
10979 #$i_stdlib I_STDLIB
10980 #ifdef I_STDLIB
10981 #include <stdlib.h>
10982 #endif
10983 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10984 int null_printf (char* pat,...) { return (int)pat; }
10985 int main () { exit(null_printf(NULL)); }
10986 EOCP
10987         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10988             : run the executable in case it produces a run-time warning
10989             if $run ./attrib >>attrib.out 2>&1; then
10990                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10991                     echo "Your C compiler doesn't allow __printf__ format to be null."
10992                     val="$undef"
10993                 else
10994                     echo "Your C compiler allows __printf__ format to be null."
10995                     val="$define"
10996                 fi
10997             else
10998             echo "Your C compiler executable failed with __printf__ format null."
10999             val="$undef"
11000         fi
11001     else
11002         echo "Your C compiler fails with __printf__ format null."
11003         val="$undef"
11004     fi
11005     ;;
11006     *)  val="$undef" ;;
11007     esac
11008 ;;
11009 *)  val="$d_printf_format_null" ;;
11010 esac
11011 set d_printf_format_null
11012 eval $setvar
11013 $rm -f attrib*
11014
11015 : Look for GCC-style attribute malloc
11016 case "$d_attribute_malloc" in
11017 '')
11018 echo " "
11019 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11020 $cat >attrib.c <<'EOCP'
11021 #include <stdio.h>
11022 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11023 EOCP
11024 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11025         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11026                 echo "Your C compiler doesn't support __attribute__((malloc))."
11027                 val="$undef"
11028         else
11029                 echo "Your C compiler supports __attribute__((malloc))."
11030                 val="$define"
11031         fi
11032 else
11033         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11034         val="$undef"
11035 fi
11036 ;;
11037 *) val="$d_attribute_malloc" ;;
11038 esac
11039 set d_attribute_malloc
11040 eval $setvar
11041 $rm -f attrib*
11042
11043 : Look for GCC-style attribute nonnull
11044 case "$d_attribute_nonnull" in
11045 '')
11046 echo " "
11047 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11048 $cat >attrib.c <<'EOCP'
11049 #include <stdio.h>
11050 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11051 EOCP
11052 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11053         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11054                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11055                 val="$undef"
11056         else
11057                 echo "Your C compiler supports __attribute__((nonnull))."
11058                 val="$define"
11059         fi
11060 else
11061         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11062         val="$undef"
11063 fi
11064 ;;
11065 *) val="$d_attribute_nonnull" ;;
11066 esac
11067 set d_attribute_nonnull
11068 eval $setvar
11069 $rm -f attrib*
11070
11071 : Look for GCC-style attribute noreturn
11072 case "$d_attribute_noreturn" in
11073 '')
11074 echo " "
11075 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11076 $cat >attrib.c <<'EOCP'
11077 #include <stdio.h>
11078 void fall_over_dead( void ) __attribute__((noreturn));
11079 EOCP
11080 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11081         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11082                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11083                 val="$undef"
11084         else
11085                 echo "Your C compiler supports __attribute__((noreturn))."
11086                 val="$define"
11087         fi
11088 else
11089         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11090         val="$undef"
11091 fi
11092 ;;
11093 *) val="$d_attribute_noreturn" ;;
11094 esac
11095 set d_attribute_noreturn
11096 eval $setvar
11097 $rm -f attrib*
11098
11099 : Look for GCC-style attribute pure
11100 case "$d_attribute_pure" in
11101 '')
11102 echo " "
11103 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11104 $cat >attrib.c <<'EOCP'
11105 #include <stdio.h>
11106 int square( int n ) __attribute__((pure));
11107 EOCP
11108 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11109         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11110                 echo "Your C compiler doesn't support __attribute__((pure))."
11111                 val="$undef"
11112         else
11113                 echo "Your C compiler supports __attribute__((pure))."
11114                 val="$define"
11115         fi
11116 else
11117         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11118         val="$undef"
11119 fi
11120 ;;
11121 *) val="$d_attribute_pure" ;;
11122 esac
11123 set d_attribute_pure
11124 eval $setvar
11125 $rm -f attrib*
11126
11127 : Look for GCC-style attribute unused
11128 case "$d_attribute_unused" in
11129 '')
11130 echo " "
11131 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11132 $cat >attrib.c <<'EOCP'
11133 #include <stdio.h>
11134 int do_something( int dummy __attribute__((unused)), int n );
11135 EOCP
11136 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11137         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11138                 echo "Your C compiler doesn't support __attribute__((unused))."
11139                 val="$undef"
11140         else
11141                 echo "Your C compiler supports __attribute__((unused))."
11142                 val="$define"
11143         fi
11144 else
11145         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11146         val="$undef"
11147 fi
11148 ;;
11149 *) val="$d_attribute_unused" ;;
11150 esac
11151 set d_attribute_unused
11152 eval $setvar
11153 $rm -f attrib*
11154
11155 : Look for GCC-style attribute deprecated
11156 case "$d_attribute_deprecated" in
11157 '')
11158 echo " "
11159 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11160 $cat >attrib.c <<'EOCP'
11161 #include <stdio.h>
11162 int I_am_deprecated(void) __attribute__((deprecated));
11163 EOCP
11164 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11165         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11166                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11167                 val="$undef"
11168         else
11169                 echo "Your C compiler supports __attribute__((deprecated))."
11170                 val="$define"
11171         fi
11172 else
11173         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11174         val="$undef"
11175 fi
11176 ;;
11177 *) val="$d_attribute_deprecated" ;;
11178 esac
11179 set d_attribute_deprecated
11180 eval $setvar
11181 $rm -f attrib*
11182
11183 : Look for GCC-style attribute warn_unused_result
11184 case "$d_attribute_warn_unused_result" in
11185 '')
11186 echo " "
11187 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11188 $cat >attrib.c <<'EOCP'
11189 #include <stdio.h>
11190 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11191 EOCP
11192 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11193         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11194                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11195                 val="$undef"
11196         else
11197                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11198                 val="$define"
11199         fi
11200 else
11201         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11202         val="$undef"
11203 fi
11204 ;;
11205 *) val="$d_attribute_warn_unused_result" ;;
11206 esac
11207 set d_attribute_warn_unused_result
11208 eval $setvar
11209 $rm -f attrib*
11210
11211 : see if bcmp exists
11212 set bcmp d_bcmp
11213 eval $inlibc
11214
11215 : see if bcopy exists
11216 set bcopy d_bcopy
11217 eval $inlibc
11218
11219 : see if getpgrp exists
11220 set getpgrp d_getpgrp
11221 eval $inlibc
11222
11223 case "$d_getpgrp" in
11224 "$define")
11225         echo " "
11226         echo "Checking to see which flavor of getpgrp is in use..."
11227         $cat >try.c <<EOP
11228 #$i_unistd I_UNISTD
11229 #include <sys/types.h>
11230 #ifdef I_UNISTD
11231 #  include <unistd.h>
11232 #endif
11233 #$i_stdlib I_STDLIB
11234 #ifdef I_STDLIB
11235 #include <stdlib.h>
11236 #endif
11237 int main()
11238 {
11239         if (getuid() == 0) {
11240                 printf("(I see you are running Configure as super-user...)\n");
11241                 setuid(1);
11242         }
11243 #ifdef TRY_BSD_PGRP
11244         if (getpgrp(1) == 0)
11245                 exit(0);
11246 #else
11247         if (getpgrp() > 0)
11248                 exit(0);
11249 #endif
11250         exit(1);
11251 }
11252 EOP
11253         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11254                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11255                 val="$define"
11256         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11257                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11258                 val="$undef"
11259         else
11260                 echo "I can't seem to compile and run the test program."
11261                 if ./usg; then
11262                         xxx="a USG one, i.e. you use getpgrp()."
11263                 else
11264                         # SVR4 systems can appear rather BSD-ish.
11265                         case "$i_unistd" in
11266                         $undef)
11267                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11268                                 val="$define"
11269                                 ;;
11270                         $define)
11271                                 xxx="probably a USG one, i.e. you use getpgrp()."
11272                                 val="$undef"
11273                                 ;;
11274                         esac
11275                 fi
11276                 echo "Assuming your getpgrp is $xxx" >&4
11277         fi
11278         ;;
11279 *) val="$undef";;
11280 esac
11281 set d_bsdgetpgrp
11282 eval $setvar
11283 $rm_try
11284
11285 : see if setpgrp exists
11286 set setpgrp d_setpgrp
11287 eval $inlibc
11288
11289 case "$d_setpgrp" in
11290 "$define")
11291         echo " "
11292         echo "Checking to see which flavor of setpgrp is in use..."
11293         $cat >try.c <<EOP
11294 #$i_unistd I_UNISTD
11295 #include <sys/types.h>
11296 #ifdef I_UNISTD
11297 #  include <unistd.h>
11298 #endif
11299 #$i_stdlib I_STDLIB
11300 #ifdef I_STDLIB
11301 #include <stdlib.h>
11302 #endif
11303 int main()
11304 {
11305         if (getuid() == 0) {
11306                 printf("(I see you are running Configure as super-user...)\n");
11307                 setuid(1);
11308         }
11309 #ifdef TRY_BSD_PGRP
11310         if (-1 == setpgrp(1, 1))
11311                 exit(0);
11312 #else
11313         if (setpgrp() != -1)
11314                 exit(0);
11315 #endif
11316         exit(1);
11317 }
11318 EOP
11319         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11320                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11321                 val="$define"
11322         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11323                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11324                 val="$undef"
11325         else
11326                 echo "(I can't seem to compile and run the test program.)"
11327                 if ./usg; then
11328                         xxx="a USG one, i.e. you use setpgrp()."
11329                 else
11330                         # SVR4 systems can appear rather BSD-ish.
11331                         case "$i_unistd" in
11332                         $undef)
11333                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11334                                 val="$define"
11335                                 ;;
11336                         $define)
11337                                 xxx="probably a USG one, i.e. you use setpgrp()."
11338                                 val="$undef"
11339                                 ;;
11340                         esac
11341                 fi
11342                 echo "Assuming your setpgrp is $xxx" >&4
11343         fi
11344         ;;
11345 *) val="$undef";;
11346 esac
11347 set d_bsdsetpgrp
11348 eval $setvar
11349 $rm_try
11350
11351 : Look for GCC-style __builtin_choose_expr
11352 case "$d_builtin_choose_expr" in
11353 '')
11354     echo " "
11355     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11356     $cat >try.c <<'EOCP'
11357 #include <assert.h>
11358 #include <stdlib.h>
11359 #include <stdio.h>
11360
11361 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11362
11363 int main(void) {
11364     assert( SYRINX(1) == 2112 );
11365     assert( SYRINX(1) != 5150 );
11366     assert( SYRINX(0) == 5150 );
11367     assert( SYRINX(0) != 2112 );
11368     puts( "All good!" );
11369     exit(0);
11370 }
11371
11372 EOCP
11373     set try
11374     if eval $compile && $run ./try; then
11375         echo "Your C compiler supports __builtin_choose_expr."
11376         val="$define"
11377     else
11378         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11379         val="$undef"
11380     fi
11381 ;;
11382 *) val="$d_builtin_choose_expr" ;;
11383 esac
11384
11385 set d_builtin_choose_expr
11386 eval $setvar
11387 $rm_try
11388
11389 : Look for GCC-style __builtin_expect
11390 case "$d_builtin_expect" in
11391 '')
11392     echo " "
11393     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11394     $cat >try.c <<'EOCP'
11395 int main(void) {
11396     int n = 50;
11397     if ( __builtin_expect(n, 0) ) n = 1;
11398     /* Remember shell exit code truth is 0, C truth is non-zero */
11399     return !(n == 1);
11400 }
11401 EOCP
11402     set try
11403     if eval $compile && $run ./try; then
11404         echo "Your C compiler supports __builtin_expect."
11405         val="$define"
11406     else
11407         echo "Your C compiler doesn't seem to understand __builtin_expect."
11408         val="$undef"
11409     fi
11410     ;;
11411 *) val="$d_builtin_expect" ;;
11412 esac
11413
11414 set d_builtin_expect
11415 eval $setvar
11416 $rm_try
11417
11418 : see if bzero exists
11419 set bzero d_bzero
11420 eval $inlibc
11421
11422 : see if stdarg is available
11423 echo " "
11424 if $test `./findhdr stdarg.h`; then
11425         echo "<stdarg.h> found." >&4
11426         valstd="$define"
11427 else
11428         echo "<stdarg.h> NOT found." >&4
11429         valstd="$undef"
11430 fi
11431
11432 : see if varargs is available
11433 echo " "
11434 if $test `./findhdr varargs.h`; then
11435         echo "<varargs.h> found." >&4
11436 else
11437         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11438 fi
11439
11440 : set up the varargs testing programs
11441 $cat > varargs.c <<EOP
11442 #ifdef I_STDARG
11443 #include <stdarg.h>
11444 #endif
11445 #ifdef I_VARARGS
11446 #include <varargs.h>
11447 #endif
11448
11449 #ifdef I_STDARG
11450 int f(char *p, ...)
11451 #else
11452 int f(va_alist)
11453 va_dcl
11454 #endif
11455 {
11456         va_list ap;
11457 #ifndef I_STDARG
11458         char *p;
11459 #endif
11460 #ifdef I_STDARG
11461         va_start(ap,p);
11462 #else
11463         va_start(ap);
11464         p = va_arg(ap, char *);
11465 #endif
11466         va_end(ap);
11467         return 0;
11468 }
11469 EOP
11470 $cat > varargs <<EOP
11471 $startsh
11472 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11473         echo "true"
11474 else
11475         echo "false"
11476 fi
11477 $rm -f varargs$_o
11478 EOP
11479 chmod +x varargs
11480
11481 : now check which varargs header should be included
11482 echo " "
11483 i_varhdr=''
11484 val=''
11485 case "$valstd" in
11486 "$define")
11487         if `./varargs I_STDARG`; then
11488                 val='stdarg.h'
11489         elif `./varargs I_VARARGS`; then
11490                 val='varargs.h'
11491         fi
11492         ;;
11493 *)
11494         if `./varargs I_VARARGS`; then
11495                 val='varargs.h'
11496         fi
11497         ;;
11498 esac
11499 case "$val" in
11500 '')
11501         echo " "
11502         echo "*** WHOA THERE!!! ***" >&4
11503         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11504         case "$knowitall" in
11505         '')
11506         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11507                 exit 1
11508                 ;;
11509         esac
11510 echo "I could not find the definition for va_dcl... You have problems..." >&4
11511         val="$undef"; set i_stdarg; eval $setvar
11512         val="$undef"; set i_varargs; eval $setvar
11513         ;;
11514 *)
11515         set i_varhdr
11516         eval $setvar
11517         case "$i_varhdr" in
11518         stdarg.h)
11519                 val="$define"; set i_stdarg; eval $setvar
11520                 val="$undef"; set i_varargs; eval $setvar
11521                 ;;
11522         varargs.h)
11523                 val="$undef"; set i_stdarg; eval $setvar
11524                 val="$define"; set i_varargs; eval $setvar
11525                 ;;
11526         esac
11527         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11528 esac
11529 $rm -f varargs*
11530
11531 : see if the Compiler supports C99 variadic macros
11532 case "$i_stdarg$i_stdlib" in
11533     "$define$define")
11534     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11535     $cat >try.c <<EOCP
11536 #include <stdio.h>
11537 #include <stdarg.h>
11538
11539 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11540
11541 int main() {
11542   char buf[20];
11543   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11544   puts(buf);
11545   return 0;
11546 }
11547 EOCP
11548     set try
11549     if eval $compile && $run ./try 2>&1 >/dev/null; then
11550         case "`$run ./try`" in
11551             "123 456 789")
11552             echo "You have C99 variadic macros." >&4
11553             d_c99_variadic_macros="$define"
11554             ;;
11555             *)
11556             echo "You don't have functional C99 variadic macros." >&4
11557             d_c99_variadic_macros="$undef"
11558             ;;
11559         esac
11560     else
11561         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11562         d_c99_variadic_macros="$undef"
11563     fi
11564     $rm_try
11565     ;;
11566     *)
11567     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11568     d_c99_variadic_macros="$undef"
11569     ;;
11570 esac
11571
11572 : see if signal is declared as pointer to function returning int or void
11573 echo " "
11574 xxx=`./findhdr signal.h`
11575 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11576 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11577         echo "You have int (*signal())() instead of void." >&4
11578         val="$undef"
11579 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11580         echo "You have void (*signal())()." >&4
11581         val="$define"
11582 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11583         echo "You have int (*signal())() instead of void." >&4
11584         val="$undef"
11585 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11586         echo "You have void (*signal())()." >&4
11587         val="$define"
11588 else
11589         case "$d_voidsig" in
11590         '')
11591         echo "I can't determine whether signal handler returns void or int..." >&4
11592                 dflt=void
11593                 rp="What type does your signal handler return?"
11594                 . ./myread
11595                 case "$ans" in
11596                 v*) val="$define";;
11597                 *) val="$undef";;
11598                 esac;;
11599         "$define")
11600                 echo "As you already told me, signal handler returns void." >&4
11601                 val="$define"
11602                 ;;
11603         *)      echo "As you already told me, signal handler returns int." >&4
11604                 val="$undef"
11605                 ;;
11606         esac
11607 fi
11608 set d_voidsig
11609 eval $setvar
11610 case "$d_voidsig" in
11611 "$define") signal_t="void";;
11612 *) signal_t="int";;
11613 esac
11614 $rm -f $$.tmp
11615
11616 : check for ability to cast large floats to 32-bit ints.
11617 echo " "
11618 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11619 if $test "$intsize" -ge 4; then
11620         xxx=int
11621 else
11622         xxx=long
11623 fi
11624 $cat >try.c <<EOCP
11625 #include <stdio.h>
11626 #$i_stdlib I_STDLIB
11627 #ifdef I_STDLIB
11628 #include <stdlib.h>
11629 #endif
11630 #include <sys/types.h>
11631 #include <signal.h>
11632 $signal_t blech(int s) { exit(3); }
11633 int main()
11634 {
11635         $xxx i32;
11636         double f, g;
11637         int result = 0;
11638         char str[16];
11639         signal(SIGFPE, blech);
11640
11641         /* Don't let compiler optimize the test away.  Store the number
11642            in a writable string for gcc to pass to sscanf under HP-UX.
11643         */
11644         sprintf(str, "2147483647");
11645         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11646         g = 10 * f;
11647         i32  = ($xxx) g;
11648
11649         /* x86 processors will probably give 0x8000 0000, which is a
11650            sign change.  We don't want that.  We want to mimic SPARC
11651            behavior here, which is to preserve the sign and give
11652            back 0x7fff ffff.
11653         */
11654         if (i32 != ($xxx) f)
11655                 result |= 1;
11656         exit(result);
11657 }
11658 EOCP
11659 set try
11660 if eval $compile_ok; then
11661         $run ./try 2>/dev/null
11662         yyy=$?
11663 else
11664         echo "(I can't seem to compile the test program--assuming it can't)"
11665         yyy=1
11666 fi
11667 case "$yyy" in
11668 0)      val="$define"
11669         echo "Yup, it can."
11670         ;;
11671 *)      val="$undef"
11672         echo "Nope, it can't."
11673         ;;
11674 esac
11675 set d_casti32
11676 eval $setvar
11677 $rm_try
11678
11679 : check for ability to cast negative floats to unsigned
11680 echo " "
11681 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11682 $cat >try.c <<EOCP
11683 #include <stdio.h>
11684 #$i_stdlib I_STDLIB
11685 #ifdef I_STDLIB
11686 #include <stdlib.h>
11687 #endif
11688 #include <sys/types.h>
11689 #include <signal.h>
11690 $signal_t blech(int s) { exit(7); }
11691 $signal_t blech_in_list(int s) { exit(4); }
11692 unsigned long dummy_long(unsigned long p) { return p; }
11693 unsigned int dummy_int(unsigned int p) { return p; }
11694 unsigned short dummy_short(unsigned short p) { return p; }
11695 int main()
11696 {
11697         double f;
11698         unsigned long along;
11699         unsigned int aint;
11700         unsigned short ashort;
11701         int result = 0;
11702         char str[16];
11703
11704         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11705            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11706            optimized the whole file away
11707         */
11708         /* Store the number in a writable string for gcc to pass to
11709            sscanf under HP-UX.
11710         */
11711         sprintf(str, "-123");
11712         sscanf(str, "%lf", &f);  /* f = -123.; */
11713
11714         signal(SIGFPE, blech);
11715         along = (unsigned long)f;
11716         aint = (unsigned int)f;
11717         ashort = (unsigned short)f;
11718         if (along != (unsigned long)-123)
11719                 result |= 1;
11720         if (aint != (unsigned int)-123)
11721                 result |= 1;
11722         if (ashort != (unsigned short)-123)
11723                 result |= 1;
11724         sprintf(str, "1073741824.");
11725         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11726         f = f + f;
11727         along = 0;
11728         along = (unsigned long)f;
11729         if (along != 0x80000000)
11730                 result |= 2;
11731         f -= 1.;
11732         along = 0;
11733         along = (unsigned long)f;
11734         if (along != 0x7fffffff)
11735                 result |= 1;
11736         f += 2.;
11737         along = 0;
11738         along = (unsigned long)f;
11739         if (along != 0x80000001)
11740                 result |= 2;
11741         if (result)
11742                 exit(result);
11743         signal(SIGFPE, blech_in_list);
11744         sprintf(str, "123.");
11745         sscanf(str, "%lf", &f);  /* f = 123.; */
11746         along = dummy_long((unsigned long)f);
11747         aint = dummy_int((unsigned int)f);
11748         ashort = dummy_short((unsigned short)f);
11749         if (along != (unsigned long)123)
11750                 result |= 4;
11751         if (aint != (unsigned int)123)
11752                 result |= 4;
11753         if (ashort != (unsigned short)123)
11754                 result |= 4;
11755         exit(result);
11756
11757 }
11758 EOCP
11759 set try
11760 if eval $compile_ok; then
11761         $run ./try 2>/dev/null
11762         castflags=$?
11763 else
11764         echo "(I can't seem to compile the test program--assuming it can't)"
11765         castflags=7
11766 fi
11767 case "$castflags" in
11768 0)      val="$define"
11769         echo "Yup, it can."
11770         ;;
11771 *)      val="$undef"
11772         echo "Nope, it can't."
11773         ;;
11774 esac
11775 set d_castneg
11776 eval $setvar
11777 $rm_try
11778
11779 : see if cbrt exists
11780 set cbrt d_cbrt
11781 eval $inlibc
11782
11783 : see if vprintf exists
11784 echo " "
11785 if set vprintf val -f d_vprintf; eval $csym; $val; then
11786         echo 'vprintf() found.' >&4
11787         val="$define"
11788         $cat >try.c <<EOF
11789 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11790 #$i_varargs I_VARARGS
11791
11792 #$i_stdlib I_STDLIB
11793 #$i_unistd I_UNISTD
11794
11795 #ifdef I_STDARG
11796 #  include <stdarg.h>
11797 #else /* I_VARARGS */
11798 #  include <varargs.h>
11799 #endif
11800
11801 #ifdef I_UNISTD
11802 #  include <unistd.h>
11803 #endif
11804
11805 #ifdef I_STDLIB
11806 #  include <stdlib.h>
11807 #endif
11808
11809 #include <stdio.h> /* vsprintf prototype */
11810
11811 #ifdef I_STDARG
11812 void xxx(int n, ...)
11813 {
11814     va_list args;
11815     char buf[10];
11816     va_start(args, n);
11817     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11818 }
11819 int main() { xxx(1, "foo"); }
11820
11821 #else /* I_VARARGS */
11822
11823 xxx(va_alist)
11824 va_dcl
11825 {
11826     va_list args;
11827     char buf[10];
11828     va_start(args);
11829     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11830 }
11831 int main() { xxx("foo"); }
11832
11833 #endif
11834
11835 EOF
11836         set try
11837         if eval $compile_ok; then
11838                 if $run ./try; then
11839                         echo "Your vsprintf() returns (int)." >&4
11840                         val2="$undef"
11841                 else
11842                         echo "Your vsprintf() returns (char*)." >&4
11843                         val2="$define"
11844                 fi
11845         else
11846                 echo 'I am unable to compile the vsprintf() test program.' >&4
11847                 # We shouldn't get here.  If we do, assume the standard signature,
11848                 # not the old BSD one.
11849                 echo 'Guessing that vsprintf() returns (int).' >&4
11850                 val2="$undef"
11851         fi
11852 else
11853         echo 'vprintf() NOT found.' >&4
11854         val="$undef"
11855         val2="$undef"
11856 fi
11857 $rm_try
11858 set d_vprintf
11859 eval $setvar
11860 val=$val2
11861 set d_charvspr
11862 eval $setvar
11863
11864 : see if chown exists
11865 set chown d_chown
11866 eval $inlibc
11867
11868 : see if chroot exists
11869 set chroot d_chroot
11870 eval $inlibc
11871
11872 : see if chsize exists
11873 set chsize d_chsize
11874 eval $inlibc
11875
11876 : see if class exists
11877 set class d_class
11878 eval $inlibc
11879
11880 : see if clearenv exists
11881 set clearenv d_clearenv
11882 eval $inlibc
11883
11884 : Define hasstruct macro for Configure internal use
11885 hasstruct='varname=$1; struct=$2; shift; shift;
11886 while $test $# -ge 2; do
11887         case "$1" in
11888         $define) echo "#include <$2>";;
11889         esac ;
11890     shift 2;
11891 done > try.c;
11892 echo "int main () { struct $struct foo; }" >> try.c;
11893 set try;
11894 if eval $compile; then
11895         val="$define";
11896 else
11897         val="$undef";
11898 fi;
11899 set $varname;
11900 eval $setvar;
11901 $rm_try'
11902
11903 : see whether socket exists
11904 socketlib=''
11905 sockethdr=''
11906 echo " "
11907 $echo $n "Hmm... $c" >&4
11908 if set socket val -f d_socket; eval $csym; $val; then
11909     echo "Looks like you have Berkeley networking support." >&4
11910     d_socket="$define"
11911     if set setsockopt val -f; eval $csym; $val; then
11912         d_oldsock="$undef"
11913     else
11914         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11915         d_oldsock="$define"
11916     fi
11917 else
11918     if $contains socklib libc.list >/dev/null 2>&1; then
11919         echo "Looks like you have Berkeley networking support." >&4
11920         d_socket="$define"
11921         : we will have to assume that it supports the 4.2 BSD interface
11922         d_oldsock="$undef"
11923     else
11924         echo "You don't have Berkeley networking in libc$_a..." >&4
11925         if test "X$d_socket" = "X$define"; then
11926             echo "...but you seem to believe that you have sockets." >&4
11927         else
11928             for net in net socket
11929             do
11930                 if test -f $sysroot/usr/lib/lib$net$_a; then
11931                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11932                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11933                     if $contains socket libc.list >/dev/null 2>&1; then
11934                         d_socket="$define"
11935                         socketlib="-l$net"
11936                         case "$net" in
11937                         net)
11938                             echo "...but the Wollongong group seems to have hacked it in." >&4
11939                             sockethdr="-I$sysroot/usr/netinclude"
11940                             ;;
11941                         esac
11942                         echo "Found Berkeley sockets interface in lib$net." >&4
11943                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11944                             d_oldsock="$undef"
11945                         else
11946                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11947                             d_oldsock="$define"
11948                         fi
11949                         break
11950                     fi
11951                 fi
11952             done
11953             if test "X$d_socket" != "X$define"; then
11954                echo "or anywhere else I see." >&4
11955                d_socket="$undef"
11956                d_oldsock="$undef"
11957             fi
11958         fi
11959     fi
11960 fi
11961
11962 : see if socketpair exists
11963 set socketpair d_sockpair
11964 eval $inlibc
11965
11966
11967 echo " "
11968 echo "Checking the availability sa_len in the sock struct ..." >&4
11969 $cat >try.c <<EOF
11970 #include <sys/types.h>
11971 #include <sys/socket.h>
11972 int main() {
11973 struct sockaddr sa;
11974 return (sa.sa_len);
11975 }
11976 EOF
11977 val="$undef"
11978 set try; if eval $compile; then
11979     val="$define"
11980 fi
11981 set d_sockaddr_sa_len; eval $setvar
11982 $rm_try
11983
11984 echo " "
11985 echo "Checking the availability struct sockaddr_in6 ..." >&4
11986 $cat >try.c <<EOF
11987 #include <sys/types.h>
11988 #include <sys/socket.h>
11989 #include <netinet/in.h>
11990 int main() {
11991 struct sockaddr_in6 sin6;
11992 return (sin6.sin6_family);
11993 }
11994 EOF
11995 val="$undef"
11996 set try; if eval $compile; then
11997     val="$define"
11998 fi
11999 set d_sockaddr_in6; eval $setvar
12000 $rm_try
12001
12002 echo " "
12003 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12004 $cat >try.c <<EOF
12005 #include <sys/types.h>
12006 #include <sys/socket.h>
12007 #include <netinet/in.h>
12008 int main() {
12009 struct sockaddr_in6 sin6;
12010 return (sin6.sin6_scope_id);
12011 }
12012 EOF
12013 val="$undef"
12014 set try; if eval $compile; then
12015     val="$define"
12016 fi
12017 set d_sin6_scope_id; eval $setvar
12018 $rm_try
12019
12020 echo " "
12021 echo "Checking the availability struct ip_mreq ..." >&4
12022 $cat >try.c <<EOF
12023 #include <sys/types.h>
12024 #include <sys/socket.h>
12025 #include <netinet/in.h>
12026 int main() {
12027 struct ip_mreq mreq;
12028 return (mreq.imr_multiaddr.s_addr);
12029 }
12030 EOF
12031 val="$undef"
12032 set try; if eval $compile; then
12033        val="$define"
12034 fi
12035 set d_ip_mreq; eval $setvar
12036 $rm_try
12037
12038 echo " "
12039 echo "Checking the availability struct ip_mreq_source ..." >&4
12040 $cat >try.c <<EOF
12041 #include <sys/types.h>
12042 #include <sys/socket.h>
12043 #include <netinet/in.h>
12044 int main() {
12045 struct ip_mreq_source mreq;
12046 return (mreq.imr_multiaddr.s_addr);
12047 }
12048 EOF
12049 val="$undef"
12050 set try; if eval $compile; then
12051        val="$define"
12052 fi
12053 set d_ip_mreq_source; eval $setvar
12054 $rm_try
12055
12056 echo " "
12057 echo "Checking the availability struct ipv6_mreq ..." >&4
12058 $cat >try.c <<EOF
12059 #include <sys/types.h>
12060 #include <sys/socket.h>
12061 #include <netinet/in.h>
12062 int main() {
12063 struct ipv6_mreq mreq;
12064 return (mreq.ipv6mr_interface);
12065 }
12066 EOF
12067 val="$undef"
12068 set try; if eval $compile; then
12069     val="$define"
12070 fi
12071 set d_ipv6_mreq; eval $setvar
12072 $rm_try
12073
12074 echo " "
12075 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12076 $cat >try.c <<EOF
12077 #include <sys/types.h>
12078 #include <sys/socket.h>
12079 #include <netinet/in.h>
12080 int main() {
12081 struct ipv6_mreq_source mreq;
12082 return (mreq.imr_multiaddr.s_addr);
12083 }
12084 EOF
12085 val="$undef"
12086 set try; if eval $compile; then
12087        val="$define"
12088 fi
12089 set d_ipv6_mreq_source; eval $setvar
12090 $rm_try
12091
12092 echo " "
12093 echo "Checking the availability of certain socket constants..." >&4
12094 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12095     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12096     $cat >try.c <<EOF
12097 #include <sys/types.h>
12098 #include <sys/socket.h>
12099 int main() {
12100     int i = $ENUM;
12101 }
12102 EOF
12103     val="$undef"
12104     set try; if eval $compile; then
12105         val="$define"
12106     fi
12107     set d_${enum}; eval $setvar
12108     $rm_try
12109 done
12110
12111 : see if this is a sys/uio.h system
12112 set sys/uio.h i_sysuio
12113 eval $inhdr
12114
12115 : Check for cmsghdr support
12116 echo " "
12117 echo "Checking to see if your system supports struct cmsghdr..." >&4
12118 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12119 eval $hasstruct
12120 case "$d_cmsghdr_s" in
12121 "$define")      echo "Yes, it does."   ;;
12122 *)              echo "No, it doesn't." ;;
12123 esac
12124
12125
12126 : check for const keyword
12127 echo " "
12128 echo 'Checking to see if your C compiler knows about "const"...' >&4
12129 $cat >const.c <<'EOCP'
12130 typedef struct spug { int drokk; } spug;
12131 int main()
12132 {
12133         const char *foo;
12134         const spug y = { 0 };
12135 }
12136 EOCP
12137 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12138         val="$define"
12139         echo "Yup, it does."
12140 else
12141         val="$undef"
12142         echo "Nope, it doesn't."
12143 fi
12144 set d_const
12145 eval $setvar
12146
12147 : see if copysign exists
12148 set copysign d_copysign
12149 eval $inlibc
12150
12151 : see if copysignl exists
12152 set copysignl d_copysignl
12153 eval $inlibc
12154
12155 : see if crypt exists
12156 echo " "
12157 set crypt d_crypt
12158 eval $inlibc
12159 case "$d_crypt" in
12160 $define) cryptlib='' ;;
12161 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12162                 echo 'crypt() found.' >&4
12163                 val="$define"
12164                 cryptlib=''
12165         else
12166                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12167                 if $test -z "$cryptlib"; then
12168                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12169                 else
12170                         cryptlib=-lcrypt
12171                 fi
12172                 if $test -z "$cryptlib"; then
12173                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12174                 else
12175                         cryptlib=-lcrypt
12176                 fi
12177                 if $test -z "$cryptlib"; then
12178                         cryptlib=`./loc libcrypt$_a "" $libpth`
12179                 else
12180                         cryptlib=-lcrypt
12181                 fi
12182                 if $test -z "$cryptlib"; then
12183                         echo 'crypt() NOT found.' >&4
12184                         val="$undef"
12185                 else
12186                         val="$define"
12187                 fi
12188         fi
12189         set d_crypt
12190         eval $setvar
12191         ;;
12192 esac
12193
12194 : see if this is a crypt.h system
12195 set crypt.h i_crypt
12196 eval $inhdr
12197
12198 : see if crypt_r exists
12199 set crypt_r d_crypt_r
12200 eval $inlibc
12201 case "$d_crypt_r" in
12202 "$define")
12203         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12204         case "$d_crypt_r_proto:$usethreads" in
12205         ":define")      d_crypt_r_proto=define
12206                 set d_crypt_r_proto crypt_r $hdrs
12207                 eval $hasproto ;;
12208         *)      ;;
12209         esac
12210         case "$d_crypt_r_proto" in
12211         define)
12212         case "$crypt_r_proto" in
12213         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12214         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12215         esac
12216         case "$crypt_r_proto" in
12217         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12218         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12219         esac
12220         case "$crypt_r_proto" in
12221         ''|0)   d_crypt_r=undef
12222                 crypt_r_proto=0
12223                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12224         * )     case "$crypt_r_proto" in
12225                 REENTRANT_PROTO*) ;;
12226                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12227                 esac
12228                 echo "Prototype: $try" ;;
12229         esac
12230         ;;
12231         *)      case "$usethreads" in
12232                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12233                 esac
12234                 d_crypt_r=undef
12235                 crypt_r_proto=0
12236                 ;;
12237         esac
12238         ;;
12239 *)      crypt_r_proto=0
12240         ;;
12241 esac
12242
12243 : get csh whereabouts
12244 case "$csh" in
12245 'csh') val="$undef" ;;
12246 *) val="$define" ;;
12247 esac
12248 set d_csh
12249 eval $setvar
12250 : Respect a hint or command line value for full_csh.
12251 case "$full_csh" in
12252 '') full_csh=$csh ;;
12253 esac
12254
12255 : see if ctermid exists
12256 set ctermid d_ctermid
12257 eval $inlibc
12258
12259 : see if ctermid_r exists
12260 set ctermid_r d_ctermid_r
12261 eval $inlibc
12262 case "$d_ctermid_r" in
12263 "$define")
12264         hdrs="$i_systypes sys/types.h define stdio.h "
12265         case "$d_ctermid_r_proto:$usethreads" in
12266         ":define")      d_ctermid_r_proto=define
12267                 set d_ctermid_r_proto ctermid_r $hdrs
12268                 eval $hasproto ;;
12269         *)      ;;
12270         esac
12271         case "$d_ctermid_r_proto" in
12272         define)
12273         case "$ctermid_r_proto" in
12274         ''|0) try='char* ctermid_r(char*);'
12275         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12276         esac
12277         case "$ctermid_r_proto" in
12278         ''|0)   d_ctermid_r=undef
12279                 ctermid_r_proto=0
12280                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12281         * )     case "$ctermid_r_proto" in
12282                 REENTRANT_PROTO*) ;;
12283                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12284                 esac
12285                 echo "Prototype: $try" ;;
12286         esac
12287         ;;
12288         *)      case "$usethreads" in
12289                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12290                 esac
12291                 d_ctermid_r=undef
12292                 ctermid_r_proto=0
12293                 ;;
12294         esac
12295         ;;
12296 *)      ctermid_r_proto=0
12297         ;;
12298 esac
12299
12300 : see if ctime_r exists
12301 set ctime_r d_ctime_r
12302 eval $inlibc
12303 case "$d_ctime_r" in
12304 "$define")
12305         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12306         case "$d_ctime_r_proto:$usethreads" in
12307         ":define")      d_ctime_r_proto=define
12308                 set d_ctime_r_proto ctime_r $hdrs
12309                 eval $hasproto ;;
12310         *)      ;;
12311         esac
12312         case "$d_ctime_r_proto" in
12313         define)
12314         case "$ctime_r_proto" in
12315         ''|0) try='char* ctime_r(const time_t*, char*);'
12316         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12317         esac
12318         case "$ctime_r_proto" in
12319         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12320         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12321         esac
12322         case "$ctime_r_proto" in
12323         ''|0) try='int ctime_r(const time_t*, char*);'
12324         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12325         esac
12326         case "$ctime_r_proto" in
12327         ''|0) try='int ctime_r(const time_t*, char*, int);'
12328         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12329         esac
12330         case "$ctime_r_proto" in
12331         ''|0)   d_ctime_r=undef
12332                 ctime_r_proto=0
12333                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12334         * )     case "$ctime_r_proto" in
12335                 REENTRANT_PROTO*) ;;
12336                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12337                 esac
12338                 echo "Prototype: $try" ;;
12339         esac
12340         ;;
12341         *)      case "$usethreads" in
12342                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12343                 esac
12344                 d_ctime_r=undef
12345                 ctime_r_proto=0
12346                 ;;
12347         esac
12348         ;;
12349 *)      ctime_r_proto=0
12350         ;;
12351 esac
12352
12353 : see if cuserid exists
12354 set cuserid d_cuserid
12355 eval $inlibc
12356
12357 : see if this is a limits.h system
12358 set limits.h i_limits
12359 eval $inhdr
12360
12361 : See if number of significant digits in a double precision number is known
12362 echo " "
12363 $cat >dbl_dig.c <<EOM
12364 #$i_limits I_LIMITS
12365 #$i_float I_FLOAT
12366 #ifdef I_LIMITS
12367 #include <limits.h>
12368 #endif
12369 #ifdef I_FLOAT
12370 #include <float.h>
12371 #endif
12372 #ifdef DBL_DIG
12373 printf("Contains DBL_DIG");
12374 #endif
12375 EOM
12376 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12377 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12378         echo "DBL_DIG found." >&4
12379         val="$define"
12380 else
12381         echo "DBL_DIG NOT found." >&4
12382         val="$undef"
12383 fi
12384 $rm -f dbl_dig.?
12385 set d_dbl_dig
12386 eval $setvar
12387
12388 : see if dbm.h is available
12389 : see if dbmclose exists
12390 set dbmclose d_dbmclose
12391 eval $inlibc
12392
12393 case "$d_dbmclose" in
12394 $define)
12395         set dbm.h i_dbm
12396         eval $inhdr
12397         case "$i_dbm" in
12398         $define)
12399                 val="$undef"
12400                 set i_rpcsvcdbm
12401                 eval $setvar
12402                 ;;
12403         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12404                 eval $inhdr
12405                 ;;
12406         esac
12407         ;;
12408 *)      echo "We won't be including <dbm.h>"
12409         val="$undef"
12410         set i_dbm
12411         eval $setvar
12412         val="$undef"
12413         set i_rpcsvcdbm
12414         eval $setvar
12415         ;;
12416 esac
12417
12418 : see if prototype for dbminit is available
12419 echo " "
12420 set d_dbminitproto dbminit $i_dbm dbm.h
12421 eval $hasproto
12422
12423 : see if difftime exists
12424 set difftime d_difftime
12425 eval $inlibc
12426
12427 : see if this is a dirent system
12428 echo " "
12429 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12430         val="$define"
12431         echo "<dirent.h> found." >&4
12432 else
12433         val="$undef"
12434         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12435                 echo "<sys/dir.h> found." >&4
12436                 echo " "
12437         else
12438                 xinc=`./findhdr sys/ndir.h`
12439         fi
12440         echo "<dirent.h> NOT found." >&4
12441 fi
12442 set i_dirent
12443 eval $setvar
12444
12445 : Look for type of directory structure.
12446 echo " "
12447 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12448
12449 case "$direntrytype" in
12450 ''|' ')
12451         case "$i_dirent" in
12452         $define) guess1='struct dirent' ;;
12453         *) guess1='struct direct'  ;;
12454         esac
12455         ;;
12456 *)      guess1="$direntrytype"
12457         ;;
12458 esac
12459
12460 case "$guess1" in
12461 'struct dirent') guess2='struct direct' ;;
12462 *) guess2='struct dirent' ;;
12463 esac
12464
12465 if $contains "$guess1" try.c >/dev/null 2>&1; then
12466         direntrytype="$guess1"
12467         echo "Your directory entries are $direntrytype." >&4
12468 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12469         direntrytype="$guess2"
12470         echo "Your directory entries seem to be $direntrytype." >&4
12471 else
12472         echo "I don't recognize your system's directory entries." >&4
12473         rp="What type is used for directory entries on this system?"
12474         dflt="$guess1"
12475         . ./myread
12476         direntrytype="$ans"
12477 fi
12478 $rm_try
12479
12480 : see if the directory entry stores field length
12481 echo " "
12482 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12483 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12484         echo "Good, your directory entry keeps length information in d_namlen." >&4
12485         val="$define"
12486 else
12487         echo "Your directory entry does not know about the d_namlen field." >&4
12488         val="$undef"
12489 fi
12490 set d_dirnamlen
12491 eval $setvar
12492 $rm_try
12493
12494 : Look for DIR.dd_fd
12495 case "$i_dirent" in
12496 "$define")
12497     echo "Checking to see if DIR has a dd_fd member variable" >&4
12498     $cat >try.c <<EOCP
12499 #$i_stdlib I_STDLIB
12500 #ifdef I_STDLIB
12501 #include <stdlib.h>
12502 #endif
12503 #include <dirent.h>
12504
12505 int main() {
12506     DIR dir;
12507     dir.dd_fd = 1;
12508     return 0;
12509 }
12510 EOCP
12511     val=$undef
12512     set try
12513     if eval $compile; then
12514         echo "Yes, it does."
12515         val="$define"
12516     else
12517         echo "No, it does not."
12518         val="$undef"
12519     fi
12520     ;;
12521 *)
12522     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12523     val="$undef"
12524     ;;
12525 esac
12526 set d_dir_dd_fd
12527 eval $setvar
12528 $rm_try
12529
12530 : see if this is an sysdir system
12531 set sys/dir.h i_sysdir
12532 eval $inhdr
12533
12534 : see if this is an sysndir system
12535 set sys/ndir.h i_sysndir
12536 eval $inhdr
12537
12538 : Look for dirfd
12539 echo " "
12540 $cat >dirfd.c <<EOM
12541 #include <stdio.h>
12542 #$i_stdlib I_STDLIB
12543 #ifdef I_STDLIB
12544 #include <stdlib.h>
12545 #endif
12546 #$i_dirent I_DIRENT             /**/
12547 #$i_sysdir I_SYS_DIR            /**/
12548 #$i_sysndir I_SYS_NDIR          /**/
12549 #$i_systypes I_SYS_TYPES        /**/
12550 #if defined(I_SYS_TYPES)
12551 #include <sys/types.h>
12552 #endif
12553 #if defined(I_DIRENT)
12554 #include <dirent.h>
12555 #else
12556 #ifdef I_SYS_NDIR
12557 #include <sys/ndir.h>
12558 #else
12559 #ifdef I_SYS_DIR
12560 #ifdef hp9000s500
12561 #include <ndir.h>       /* may be wrong in the future */
12562 #else
12563 #include <sys/dir.h>
12564 #endif
12565 #endif
12566 #endif
12567 #endif
12568 int main() {
12569         DIR *dirp = opendir(".");
12570         if (dirfd(dirp) >= 0)
12571                 exit(0);
12572         else
12573                 exit(1);
12574 }
12575 EOM
12576 val=$undef
12577 set dirfd
12578 if eval $compile; then
12579         val="$define"
12580 fi
12581 case "$val" in
12582 $define)        echo "dirfd() found." >&4       ;;
12583 *)              echo "dirfd() NOT found." >&4   ;;
12584 esac
12585 set d_dirfd
12586 eval $setvar
12587 $rm -f dirfd*
12588
12589 : see if dladdr exists
12590 set dladdr d_dladdr
12591 eval $inlibc
12592
12593 : see if dlerror exists
12594 xxx_runnm="$runnm"
12595 runnm=false
12596 set dlerror d_dlerror
12597 eval $inlibc
12598 runnm="$xxx_runnm"
12599
12600 : see if dlfcn is available
12601 set dlfcn.h i_dlfcn
12602 eval $inhdr
12603
12604 : Check what extension to use for shared libs
12605 case "$usedl" in
12606 $define|y|true)
12607         $cat << EOM
12608
12609 On a few systems, the dynamically loaded modules that perl generates and uses
12610 will need a different extension than shared libs. The default will probably
12611 be appropriate.
12612
12613 EOM
12614         case "$dlext" in
12615         '')     dflt="$so" ;;
12616         *)      dflt="$dlext" ;;
12617         esac
12618         rp='What is the extension of dynamically loaded modules'
12619         . ./myread
12620         dlext="$ans"
12621         ;;
12622 *)
12623         dlext="none"
12624         ;;
12625 esac
12626
12627 : Check if dlsym need a leading underscore
12628 echo " "
12629 val="$undef"
12630
12631 case "$dlsrc" in
12632 dl_dlopen.xs)
12633         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12634         $cat >dyna.c <<'EOM'
12635 fred () { }
12636 EOM
12637
12638 $cat >fred.c<<EOM
12639
12640 #include <stdio.h>
12641 #$i_stdlib I_STDLIB
12642 #ifdef I_STDLIB
12643 #include <stdlib.h>
12644 #endif
12645 #$i_dlfcn I_DLFCN
12646 #ifdef I_DLFCN
12647 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12648 #else
12649 #include <sys/types.h>
12650 #include <nlist.h>
12651 #include <link.h>
12652 #endif
12653
12654 extern int fred() ;
12655
12656 int main()
12657 {
12658     void * handle ;
12659     void * symbol ;
12660 #ifndef RTLD_LAZY
12661     int mode = 1 ;
12662 #else
12663     int mode = RTLD_LAZY ;
12664 #endif
12665     handle = dlopen("./dyna.$dlext", mode) ;
12666     if (handle == NULL) {
12667         printf ("1\n") ;
12668         fflush (stdout) ;
12669         exit(0);
12670     }
12671     symbol = dlsym(handle, "fred") ;
12672     if (symbol == NULL) {
12673         /* try putting a leading underscore */
12674         symbol = dlsym(handle, "_fred") ;
12675         if (symbol == NULL) {
12676             printf ("2\n") ;
12677             fflush (stdout) ;
12678             exit(0);
12679         }
12680         printf ("3\n") ;
12681     }
12682     else
12683         printf ("4\n") ;
12684     fflush (stdout) ;
12685     exit(0);
12686 }
12687 EOM
12688         : Call the object file tmp-dyna.o in case dlext=o.
12689         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12690                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12691                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12692                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12693                 xxx=`$run ./fred`
12694                 case $xxx in
12695                 1)      echo "Test program failed using dlopen." >&4
12696                         echo "Perhaps you should not use dynamic loading." >&4;;
12697                 2)      echo "Test program failed using dlsym." >&4
12698                         echo "Perhaps you should not use dynamic loading." >&4;;
12699                 3)      echo "dlsym needs a leading underscore" >&4
12700                         val="$define" ;;
12701                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12702                 esac
12703         else
12704                 echo "I can't compile and run the test program." >&4
12705                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12706         fi
12707         ;;
12708 esac
12709
12710 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12711
12712 set d_dlsymun
12713 eval $setvar
12714
12715 : see if drand48_r exists
12716 set drand48_r d_drand48_r
12717 eval $inlibc
12718 case "$d_drand48_r" in
12719 "$define")
12720         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12721         case "$d_drand48_r_proto:$usethreads" in
12722         ":define")      d_drand48_r_proto=define
12723                 set d_drand48_r_proto drand48_r $hdrs
12724                 eval $hasproto ;;
12725         *)      ;;
12726         esac
12727         case "$d_drand48_r_proto" in
12728         define)
12729         case "$drand48_r_proto" in
12730         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12731         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12732         esac
12733         case "$drand48_r_proto" in
12734         ''|0)   d_drand48_r=undef
12735                 drand48_r_proto=0
12736                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12737         * )     case "$drand48_r_proto" in
12738                 REENTRANT_PROTO*) ;;
12739                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12740                 esac
12741                 echo "Prototype: $try" ;;
12742         esac
12743         ;;
12744         *)      case "$usethreads" in
12745                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12746                 esac
12747                 d_drand48_r=undef
12748                 drand48_r_proto=0
12749                 ;;
12750         esac
12751         ;;
12752 *)      drand48_r_proto=0
12753         ;;
12754 esac
12755
12756 : see if prototype for drand48 is available
12757 echo " "
12758 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12759 eval $hasproto
12760
12761 : see if dup2 exists
12762 set dup2 d_dup2
12763 eval $inlibc
12764
12765 : see if eaccess exists
12766 set eaccess d_eaccess
12767 eval $inlibc
12768
12769 : see if endgrent exists
12770 set endgrent d_endgrent
12771 eval $inlibc
12772
12773 : see if this is an grp system
12774 set grp.h i_grp
12775 eval $inhdr
12776
12777 case "$i_grp" in
12778 $define)
12779         xxx=`./findhdr grp.h`
12780         $cppstdin $cppflags $cppminus < $xxx >$$.h
12781
12782         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12783                 val="$define"
12784         else
12785                 val="$undef"
12786         fi
12787         set d_grpasswd
12788         eval $setvar
12789
12790         $rm -f $$.h
12791         ;;
12792 *)
12793         val="$undef";
12794         set d_grpasswd; eval $setvar
12795         ;;
12796 esac
12797
12798 : see if endgrent_r exists
12799 set endgrent_r d_endgrent_r
12800 eval $inlibc
12801 case "$d_endgrent_r" in
12802 "$define")
12803         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12804         case "$d_endgrent_r_proto:$usethreads" in
12805         ":define")      d_endgrent_r_proto=define
12806                 set d_endgrent_r_proto endgrent_r $hdrs
12807                 eval $hasproto ;;
12808         *)      ;;
12809         esac
12810         case "$d_endgrent_r_proto" in
12811         define)
12812         case "$endgrent_r_proto" in
12813         ''|0) try='int endgrent_r(FILE**);'
12814         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12815         esac
12816         case "$endgrent_r_proto" in
12817         ''|0) try='void endgrent_r(FILE**);'
12818         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12819         esac
12820         case "$endgrent_r_proto" in
12821         ''|0)   d_endgrent_r=undef
12822                 endgrent_r_proto=0
12823                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12824         * )     case "$endgrent_r_proto" in
12825                 REENTRANT_PROTO*) ;;
12826                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12827                 esac
12828                 echo "Prototype: $try" ;;
12829         esac
12830         ;;
12831         *)      case "$usethreads" in
12832                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12833                 esac
12834                 d_endgrent_r=undef
12835                 endgrent_r_proto=0
12836                 ;;
12837         esac
12838         ;;
12839 *)      endgrent_r_proto=0
12840         ;;
12841 esac
12842
12843 : see if endhostent exists
12844 set endhostent d_endhent
12845 eval $inlibc
12846
12847 : see if this is a netdb.h system
12848 set netdb.h i_netdb
12849 eval $inhdr
12850
12851 : see if endhostent_r exists
12852 set endhostent_r d_endhostent_r
12853 eval $inlibc
12854 case "$d_endhostent_r" in
12855 "$define")
12856         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12857         case "$d_endhostent_r_proto:$usethreads" in
12858         ":define")      d_endhostent_r_proto=define
12859                 set d_endhostent_r_proto endhostent_r $hdrs
12860                 eval $hasproto ;;
12861         *)      ;;
12862         esac
12863         case "$d_endhostent_r_proto" in
12864         define)
12865         case "$endhostent_r_proto" in
12866         ''|0) try='int endhostent_r(struct hostent_data*);'
12867         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12868         esac
12869         case "$endhostent_r_proto" in
12870         ''|0) try='void endhostent_r(struct hostent_data*);'
12871         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12872         esac
12873         case "$endhostent_r_proto" in
12874         ''|0)   d_endhostent_r=undef
12875                 endhostent_r_proto=0
12876                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12877         * )     case "$endhostent_r_proto" in
12878                 REENTRANT_PROTO*) ;;
12879                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12880                 esac
12881                 echo "Prototype: $try" ;;
12882         esac
12883         ;;
12884         *)      case "$usethreads" in
12885                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12886                 esac
12887                 d_endhostent_r=undef
12888                 endhostent_r_proto=0
12889                 ;;
12890         esac
12891         ;;
12892 *)      endhostent_r_proto=0
12893         ;;
12894 esac
12895
12896 : see if endnetent exists
12897 set endnetent d_endnent
12898 eval $inlibc
12899
12900 : see if endnetent_r exists
12901 set endnetent_r d_endnetent_r
12902 eval $inlibc
12903 case "$d_endnetent_r" in
12904 "$define")
12905         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12906         case "$d_endnetent_r_proto:$usethreads" in
12907         ":define")      d_endnetent_r_proto=define
12908                 set d_endnetent_r_proto endnetent_r $hdrs
12909                 eval $hasproto ;;
12910         *)      ;;
12911         esac
12912         case "$d_endnetent_r_proto" in
12913         define)
12914         case "$endnetent_r_proto" in
12915         ''|0) try='int endnetent_r(struct netent_data*);'
12916         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12917         esac
12918         case "$endnetent_r_proto" in
12919         ''|0) try='void endnetent_r(struct netent_data*);'
12920         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12921         esac
12922         case "$endnetent_r_proto" in
12923         ''|0)   d_endnetent_r=undef
12924                 endnetent_r_proto=0
12925                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12926         * )     case "$endnetent_r_proto" in
12927                 REENTRANT_PROTO*) ;;
12928                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12929                 esac
12930                 echo "Prototype: $try" ;;
12931         esac
12932         ;;
12933         *)      case "$usethreads" in
12934                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12935                 esac
12936                 d_endnetent_r=undef
12937                 endnetent_r_proto=0
12938                 ;;
12939         esac
12940         ;;
12941 *)      endnetent_r_proto=0
12942         ;;
12943 esac
12944
12945 : see if endprotoent exists
12946 set endprotoent d_endpent
12947 eval $inlibc
12948
12949 : see if endprotoent_r exists
12950 set endprotoent_r d_endprotoent_r
12951 eval $inlibc
12952 case "$d_endprotoent_r" in
12953 "$define")
12954         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12955         case "$d_endprotoent_r_proto:$usethreads" in
12956         ":define")      d_endprotoent_r_proto=define
12957                 set d_endprotoent_r_proto endprotoent_r $hdrs
12958                 eval $hasproto ;;
12959         *)      ;;
12960         esac
12961         case "$d_endprotoent_r_proto" in
12962         define)
12963         case "$endprotoent_r_proto" in
12964         ''|0) try='int endprotoent_r(struct protoent_data*);'
12965         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12966         esac
12967         case "$endprotoent_r_proto" in
12968         ''|0) try='void endprotoent_r(struct protoent_data*);'
12969         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12970         esac
12971         case "$endprotoent_r_proto" in
12972         ''|0)   d_endprotoent_r=undef
12973                 endprotoent_r_proto=0
12974                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12975         * )     case "$endprotoent_r_proto" in
12976                 REENTRANT_PROTO*) ;;
12977                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12978                 esac
12979                 echo "Prototype: $try" ;;
12980         esac
12981         ;;
12982         *)      case "$usethreads" in
12983                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12984                 esac
12985                 d_endprotoent_r=undef
12986                 endprotoent_r_proto=0
12987                 ;;
12988         esac
12989         ;;
12990 *)      endprotoent_r_proto=0
12991         ;;
12992 esac
12993
12994 : see if endpwent exists
12995 set endpwent d_endpwent
12996 eval $inlibc
12997
12998 : see if this is a pwd.h system
12999 set pwd.h i_pwd
13000 eval $inhdr
13001
13002 case "$i_pwd" in
13003 $define)
13004         xxx=`./findhdr pwd.h`
13005         $cppstdin $cppflags $cppminus < $xxx >$$.h
13006
13007         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13008                 val="$define"
13009         else
13010                 val="$undef"
13011         fi
13012         set d_pwquota
13013         eval $setvar
13014
13015         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13016                 val="$define"
13017         else
13018                 val="$undef"
13019         fi
13020         set d_pwage
13021         eval $setvar
13022
13023         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13024                 val="$define"
13025         else
13026                 val="$undef"
13027         fi
13028         set d_pwchange
13029         eval $setvar
13030
13031         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13032                 val="$define"
13033         else
13034                 val="$undef"
13035         fi
13036         set d_pwclass
13037         eval $setvar
13038
13039         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13040                 val="$define"
13041         else
13042                 val="$undef"
13043         fi
13044         set d_pwexpire
13045         eval $setvar
13046
13047         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13048                 val="$define"
13049         else
13050                 val="$undef"
13051         fi
13052         set d_pwcomment
13053         eval $setvar
13054
13055         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13056                 val="$define"
13057         else
13058                 val="$undef"
13059         fi
13060         set d_pwgecos
13061         eval $setvar
13062
13063         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13064                 val="$define"
13065         else
13066                 val="$undef"
13067         fi
13068         set d_pwpasswd
13069         eval $setvar
13070
13071         $rm -f $$.h
13072         ;;
13073 *)
13074         val="$undef";
13075         set d_pwquota; eval $setvar
13076         set d_pwage; eval $setvar
13077         set d_pwchange; eval $setvar
13078         set d_pwclass; eval $setvar
13079         set d_pwexpire; eval $setvar
13080         set d_pwcomment; eval $setvar
13081         set d_pwgecos; eval $setvar
13082         set d_pwpasswd; eval $setvar
13083         ;;
13084 esac
13085
13086 : see if endpwent_r exists
13087 set endpwent_r d_endpwent_r
13088 eval $inlibc
13089 case "$d_endpwent_r" in
13090 "$define")
13091         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13092         case "$d_endpwent_r_proto:$usethreads" in
13093         ":define")      d_endpwent_r_proto=define
13094                 set d_endpwent_r_proto endpwent_r $hdrs
13095                 eval $hasproto ;;
13096         *)      ;;
13097         esac
13098         case "$d_endpwent_r_proto" in
13099         define)
13100         case "$endpwent_r_proto" in
13101         ''|0) try='int endpwent_r(FILE**);'
13102         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13103         esac
13104         case "$endpwent_r_proto" in
13105         ''|0) try='void endpwent_r(FILE**);'
13106         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13107         esac
13108         case "$endpwent_r_proto" in
13109         ''|0)   d_endpwent_r=undef
13110                 endpwent_r_proto=0
13111                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13112         * )     case "$endpwent_r_proto" in
13113                 REENTRANT_PROTO*) ;;
13114                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13115                 esac
13116                 echo "Prototype: $try" ;;
13117         esac
13118         ;;
13119         *)      case "$usethreads" in
13120                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13121                 esac
13122                 d_endpwent_r=undef
13123                 endpwent_r_proto=0
13124                 ;;
13125         esac
13126         ;;
13127 *)      endpwent_r_proto=0
13128         ;;
13129 esac
13130
13131 : see if endservent exists
13132 set endservent d_endsent
13133 eval $inlibc
13134
13135 : see if endservent_r exists
13136 set endservent_r d_endservent_r
13137 eval $inlibc
13138 case "$d_endservent_r" in
13139 "$define")
13140         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13141         case "$d_endservent_r_proto:$usethreads" in
13142         ":define")      d_endservent_r_proto=define
13143                 set d_endservent_r_proto endservent_r $hdrs
13144                 eval $hasproto ;;
13145         *)      ;;
13146         esac
13147         case "$d_endservent_r_proto" in
13148         define)
13149         case "$endservent_r_proto" in
13150         ''|0) try='int endservent_r(struct servent_data*);'
13151         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13152         esac
13153         case "$endservent_r_proto" in
13154         ''|0) try='void endservent_r(struct servent_data*);'
13155         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13156         esac
13157         case "$endservent_r_proto" in
13158         ''|0)   d_endservent_r=undef
13159                 endservent_r_proto=0
13160                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13161         * )     case "$endservent_r_proto" in
13162                 REENTRANT_PROTO*) ;;
13163                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13164                 esac
13165                 echo "Prototype: $try" ;;
13166         esac
13167         ;;
13168         *)      case "$usethreads" in
13169                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13170                 esac
13171                 d_endservent_r=undef
13172                 endservent_r_proto=0
13173                 ;;
13174         esac
13175         ;;
13176 *)      endservent_r_proto=0
13177         ;;
13178 esac
13179
13180 : Locate the flags for 'open()'
13181 echo " "
13182 $cat >try.c <<EOCP
13183 #include <sys/types.h>
13184 #ifdef I_FCNTL
13185 #include <fcntl.h>
13186 #endif
13187 #ifdef I_SYS_FILE
13188 #include <sys/file.h>
13189 #endif
13190 #$i_stdlib I_STDLIB
13191 #ifdef I_STDLIB
13192 #include <stdlib.h>
13193 #endif
13194 int main() {
13195         if(O_RDONLY);
13196 #ifdef O_TRUNC
13197         exit(0);
13198 #else
13199         exit(1);
13200 #endif
13201 }
13202 EOCP
13203 : check sys/file.h first to get FREAD on Sun
13204 if $test `./findhdr sys/file.h` && \
13205                 set try -DI_SYS_FILE && eval $compile; then
13206         h_sysfile=true;
13207         echo "<sys/file.h> defines the O_* constants..." >&4
13208         if $run ./try; then
13209                 echo "and you have the 3 argument form of open()." >&4
13210                 val="$define"
13211         else
13212                 echo "but not the 3 argument form of open().  Oh, well." >&4
13213                 val="$undef"
13214         fi
13215 elif $test `./findhdr fcntl.h` && \
13216                 set try -DI_FCNTL && eval $compile; then
13217         h_fcntl=true;
13218         echo "<fcntl.h> defines the O_* constants..." >&4
13219         if $run ./try; then
13220                 echo "and you have the 3 argument form of open()." >&4
13221                 val="$define"
13222         else
13223                 echo "but not the 3 argument form of open().  Oh, well." >&4
13224                 val="$undef"
13225         fi
13226 else
13227         val="$undef"
13228         echo "I can't find the O_* constant definitions!  You got problems." >&4
13229 fi
13230 set d_open3
13231 eval $setvar
13232 $rm_try
13233
13234 : see if this is a sys/file.h system
13235 val=''
13236 set sys/file.h val
13237 eval $inhdr
13238
13239 : do we need to include sys/file.h ?
13240 case "$val" in
13241 "$define")
13242         echo " "
13243         if $h_sysfile; then
13244                 val="$define"
13245                 echo "We'll be including <sys/file.h>." >&4
13246         else
13247                 val="$undef"
13248                 echo "We won't be including <sys/file.h>." >&4
13249         fi
13250         ;;
13251 *)
13252         h_sysfile=false
13253         ;;
13254 esac
13255 set i_sysfile
13256 eval $setvar
13257
13258 : see if fcntl.h is there
13259 val=''
13260 set fcntl.h val
13261 eval $inhdr
13262
13263 : see if we can include fcntl.h
13264 case "$val" in
13265 "$define")
13266         echo " "
13267         if $h_fcntl; then
13268                 val="$define"
13269                 echo "We'll be including <fcntl.h>." >&4
13270         else
13271                 val="$undef"
13272                 if $h_sysfile; then
13273         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13274                 else
13275                         echo "We won't be including <fcntl.h>." >&4
13276                 fi
13277         fi
13278         ;;
13279 *)
13280         h_fcntl=false
13281         val="$undef"
13282         ;;
13283 esac
13284 set i_fcntl
13285 eval $setvar
13286
13287 : see if fork exists
13288 set fork d_fork
13289 eval $inlibc
13290
13291 : see if pipe exists
13292 set pipe d_pipe
13293 eval $inlibc
13294
13295 : check for non-blocking I/O stuff
13296 case "$h_sysfile" in
13297 true) echo "#include <sys/file.h>" > head.c;;
13298 *)
13299        case "$h_fcntl" in
13300        true) echo "#include <fcntl.h>" > head.c;;
13301        *) echo "#include <sys/fcntl.h>" > head.c;;
13302        esac
13303        ;;
13304 esac
13305 echo " "
13306 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13307 case "$o_nonblock" in
13308 '')
13309         $cat head.c > try.c
13310         $cat >>try.c <<EOCP
13311 #include <stdio.h>
13312 #$i_stdlib I_STDLIB
13313 #ifdef I_STDLIB
13314 #include <stdlib.h>
13315 #endif
13316 #$i_fcntl I_FCNTL
13317 #ifdef I_FCNTL
13318 #include <fcntl.h>
13319 #endif
13320 int main() {
13321 #ifdef O_NONBLOCK
13322         printf("O_NONBLOCK\n");
13323         exit(0);
13324 #endif
13325 #ifdef O_NDELAY
13326         printf("O_NDELAY\n");
13327         exit(0);
13328 #endif
13329 #ifdef FNDELAY
13330         printf("FNDELAY\n");
13331         exit(0);
13332 #endif
13333         exit(0);
13334 }
13335 EOCP
13336         set try
13337         if eval $compile_ok; then
13338                 o_nonblock=`$run ./try`
13339                 case "$o_nonblock" in
13340                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13341                 *) echo "Seems like we can use $o_nonblock.";;
13342                 esac
13343         else
13344                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13345         fi
13346         ;;
13347 *) echo "Using $hint value $o_nonblock.";;
13348 esac
13349 $rm_try
13350
13351 echo " "
13352 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13353 case "$eagain" in
13354 '')
13355         case "$d_fork:$d_pipe:$d_alarm" in
13356         define:define:define)
13357         $cat head.c > try.c
13358         $cat >>try.c <<EOCP
13359 #include <errno.h>
13360 #include <sys/types.h>
13361 #include <signal.h>
13362 #include <stdio.h>
13363 #$i_stdlib I_STDLIB
13364 #ifdef I_STDLIB
13365 #include <stdlib.h>
13366 #endif
13367 #$i_fcntl I_FCNTL
13368 #ifdef I_FCNTL
13369 #include <fcntl.h>
13370 #endif
13371 #define MY_O_NONBLOCK $o_nonblock
13372 #ifndef errno  /* XXX need better Configure test */
13373 extern int errno;
13374 #endif
13375 #$i_unistd I_UNISTD
13376 #ifdef I_UNISTD
13377 #include <unistd.h>
13378 #endif
13379 #$i_string I_STRING
13380 #ifdef I_STRING
13381 #include <string.h>
13382 #else
13383 #include <strings.h>
13384 #endif
13385 $signal_t blech(int x) { exit(3); }
13386 EOCP
13387         $cat >> try.c <<'EOCP'
13388 int main()
13389 {
13390         int pd[2];
13391         int pu[2];
13392         char buf[1];
13393         char string[100];
13394         int ret;
13395
13396         ret = pipe(pd); /* Down: child -> parent */
13397         if (ret != 0)
13398                 exit(3);
13399         ret = pipe(pu); /* Up: parent -> child */
13400         if (ret != 0)
13401                 exit(3);
13402         if (0 != fork()) {
13403                 close(pd[1]);   /* Parent reads from pd[0] */
13404                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13405 #ifdef F_SETFL
13406                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13407                         exit(1);
13408 #else
13409                 exit(4);
13410 #endif
13411                 signal(SIGALRM, blech);
13412                 alarm(5);
13413                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13414                         exit(2);
13415                 sprintf(string, "%d\n", ret);
13416                 ret = write(2, string, strlen(string));
13417                 if (ret != strlen(string))
13418                         exit(3);
13419                 alarm(0);
13420 #ifdef EAGAIN
13421                 if (errno == EAGAIN) {
13422                         printf("EAGAIN\n");
13423                         goto ok;
13424                 }
13425 #endif
13426 #ifdef EWOULDBLOCK
13427                 if (errno == EWOULDBLOCK)
13428                         printf("EWOULDBLOCK\n");
13429 #endif
13430         ok:
13431                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13432                 if (ret != 1)
13433                         exit(3);
13434                 sleep(2);                               /* Give it time to close our pipe */
13435                 alarm(5);
13436                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13437                 alarm(0);
13438                 sprintf(string, "%d\n", ret);
13439                 ret = write(4, string, strlen(string));
13440                 if (ret != strlen(string))
13441                         exit(3);
13442                 exit(0);
13443         }
13444
13445         close(pd[0]);                   /* We write to pd[1] */
13446         close(pu[1]);                   /* We read from pu[0] */
13447         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13448         if (ret != 1)
13449                 exit(3);
13450         close(pd[1]);                   /* Pipe pd is now fully closed! */
13451         exit(0);                                /* Bye bye, thank you for playing! */
13452 }
13453 EOCP
13454         set try
13455         if eval $compile_ok; then
13456                 echo "$startsh" >mtry
13457                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13458                 chmod +x mtry
13459                 $run ./mtry >/dev/null 2>&1
13460                 case $? in
13461                 0) eagain=`$cat try.out`;;
13462                 1) echo "Could not perform non-blocking setting!";;
13463                 2) echo "I did a successful read() for something that was not there!";;
13464                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13465                 4) echo "Could not find F_SETFL!";;
13466                 *) echo "Something terribly wrong happened during testing.";;
13467                 esac
13468                 rd_nodata=`$cat try.ret`
13469                 echo "A read() system call with no data present returns $rd_nodata."
13470                 case "$rd_nodata" in
13471                 0|-1) ;;
13472                 *)
13473                         echo "(That's peculiar, fixing that to be -1.)"
13474                         rd_nodata=-1
13475                         ;;
13476                 esac
13477                 case "$eagain" in
13478                 '')
13479                         echo "Forcing errno EAGAIN on read() with no data available."
13480                         eagain=EAGAIN
13481                         ;;
13482                 *)
13483                         echo "Your read() sets errno to $eagain when no data is available."
13484                         ;;
13485                 esac
13486                 status=`$cat try.err`
13487                 case "$status" in
13488                 0) echo "And it correctly returns 0 to signal EOF.";;
13489                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13490                 *) echo "However, your read() returns '$status' on EOF??";;
13491                 esac
13492                 val="$define"
13493                 if test "$status" = "$rd_nodata"; then
13494                         echo "WARNING: you can't distinguish between EOF and no data!"
13495                         val="$undef"
13496                 fi
13497         else
13498                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13499                 eagain=EAGAIN
13500         fi
13501         ;;
13502         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13503                 eagain=EAGAIN
13504                 val="$define"
13505                 ;;
13506         esac
13507         set d_eofnblk
13508         eval $setvar
13509         ;;
13510 *)
13511         echo "Using $hint value $eagain."
13512         echo "Your read() returns $rd_nodata when no data is present."
13513         case "$d_eofnblk" in
13514         "$define") echo "And you can see EOF because read() returns 0.";;
13515         "$undef") echo "But you can't see EOF status from read() returned value.";;
13516         *)
13517                 echo "(Assuming you can't see EOF status from read anyway.)"
13518                 d_eofnblk=$undef
13519                 ;;
13520         esac
13521         ;;
13522 esac
13523 $rm_try head.c mtry
13524
13525 : see if erf exists
13526 set erf d_erf
13527 eval $inlibc
13528
13529 : see if erfc exists
13530 set erfc d_erfc
13531 eval $inlibc
13532
13533 : see if exp2 exists
13534 set exp2 d_exp2
13535 eval $inlibc
13536
13537 : see if expm1 exists
13538 set expm1 d_expm1
13539 eval $inlibc
13540
13541 : see if _ptr and _cnt from stdio act std
13542 echo " "
13543
13544 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13545         echo "(Looks like you have stdio.h from BSD.)"
13546         case "$stdio_ptr" in
13547         '') stdio_ptr='((fp)->_p)'
13548                 ptr_lval=$define
13549                 ;;
13550         *)      ptr_lval=$d_stdio_ptr_lval;;
13551         esac
13552         case "$stdio_cnt" in
13553         '') stdio_cnt='((fp)->_r)'
13554                 cnt_lval=$define
13555                 ;;
13556         *)      cnt_lval=$d_stdio_cnt_lval;;
13557         esac
13558         case "$stdio_base" in
13559         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13560         esac
13561         case "$stdio_bufsiz" in
13562         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13563         esac
13564 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13565         echo "(Looks like you have stdio.h from Linux.)"
13566         case "$stdio_ptr" in
13567         '') stdio_ptr='((fp)->_IO_read_ptr)'
13568                 ptr_lval=$define
13569                 ;;
13570         *)      ptr_lval=$d_stdio_ptr_lval;;
13571         esac
13572         case "$stdio_cnt" in
13573         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13574                 cnt_lval=$undef
13575                 ;;
13576         *)      cnt_lval=$d_stdio_cnt_lval;;
13577         esac
13578         case "$stdio_base" in
13579         '') stdio_base='((fp)->_IO_read_base)';;
13580         esac
13581         case "$stdio_bufsiz" in
13582         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13583         esac
13584 else
13585         case "$stdio_ptr" in
13586         '') stdio_ptr='((fp)->_ptr)'
13587                 ptr_lval=$define
13588                 ;;
13589         *)      ptr_lval=$d_stdio_ptr_lval;;
13590         esac
13591         case "$stdio_cnt" in
13592         '') stdio_cnt='((fp)->_cnt)'
13593                 cnt_lval=$define
13594                 ;;
13595         *)      cnt_lval=$d_stdio_cnt_lval;;
13596         esac
13597         case "$stdio_base" in
13598         '') stdio_base='((fp)->_base)';;
13599         esac
13600         case "$stdio_bufsiz" in
13601         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13602         esac
13603 fi
13604
13605 : test whether _ptr and _cnt really work
13606 echo "Checking how std your stdio is..." >&4
13607 $cat >try.c <<EOP
13608 #include <stdio.h>
13609 #$i_stdlib I_STDLIB
13610 #ifdef I_STDLIB
13611 #include <stdlib.h>
13612 #endif
13613 #define FILE_ptr(fp)    $stdio_ptr
13614 #define FILE_cnt(fp)    $stdio_cnt
13615 int main() {
13616         FILE *fp = fopen("try.c", "r");
13617         char c = getc(fp);
13618         if (
13619                 18 <= FILE_cnt(fp) &&
13620                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13621         )
13622                 exit(0);
13623         exit(1);
13624 }
13625 EOP
13626 val="$undef"
13627 set try
13628 if eval $compile && $to try.c; then
13629         if $run ./try; then
13630                 echo "Your stdio acts pretty std."
13631                 val="$define"
13632         else
13633                 echo "Your stdio isn't very std."
13634         fi
13635 else
13636         echo "Your stdio doesn't appear very std."
13637 fi
13638 $rm_try
13639
13640 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13641 # direct buffer manipulation no longer works.  The Configure tests
13642 # should be changed to correctly detect this, but until then,
13643 # the following check should at least let perl compile and run.
13644 # (This quick fix should be updated before 5.8.1.)
13645 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13646 # A. Dougherty, June 3, 2002.
13647 case "$d_gnulibc" in
13648 $define)
13649         case "$gnulibc_version" in
13650         2.[01]*)  ;;
13651         2.2) ;;
13652         2.2.[0-9]) ;;
13653         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13654                 val="$undef"
13655                 ;;
13656         esac
13657         ;;
13658 esac
13659 set d_stdstdio
13660 eval $setvar
13661
13662 : Can _ptr be used as an lvalue?
13663 case "$d_stdstdio$ptr_lval" in
13664 $define$define) val=$define ;;
13665 *) val=$undef ;;
13666 esac
13667 set d_stdio_ptr_lval
13668 eval $setvar
13669
13670 : Can _cnt be used as an lvalue?
13671 case "$d_stdstdio$cnt_lval" in
13672 $define$define) val=$define ;;
13673 *) val=$undef ;;
13674 esac
13675 set d_stdio_cnt_lval
13676 eval $setvar
13677
13678
13679 : test whether setting _ptr sets _cnt as a side effect
13680 d_stdio_ptr_lval_sets_cnt="$undef"
13681 d_stdio_ptr_lval_nochange_cnt="$undef"
13682 case "$d_stdio_ptr_lval$d_stdstdio" in
13683 $define$define)
13684         echo "Checking to see what happens if we set the stdio ptr..." >&4
13685 $cat >try.c <<EOP
13686 #include <stdio.h>
13687 /* Can we scream? */
13688 /* Eat dust sed :-) */
13689 /* In the buffer space, no one can hear you scream. */
13690 #$i_stdlib I_STDLIB
13691 #ifdef I_STDLIB
13692 #include <stdlib.h>
13693 #endif
13694 #define FILE_ptr(fp)    $stdio_ptr
13695 #define FILE_cnt(fp)    $stdio_cnt
13696 #include <sys/types.h>
13697 int main() {
13698         FILE *fp = fopen("try.c", "r");
13699         int c;
13700         char *ptr;
13701         size_t cnt;
13702         if (!fp) {
13703             puts("Fail even to read");
13704             exit(1);
13705         }
13706         c = getc(fp); /* Read away the first # */
13707         if (c == EOF) {
13708             puts("Fail even to read");
13709             exit(1);
13710         }
13711         if (!(
13712                 18 <= FILE_cnt(fp) &&
13713                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13714         )) {
13715                 puts("Fail even to read");
13716                 exit (1);
13717         }
13718         ptr = (char*) FILE_ptr(fp);
13719         cnt = (size_t)FILE_cnt(fp);
13720
13721         FILE_ptr(fp) += 42;
13722
13723         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13724                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13725                 exit (1);
13726         }
13727         if (FILE_cnt(fp) <= 20) {
13728                 printf ("Fail (<20 chars to test)");
13729                 exit (1);
13730         }
13731         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13732                 puts("Fail compare");
13733                 exit (1);
13734         }
13735         if (cnt == FILE_cnt(fp)) {
13736                 puts("Pass_unchanged");
13737                 exit (0);
13738         }
13739         if (FILE_cnt(fp) == (cnt - 42)) {
13740                 puts("Pass_changed");
13741                 exit (0);
13742         }
13743         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13744         return 1;
13745
13746 }
13747 EOP
13748         set try
13749         if eval $compile && $to try.c; then
13750                 case `$run ./try` in
13751                 Pass_changed)
13752                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13753                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13754                 Pass_unchanged)
13755                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13756                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13757                 Fail*)
13758                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13759                 *)
13760                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13761         esac
13762         else
13763                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13764         fi
13765         $rm_try
13766         ;;
13767 esac
13768
13769 : see if _base is also standard
13770 val="$undef"
13771 case "$d_stdstdio" in
13772 $define)
13773         $cat >try.c <<EOP
13774 #include <stdio.h>
13775 #$i_stdlib I_STDLIB
13776 #ifdef I_STDLIB
13777 #include <stdlib.h>
13778 #endif
13779 #define FILE_base(fp)   $stdio_base
13780 #define FILE_bufsiz(fp) $stdio_bufsiz
13781 int main() {
13782         FILE *fp = fopen("try.c", "r");
13783         char c = getc(fp);
13784         if (
13785                 19 <= FILE_bufsiz(fp) &&
13786                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13787         )
13788                 exit(0);
13789         exit(1);
13790 }
13791 EOP
13792         set try
13793         if eval $compile && $to try.c; then
13794                 if $run ./try; then
13795                         echo "And its _base field acts std."
13796                         val="$define"
13797                 else
13798                         echo "But its _base field isn't std."
13799                 fi
13800         else
13801                 echo "However, it seems to be lacking the _base field."
13802         fi
13803         $rm_try
13804         ;;
13805 esac
13806 set d_stdiobase
13807 eval $setvar
13808
13809 : see if fast_stdio exists
13810 val="$undef"
13811 case "$d_stdstdio:$d_stdio_ptr_lval" in
13812 "$define:$define")
13813         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13814         *$define*)
13815                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13816                 val="$define"
13817                 ;;
13818         esac
13819         ;;
13820 esac
13821 set d_faststdio
13822 eval $setvar
13823
13824
13825
13826 : see if fchdir exists
13827 set fchdir d_fchdir
13828 eval $inlibc
13829
13830 : see if fchmod exists
13831 set fchmod d_fchmod
13832 eval $inlibc
13833
13834 : see if fchown exists
13835 set fchown d_fchown
13836 eval $inlibc
13837
13838 : see if this is an fcntl system
13839 set fcntl d_fcntl
13840 eval $inlibc
13841
13842 : See if fcntl-based locking works.
13843 echo " "
13844 $cat >try.c <<EOCP
13845 #$i_stdlib I_STDLIB
13846 #ifdef I_STDLIB
13847 #include <stdlib.h>
13848 #endif
13849 #include <unistd.h>
13850 #include <fcntl.h>
13851 #include <signal.h>
13852 $signal_t blech(int x) { exit(3); }
13853 int main() {
13854 #if defined(F_SETLK) && defined(F_SETLKW)
13855      struct flock flock;
13856      int retval, fd;
13857      fd = open("try.c", O_RDONLY);
13858      flock.l_type = F_RDLCK;
13859      flock.l_whence = SEEK_SET;
13860      flock.l_start = flock.l_len = 0;
13861      signal(SIGALRM, blech);
13862      alarm(10);
13863      retval = fcntl(fd, F_SETLK, &flock);
13864      close(fd);
13865      (retval < 0 ? exit(2) : exit(0));
13866 #else
13867      exit(2);
13868 #endif
13869 }
13870 EOCP
13871 echo "Checking if fcntl-based file locking works... "
13872 case "$d_fcntl" in
13873 "$define")
13874         set try
13875         if eval $compile_ok; then
13876                 if $run ./try; then
13877                         echo "Yes, it seems to work."
13878                         val="$define"
13879                 else
13880                         echo "Nope, it didn't work."
13881                         val="$undef"
13882                         case "$?" in
13883                         3) $cat >&4 <<EOM
13884 ***
13885 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13886 *** This is (almost) impossible.
13887 *** If your NFS lock daemons are not feeling well, something like
13888 *** this may happen, please investigate.  Cannot continue, aborting.
13889 ***
13890 EOM
13891                                 exit 1
13892                                 ;;
13893                         esac
13894                 fi
13895         else
13896                 echo "I'm unable to compile the test program, so I'll assume not."
13897                 val="$undef"
13898         fi
13899         ;;
13900 *) val="$undef";
13901         echo "Nope, since you don't even have fcntl()."
13902         ;;
13903 esac
13904 set d_fcntl_can_lock
13905 eval $setvar
13906 $rm_try
13907
13908 : check for fd_set items
13909 $cat <<EOM
13910
13911 Checking to see how well your C compiler handles fd_set and friends ...
13912 EOM
13913 $cat >try.c <<EOCP
13914 #$i_stdlib I_STDLIB
13915 #ifdef I_STDLIB
13916 #include <stdlib.h>
13917 #endif
13918 #$i_systime I_SYS_TIME
13919 #$i_sysselct I_SYS_SELECT
13920 #$d_socket HAS_SOCKET
13921 #include <sys/types.h>
13922 #ifdef HAS_SOCKET
13923 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13924 #endif
13925 #ifdef I_SYS_TIME
13926 #include <sys/time.h>
13927 #endif
13928 #ifdef I_SYS_SELECT
13929 #include <sys/select.h>
13930 #endif
13931 int main() {
13932         fd_set fds;
13933
13934 #ifdef TRYBITS
13935         if(fds.fds_bits);
13936 #endif
13937
13938 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13939         exit(0);
13940 #else
13941         exit(1);
13942 #endif
13943 }
13944 EOCP
13945 set try -DTRYBITS
13946 if eval $compile; then
13947         d_fds_bits="$define"
13948         d_fd_set="$define"
13949         echo "Well, your system knows about the normal fd_set typedef..." >&4
13950         if $run ./try; then
13951                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13952                 d_fd_macros="$define"
13953         else
13954                 $cat >&4 <<'EOM'
13955 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13956 EOM
13957                 d_fd_macros="$undef"
13958         fi
13959 else
13960         $cat <<'EOM'
13961 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13962 EOM
13963         set try
13964         if eval $compile; then
13965                 d_fds_bits="$undef"
13966                 d_fd_set="$define"
13967                 echo "Well, your system has some sort of fd_set available..." >&4
13968                 if $run ./try; then
13969                         echo "and you have the normal fd_set macros." >&4
13970                         d_fd_macros="$define"
13971                 else
13972                         $cat <<'EOM'
13973 but not the normal fd_set macros!  Gross!  More work for me...
13974 EOM
13975                         d_fd_macros="$undef"
13976                 fi
13977         else
13978         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13979                 d_fd_set="$undef"
13980                 d_fds_bits="$undef"
13981                 d_fd_macros="$undef"
13982         fi
13983 fi
13984 $rm_try
13985
13986 : see if fdim exists
13987 set fdim d_fdim
13988 eval $inlibc
13989
13990 : see if fegetround exists
13991 set fegetround d_fegetround
13992 eval $inlibc
13993
13994 : see if fgetpos exists
13995 set fgetpos d_fgetpos
13996 eval $inlibc
13997
13998 : see if finite exists
13999 set finite d_finite
14000 eval $inlibc
14001
14002 : see if finitel exists
14003 set finitel d_finitel
14004 eval $inlibc
14005
14006 : see if flock exists
14007 set flock d_flock
14008 eval $inlibc
14009
14010 : see if prototype for flock is available
14011 echo " "
14012 set d_flockproto flock $i_sysfile sys/file.h
14013 eval $hasproto
14014
14015 : see if fma exists
14016 set fma d_fma
14017 eval $inlibc
14018
14019 : see if fmax exists
14020 set fmax d_fmax
14021 eval $inlibc
14022
14023 : see if fmin exists
14024 set fmin d_fmin
14025 eval $inlibc
14026
14027 : see if fp_class exists
14028 set fp_class d_fp_class
14029 eval $inlibc
14030
14031 : see if this is a math.h system
14032 set math.h i_math
14033 eval $inhdr
14034
14035 : check for fpclassify
14036 echo "Checking to see if you have fpclassify..." >&4
14037 $cat >try.c <<EOCP
14038 #$i_math I_MATH
14039 #ifdef I_MATH
14040 #include <math.h>
14041 #endif
14042 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14043 EOCP
14044 set try
14045 if eval $compile; then
14046         val="$define"
14047         echo "You have fpclassify."
14048 else
14049         val="$undef"
14050         echo "You do not have fpclassify."
14051 fi
14052 $rm_try
14053 set d_fpclassify
14054 eval $setvar
14055
14056 : see if fp_classify exists
14057 set fp_classify d_fp_classify
14058 eval $inlibc
14059
14060 : see if fp_classl exists
14061 set fp_classl d_fp_classl
14062 eval $inlibc
14063
14064 : see if pathconf exists
14065 set pathconf d_pathconf
14066 eval $inlibc
14067
14068 : see if fpathconf exists
14069 set fpathconf d_fpathconf
14070 eval $inlibc
14071
14072 : see if fpclass exists
14073 set fpclass d_fpclass
14074 eval $inlibc
14075
14076 : see if fpclassl exists
14077 set fpclassl d_fpclassl
14078 eval $inlibc
14079
14080 : see if fpgetround exists
14081 set fpgetround d_fpgetround
14082 eval $inlibc
14083
14084 : check for fpos64_t
14085 echo " "
14086 echo "Checking to see if you have fpos64_t..." >&4
14087 $cat >try.c <<EOCP
14088 #include <stdio.h>
14089 int main() { fpos64_t x = 7; }
14090 EOCP
14091 set try
14092 if eval $compile; then
14093         val="$define"
14094         echo "You have fpos64_t."
14095 else
14096         val="$undef"
14097         echo "You do not have fpos64_t."
14098         case "$fpossize" in
14099         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14100         esac
14101 fi
14102 $rm_try
14103 set d_fpos64_t
14104 eval $setvar
14105
14106 : see if frexpl exists
14107 set frexpl d_frexpl
14108 eval $inlibc
14109
14110 : see if this is a sys/param system
14111 set sys/param.h i_sysparam
14112 eval $inhdr
14113
14114 : see if this is a sys/mount.h system
14115 set sys/mount.h i_sysmount
14116 eval $inhdr
14117
14118 : Check for fs_data_s
14119 echo " "
14120 echo "Checking to see if your system supports struct fs_data..." >&4
14121 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14122 eval $hasstruct
14123 case "$d_fs_data_s" in
14124 "$define")      echo "Yes, it does."   ;;
14125 *)              echo "No, it doesn't." ;;
14126 esac
14127
14128 : see if fseeko exists
14129 set fseeko d_fseeko
14130 eval $inlibc
14131 case "$longsize" in
14132 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14133 esac
14134
14135 : see if fsetpos exists
14136 set fsetpos d_fsetpos
14137 eval $inlibc
14138
14139 : see if fstatfs exists
14140 set fstatfs d_fstatfs
14141 eval $inlibc
14142
14143 : see if statvfs exists
14144 set statvfs d_statvfs
14145 eval $inlibc
14146
14147 : see if fstatvfs exists
14148 set fstatvfs d_fstatvfs
14149 eval $inlibc
14150
14151
14152 : see if fsync exists
14153 set fsync d_fsync
14154 eval $inlibc
14155
14156 : see if ftello exists
14157 set ftello d_ftello
14158 eval $inlibc
14159 case "$longsize" in
14160 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14161 esac
14162
14163 : check for a working futimes
14164 d_futimes="$undef"
14165 echo " "
14166 echo "Checking if you have a working futimes()" >&4
14167 $cat >try.c <<EOCP
14168 #include <stdio.h>
14169 #include <sys/time.h>
14170 #include <errno.h>
14171 #include <fcntl.h>
14172
14173 int main ()
14174 {
14175     int fd, rv;
14176     fd = open ("try.c", O_RDWR);
14177     if (-1 == fd) exit (1);
14178     rv = futimes (fd, NULL);
14179     exit (rv == -1 ? errno : 0);
14180 }
14181 EOCP
14182 set try
14183 if eval $compile; then
14184     `$run ./try`
14185     rc=$?
14186     case "$rc" in
14187         0)  echo "Yes, you have" >&4
14188             d_futimes="$define"
14189             ;;
14190         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14191             ;;
14192     esac
14193 else
14194     echo "No, it does not (probably harmless)" >&4
14195 fi
14196 $rm_try
14197
14198 : see if ndbm.h is available
14199 set ndbm.h i_ndbm
14200 eval $inhdr
14201 : Compatibility location for RedHat 7.1
14202 set gdbm/ndbm.h i_gdbmndbm
14203 eval $inhdr
14204 : Compatibility location for Debian 4.0
14205 set gdbm-ndbm.h i_gdbm_ndbm
14206 eval $inhdr
14207
14208 val="$undef"
14209 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14210         : see if dbm_open exists
14211         set dbm_open d_dbm_open
14212         eval $inlibc
14213         case "$d_dbm_open" in
14214         $undef)
14215                 i_ndbm="$undef"
14216                 i_gdbmndbm="$undef"
14217                 i_gdbm_ndbm="$undef"
14218                 echo "We won't be including <ndbm.h>"
14219                 val="$undef"
14220                 ;;
14221         *) val="$define"
14222            ;;
14223         esac
14224 fi
14225 set d_ndbm
14226 eval $setvar
14227
14228 ndbm_hdr_protochk='name=$1; hdr=$2;
14229 eval "ihdr=\$""i_$name";
14230 val="$undef";
14231 if $test "$ihdr" = "$define"; then
14232         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14233         case "$d_cplusplus" in
14234         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14235         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14236         esac;
14237         case "$val" in
14238         $define) $echo "Your <$hdr> seems to have prototypes";;
14239         *) $echo "Your <$hdr> does not seem to have prototypes";;
14240         esac;
14241 fi;
14242 set "d_${name}_h_uses_prototypes";
14243 eval $setvar'
14244
14245 set ndbm ndbm.h
14246 eval $ndbm_hdr_protochk
14247 set gdbmndbm gdbm/ndbm.h
14248 eval $ndbm_hdr_protochk
14249 set gdbm_ndbm gdbm-ndbm.h
14250 eval $ndbm_hdr_protochk
14251
14252 : see if getaddrinfo exists
14253 set getaddrinfo d_getaddrinfo
14254 eval $inlibc
14255
14256 : see if getcwd exists
14257 set getcwd d_getcwd
14258 eval $inlibc
14259
14260 : see if getespwnam exists
14261 set getespwnam d_getespwnam
14262 eval $inlibc
14263
14264 : see if getfsstat exists
14265 set getfsstat d_getfsstat
14266 eval $inlibc
14267
14268 : see if getgrent exists
14269 set getgrent d_getgrent
14270 eval $inlibc
14271
14272 : see if getgrent_r exists
14273 set getgrent_r d_getgrent_r
14274 eval $inlibc
14275 case "$d_getgrent_r" in
14276 "$define")
14277         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14278         case "$d_getgrent_r_proto:$usethreads" in
14279         ":define")      d_getgrent_r_proto=define
14280                 set d_getgrent_r_proto getgrent_r $hdrs
14281                 eval $hasproto ;;
14282         *)      ;;
14283         esac
14284         case "$d_getgrent_r_proto" in
14285         define)
14286         case "$getgrent_r_proto" in
14287         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14288         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14289         esac
14290         case "$getgrent_r_proto" in
14291         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14292         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14293         esac
14294         case "$getgrent_r_proto" in
14295         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14296         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14297         esac
14298         case "$getgrent_r_proto" in
14299         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14300         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14301         esac
14302         case "$getgrent_r_proto" in
14303         ''|0) try='int getgrent_r(struct group*, char*, int);'
14304         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14305         esac
14306         case "$getgrent_r_proto" in
14307         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14308         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14309         esac
14310         case "$getgrent_r_proto" in
14311         ''|0)   d_getgrent_r=undef
14312                 getgrent_r_proto=0
14313                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14314         * )     case "$getgrent_r_proto" in
14315                 REENTRANT_PROTO*) ;;
14316                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14317                 esac
14318                 echo "Prototype: $try" ;;
14319         esac
14320         ;;
14321         *)      case "$usethreads" in
14322                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14323                 esac
14324                 d_getgrent_r=undef
14325                 getgrent_r_proto=0
14326                 ;;
14327         esac
14328         ;;
14329 *)      getgrent_r_proto=0
14330         ;;
14331 esac
14332
14333 : see if getgrgid_r exists
14334 set getgrgid_r d_getgrgid_r
14335 eval $inlibc
14336 case "$d_getgrgid_r" in
14337 "$define")
14338         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14339         case "$d_getgrgid_r_proto:$usethreads" in
14340         ":define")      d_getgrgid_r_proto=define
14341                 set d_getgrgid_r_proto getgrgid_r $hdrs
14342                 eval $hasproto ;;
14343         *)      ;;
14344         esac
14345         case "$d_getgrgid_r_proto" in
14346         define)
14347         case "$getgrgid_r_proto" in
14348         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14349         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14350         esac
14351         case "$getgrgid_r_proto" in
14352         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14353         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14354         esac
14355         case "$getgrgid_r_proto" in
14356         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14357         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14358         esac
14359         case "$getgrgid_r_proto" in
14360         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14361         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14362         esac
14363         case "$getgrgid_r_proto" in
14364         ''|0)   d_getgrgid_r=undef
14365                 getgrgid_r_proto=0
14366                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14367         * )     case "$getgrgid_r_proto" in
14368                 REENTRANT_PROTO*) ;;
14369                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14370                 esac
14371                 echo "Prototype: $try" ;;
14372         esac
14373         ;;
14374         *)      case "$usethreads" in
14375                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14376                 esac
14377                 d_getgrgid_r=undef
14378                 getgrgid_r_proto=0
14379                 ;;
14380         esac
14381         ;;
14382 *)      getgrgid_r_proto=0
14383         ;;
14384 esac
14385
14386 : see if getgrnam_r exists
14387 set getgrnam_r d_getgrnam_r
14388 eval $inlibc
14389 case "$d_getgrnam_r" in
14390 "$define")
14391         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14392         case "$d_getgrnam_r_proto:$usethreads" in
14393         ":define")      d_getgrnam_r_proto=define
14394                 set d_getgrnam_r_proto getgrnam_r $hdrs
14395                 eval $hasproto ;;
14396         *)      ;;
14397         esac
14398         case "$d_getgrnam_r_proto" in
14399         define)
14400         case "$getgrnam_r_proto" in
14401         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14402         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14403         esac
14404         case "$getgrnam_r_proto" in
14405         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14406         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14407         esac
14408         case "$getgrnam_r_proto" in
14409         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14410         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14411         esac
14412         case "$getgrnam_r_proto" in
14413         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14414         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14415         esac
14416         case "$getgrnam_r_proto" in
14417         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14418         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14419         esac
14420         case "$getgrnam_r_proto" in
14421         ''|0)   d_getgrnam_r=undef
14422                 getgrnam_r_proto=0
14423                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14424         * )     case "$getgrnam_r_proto" in
14425                 REENTRANT_PROTO*) ;;
14426                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14427                 esac
14428                 echo "Prototype: $try" ;;
14429         esac
14430         ;;
14431         *)      case "$usethreads" in
14432                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14433                 esac
14434                 d_getgrnam_r=undef
14435                 getgrnam_r_proto=0
14436                 ;;
14437         esac
14438         ;;
14439 *)      getgrnam_r_proto=0
14440         ;;
14441 esac
14442
14443 : see if gethostbyaddr exists
14444 set gethostbyaddr d_gethbyaddr
14445 eval $inlibc
14446
14447 : see if gethostbyname exists
14448 set gethostbyname d_gethbyname
14449 eval $inlibc
14450
14451 : see if gethostent exists
14452 set gethostent d_gethent
14453 eval $inlibc
14454
14455 : see how we will look up host name
14456 echo " "
14457 call=''
14458 if set gethostname val -f d_gethname; eval $csym; $val; then
14459         echo 'gethostname() found.' >&4
14460         d_gethname="$define"
14461         call=gethostname
14462 fi
14463 if set uname val -f d_uname; eval $csym; $val; then
14464         if ./xenix; then
14465                 $cat <<'EOM'
14466 uname() was found, but you're running xenix, and older versions of xenix
14467 have a broken uname(). If you don't really know whether your xenix is old
14468 enough to have a broken system call, use the default answer.
14469
14470 EOM
14471                 dflt=y
14472                 case "$d_uname" in
14473                 "$define") dflt=n;;
14474                 esac
14475                 rp='Is your uname() broken?'
14476                 . ./myread
14477                 case "$ans" in
14478                 n*) d_uname="$define"; call=uname;;
14479                 esac
14480         else
14481                 echo 'uname() found.' >&4
14482                 d_uname="$define"
14483                 case "$call" in
14484                 '') call=uname ;;
14485                 esac
14486         fi
14487 fi
14488 case "$d_gethname" in
14489 '') d_gethname="$undef";;
14490 esac
14491 case "$d_uname" in
14492 '') d_uname="$undef";;
14493 esac
14494 case "$d_uname$d_gethname" in
14495 *define*)
14496         dflt=n
14497         cat <<EOM
14498
14499 Every now and then someone has a $call() that lies about the hostname
14500 but can't be fixed for political or economic reasons.  If you wish, I can
14501 pretend $call() isn't there and maybe compute hostname at run-time
14502 thanks to the '$phostname' command.
14503
14504 EOM
14505         rp="Shall I ignore $call() from now on?"
14506         . ./myread
14507         case "$ans" in
14508         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14509         esac;;
14510 esac
14511 case "$phostname" in
14512 '') aphostname='';;
14513 *) case "$aphostname" in
14514         /*) ;;
14515         *) set X $phostname
14516                 shift
14517                 file=$1
14518                 shift
14519                 file=`./loc $file $file $pth`
14520                 aphostname=`echo $file $*`
14521                 ;;
14522         esac
14523         ;;
14524 esac
14525 case "$d_uname$d_gethname" in
14526 *define*) ;;
14527 *)
14528         case "$phostname" in
14529         '')
14530                 echo "There will be no way for $package to get your hostname." >&4;;
14531         *)
14532         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14533                 ;;
14534         esac;;
14535 esac
14536 case "$d_phostname" in
14537 '') d_phostname="$undef";;
14538 esac
14539
14540 : see if gethostbyaddr_r exists
14541 set gethostbyaddr_r d_gethostbyaddr_r
14542 eval $inlibc
14543 case "$d_gethostbyaddr_r" in
14544 "$define")
14545         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14546         case "$d_gethostbyaddr_r_proto:$usethreads" in
14547         ":define")      d_gethostbyaddr_r_proto=define
14548                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14549                 eval $hasproto ;;
14550         *)      ;;
14551         esac
14552         case "$d_gethostbyaddr_r_proto" in
14553         define)
14554         case "$gethostbyaddr_r_proto" in
14555         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14556         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14557         esac
14558         case "$gethostbyaddr_r_proto" in
14559         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14560         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14561         esac
14562         case "$gethostbyaddr_r_proto" in
14563         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14564         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14565         esac
14566         case "$gethostbyaddr_r_proto" in
14567         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14568         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14569         esac
14570         case "$gethostbyaddr_r_proto" in
14571         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14572         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14573         esac
14574         case "$gethostbyaddr_r_proto" in
14575         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14576         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14577         esac
14578         case "$gethostbyaddr_r_proto" in
14579         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14580         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14581         esac
14582         case "$gethostbyaddr_r_proto" in
14583         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14584         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14585         esac
14586         case "$gethostbyaddr_r_proto" in
14587         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14588         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14589         esac
14590         case "$gethostbyaddr_r_proto" in
14591         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14592         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14593         esac
14594         case "$gethostbyaddr_r_proto" in
14595         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14596         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14597         esac
14598         case "$gethostbyaddr_r_proto" in
14599         ''|0)   d_gethostbyaddr_r=undef
14600                 gethostbyaddr_r_proto=0
14601                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14602         * )     case "$gethostbyaddr_r_proto" in
14603                 REENTRANT_PROTO*) ;;
14604                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14605                 esac
14606                 echo "Prototype: $try" ;;
14607         esac
14608         ;;
14609         *)      case "$usethreads" in
14610                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14611                 esac
14612                 d_gethostbyaddr_r=undef
14613                 gethostbyaddr_r_proto=0
14614                 ;;
14615         esac
14616         ;;
14617 *)      gethostbyaddr_r_proto=0
14618         ;;
14619 esac
14620
14621 : see if gethostbyname_r exists
14622 set gethostbyname_r d_gethostbyname_r
14623 eval $inlibc
14624 case "$d_gethostbyname_r" in
14625 "$define")
14626         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14627         case "$d_gethostbyname_r_proto:$usethreads" in
14628         ":define")      d_gethostbyname_r_proto=define
14629                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14630                 eval $hasproto ;;
14631         *)      ;;
14632         esac
14633         case "$d_gethostbyname_r_proto" in
14634         define)
14635         case "$gethostbyname_r_proto" in
14636         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14637         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14638         esac
14639         case "$gethostbyname_r_proto" in
14640         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14641         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14642         esac
14643         case "$gethostbyname_r_proto" in
14644         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14645         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14646         esac
14647         case "$gethostbyname_r_proto" in
14648         ''|0)   d_gethostbyname_r=undef
14649                 gethostbyname_r_proto=0
14650                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14651         * )     case "$gethostbyname_r_proto" in
14652                 REENTRANT_PROTO*) ;;
14653                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14654                 esac
14655                 echo "Prototype: $try" ;;
14656         esac
14657         ;;
14658         *)      case "$usethreads" in
14659                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14660                 esac
14661                 d_gethostbyname_r=undef
14662                 gethostbyname_r_proto=0
14663                 ;;
14664         esac
14665         ;;
14666 *)      gethostbyname_r_proto=0
14667         ;;
14668 esac
14669
14670 : see if gethostent_r exists
14671 set gethostent_r d_gethostent_r
14672 eval $inlibc
14673 case "$d_gethostent_r" in
14674 "$define")
14675         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14676         case "$d_gethostent_r_proto:$usethreads" in
14677         ":define")      d_gethostent_r_proto=define
14678                 set d_gethostent_r_proto gethostent_r $hdrs
14679                 eval $hasproto ;;
14680         *)      ;;
14681         esac
14682         case "$d_gethostent_r_proto" in
14683         define)
14684         case "$gethostent_r_proto" in
14685         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14686         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14687         esac
14688         case "$gethostent_r_proto" in
14689         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14690         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14691         esac
14692         case "$gethostent_r_proto" in
14693         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14694         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14695         esac
14696         case "$gethostent_r_proto" in
14697         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14698         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14699         esac
14700         case "$gethostent_r_proto" in
14701         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14702         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14703         esac
14704         case "$gethostent_r_proto" in
14705         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14706         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14707         esac
14708         case "$gethostent_r_proto" in
14709         ''|0)   d_gethostent_r=undef
14710                 gethostent_r_proto=0
14711                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14712         * )     case "$gethostent_r_proto" in
14713                 REENTRANT_PROTO*) ;;
14714                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14715                 esac
14716                 echo "Prototype: $try" ;;
14717         esac
14718         ;;
14719         *)      case "$usethreads" in
14720                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14721                 esac
14722                 d_gethostent_r=undef
14723                 gethostent_r_proto=0
14724                 ;;
14725         esac
14726         ;;
14727 *)      gethostent_r_proto=0
14728         ;;
14729 esac
14730
14731 : see if prototypes for various gethostxxx netdb.h functions are available
14732 echo " "
14733 set d_gethostprotos gethostent $i_netdb netdb.h
14734 eval $hasproto
14735
14736 : see if getitimer exists
14737 set getitimer d_getitimer
14738 eval $inlibc
14739
14740 : see if getlogin exists
14741 set getlogin d_getlogin
14742 eval $inlibc
14743
14744 : see if getlogin_r exists
14745 set getlogin_r d_getlogin_r
14746 eval $inlibc
14747 case "$d_getlogin_r" in
14748 "$define")
14749         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14750         case "$d_getlogin_r_proto:$usethreads" in
14751         ":define")      d_getlogin_r_proto=define
14752                 set d_getlogin_r_proto getlogin_r $hdrs
14753                 eval $hasproto ;;
14754         *)      ;;
14755         esac
14756         case "$d_getlogin_r_proto" in
14757         define)
14758         case "$getlogin_r_proto" in
14759         ''|0) try='int getlogin_r(char*, size_t);'
14760         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14761         esac
14762         case "$getlogin_r_proto" in
14763         ''|0) try='int getlogin_r(char*, int);'
14764         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14765         esac
14766         case "$getlogin_r_proto" in
14767         ''|0) try='char* getlogin_r(char*, size_t);'
14768         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14769         esac
14770         case "$getlogin_r_proto" in
14771         ''|0) try='char* getlogin_r(char*, int);'
14772         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14773         esac
14774         case "$getlogin_r_proto" in
14775         ''|0)   d_getlogin_r=undef
14776                 getlogin_r_proto=0
14777                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14778         * )     case "$getlogin_r_proto" in
14779                 REENTRANT_PROTO*) ;;
14780                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14781                 esac
14782                 echo "Prototype: $try" ;;
14783         esac
14784         ;;
14785         *)      case "$usethreads" in
14786                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14787                 esac
14788                 d_getlogin_r=undef
14789                 getlogin_r_proto=0
14790                 ;;
14791         esac
14792         ;;
14793 *)      getlogin_r_proto=0
14794         ;;
14795 esac
14796
14797 : see if getmnt exists
14798 set getmnt d_getmnt
14799 eval $inlibc
14800
14801 : see if getmntent exists
14802 set getmntent d_getmntent
14803 eval $inlibc
14804
14805 : see if getnameinfo exists
14806 set getnameinfo d_getnameinfo
14807 eval $inlibc
14808
14809 : see if getnetbyaddr exists
14810 set getnetbyaddr d_getnbyaddr
14811 eval $inlibc
14812
14813 : see if getnetbyname exists
14814 set getnetbyname d_getnbyname
14815 eval $inlibc
14816
14817 : see if getnetent exists
14818 set getnetent d_getnent
14819 eval $inlibc
14820
14821 : see if getnetbyaddr_r exists
14822 set getnetbyaddr_r d_getnetbyaddr_r
14823 eval $inlibc
14824 case "$d_getnetbyaddr_r" in
14825 "$define")
14826         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14827         case "$d_getnetbyaddr_r_proto:$usethreads" in
14828         ":define")      d_getnetbyaddr_r_proto=define
14829                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14830                 eval $hasproto ;;
14831         *)      ;;
14832         esac
14833         case "$d_getnetbyaddr_r_proto" in
14834         define)
14835         case "$getnetbyaddr_r_proto" in
14836         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14837         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14838         esac
14839         case "$getnetbyaddr_r_proto" in
14840         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14841         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14842         esac
14843         case "$getnetbyaddr_r_proto" in
14844         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14845         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14846         esac
14847         case "$getnetbyaddr_r_proto" in
14848         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14849         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14850         esac
14851         case "$getnetbyaddr_r_proto" in
14852         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14853         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14854         esac
14855         case "$getnetbyaddr_r_proto" in
14856         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14857         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14858         esac
14859         case "$getnetbyaddr_r_proto" in
14860         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14861         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14862         esac
14863         case "$getnetbyaddr_r_proto" in
14864         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14865         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14866         esac
14867         case "$getnetbyaddr_r_proto" in
14868         ''|0)   d_getnetbyaddr_r=undef
14869                 getnetbyaddr_r_proto=0
14870                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14871         * )     case "$getnetbyaddr_r_proto" in
14872                 REENTRANT_PROTO*) ;;
14873                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14874                 esac
14875                 echo "Prototype: $try" ;;
14876         esac
14877         ;;
14878         *)      case "$usethreads" in
14879                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14880                 esac
14881                 d_getnetbyaddr_r=undef
14882                 getnetbyaddr_r_proto=0
14883                 ;;
14884         esac
14885         ;;
14886 *)      getnetbyaddr_r_proto=0
14887         ;;
14888 esac
14889
14890 : see if getnetbyname_r exists
14891 set getnetbyname_r d_getnetbyname_r
14892 eval $inlibc
14893 case "$d_getnetbyname_r" in
14894 "$define")
14895         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14896         case "$d_getnetbyname_r_proto:$usethreads" in
14897         ":define")      d_getnetbyname_r_proto=define
14898                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14899                 eval $hasproto ;;
14900         *)      ;;
14901         esac
14902         case "$d_getnetbyname_r_proto" in
14903         define)
14904         case "$getnetbyname_r_proto" in
14905         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14906         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14907         esac
14908         case "$getnetbyname_r_proto" in
14909         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14910         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14911         esac
14912         case "$getnetbyname_r_proto" in
14913         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14914         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14915         esac
14916         case "$getnetbyname_r_proto" in
14917         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14918         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14919         esac
14920         case "$getnetbyname_r_proto" in
14921         ''|0)   d_getnetbyname_r=undef
14922                 getnetbyname_r_proto=0
14923                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14924         * )     case "$getnetbyname_r_proto" in
14925                 REENTRANT_PROTO*) ;;
14926                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14927                 esac
14928                 echo "Prototype: $try" ;;
14929         esac
14930         ;;
14931         *)      case "$usethreads" in
14932                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14933                 esac
14934                 d_getnetbyname_r=undef
14935                 getnetbyname_r_proto=0
14936                 ;;
14937         esac
14938         ;;
14939 *)      getnetbyname_r_proto=0
14940         ;;
14941 esac
14942
14943 : see if getnetent_r exists
14944 set getnetent_r d_getnetent_r
14945 eval $inlibc
14946 case "$d_getnetent_r" in
14947 "$define")
14948         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14949         case "$d_getnetent_r_proto:$usethreads" in
14950         ":define")      d_getnetent_r_proto=define
14951                 set d_getnetent_r_proto getnetent_r $hdrs
14952                 eval $hasproto ;;
14953         *)      ;;
14954         esac
14955         case "$d_getnetent_r_proto" in
14956         define)
14957         case "$getnetent_r_proto" in
14958         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14959         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14960         esac
14961         case "$getnetent_r_proto" in
14962         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14963         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14964         esac
14965         case "$getnetent_r_proto" in
14966         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14967         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14968         esac
14969         case "$getnetent_r_proto" in
14970         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14971         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14972         esac
14973         case "$getnetent_r_proto" in
14974         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14975         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14976         esac
14977         case "$getnetent_r_proto" in
14978         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14979         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14980         esac
14981         case "$getnetent_r_proto" in
14982         ''|0)   d_getnetent_r=undef
14983                 getnetent_r_proto=0
14984                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14985         * )     case "$getnetent_r_proto" in
14986                 REENTRANT_PROTO*) ;;
14987                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14988                 esac
14989                 echo "Prototype: $try" ;;
14990         esac
14991         ;;
14992         *)      case "$usethreads" in
14993                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14994                 esac
14995                 d_getnetent_r=undef
14996                 getnetent_r_proto=0
14997                 ;;
14998         esac
14999         ;;
15000 *)      getnetent_r_proto=0
15001         ;;
15002 esac
15003
15004 : see if prototypes for various getnetxxx netdb.h functions are available
15005 echo " "
15006 set d_getnetprotos getnetent $i_netdb netdb.h
15007 eval $hasproto
15008
15009 : see if getpagesize exists
15010 set getpagesize d_getpagsz
15011 eval $inlibc
15012
15013 : Optional checks for getprotobyname and getprotobynumber
15014
15015 : see if getprotobyname exists
15016 set getprotobyname d_getpbyname
15017 eval $inlibc
15018
15019 : see if getprotobynumber exists
15020 set getprotobynumber d_getpbynumber
15021 eval $inlibc
15022
15023 : see if getprotoent exists
15024 set getprotoent d_getpent
15025 eval $inlibc
15026
15027 : see if getpgid exists
15028 set getpgid d_getpgid
15029 eval $inlibc
15030
15031 : see if getpgrp2 exists
15032 set getpgrp2 d_getpgrp2
15033 eval $inlibc
15034
15035 : see if getppid exists
15036 set getppid d_getppid
15037 eval $inlibc
15038
15039 : see if getpriority exists
15040 set getpriority d_getprior
15041 eval $inlibc
15042
15043 : see if getprotobyname_r exists
15044 set getprotobyname_r d_getprotobyname_r
15045 eval $inlibc
15046 case "$d_getprotobyname_r" in
15047 "$define")
15048         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15049         case "$d_getprotobyname_r_proto:$usethreads" in
15050         ":define")      d_getprotobyname_r_proto=define
15051                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15052                 eval $hasproto ;;
15053         *)      ;;
15054         esac
15055         case "$d_getprotobyname_r_proto" in
15056         define)
15057         case "$getprotobyname_r_proto" in
15058         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15059         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15060         esac
15061         case "$getprotobyname_r_proto" in
15062         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15063         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15064         esac
15065         case "$getprotobyname_r_proto" in
15066         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15067         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15068         esac
15069         case "$getprotobyname_r_proto" in
15070         ''|0)   d_getprotobyname_r=undef
15071                 getprotobyname_r_proto=0
15072                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15073         * )     case "$getprotobyname_r_proto" in
15074                 REENTRANT_PROTO*) ;;
15075                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15076                 esac
15077                 echo "Prototype: $try" ;;
15078         esac
15079         ;;
15080         *)      case "$usethreads" in
15081                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15082                 esac
15083                 d_getprotobyname_r=undef
15084                 getprotobyname_r_proto=0
15085                 ;;
15086         esac
15087         ;;
15088 *)      getprotobyname_r_proto=0
15089         ;;
15090 esac
15091
15092 : see if getprotobynumber_r exists
15093 set getprotobynumber_r d_getprotobynumber_r
15094 eval $inlibc
15095 case "$d_getprotobynumber_r" in
15096 "$define")
15097         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15098         case "$d_getprotobynumber_r_proto:$usethreads" in
15099         ":define")      d_getprotobynumber_r_proto=define
15100                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15101                 eval $hasproto ;;
15102         *)      ;;
15103         esac
15104         case "$d_getprotobynumber_r_proto" in
15105         define)
15106         case "$getprotobynumber_r_proto" in
15107         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15108         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15109         esac
15110         case "$getprotobynumber_r_proto" in
15111         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15112         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15113         esac
15114         case "$getprotobynumber_r_proto" in
15115         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15116         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15117         esac
15118         case "$getprotobynumber_r_proto" in
15119         ''|0)   d_getprotobynumber_r=undef
15120                 getprotobynumber_r_proto=0
15121                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15122         * )     case "$getprotobynumber_r_proto" in
15123                 REENTRANT_PROTO*) ;;
15124                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15125                 esac
15126                 echo "Prototype: $try" ;;
15127         esac
15128         ;;
15129         *)      case "$usethreads" in
15130                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15131                 esac
15132                 d_getprotobynumber_r=undef
15133                 getprotobynumber_r_proto=0
15134                 ;;
15135         esac
15136         ;;
15137 *)      getprotobynumber_r_proto=0
15138         ;;
15139 esac
15140
15141 : see if getprotoent_r exists
15142 set getprotoent_r d_getprotoent_r
15143 eval $inlibc
15144 case "$d_getprotoent_r" in
15145 "$define")
15146         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15147         case "$d_getprotoent_r_proto:$usethreads" in
15148         ":define")      d_getprotoent_r_proto=define
15149                 set d_getprotoent_r_proto getprotoent_r $hdrs
15150                 eval $hasproto ;;
15151         *)      ;;
15152         esac
15153         case "$d_getprotoent_r_proto" in
15154         define)
15155         case "$getprotoent_r_proto" in
15156         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15157         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15158         esac
15159         case "$getprotoent_r_proto" in
15160         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15161         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15162         esac
15163         case "$getprotoent_r_proto" in
15164         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15165         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15166         esac
15167         case "$getprotoent_r_proto" in
15168         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15169         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15170         esac
15171         case "$getprotoent_r_proto" in
15172         ''|0)   d_getprotoent_r=undef
15173                 getprotoent_r_proto=0
15174                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15175         * )     case "$getprotoent_r_proto" in
15176                 REENTRANT_PROTO*) ;;
15177                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15178                 esac
15179                 echo "Prototype: $try" ;;
15180         esac
15181         ;;
15182         *)      case "$usethreads" in
15183                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15184                 esac
15185                 d_getprotoent_r=undef
15186                 getprotoent_r_proto=0
15187                 ;;
15188         esac
15189         ;;
15190 *)      getprotoent_r_proto=0
15191         ;;
15192 esac
15193
15194 : see if prototypes for various getprotoxxx netdb.h functions are available
15195 echo " "
15196 set d_getprotoprotos getprotoent $i_netdb netdb.h
15197 eval $hasproto
15198
15199 : see if getprpwnam exists
15200 set getprpwnam d_getprpwnam
15201 eval $inlibc
15202
15203 : see if getpwent exists
15204 set getpwent d_getpwent
15205 eval $inlibc
15206
15207 : see if getpwent_r exists
15208 set getpwent_r d_getpwent_r
15209 eval $inlibc
15210 case "$d_getpwent_r" in
15211 "$define")
15212         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15213         case "$d_getpwent_r_proto:$usethreads" in
15214         ":define")      d_getpwent_r_proto=define
15215                 set d_getpwent_r_proto getpwent_r $hdrs
15216                 eval $hasproto ;;
15217         *)      ;;
15218         esac
15219         case "$d_getpwent_r_proto" in
15220         define)
15221         case "$getpwent_r_proto" in
15222         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15223         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15224         esac
15225         case "$getpwent_r_proto" in
15226         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15227         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15228         esac
15229         case "$getpwent_r_proto" in
15230         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15231         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15232         esac
15233         case "$getpwent_r_proto" in
15234         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15235         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15236         esac
15237         case "$getpwent_r_proto" in
15238         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15239         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15240         esac
15241         case "$getpwent_r_proto" in
15242         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15243         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15244         esac
15245         case "$getpwent_r_proto" in
15246         ''|0)   d_getpwent_r=undef
15247                 getpwent_r_proto=0
15248                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15249         * )     case "$getpwent_r_proto" in
15250                 REENTRANT_PROTO*) ;;
15251                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15252                 esac
15253                 echo "Prototype: $try" ;;
15254         esac
15255         ;;
15256         *)      case "$usethreads" in
15257                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15258                 esac
15259                 d_getpwent_r=undef
15260                 getpwent_r_proto=0
15261                 ;;
15262         esac
15263         ;;
15264 *)      getpwent_r_proto=0
15265         ;;
15266 esac
15267
15268 : see if getpwnam_r exists
15269 set getpwnam_r d_getpwnam_r
15270 eval $inlibc
15271 case "$d_getpwnam_r" in
15272 "$define")
15273         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15274         case "$d_getpwnam_r_proto:$usethreads" in
15275         ":define")      d_getpwnam_r_proto=define
15276                 set d_getpwnam_r_proto getpwnam_r $hdrs
15277                 eval $hasproto ;;
15278         *)      ;;
15279         esac
15280         case "$d_getpwnam_r_proto" in
15281         define)
15282         case "$getpwnam_r_proto" in
15283         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15284         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15285         esac
15286         case "$getpwnam_r_proto" in
15287         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15288         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15289         esac
15290         case "$getpwnam_r_proto" in
15291         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15292         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15293         esac
15294         case "$getpwnam_r_proto" in
15295         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15296         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15297         esac
15298         case "$getpwnam_r_proto" in
15299         ''|0)   d_getpwnam_r=undef
15300                 getpwnam_r_proto=0
15301                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15302         * )     case "$getpwnam_r_proto" in
15303                 REENTRANT_PROTO*) ;;
15304                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15305                 esac
15306                 echo "Prototype: $try" ;;
15307         esac
15308         ;;
15309         *)      case "$usethreads" in
15310                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15311                 esac
15312                 d_getpwnam_r=undef
15313                 getpwnam_r_proto=0
15314                 ;;
15315         esac
15316         ;;
15317 *)      getpwnam_r_proto=0
15318         ;;
15319 esac
15320
15321 : see if getpwuid_r exists
15322 set getpwuid_r d_getpwuid_r
15323 eval $inlibc
15324 case "$d_getpwuid_r" in
15325 "$define")
15326         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15327         case "$d_getpwuid_r_proto:$usethreads" in
15328         ":define")      d_getpwuid_r_proto=define
15329                 set d_getpwuid_r_proto getpwuid_r $hdrs
15330                 eval $hasproto ;;
15331         *)      ;;
15332         esac
15333         case "$d_getpwuid_r_proto" in
15334         define)
15335         case "$getpwuid_r_proto" in
15336         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15337         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15338         esac
15339         case "$getpwuid_r_proto" in
15340         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15341         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15342         esac
15343         case "$getpwuid_r_proto" in
15344         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15345         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15346         esac
15347         case "$getpwuid_r_proto" in
15348         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15349         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15350         esac
15351         case "$getpwuid_r_proto" in
15352         ''|0)   d_getpwuid_r=undef
15353                 getpwuid_r_proto=0
15354                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15355         * )     case "$getpwuid_r_proto" in
15356                 REENTRANT_PROTO*) ;;
15357                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15358                 esac
15359                 echo "Prototype: $try" ;;
15360         esac
15361         ;;
15362         *)      case "$usethreads" in
15363                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15364                 esac
15365                 d_getpwuid_r=undef
15366                 getpwuid_r_proto=0
15367                 ;;
15368         esac
15369         ;;
15370 *)      getpwuid_r_proto=0
15371         ;;
15372 esac
15373
15374 : Optional checks for getsbyname and getsbyport
15375
15376 : see if getservbyname exists
15377 set getservbyname d_getsbyname
15378 eval $inlibc
15379
15380 : see if getservbyport exists
15381 set getservbyport d_getsbyport
15382 eval $inlibc
15383
15384 : see if getservent exists
15385 set getservent d_getsent
15386 eval $inlibc
15387
15388 : see if getservbyname_r exists
15389 set getservbyname_r d_getservbyname_r
15390 eval $inlibc
15391 case "$d_getservbyname_r" in
15392 "$define")
15393         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15394         case "$d_getservbyname_r_proto:$usethreads" in
15395         ":define")      d_getservbyname_r_proto=define
15396                 set d_getservbyname_r_proto getservbyname_r $hdrs
15397                 eval $hasproto ;;
15398         *)      ;;
15399         esac
15400         case "$d_getservbyname_r_proto" in
15401         define)
15402         case "$getservbyname_r_proto" in
15403         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15404         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15405         esac
15406         case "$getservbyname_r_proto" in
15407         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15408         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15409         esac
15410         case "$getservbyname_r_proto" in
15411         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15412         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15413         esac
15414         case "$getservbyname_r_proto" in
15415         ''|0)   d_getservbyname_r=undef
15416                 getservbyname_r_proto=0
15417                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15418         * )     case "$getservbyname_r_proto" in
15419                 REENTRANT_PROTO*) ;;
15420                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15421                 esac
15422                 echo "Prototype: $try" ;;
15423         esac
15424         ;;
15425         *)      case "$usethreads" in
15426                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15427                 esac
15428                 d_getservbyname_r=undef
15429                 getservbyname_r_proto=0
15430                 ;;
15431         esac
15432         ;;
15433 *)      getservbyname_r_proto=0
15434         ;;
15435 esac
15436
15437 : see if getservbyport_r exists
15438 set getservbyport_r d_getservbyport_r
15439 eval $inlibc
15440 case "$d_getservbyport_r" in
15441 "$define")
15442         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15443         case "$d_getservbyport_r_proto:$usethreads" in
15444         ":define")      d_getservbyport_r_proto=define
15445                 set d_getservbyport_r_proto getservbyport_r $hdrs
15446                 eval $hasproto ;;
15447         *)      ;;
15448         esac
15449         case "$d_getservbyport_r_proto" in
15450         define)
15451         case "$getservbyport_r_proto" in
15452         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15453         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15454         esac
15455         case "$getservbyport_r_proto" in
15456         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15457         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15458         esac
15459         case "$getservbyport_r_proto" in
15460         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15461         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15462         esac
15463         case "$getservbyport_r_proto" in
15464         ''|0)   d_getservbyport_r=undef
15465                 getservbyport_r_proto=0
15466                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15467         * )     case "$getservbyport_r_proto" in
15468                 REENTRANT_PROTO*) ;;
15469                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15470                 esac
15471                 echo "Prototype: $try" ;;
15472         esac
15473         ;;
15474         *)      case "$usethreads" in
15475                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15476                 esac
15477                 d_getservbyport_r=undef
15478                 getservbyport_r_proto=0
15479                 ;;
15480         esac
15481         ;;
15482 *)      getservbyport_r_proto=0
15483         ;;
15484 esac
15485
15486 : see if getservent_r exists
15487 set getservent_r d_getservent_r
15488 eval $inlibc
15489 case "$d_getservent_r" in
15490 "$define")
15491         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15492         case "$d_getservent_r_proto:$usethreads" in
15493         ":define")      d_getservent_r_proto=define
15494                 set d_getservent_r_proto getservent_r $hdrs
15495                 eval $hasproto ;;
15496         *)      ;;
15497         esac
15498         case "$d_getservent_r_proto" in
15499         define)
15500         case "$getservent_r_proto" in
15501         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15502         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15503         esac
15504         case "$getservent_r_proto" in
15505         ''|0) try='int getservent_r(struct servent*, char*, int);'
15506         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15507         esac
15508         case "$getservent_r_proto" in
15509         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15510         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15511         esac
15512         case "$getservent_r_proto" in
15513         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15514         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15515         esac
15516         case "$getservent_r_proto" in
15517         ''|0)   d_getservent_r=undef
15518                 getservent_r_proto=0
15519                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15520         * )     case "$getservent_r_proto" in
15521                 REENTRANT_PROTO*) ;;
15522                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15523                 esac
15524                 echo "Prototype: $try" ;;
15525         esac
15526         ;;
15527         *)      case "$usethreads" in
15528                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15529                 esac
15530                 d_getservent_r=undef
15531                 getservent_r_proto=0
15532                 ;;
15533         esac
15534         ;;
15535 *)      getservent_r_proto=0
15536         ;;
15537 esac
15538
15539 : see if prototypes for various getservxxx netdb.h functions are available
15540 echo " "
15541 set d_getservprotos getservent $i_netdb netdb.h
15542 eval $hasproto
15543
15544 : see if getspnam exists
15545 set getspnam d_getspnam
15546 eval $inlibc
15547
15548 : see if this is a shadow.h system
15549 set shadow.h i_shadow
15550 eval $inhdr
15551
15552 : see if getspnam_r exists
15553 set getspnam_r d_getspnam_r
15554 eval $inlibc
15555 case "$d_getspnam_r" in
15556 "$define")
15557         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15558         case "$d_getspnam_r_proto:$usethreads" in
15559         ":define")      d_getspnam_r_proto=define
15560                 set d_getspnam_r_proto getspnam_r $hdrs
15561                 eval $hasproto ;;
15562         *)      ;;
15563         esac
15564         case "$d_getspnam_r_proto" in
15565         define)
15566         case "$getspnam_r_proto" in
15567         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15568         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15569         esac
15570         case "$getspnam_r_proto" in
15571         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15572         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15573         esac
15574         case "$getspnam_r_proto" in
15575         ''|0)   d_getspnam_r=undef
15576                 getspnam_r_proto=0
15577                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15578         * )     case "$getspnam_r_proto" in
15579                 REENTRANT_PROTO*) ;;
15580                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15581                 esac
15582                 echo "Prototype: $try" ;;
15583         esac
15584         ;;
15585         *)      case "$usethreads" in
15586                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15587                 esac
15588                 d_getspnam_r=undef
15589                 getspnam_r_proto=0
15590                 ;;
15591         esac
15592         ;;
15593 *)      getspnam_r_proto=0
15594         ;;
15595 esac
15596
15597 : see if gettimeofday or ftime exists
15598 set gettimeofday d_gettimeod
15599 eval $inlibc
15600 case "$d_gettimeod" in
15601 "$undef")
15602         set ftime d_ftime 
15603         eval $inlibc
15604         ;;
15605 *)
15606         val="$undef"; set d_ftime; eval $setvar
15607         ;;
15608 esac
15609 case "$d_gettimeod$d_ftime" in
15610 "$undef$undef")
15611         echo " "
15612         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15613         ;;
15614 esac
15615
15616 : see if gmtime_r exists
15617 set gmtime_r d_gmtime_r
15618 eval $inlibc
15619 case "$d_gmtime_r" in
15620 "$define")
15621         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15622         case "$d_gmtime_r_proto:$usethreads" in
15623         ":define")      d_gmtime_r_proto=define
15624                 set d_gmtime_r_proto gmtime_r $hdrs
15625                 eval $hasproto ;;
15626         *)      ;;
15627         esac
15628         case "$d_gmtime_r_proto" in
15629         define)
15630         case "$gmtime_r_proto" in
15631         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15632         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15633         esac
15634         case "$gmtime_r_proto" in
15635         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15636         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15637         esac
15638         case "$gmtime_r_proto" in
15639         ''|0)   d_gmtime_r=undef
15640                 gmtime_r_proto=0
15641                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15642         * )     case "$gmtime_r_proto" in
15643                 REENTRANT_PROTO*) ;;
15644                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15645                 esac
15646                 echo "Prototype: $try" ;;
15647         esac
15648         ;;
15649         *)      case "$usethreads" in
15650                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15651                 esac
15652                 d_gmtime_r=undef
15653                 gmtime_r_proto=0
15654                 ;;
15655         esac
15656         ;;
15657 *)      gmtime_r_proto=0
15658         ;;
15659 esac
15660
15661 : see if hasmntopt exists
15662 set hasmntopt d_hasmntopt
15663 eval $inlibc
15664
15665 : see if this is a netinet/in.h or sys/in.h system
15666 set netinet/in.h i_niin sys/in.h i_sysin
15667 eval $inhdr
15668
15669 : see if arpa/inet.h has to be included
15670 set arpa/inet.h i_arpainet
15671 eval $inhdr
15672
15673 : see if htonl --and friends-- exists
15674 val=''
15675 set htonl val
15676 eval $inlibc
15677
15678 : Maybe they are macros.
15679 case "$val" in
15680 $undef)
15681         $cat >htonl.c <<EOM
15682 #include <stdio.h>
15683 #include <sys/types.h>
15684 #$i_niin I_NETINET_IN
15685 #$i_sysin I_SYS_IN
15686 #$i_arpainet I_ARPA_INET
15687 #ifdef I_NETINET_IN
15688 #include <netinet/in.h>
15689 #endif
15690 #ifdef I_SYS_IN
15691 #include <sys/in.h>
15692 #endif
15693 #ifdef I_ARPA_INET
15694 #include <arpa/inet.h>
15695 #endif
15696 #ifdef htonl
15697 printf("Defined as a macro.");
15698 #endif
15699 EOM
15700         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15701         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15702                 val="$define"
15703                 echo "But it seems to be defined as a macro." >&4
15704         fi
15705         $rm -f htonl.?
15706         ;;
15707 esac
15708 set d_htonl
15709 eval $setvar
15710
15711 : see if hypot exists
15712 set hypot d_hypot
15713 eval $inlibc
15714
15715 : see if ilogb exists
15716 set ilogb d_ilogb
15717 eval $inlibc
15718
15719 : see if ilogbl exists
15720 set ilogbl d_ilogbl
15721 eval $inlibc
15722
15723 : index or strchr
15724 echo " "
15725 if set index val -f; eval $csym; $val; then
15726         if set strchr val -f d_strchr; eval $csym; $val; then
15727                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15728                         val="$define"
15729                         vali="$undef"
15730                         echo "strchr() found." >&4
15731                 else
15732                         val="$undef"
15733                         vali="$define"
15734                         echo "index() found." >&4
15735                 fi
15736         else
15737                 val="$undef"
15738                 vali="$define"
15739                 echo "index() found." >&4
15740         fi
15741 else
15742         if set strchr val -f d_strchr; eval $csym; $val; then
15743                 val="$define"
15744                 vali="$undef"
15745                 echo "strchr() found." >&4
15746         else
15747                 echo "No index() or strchr() found!" >&4
15748                 val="$undef"
15749                 vali="$undef"
15750         fi
15751 fi
15752 set d_strchr; eval $setvar
15753 val="$vali"
15754 set d_index; eval $setvar
15755
15756 : check whether inet_aton exists
15757 set inet_aton d_inetaton
15758 eval $inlibc
15759
15760 : see if inet_ntop exists
15761 set inet_ntop d_inetntop
15762 eval $inlibc
15763
15764 : see if inet_pton exists
15765 set inet_pton d_inetpton
15766 eval $inlibc
15767
15768 : Look for isascii
15769 echo " "
15770 $cat >isascii.c <<EOCP
15771 #include <stdio.h>
15772 #include <ctype.h>
15773 #$i_stdlib I_STDLIB
15774 #ifdef I_STDLIB
15775 #include <stdlib.h>
15776 #endif
15777 int main() {
15778         int c = 'A';
15779         if (isascii(c))
15780                 exit(0);
15781         else
15782                 exit(1);
15783 }
15784 EOCP
15785 set isascii
15786 if eval $compile; then
15787         echo "isascii() found." >&4
15788         val="$define"
15789 else
15790         echo "isascii() NOT found." >&4
15791         val="$undef"
15792 fi
15793 set d_isascii
15794 eval $setvar
15795 $rm -f isascii*
15796
15797 : Look for isblank
15798 echo " "
15799 $cat >isblank.c <<'EOCP'
15800 #include <stdio.h>
15801 #include <ctype.h>
15802 int main() {
15803         int c = ' ';
15804         if (isblank(c))
15805                 return 0 ;
15806         else
15807                 return 1 ;
15808 }
15809 EOCP
15810 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15811         echo "isblank() found." >&4
15812         val="$define"
15813 else
15814         echo "isblank() NOT found." >&4
15815         val="$undef"
15816 fi
15817 set d_isblank
15818 eval $setvar
15819 $rm -f isblank*
15820
15821 : check for isfinite
15822 echo "Checking to see if you have isfinite..." >&4
15823 $cat >try.c <<EOCP
15824 #$i_math I_MATH
15825 #ifdef I_MATH
15826 #include <math.h>
15827 #endif
15828 int main() { return isfinite(0.0); }
15829 EOCP
15830 set try
15831 if eval $compile; then
15832         val="$define"
15833         echo "You have isfinite."
15834 else
15835         val="$undef"
15836         echo "You do not have isfinite."
15837 fi
15838 $rm_try
15839 set d_isfinite
15840 eval $setvar
15841
15842 : see if isfinitel exists
15843 set isfinitel d_isfinitel
15844 eval $inlibc
15845
15846 : check for isinf
15847 echo "Checking to see if you have isinf..." >&4
15848 $cat >try.c <<EOCP
15849 #$i_math I_MATH
15850 #ifdef I_MATH
15851 #include <math.h>
15852 #endif
15853 int main() { return isinf(0.0); }
15854 EOCP
15855 set try
15856 if eval $compile; then
15857         val="$define"
15858         echo "You have isinf."
15859 else
15860         val="$undef"
15861         echo "You do not have isinf."
15862 fi
15863 $rm_try
15864 set d_isinf
15865 eval $setvar
15866
15867 : see if isinfl exists
15868 set isinfl d_isinfl
15869 eval $inlibc
15870
15871 : check for isless
15872 echo "Checking to see if you have isless..." >&4
15873 $cat >try.c <<EOCP
15874 #$i_math I_MATH
15875 #ifdef I_MATH
15876 #include <math.h>
15877 #endif
15878 int main() { return isless(0.0); }
15879 EOCP
15880 set try
15881 if eval $compile; then
15882         val="$define"
15883         echo "You have isless."
15884 else
15885         val="$undef"
15886         echo "You do not have isless."
15887 fi
15888 $rm_try
15889 set d_isless
15890 eval $setvar
15891
15892 : check for isnan
15893 echo "Checking to see if you have isnan..." >&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 isnan(0.0); }
15900 EOCP
15901 set try
15902 if eval $compile; then
15903         val="$define"
15904         echo "You have isnan."
15905 else
15906         val="$undef"
15907         echo "You do not have isnan."
15908 fi
15909 $rm_try
15910 set d_isnan
15911 eval $setvar
15912
15913 : see if isnanl exists
15914 set isnanl d_isnanl
15915 eval $inlibc
15916
15917 : check for isnormal
15918 echo "Checking to see if you have isnormal..." >&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 isnormal(0.0); }
15925 EOCP
15926 set try
15927 if eval $compile; then
15928         val="$define"
15929         echo "You have isnormal."
15930 else
15931         val="$undef"
15932         echo "You do not have isnormal."
15933 fi
15934 $rm_try
15935 set d_isnormal
15936 eval $setvar
15937
15938 : see if j0 exists
15939 set j0 d_j0
15940 eval $inlibc
15941
15942 : see if j0l exists
15943 set j0l d_j0l
15944 eval $inlibc
15945
15946 : see if killpg exists
15947 set killpg d_killpg
15948 eval $inlibc
15949
15950 : see if localeconv exists
15951 set localeconv d_locconv
15952 eval $inlibc
15953
15954 : see if libc has the POSIX.1-2008 currency locale rules
15955 case "$d_locconv:$d_lc_monetary_2008" in
15956 $define:)
15957         $cat >try.c <<EOCP
15958 #include <locale.h>
15959 int main() {
15960         struct lconv *lc = localeconv();
15961         char int_p_cs_precedes = lc->int_p_cs_precedes;
15962         return 0;
15963 }
15964 EOCP
15965         set try
15966         if eval $compile; then
15967                 d_lc_monetary_2008="$define"
15968         else
15969                 d_lc_monetary_2008="$undef"
15970         fi;
15971         $rm_try
15972         ;;
15973 esac
15974
15975 : see if lchown exists
15976 echo " "
15977 $cat > try.c <<'EOCP'
15978 /* System header to define __stub macros and hopefully few prototypes,
15979     which can conflict with char lchown(); below.  */
15980 #include <assert.h>
15981 /* Override any gcc2 internal prototype to avoid an error.  */
15982 /* We use char because int might match the return type of a gcc2
15983    builtin and then its argument prototype would still apply.  */
15984 char lchown();
15985 int main() {
15986     /*  The GNU C library defines this for functions which it implements
15987         to always fail with ENOSYS.  Some functions are actually named
15988         something starting with __ and the normal name is an alias.  */
15989 #if defined (__stub_lchown) || defined (__stub___lchown)
15990 choke me
15991 #else
15992 lchown();
15993 #endif
15994 ; return 0; }
15995 EOCP
15996 set try
15997 if eval $compile; then
15998     $echo "lchown() found." >&4
15999     val="$define"
16000 else
16001     $echo "lchown() NOT found." >&4
16002     val="$undef"
16003 fi
16004 set d_lchown
16005 eval $setvar
16006
16007 : See if number of significant digits in a double precision number is known
16008 echo " "
16009 $cat >ldbl_dig.c <<EOM
16010 #$i_limits I_LIMITS
16011 #$i_float I_FLOAT
16012 #ifdef I_LIMITS
16013 #include <limits.h>
16014 #endif
16015 #ifdef I_FLOAT
16016 #include <float.h>
16017 #endif
16018 #ifdef LDBL_DIG
16019 printf("Contains LDBL_DIG");
16020 #endif
16021 EOM
16022 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16023 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16024         echo "LDBL_DIG found." >&4
16025         val="$define"
16026 else
16027         echo "LDBL_DIG NOT found." >&4
16028         val="$undef"
16029 fi
16030 $rm -f ldbl_dig.?
16031 set d_ldbl_dig
16032 eval $setvar
16033
16034 : see if lgamma exists
16035 set lgamma d_lgamma
16036 eval $inlibc
16037
16038 : see if lgamma_r exists
16039 set lgamma_r d_lgamma_r
16040 eval $inlibc
16041
16042 : check to see if math.h defines _LIB_VERSION
16043 d_libm_lib_version="$undef"
16044 case $i_math in
16045     $define)
16046         echo " "
16047         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16048         $cat >try.c <<EOCP
16049 #include <unistd.h>
16050 #include <math.h>
16051 int main (int argc, char *argv[])
16052 {
16053     printf ("%d\n", _LIB_VERSION);
16054     return (0);
16055     } /* main */
16056 EOCP
16057         set try
16058         if eval $compile; then
16059             foo=`$run ./try`
16060             echo "Yes, it does ($foo)" >&4
16061             d_libm_lib_version="$define"
16062         else
16063             echo "No, it does not (probably harmless)" >&4
16064             fi
16065         $rm_try
16066         ;;
16067
16068     esac
16069
16070 : see if link exists
16071 set link d_link
16072 eval $inlibc
16073
16074 : see if llrint exists
16075 set llrint d_llrint
16076 eval $inlibc
16077
16078 : see if llrintl exists
16079 set llrintl d_llrintl
16080 eval $inlibc
16081
16082 : see if llround exists
16083 set llround d_llround
16084 eval $inlibc
16085
16086 : see if llroundl exists
16087 set llroundl d_llroundl
16088 eval $inlibc
16089
16090 : see if localtime_r exists
16091 set localtime_r d_localtime_r
16092 eval $inlibc
16093 case "$d_localtime_r" in
16094 "$define")
16095         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16096         case "$d_localtime_r_proto:$usethreads" in
16097         ":define")      d_localtime_r_proto=define
16098                 set d_localtime_r_proto localtime_r $hdrs
16099                 eval $hasproto ;;
16100         *)      ;;
16101         esac
16102         case "$d_localtime_r_proto" in
16103         define)
16104         case "$localtime_r_proto" in
16105         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16106         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16107         esac
16108         case "$localtime_r_proto" in
16109         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16110         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16111         esac
16112         case "$localtime_r_proto" in
16113         ''|0)   d_localtime_r=undef
16114                 localtime_r_proto=0
16115                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16116         * )     case "$localtime_r_proto" in
16117                 REENTRANT_PROTO*) ;;
16118                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16119                 esac
16120                 echo "Prototype: $try" ;;
16121         esac
16122         ;;
16123         *)      case "$usethreads" in
16124                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16125                 esac
16126                 d_localtime_r=undef
16127                 localtime_r_proto=0
16128                 ;;
16129         esac
16130         ;;
16131 *)      localtime_r_proto=0
16132         ;;
16133 esac
16134
16135 : see if localtime_r calls tzset
16136 case "$localtime_r_proto" in
16137 REENTRANT_PROTO*)
16138         $cat >try.c <<EOCP
16139 /*  Does our libc's localtime_r call tzset ?
16140  *  return 0 if so, 1 otherwise.
16141  */
16142 #$i_systypes    I_SYS_TYPES
16143 #$i_unistd      I_UNISTD
16144 #$i_time        I_TIME
16145 #$i_stdlib      I_STDLIB
16146 #$i_string      I_STRING
16147 #$i_malloc      I_MALLOC
16148 #ifdef I_SYS_TYPES
16149 #  include <sys/types.h>
16150 #endif
16151 #ifdef I_UNISTD
16152 #  include <unistd.h>
16153 #endif
16154 #ifdef I_TIME
16155 #  include <time.h>
16156 #endif
16157 #ifdef I_STDLIB
16158 #include <stdlib.h>
16159 #endif
16160 #ifdef I_STRING
16161 #  include <string.h>
16162 #else
16163 #  include <strings.h>
16164 #endif
16165 #ifdef I_MALLOC
16166 #  include <malloc.h>
16167 #endif
16168 int main()
16169 {
16170     time_t t = time(0L);
16171     char w_tz[]="TZ" "=GMT+5",
16172          e_tz[]="TZ" "=GMT-5",
16173         *tz_e = (char*)malloc(16),
16174         *tz_w = (char*)malloc(16);
16175     struct tm tm_e, tm_w;
16176     memset(&tm_e,'\0',sizeof(struct tm));
16177     memset(&tm_w,'\0',sizeof(struct tm));
16178     strcpy(tz_e,e_tz);
16179     strcpy(tz_w,w_tz);
16180
16181     putenv(tz_e);
16182     localtime_r(&t, &tm_e);
16183
16184     putenv(tz_w);
16185     localtime_r(&t, &tm_w);
16186
16187     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16188         return 1;
16189     return 0;
16190 }
16191 EOCP
16192         set try
16193         if eval $compile; then
16194             if $run ./try; then
16195                 d_localtime_r_needs_tzset=undef;
16196             else
16197                 d_localtime_r_needs_tzset=define;
16198             fi;
16199         else
16200             d_localtime_r_needs_tzset=undef;
16201         fi;
16202      ;;
16203   *)
16204      d_localtime_r_needs_tzset=undef;
16205      ;;
16206 esac
16207 $rm_try
16208
16209 : see if lockf exists
16210 set lockf d_lockf
16211 eval $inlibc
16212
16213 : see if log1p exists
16214 set log1p d_log1p
16215 eval $inlibc
16216
16217 : see if log2 exists
16218 set log2 d_log2
16219 eval $inlibc
16220
16221 : see if logb exists
16222 set logb d_logb
16223 eval $inlibc
16224
16225 : see if lrint exists
16226 set lrint d_lrint
16227 eval $inlibc
16228
16229 : see if lrintl exists
16230 set lrintl d_lrintl
16231 eval $inlibc
16232
16233 : see if lround exists
16234 set lround d_lround
16235 eval $inlibc
16236
16237 : see if lroundl exists
16238 set lroundl d_lroundl
16239 eval $inlibc
16240
16241 : see if prototype for lseek is available
16242 echo " "
16243 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16244 eval $hasproto
16245
16246 : see if lstat exists
16247 set lstat d_lstat
16248 eval $inlibc
16249
16250 : see if madvise exists
16251 set madvise d_madvise
16252 eval $inlibc
16253
16254 : see if malloc_size exists
16255 set malloc_size d_malloc_size
16256 eval $inlibc
16257
16258 : see if malloc_size_good exists
16259 set malloc_good_size d_malloc_good_size
16260 eval $inlibc
16261
16262 : see if mblen exists
16263 set mblen d_mblen
16264 eval $inlibc
16265
16266 : see if mbstowcs exists
16267 set mbstowcs d_mbstowcs
16268 eval $inlibc
16269
16270 : see if mbtowc exists
16271 set mbtowc d_mbtowc
16272 eval $inlibc
16273
16274 : see if memchr exists
16275 set memchr d_memchr
16276 eval $inlibc
16277
16278 : see if memcmp exists
16279 set memcmp d_memcmp
16280 eval $inlibc
16281
16282 : see if memcpy exists
16283 set memcpy d_memcpy
16284 eval $inlibc
16285
16286 : see if memmove exists
16287 set memmove d_memmove
16288 eval $inlibc
16289
16290 : see if memset exists
16291 set memset d_memset
16292 eval $inlibc
16293
16294 : see if mkdir exists
16295 set mkdir d_mkdir
16296 eval $inlibc
16297
16298 : see if mkdtemp exists
16299 set mkdtemp d_mkdtemp
16300 eval $inlibc
16301
16302 : see if mkfifo exists
16303 set mkfifo d_mkfifo
16304 eval $inlibc
16305
16306 : see if mkstemp exists
16307 set mkstemp d_mkstemp
16308 eval $inlibc
16309
16310 : see if mkstemps exists
16311 set mkstemps d_mkstemps
16312 eval $inlibc
16313
16314 : see if mktime exists
16315 set mktime d_mktime
16316 eval $inlibc
16317
16318 : see if this is a sys/mman.h system
16319 set sys/mman.h i_sysmman
16320 eval $inhdr
16321
16322 : see if mmap exists
16323 set mmap d_mmap
16324 eval $inlibc
16325 : see what shmat returns
16326 : default to something harmless
16327 mmaptype='void *'
16328 case "$i_sysmman$d_mmap" in
16329 "$define$define")
16330         $cat >mmap.c <<'END'
16331 #include <sys/mman.h>
16332 void *mmap();
16333 END
16334         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16335                 mmaptype='void *'
16336         else
16337                 mmaptype='caddr_t'
16338         fi
16339         echo "and it returns ($mmaptype)." >&4
16340         ;;
16341 esac
16342
16343
16344
16345 : see if sqrtl exists
16346 set sqrtl d_sqrtl
16347 eval $inlibc
16348
16349 : see if scalbnl exists
16350 set scalbnl d_scalbnl
16351 eval $inlibc
16352
16353 : see if truncl exists
16354 set truncl d_truncl
16355 eval $inlibc
16356
16357 : see if modfl exists
16358 set modfl d_modfl
16359 eval $inlibc
16360
16361 : see if prototype for modfl is available
16362 echo " "
16363 set d_modflproto modfl $i_math math.h
16364 eval $hasproto
16365
16366 d_modfl_pow32_bug="$undef"
16367
16368 case "$d_longdbl$d_modfl" in
16369 $define$define)
16370         $cat <<EOM
16371 Checking to see whether your modfl() is okay for large values...
16372 EOM
16373 $cat >try.c <<EOCP
16374 #include <math.h>
16375 #include <stdio.h>
16376 EOCP
16377 if $test "X$d_modflproto" != "X$define"; then
16378         $cat >>try.c <<EOCP
16379 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16380 long double modfl (long double, long double *);
16381 EOCP
16382 fi
16383 $cat >>try.c <<EOCP
16384 int main() {
16385     long double nv = 4294967303.15;
16386     long double v, w;
16387     v = modfl(nv, &w);
16388 #ifdef __GLIBC__
16389     printf("glibc");
16390 #endif
16391     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16392     return 0;
16393 }
16394 EOCP
16395         case "$osname:$gccversion" in
16396         aix:)   saveccflags="$ccflags"
16397                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16398         esac
16399         set try
16400         if eval $compile; then
16401                 foo=`$run ./try`
16402                 case "$foo" in
16403                 *" 4294967303.150000 1.150000 4294967302.000000")
16404                         echo >&4 "Your modfl() is broken for large values."
16405                         d_modfl_pow32_bug="$define"
16406                         case "$foo" in
16407                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16408                         ;;
16409                         esac
16410                         ;;
16411                 *" 4294967303.150000 0.150000 4294967303.000000")
16412                         echo >&4 "Your modfl() seems okay for large values."
16413                         ;;
16414                 *)      echo >&4 "I don't understand your modfl() at all."
16415                         d_modfl="$undef"
16416                         ;;
16417                 esac
16418                 $rm_try
16419         else
16420                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16421                 d_modfl="$undef"
16422         fi
16423         case "$osname:$gccversion" in
16424         aix:)   ccflags="$saveccflags" ;; # restore
16425         esac
16426         ;;
16427 esac
16428
16429 if $test "$uselongdouble" = "$define"; then
16430     message=""
16431     if $test "$d_sqrtl" != "$define"; then
16432         message="$message sqrtl"
16433     fi
16434     if $test "$d_modfl" != "$define"; then
16435         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16436             echo "You have both truncl and copysignl, so I can emulate modfl."
16437         else
16438             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16439                 echo "You have both aintl and copysignl, so I can emulate modfl."
16440             else
16441                 message="$message modfl"
16442             fi
16443         fi
16444     fi
16445     if $test "$d_frexpl" != "$define"; then
16446         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16447             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16448         else
16449             message="$message frexpl"
16450         fi
16451     fi
16452     if $test "$d_ldexpl" != "$define"; then
16453         message="$message ldexpl"
16454     fi
16455
16456     if $test "$message" != ""; then
16457         $cat <<EOM >&4
16458
16459 *** You requested the use of long doubles but you do not seem to have
16460 *** the following mathematical functions needed for long double support:
16461 ***    $message
16462 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16463 *** Cannot continue, aborting.
16464
16465 EOM
16466
16467         exit 1
16468     fi
16469 fi
16470
16471 : see if mprotect exists
16472 set mprotect d_mprotect
16473 eval $inlibc
16474
16475 : see if msgctl exists
16476 set msgctl d_msgctl
16477 eval $inlibc
16478
16479 : see if msgget exists
16480 set msgget d_msgget
16481 eval $inlibc
16482
16483 : see if msgsnd exists
16484 set msgsnd d_msgsnd
16485 eval $inlibc
16486
16487 : see if msgrcv exists
16488 set msgrcv d_msgrcv
16489 eval $inlibc
16490
16491 : see how much of the 'msg*(2)' library is present.
16492 h_msg=true
16493 echo " "
16494 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16495 *"$undef"*) h_msg=false;;
16496 esac
16497 case "$osname" in
16498 freebsd)
16499     case "`ipcs 2>&1`" in
16500     "SVID messages"*"not configured"*)
16501         echo "Your $osname does not have the msg*(2) configured." >&4
16502         h_msg=false
16503         val="$undef"
16504         set msgctl d_msgctl
16505         eval $setvar
16506         set msgget d_msgget
16507         eval $setvar
16508         set msgsnd d_msgsnd
16509         eval $setvar
16510         set msgrcv d_msgrcv
16511         eval $setvar
16512         ;;
16513     esac
16514     ;;
16515 esac
16516 : we could also check for sys/ipc.h ...
16517 if $h_msg && $test `./findhdr sys/msg.h`; then
16518         echo "You have the full msg*(2) library." >&4
16519         val="$define"
16520 else
16521         echo "You don't have the full msg*(2) library." >&4
16522         val="$undef"
16523 fi
16524 set d_msg
16525 eval $setvar
16526
16527 : Check for msghdr_s
16528 echo " "
16529 echo "Checking to see if your system supports struct msghdr..." >&4
16530 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16531 eval $hasstruct
16532 case "$d_msghdr_s" in
16533 "$define")      echo "Yes, it does."   ;;
16534 *)              echo "No, it doesn't." ;;
16535 esac
16536
16537
16538 : see if msync exists
16539 set msync d_msync
16540 eval $inlibc
16541
16542 : see if munmap exists
16543 set munmap d_munmap
16544 eval $inlibc
16545
16546 : see if nan exists
16547 set nan d_nan
16548 eval $inlibc
16549
16550 : see if nearbyint exists
16551 set nearbyint d_nearbyint
16552 eval $inlibc
16553
16554 : see if nextafter exists
16555 set nextafter d_nextafter
16556 eval $inlibc
16557
16558 : see if nexttoward exists
16559 set nexttoward d_nexttoward
16560 eval $inlibc
16561
16562 : see if nice exists
16563 set nice d_nice
16564 eval $inlibc
16565
16566 : see if this is a langinfo.h system
16567 set langinfo.h i_langinfo
16568 eval $inhdr
16569
16570 : see if nl_langinfo exists
16571 set nl_langinfo d_nl_langinfo
16572 eval $inlibc
16573
16574 : see if this is a quadmath.h system
16575 set quadmath.h i_quadmath
16576 eval $inhdr
16577
16578 : check for volatile keyword
16579 echo " "
16580 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16581 $cat >try.c <<'EOCP'
16582 int main()
16583 {
16584         typedef struct _goo_struct goo_struct;
16585         goo_struct * volatile goo = ((goo_struct *)0);
16586         struct _goo_struct {
16587                 long long_int;
16588                 int reg_int;
16589                 char char_var;
16590         };
16591         typedef unsigned short foo_t;
16592         char *volatile foo;
16593         volatile int bar;
16594         volatile foo_t blech;
16595         foo = foo;
16596 }
16597 EOCP
16598 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16599         val="$define"
16600         echo "Yup, it does."
16601 else
16602         val="$undef"
16603         echo "Nope, it doesn't."
16604 fi
16605 set d_volatile
16606 eval $setvar
16607 $rm_try
16608
16609 : Check basic sizes
16610 echo " "
16611 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16612
16613 case "$use64bitint:$d_quad:$quadtype" in
16614 define:define:?*)
16615         ivtype="$quadtype"
16616         uvtype="$uquadtype"
16617         ivsize=8
16618         uvsize=8
16619         ;;
16620 *)      ivtype="long"
16621         uvtype="unsigned long"
16622         ivsize=$longsize
16623         uvsize=$longsize
16624         ;;
16625 esac
16626
16627 case "$uselongdouble:$d_longdbl" in
16628 define:define)
16629         nvtype="long double"
16630         nvsize=$longdblsize
16631         ;;
16632 *)      nvtype=double
16633         nvsize=$doublesize
16634         ;;
16635 esac
16636
16637 case "$usequadmath:$i_quadmath" in
16638 define:define)
16639   nvtype="__float128"
16640   nvsize=16
16641   case "$libs" in
16642   *quadmath*) ;;
16643   *) $cat <<EOM >&4
16644
16645 *** You requested the use of the quadmath library, but you
16646 *** do not seem to have the quadmath library installed.
16647 *** Cannot continue, aborting.
16648 EOM
16649     exit 1
16650     ;;
16651   esac
16652   ;;
16653 define:*) $cat <<EOM >&4
16654
16655 *** You requested the use of the quadmath library, but you
16656 *** do not seem to have the required header, <quadmath.h>.
16657 EOM
16658   case "$gccversion" in
16659   [23].*|4.[0-5]*)
16660    $cat <<EOM >&4
16661 *** Your gcc looks a bit old:
16662 *** $gccversion
16663 EOM
16664     ;;
16665   '')
16666    $cat <<EOM >&4
16667 *** You are not running a gcc.
16668 EOM
16669     ;;
16670   esac
16671   $cat <<EOM >&4
16672 *** For the quadmath library you need at least gcc 4.6.
16673 *** Cannot continue, aborting.
16674 EOM
16675   exit 1
16676   ;;
16677 esac
16678
16679 $echo "(IV will be "$ivtype", $ivsize bytes)"
16680 $echo "(UV will be "$uvtype", $uvsize bytes)"
16681 $echo "(NV will be "$nvtype", $nvsize bytes)"
16682
16683 $cat >try.c <<EOCP
16684 #$i_inttypes I_INTTYPES
16685 #ifdef I_INTTYPES
16686 #include <inttypes.h>
16687 #endif
16688 #include <stdio.h>
16689 int main() {
16690 #ifdef INT8
16691    int8_t i =  INT8_MAX;
16692   uint8_t u = UINT8_MAX;
16693   printf("int8_t\n");
16694 #endif
16695 #ifdef INT16
16696    int16_t i =  INT16_MAX;
16697   uint16_t u = UINT16_MAX;
16698   printf("int16_t\n");
16699 #endif
16700 #ifdef INT32
16701    int32_t i =  INT32_MAX;
16702   uint32_t u = UINT32_MAX;
16703   printf("int32_t\n");
16704 #endif
16705 }
16706 EOCP
16707
16708 i8type="signed char"
16709 u8type="unsigned char"
16710 i8size=1
16711 u8size=1
16712
16713 case "$i16type" in
16714 '')     case "$shortsize" in
16715         2)      i16type=short
16716                 u16type="unsigned short"
16717                 i16size=$shortsize
16718                 u16size=$shortsize
16719                 ;;
16720         esac
16721         ;;
16722 esac
16723 case "$i16type" in
16724 '')     set try -DINT16
16725         if eval $compile; then
16726                 case "`$run ./try`" in
16727                 int16_t)
16728                         i16type=int16_t
16729                         u16type=uint16_t
16730                         i16size=2
16731                         u16size=2
16732                         ;;
16733                 esac
16734         fi
16735         ;;
16736 esac
16737 case "$i16type" in
16738 '')     if $test $shortsize -ge 2; then
16739                 i16type=short
16740                 u16type="unsigned short"
16741                 i16size=$shortsize
16742                 u16size=$shortsize
16743         fi
16744         ;;
16745 esac
16746
16747 case "$i32type" in
16748 '')     case "$longsize" in
16749         4)      i32type=long
16750                 u32type="unsigned long"
16751                 i32size=$longsize
16752                 u32size=$longsize
16753                 ;;
16754         *)      case "$intsize" in
16755                 4)      i32type=int
16756                         u32type="unsigned int"
16757                         i32size=$intsize
16758                         u32size=$intsize
16759                         ;;
16760                 esac
16761                 ;;
16762         esac
16763         ;;
16764 esac
16765 case "$i32type" in
16766 '')     set try -DINT32
16767         if eval $compile; then
16768                 case "`$run ./try`" in
16769                 int32_t)
16770                         i32type=int32_t
16771                         u32type=uint32_t
16772                         i32size=4
16773                         u32size=4
16774                         ;;
16775                 esac
16776         fi
16777         ;;
16778 esac
16779 case "$i32type" in
16780 '')     if $test $intsize -ge 4; then
16781                 i32type=int
16782                 u32type="unsigned int"
16783                 i32size=$intsize
16784                 u32size=$intsize
16785         fi
16786         ;;
16787 esac
16788
16789 case "$i64type" in
16790 '')     case "$d_quad:$quadtype" in
16791         define:?*)
16792                 i64type="$quadtype"
16793                 u64type="$uquadtype"
16794                 i64size=8
16795                 u64size=8
16796                 ;;
16797         esac
16798         ;;
16799 esac
16800
16801 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16802 : volatile so that the compiler has to store it out to memory.
16803 if test X"$d_volatile" = X"$define"; then
16804         volatile=volatile
16805 fi
16806 $cat <<EOP >try.c
16807 #include <stdio.h>
16808 #$i_stdlib I_STDLIB
16809 #ifdef I_STDLIB
16810 #include <stdlib.h>
16811 #endif
16812 #include <sys/types.h>
16813 #include <signal.h>
16814 #ifdef SIGFPE
16815 $volatile int bletched = 0;
16816 $signal_t blech(int s) { bletched = 1; }
16817 #endif
16818 int main() {
16819     $uvtype u = 0;
16820     $nvtype d;
16821     int     n = 8 * $uvsize;
16822     int     i;
16823 #ifdef SIGFPE
16824     signal(SIGFPE, blech);
16825 #endif
16826
16827     for (i = 0; i < n; i++) {
16828       u = u << 1 | ($uvtype)1;
16829       d = ($nvtype)u;
16830       if (($uvtype)d != u)
16831         break;
16832       if (d <= 0)
16833         break;
16834       d = ($nvtype)(u - 1);
16835       if (($uvtype)d != (u - 1))
16836         break;
16837 #ifdef SIGFPE
16838       if (bletched)
16839         break;
16840 #endif
16841     }
16842     printf("%d\n", ((i == n) ? -n : i));
16843     exit(0);
16844 }
16845 EOP
16846 set try
16847
16848 d_nv_preserves_uv="$undef"
16849 if eval $compile; then
16850         nv_preserves_uv_bits="`$run ./try`"
16851 fi
16852 case "$nv_preserves_uv_bits" in
16853 \-[1-9]*)
16854         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16855         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16856         d_nv_preserves_uv="$define"
16857         ;;
16858 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16859         d_nv_preserves_uv="$undef" ;;
16860 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16861         nv_preserves_uv_bits="0" ;;
16862 esac
16863 $rm_try
16864
16865 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16866 : volatile so that the compiler has to store it out to memory.
16867 if test X"$d_volatile" = X"$define"; then
16868         volatile=volatile
16869 fi
16870 $cat <<EOP >try.c
16871 #include <stdio.h>
16872
16873 typedef $nvtype NV;
16874
16875 int
16876 main() {
16877   NV value = 2;
16878   int count = 1;
16879
16880   while(count < 256) {
16881     $volatile NV up = value + 1.0;
16882     $volatile NV negated = -value;
16883     $volatile NV down = negated - 1.0;
16884     $volatile NV got_up = up - value;
16885     int up_good = got_up == 1.0;
16886     int got_down = down - negated;
16887     int down_good = got_down == -1.0;
16888
16889     if (down_good != up_good) {
16890       fprintf(stderr,
16891               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16892               up_good, (double) got_up, down_good, (double) got_down,
16893               count, (double) value);
16894       return 1;
16895     }
16896     if (!up_good) {
16897       while (1) {
16898         if (count > 8) {
16899           count -= 8;
16900           fputs("256.0", stdout);
16901         } else {
16902           count--;
16903           fputs("2.0", stdout);
16904         }
16905         if (!count) {
16906           puts("");
16907           return 0;
16908         }
16909         fputs("*", stdout);
16910       }
16911     }
16912     value *= 2;
16913     ++count;
16914   }
16915   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16916           count, (double) value);
16917   return 1;
16918 }
16919 EOP
16920 set try
16921
16922 nv_overflows_integers_at='0'
16923 if eval $compile; then
16924     xxx="`$run ./try`"
16925     case "$?" in
16926         0)
16927             case "$xxx" in
16928                 2*)  cat >&4 <<EOM
16929 The largest integer your NVs can preserve is equal to $xxx
16930 EOM
16931                     nv_overflows_integers_at="$xxx"
16932                     ;;
16933                 *)  cat >&4 <<EOM
16934 Cannot determine the largest integer value your NVs can hold, unexpected output
16935 '$xxx'
16936 EOM
16937                     ;;
16938             esac
16939             ;;
16940         *)  cat >&4 <<EOM
16941 Cannot determine the largest integer value your NVs can hold
16942 EOM
16943             ;;
16944     esac
16945 fi
16946 $rm_try
16947
16948 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16949 : volatile so that the compiler has to store it out to memory.
16950 if test X"$d_volatile" = X"$define"; then
16951         volatile=volatile
16952 fi
16953 $cat <<EOP >try.c
16954 #include <stdio.h>
16955 #$i_stdlib I_STDLIB
16956 #ifdef I_STDLIB
16957 #include <stdlib.h>
16958 #endif
16959 #$i_string I_STRING
16960 #ifdef I_STRING
16961 #  include <string.h>
16962 #else
16963 #  include <strings.h>
16964 #endif
16965 #include <sys/types.h>
16966 #include <signal.h>
16967 #ifdef SIGFPE
16968 $volatile int bletched = 0;
16969 $signal_t blech(int s) { bletched = 1; }
16970 #endif
16971
16972 int checkit($nvtype d, char *where) {
16973     unsigned char *p = (char *)&d;
16974     unsigned char *end = p + sizeof(d);
16975     int fail = 0;
16976
16977     while (p < end)
16978         fail += *p++;
16979
16980     if (!fail)
16981         return 0;
16982
16983     p = (char *)&d;
16984     printf("No - %s: 0x", where);
16985     while (p < end)
16986         printf ("%02X", *p++);
16987     printf("\n");
16988     return 1;
16989 }
16990
16991 int main(int argc, char **argv) {
16992     $nvtype d = 0.0;
16993     int fail = 0;
16994     fail += checkit(d, "0.0");
16995
16996     /* The compiler shouldn't be assuming that bletched is 0  */
16997     d = bletched;
16998
16999     fail += checkit(d, "bleched");
17000
17001 #ifdef SIGFPE
17002     signal(SIGFPE, blech);
17003 #endif
17004
17005     /* Paranoia - the compiler should have no way of knowing that ANSI says
17006        that argv[argc] will always be NULL.  Actually, if it did assume this it
17007        would be buggy, as this is C and main() can be called from elsewhere in
17008        the program.  */
17009     d = argv[argc] ? 1 : 0;
17010
17011     if (d) {
17012         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17013     }
17014
17015     fail += checkit(d, "ternary");
17016
17017     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17018
17019     if (d != 0.0) {
17020         printf("No - memset doesn't give 0.0\n");
17021         /* This might just blow up:  */
17022         printf("(gives %g)\n", d);
17023         return 1;
17024     }
17025
17026 #ifdef SIGFPE
17027     if (bletched) {
17028         printf("No - something bleched\n");
17029         return 1;
17030     }
17031 #endif
17032     if (fail) {
17033       printf("No - %d fail(s)\n", fail);
17034       return 1;
17035     }
17036     printf("Yes\n");
17037     return 0;
17038 }
17039 EOP
17040 set try
17041
17042 d_nv_zero_is_allbits_zero="$undef"
17043 if eval $compile; then
17044     xxx="`$run ./try`"
17045     case "$?" in
17046         0)
17047             case "$xxx" in
17048                 Yes)  cat >&4 <<EOM
17049 0.0 is represented as all bits zero in memory
17050 EOM
17051                     d_nv_zero_is_allbits_zero="$define"
17052                     ;;
17053                 *)  cat >&4 <<EOM
17054 0.0 is not represented as all bits zero in memory
17055 EOM
17056                     d_nv_zero_is_allbits_zero="$undef"
17057                     ;;
17058             esac
17059             ;;
17060         *)  cat >&4 <<EOM
17061 0.0 is not represented as all bits zero in memory
17062 EOM
17063             d_nv_zero_is_allbits_zero="$undef"
17064             ;;
17065     esac
17066 fi
17067 $rm_try
17068
17069 : check for off64_t
17070 echo " "
17071 echo "Checking to see if you have off64_t..." >&4
17072 $cat >try.c <<EOCP
17073 #include <sys/types.h>
17074 #include <unistd.h>
17075 int main() { off64_t x = 7; }
17076 EOCP
17077 set try
17078 if eval $compile; then
17079         val="$define"
17080         echo "You have off64_t."
17081 else
17082         val="$undef"
17083         echo "You do not have off64_t."
17084         case "$lseeksize" in
17085         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17086         esac
17087 fi
17088 $rm_try
17089 set d_off64_t
17090 eval $setvar
17091
17092 : how to create joinable pthreads
17093 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17094         echo " "
17095         echo "Checking what constant to use for creating joinable pthreads..." >&4
17096         $cat >try.c <<'EOCP'
17097 #include <pthread.h>
17098 int main() {
17099     int detachstate = JOINABLE;
17100 }
17101 EOCP
17102         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17103         if eval $compile; then
17104                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17105                 val="$undef" # Yes, undef.
17106                 set d_old_pthread_create_joinable
17107                 eval $setvar
17108                 val=""
17109                 set old_pthread_create_joinable
17110                 eval $setvar
17111         else
17112                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17113                 if eval $compile; then
17114                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17115                         val="$define"
17116                         set d_old_pthread_create_joinable
17117                         eval $setvar
17118                         val=PTHREAD_CREATE_UNDETACHED
17119                         set old_pthread_create_joinable
17120                         eval $setvar
17121                 else
17122                         set try -DJOINABLE=__UNDETACHED
17123                         if eval $compile; then
17124                                 echo "You seem to use __UNDETACHED." >&4
17125                                 val="$define"
17126                                 set d_old_pthread_create_joinable
17127                                 eval $setvar
17128                                 val=__UNDETACHED
17129                                 set old_pthread_create_joinable
17130                                 eval $setvar
17131                         else
17132                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17133                                 val="$define"
17134                                 set d_old_pthread_create_joinable
17135                                 eval $setvar
17136                                 val=0
17137                                 set old_pthread_create_joinable
17138                                 eval $setvar
17139                         fi
17140                 fi
17141         fi
17142         $rm_try
17143 else
17144     d_old_pthread_create_joinable="$undef"
17145     old_pthread_create_joinable=""
17146 fi
17147
17148 : see if pause exists
17149 set pause d_pause
17150 eval $inlibc
17151
17152 : see if poll exists
17153 set poll d_poll
17154 eval $inlibc
17155
17156 : see if prctl exists
17157 set prctl d_prctl
17158 eval $inlibc
17159
17160 : see if prctl supports PR_SET_NAME
17161 d_prctl_set_name=$undef
17162 case $d_prctl in
17163     $define)
17164         $cat >try.c <<EOM
17165 #ifdef __ANDROID__
17166 #include <unistd.h>
17167 #endif
17168 #include <sys/prctl.h>
17169
17170 int main (int argc, char *argv[])
17171 {
17172     return (prctl (PR_SET_NAME, "Test"));
17173     } /* main */
17174 EOM
17175         set try
17176         if eval $compile_ok && $run ./try; then
17177             echo "Your prctl (PR_SET_NAME, ...) works"
17178             d_prctl_set_name=$define
17179             fi
17180         $rm_try
17181         ;;
17182     esac
17183
17184 : see if readlink exists
17185 set readlink d_readlink
17186 eval $inlibc
17187
17188 : Check if there is a /proc symlink to the abs path of
17189 : the executing program.  We will honor hints of d_procselfexe=$undef
17190 : or procselfexe being non-empty, otherwise will try to determine both
17191 : if we have readlink.
17192 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17193 : referenced, and AmigaOS does not have a proc filesystem anyway.
17194 echo " "
17195 val="$undef"
17196 if $test "X$d_procselfexe" = Xundef; then
17197         procselfexe=''
17198 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17199         val="$define"
17200 elif $test "X$d_readlink" = Xdefine; then
17201         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17202         : and it feels more tidy to avoid an extra level of symlink
17203         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17204         while test $# -gt 0; do
17205             type=$1; try=$2
17206             shift; shift
17207             if $issymlink $try; then
17208                 $ls -l $try > reflect
17209                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17210                     echo "You have $type-like $try."
17211                     procselfexe='"'$try'"'
17212                     val="$define"
17213                     : This will break out of the loop
17214                     set X; shift
17215                 fi
17216             fi
17217         done
17218 fi
17219 $rm -f reflect
17220 set d_procselfexe
17221 eval $setvar
17222
17223 : backward compatibility for d_hvfork
17224 if test X$d_hvfork != X; then
17225         d_vfork="$d_hvfork"
17226         d_hvfork=''
17227 fi
17228 : see if there is a vfork
17229 val=''
17230 set vfork val
17231 eval $inlibc
17232
17233 d_pseudofork=$undef
17234
17235 : Ok, but do we want to use it. vfork is reportedly unreliable in
17236 : perl on Solaris 2.x, and probably elsewhere.
17237 case "$val" in
17238 $define)
17239         echo " "
17240         case "$usevfork" in
17241         false) dflt='n';;
17242         *) dflt='y';;
17243         esac
17244         cat <<'EOM'
17245
17246 Perl can only use a vfork() that doesn't suffer from strict
17247 restrictions on calling functions or modifying global data in
17248 the child.  For example, glibc-2.1 contains such a vfork()
17249 that is unsuitable.  If your system provides a proper fork()
17250 call, chances are that you do NOT want perl to use vfork().
17251
17252 EOM
17253         rp="Do you still want to use vfork()?"
17254         . ./myread
17255         case "$ans" in
17256         y|Y) ;;
17257         *)
17258                 echo "Ok, we won't use vfork()."
17259                 val="$undef"
17260                 ;;
17261         esac
17262         ;;
17263 esac
17264 set d_vfork
17265 eval $setvar
17266 case "$d_vfork" in
17267 $define) usevfork='true';;
17268 *) usevfork='false';;
17269 esac
17270
17271 : see whether the pthread_atfork exists
17272 $cat >try.c <<EOP
17273 #include <pthread.h>
17274 #include <stdio.h>
17275 int main() {
17276 #ifdef  PTHREAD_ATFORK
17277         pthread_atfork(NULL,NULL,NULL);
17278 #endif
17279 }
17280 EOP
17281
17282 : see if pthread_atfork exists
17283 set try -DPTHREAD_ATFORK
17284 if eval $compile; then
17285     val="$define"
17286 else
17287     val="$undef"
17288 fi
17289 case "$usethreads" in
17290 $define)
17291         case "$val" in
17292         $define) echo 'pthread_atfork found.' >&4        ;;
17293         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17294         esac
17295 esac
17296 set d_pthread_atfork
17297 eval $setvar
17298
17299 : see if pthread_attr_setscope exists
17300 set pthread_attr_setscope d_pthread_attr_setscope
17301 eval $inlibc
17302
17303 : see whether the various POSIXish _yields exist
17304 $cat >try.c <<EOP
17305 #include <pthread.h>
17306 #include <stdio.h>
17307 int main() {
17308 #ifdef SCHED_YIELD
17309         sched_yield();
17310 #else
17311 #ifdef PTHREAD_YIELD
17312         pthread_yield();
17313 #else
17314 #ifdef PTHREAD_YIELD_NULL
17315         pthread_yield(NULL);
17316 #endif
17317 #endif
17318 #endif
17319 }
17320 EOP
17321 : see if sched_yield exists
17322 set try -DSCHED_YIELD
17323 if eval $compile; then
17324     val="$define"
17325     sched_yield='sched_yield()'
17326 else
17327     val="$undef"
17328 fi
17329 case "$usethreads" in
17330 $define)
17331         case "$val" in
17332         $define) echo 'sched_yield() found.' >&4        ;;
17333         *)       echo 'sched_yield() NOT found.' >&4    ;;
17334         esac
17335 esac
17336 set d_sched_yield
17337 eval $setvar
17338
17339 : see if pthread_yield exists
17340 set try -DPTHREAD_YIELD
17341 if eval $compile; then
17342     val="$define"
17343     case "$sched_yield" in
17344     '') sched_yield='pthread_yield()' ;;
17345     esac
17346 else
17347     set try -DPTHREAD_YIELD_NULL
17348     if eval $compile; then
17349         val="$define"
17350         case "$sched_yield" in
17351         '') sched_yield='pthread_yield(NULL)' ;;
17352         esac
17353     else
17354         val="$undef"
17355     fi
17356 fi
17357 case "$usethreads" in
17358 $define)
17359         case "$val" in
17360         $define) echo 'pthread_yield() found.' >&4      ;;
17361         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17362         esac
17363         ;;
17364 esac
17365 set d_pthread_yield
17366 eval $setvar
17367 case "$sched_yield" in
17368 '') sched_yield=undef ;;
17369 esac
17370 $rm_try
17371
17372 : check for ptrdiff_t
17373 echo " "
17374 echo "Checking to see if you have ptrdiff_t..." >&4
17375 $cat >try.c <<EOCP
17376 #include <stddef.h>
17377 int main() { ptrdiff_t x = 7; }
17378 EOCP
17379 set try
17380 if eval $compile; then
17381         val="$define"
17382         echo "You have ptrdiff_t."
17383 else
17384         val="$undef"
17385         echo "You do not have ptrdiff_t."
17386 fi
17387 $rm_try
17388 set d_ptrdiff_t
17389 eval $setvar
17390
17391 : see if random_r exists
17392 set random_r d_random_r
17393 eval $inlibc
17394 case "$d_random_r" in
17395 "$define")
17396         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17397         case "$d_random_r_proto:$usethreads" in
17398         ":define")      d_random_r_proto=define
17399                 set d_random_r_proto random_r $hdrs
17400                 eval $hasproto ;;
17401         *)      ;;
17402         esac
17403         case "$d_random_r_proto" in
17404         define)
17405         case "$random_r_proto" in
17406         ''|0) try='int random_r(int*, struct random_data*);'
17407         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17408         esac
17409         case "$random_r_proto" in
17410         ''|0) try='int random_r(long*, struct random_data*);'
17411         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17412         esac
17413         case "$random_r_proto" in
17414         ''|0) try='int random_r(struct random_data*, int32_t*);'
17415         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17416         esac
17417         case "$random_r_proto" in
17418         ''|0)   d_random_r=undef
17419                 random_r_proto=0
17420                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17421         * )     case "$random_r_proto" in
17422                 REENTRANT_PROTO*) ;;
17423                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17424                 esac
17425                 echo "Prototype: $try" ;;
17426         esac
17427         ;;
17428         *)      case "$usethreads" in
17429                 define) echo "random_r has no prototype, not using it." >&4 ;;
17430                 esac
17431                 d_random_r=undef
17432                 random_r_proto=0
17433                 ;;
17434         esac
17435         ;;
17436 *)      random_r_proto=0
17437         ;;
17438 esac
17439
17440 : see if readdir and friends exist
17441 set readdir d_readdir
17442 eval $inlibc
17443 set seekdir d_seekdir
17444 eval $inlibc
17445 set telldir d_telldir
17446 eval $inlibc
17447 set rewinddir d_rewinddir
17448 eval $inlibc
17449
17450 : see if readdir64_r exists
17451 set readdir64_r d_readdir64_r
17452 eval $inlibc
17453 case "$d_readdir64_r" in
17454 "$define")
17455         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17456         case "$d_readdir64_r_proto:$usethreads" in
17457         ":define")      d_readdir64_r_proto=define
17458                 set d_readdir64_r_proto readdir64_r $hdrs
17459                 eval $hasproto ;;
17460         *)      ;;
17461         esac
17462         case "$d_readdir64_r_proto" in
17463         define)
17464         case "$readdir64_r_proto" in
17465         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17466         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17467         esac
17468         case "$readdir64_r_proto" in
17469         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17470         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17471         esac
17472         case "$readdir64_r_proto" in
17473         ''|0)   d_readdir64_r=undef
17474                 readdir64_r_proto=0
17475                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17476         * )     case "$readdir64_r_proto" in
17477                 REENTRANT_PROTO*) ;;
17478                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17479                 esac
17480                 echo "Prototype: $try" ;;
17481         esac
17482         ;;
17483         *)      case "$usethreads" in
17484                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17485                 esac
17486                 d_readdir64_r=undef
17487                 readdir64_r_proto=0
17488                 ;;
17489         esac
17490         ;;
17491 *)      readdir64_r_proto=0
17492         ;;
17493 esac
17494
17495 : see if readdir_r exists
17496 set readdir_r d_readdir_r
17497 eval $inlibc
17498 case "$d_readdir_r" in
17499 "$define")
17500         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17501         case "$d_readdir_r_proto:$usethreads" in
17502         ":define")      d_readdir_r_proto=define
17503                 set d_readdir_r_proto readdir_r $hdrs
17504                 eval $hasproto ;;
17505         *)      ;;
17506         esac
17507         case "$d_readdir_r_proto" in
17508         define)
17509         case "$readdir_r_proto" in
17510         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17511         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17512         esac
17513         case "$readdir_r_proto" in
17514         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17515         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17516         esac
17517         case "$readdir_r_proto" in
17518         ''|0)   d_readdir_r=undef
17519                 readdir_r_proto=0
17520                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17521         * )     case "$readdir_r_proto" in
17522                 REENTRANT_PROTO*) ;;
17523                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17524                 esac
17525                 echo "Prototype: $try" ;;
17526         esac
17527         ;;
17528         *)      case "$usethreads" in
17529                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17530                 esac
17531                 d_readdir_r=undef
17532                 readdir_r_proto=0
17533                 ;;
17534         esac
17535         ;;
17536 *)      readdir_r_proto=0
17537         ;;
17538 esac
17539
17540 : see if readv exists
17541 set readv d_readv
17542 eval $inlibc
17543
17544 : see if recvmsg exists
17545 set recvmsg d_recvmsg
17546 eval $inlibc
17547
17548 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17549 echo " "
17550 if set regcomp val -f d_regcomp; eval $csym; $val; then
17551         echo 'regcomp() found.' >&4
17552         d_regcomp="$define"
17553         d_regcmp="$undef"
17554         d_re_comp="$undef"
17555 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17556         echo 'regcmp() found.' >&4
17557         d_regcmp="$define"
17558         d_regcomp="$undef"
17559         d_re_comp="$undef"
17560 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17561         echo 're_comp() found, assuming re_exec() also exists.' >&4
17562         d_re_comp="$define"
17563         d_regcomp="$undef"
17564         d_regcmp="$undef"
17565 else
17566         $cat >&4 <<EOM
17567 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17568 EOM
17569         d_regcmp="$undef"
17570         d_re_comp="$undef"
17571         d_regcomp="$undef"
17572 fi
17573
17574 : see if remainder exists
17575 set remainder d_remainder
17576 eval $inlibc
17577
17578 : see if remquo exists
17579 set remquo d_remquo
17580 eval $inlibc
17581
17582 : see if rename exists
17583 set rename d_rename
17584 eval $inlibc
17585
17586 : see if rint exists
17587 set rint d_rint
17588 eval $inlibc
17589
17590 : see if rmdir exists
17591 set rmdir d_rmdir
17592 eval $inlibc
17593
17594 : see if round exists
17595 set round d_round
17596 eval $inlibc
17597
17598 : see if memory.h is available.
17599 val=''
17600 set memory.h val
17601 eval $inhdr
17602
17603 : See if it conflicts with string.h
17604 case "$val" in
17605 $define)
17606         case "$strings" in
17607         '') ;;
17608         *)
17609                 $cppstdin $cppflags $cppminus < $strings > mem.h
17610                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17611                         echo " "
17612                         echo "We won't be including <memory.h>."
17613                         val="$undef"
17614                 fi
17615                 $rm -f mem.h
17616                 ;;
17617         esac
17618 esac
17619 set i_memory
17620 eval $setvar
17621
17622 : can bcopy handle overlapping blocks?
17623 echo " "
17624 val="$undef"
17625 case "$d_memmove" in
17626 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17627 *)      case "$d_bcopy" in
17628         "$define")
17629                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17630                 $cat >try.c <<EOCP
17631 #$i_memory I_MEMORY
17632 #$i_stdlib I_STDLIB
17633 #$i_string I_STRING
17634 #$i_unistd I_UNISTD
17635 EOCP
17636         $cat >>try.c <<'EOCP'
17637 #include <stdio.h>
17638 #ifdef I_MEMORY
17639 #  include <memory.h>
17640 #endif
17641 #ifdef I_STDLIB
17642 #  include <stdlib.h>
17643 #endif
17644 #ifdef I_STRING
17645 #  include <string.h>
17646 #else
17647 #  include <strings.h>
17648 #endif
17649 #ifdef I_UNISTD
17650 #  include <unistd.h>  /* Needed for NetBSD */
17651 #endif
17652 int main()
17653 {
17654 char buf[128], abc[128];
17655 char *b;
17656 int len;
17657 int off;
17658 int align;
17659
17660 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17661    try to store the string in read-only memory. */
17662 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17663
17664 for (align = 7; align >= 0; align--) {
17665         for (len = 36; len; len--) {
17666                 b = buf+align;
17667                 bcopy(abc, b, len);
17668                 for (off = 1; off <= len; off++) {
17669                         bcopy(b, b+off, len);
17670                         bcopy(b+off, b, len);
17671                         if (bcmp(b, abc, len))
17672                                 exit(1);
17673                 }
17674         }
17675 }
17676 exit(0);
17677 }
17678 EOCP
17679                 set try
17680                 if eval $compile_ok; then
17681                         if $run ./try 2>/dev/null; then
17682                                 echo "Yes, it can."
17683                                 val="$define"
17684                         else
17685                                 echo "It can't, sorry."
17686                         fi
17687                 else
17688                         echo "(I can't compile the test program, so we'll assume not...)"
17689                 fi
17690                 ;;
17691         esac
17692         $rm_try
17693         ;;
17694 esac
17695 set d_safebcpy
17696 eval $setvar
17697
17698 : can memcpy handle overlapping blocks?
17699 echo " "
17700 val="$undef"
17701 case "$d_memmove" in
17702 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17703 *)      case "$d_memcpy" in
17704         "$define")
17705                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17706                 $cat >try.c <<EOCP
17707 #$i_memory I_MEMORY
17708 #$i_stdlib I_STDLIB
17709 #$i_string I_STRING
17710 #$i_unistd I_UNISTD
17711 EOCP
17712         $cat >>try.c <<'EOCP'
17713 #include <stdio.h>
17714 #ifdef I_MEMORY
17715 #  include <memory.h>
17716 #endif
17717 #ifdef I_STDLIB
17718 #  include <stdlib.h>
17719 #endif
17720 #ifdef I_STRING
17721 #  include <string.h>
17722 #else
17723 #  include <strings.h>
17724 #endif
17725 #ifdef I_UNISTD
17726 #  include <unistd.h>  /* Needed for NetBSD */
17727 #endif
17728 int main()
17729 {
17730 char buf[128], abc[128];
17731 char *b;
17732 int len;
17733 int off;
17734 int align;
17735
17736 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17737    try to store the string in read-only memory. */
17738 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17739
17740 for (align = 7; align >= 0; align--) {
17741         for (len = 36; len; len--) {
17742                 b = buf+align;
17743                 memcpy(b, abc, len);
17744                 for (off = 1; off <= len; off++) {
17745                         memcpy(b+off, b, len);
17746                         memcpy(b, b+off, len);
17747                         if (memcmp(b, abc, len))
17748                                 exit(1);
17749                 }
17750         }
17751 }
17752 exit(0);
17753 }
17754 EOCP
17755                 set try
17756                 if eval $compile_ok; then
17757                         if $run ./try 2>/dev/null; then
17758                                 echo "Yes, it can."
17759                                 val="$define"
17760                         else
17761                                 echo "It can't, sorry."
17762                         fi
17763                 else
17764                         echo "(I can't compile the test program, so we'll assume not...)"
17765                 fi
17766                 ;;
17767         esac
17768         $rm_try
17769         ;;
17770 esac
17771 set d_safemcpy
17772 eval $setvar
17773
17774 : can memcmp be trusted to compare relative magnitude?
17775 val="$undef"
17776 case "$d_memcmp" in
17777 "$define")
17778         echo " "
17779         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17780         $cat >try.c <<EOCP
17781 #$i_memory I_MEMORY
17782 #$i_stdlib I_STDLIB
17783 #$i_string I_STRING
17784 #$i_unistd I_UNISTD
17785 EOCP
17786         $cat >>try.c <<'EOCP'
17787 #include <stdio.h>
17788 #ifdef I_MEMORY
17789 #  include <memory.h>
17790 #endif
17791 #ifdef I_STDLIB
17792 #  include <stdlib.h>
17793 #endif
17794 #ifdef I_STRING
17795 #  include <string.h>
17796 #else
17797 #  include <strings.h>
17798 #endif
17799 #ifdef I_UNISTD
17800 #  include <unistd.h>  /* Needed for NetBSD */
17801 #endif
17802 int main()
17803 {
17804 char a = -1;
17805 char b = 0;
17806 if ((a < b) && memcmp(&a, &b, 1) < 0)
17807         exit(1);
17808 exit(0);
17809 }
17810 EOCP
17811         set try
17812         if eval $compile_ok; then
17813                 if $run ./try 2>/dev/null; then
17814                         echo "Yes, it can."
17815                         val="$define"
17816                 else
17817                         echo "No, it can't (it uses signed chars)."
17818                 fi
17819         else
17820                 echo "(I can't compile the test program, so we'll assume not...)"
17821         fi
17822         ;;
17823 esac
17824 $rm_try
17825 set d_sanemcmp
17826 eval $setvar
17827
17828 : see if prototype for sbrk is available
17829 echo " "
17830 set d_sbrkproto sbrk $i_unistd unistd.h
17831 eval $hasproto
17832
17833 : see if scalbn exists
17834 set scalbn d_scalbn
17835 eval $inlibc
17836
17837 : see if select exists
17838 set select d_select
17839 eval $inlibc
17840
17841 : see if semctl exists
17842 set semctl d_semctl
17843 eval $inlibc
17844
17845 : see if semget exists
17846 set semget d_semget
17847 eval $inlibc
17848
17849 : see if semop exists
17850 set semop d_semop
17851 eval $inlibc
17852
17853 : see how much of the 'sem*(2)' library is present.
17854 h_sem=true
17855 echo " "
17856 case "$d_semctl$d_semget$d_semop" in
17857 *"$undef"*) h_sem=false;;
17858 esac
17859 case "$osname" in
17860 freebsd)
17861     case "`ipcs 2>&1`" in
17862     "SVID messages"*"not configured"*)
17863         echo "Your $osname does not have the sem*(2) configured." >&4
17864         h_sem=false
17865         val="$undef"
17866         set semctl d_semctl
17867         eval $setvar
17868         set semget d_semget
17869         eval $setvar
17870         set semop d_semop
17871         eval $setvar
17872         ;;
17873     esac
17874     ;;
17875 esac
17876 : we could also check for sys/ipc.h ...
17877 if $h_sem && $test `./findhdr sys/sem.h`; then
17878         echo "You have the full sem*(2) library." >&4
17879         val="$define"
17880 else
17881         echo "You don't have the full sem*(2) library." >&4
17882         val="$undef"
17883 fi
17884 set d_sem
17885 eval $setvar
17886
17887 : see whether sys/sem.h defines union semun
17888 echo " "
17889 $cat > try.c <<'END'
17890 #include <sys/types.h>
17891 #include <sys/ipc.h>
17892 #include <sys/sem.h>
17893 int main () { union semun semun; semun.buf = 0; }
17894 END
17895 set try
17896 if eval $compile; then
17897     echo "You have union semun in <sys/sem.h>." >&4
17898     val="$define"
17899 else
17900     echo "You do not have union semun in <sys/sem.h>." >&4
17901     val="$undef"
17902 fi
17903 $rm_try
17904 set d_union_semun
17905 eval $setvar
17906
17907 : see how to do semctl IPC_STAT
17908 case "$d_sem" in
17909 $define)
17910     echo " "
17911     $cat > tryh.h <<END
17912 #ifndef S_IRUSR
17913 #   ifdef S_IREAD
17914 #       define S_IRUSR S_IREAD
17915 #       define S_IWUSR S_IWRITE
17916 #       define S_IXUSR S_IEXEC
17917 #   else
17918 #       define S_IRUSR 0400
17919 #       define S_IWUSR 0200
17920 #       define S_IXUSR 0100
17921 #   endif
17922 #   define S_IRGRP (S_IRUSR>>3)
17923 #   define S_IWGRP (S_IWUSR>>3)
17924 #   define S_IXGRP (S_IXUSR>>3)
17925 #   define S_IROTH (S_IRUSR>>6)
17926 #   define S_IWOTH (S_IWUSR>>6)
17927 #   define S_IXOTH (S_IXUSR>>6)
17928 #endif
17929 #ifndef S_IRWXU
17930 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17931 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17932 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17933 #endif
17934 END
17935     : see whether semctl IPC_STAT can use union semun
17936     case "$d_semctl_semun" in
17937     '')
17938       val="$undef"
17939       $cat > try.c <<END
17940 #include <sys/types.h>
17941 #include <sys/ipc.h>
17942 #include <sys/sem.h>
17943 #include <sys/stat.h>
17944 #include <stdio.h>
17945 #include <errno.h>
17946 #include "tryh.h"
17947 #ifndef errno
17948 extern int errno;
17949 #endif
17950 #$d_union_semun HAS_UNION_SEMUN
17951 int main() {
17952     union semun
17953 #ifndef HAS_UNION_SEMUN
17954     {
17955         int val;
17956         struct semid_ds *buf;
17957         unsigned short *array;
17958     }
17959 #endif
17960     arg;
17961     int sem, st;
17962
17963 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17964     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17965     if (sem > -1) {
17966         struct semid_ds argbuf;
17967         arg.buf = &argbuf;
17968 #       ifdef IPC_STAT
17969         st = semctl(sem, 0, IPC_STAT, arg);
17970         if (st == 0)
17971             printf("semun\n");
17972         else
17973 #       endif /* IPC_STAT */
17974             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17975 #       ifdef IPC_RMID
17976         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17977 #       endif /* IPC_RMID */
17978             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17979     } else
17980 #endif /* IPC_PRIVATE && ... */
17981         printf("semget failed: errno = %d\n", errno);
17982   return 0;
17983 }
17984 END
17985       set try
17986       if eval $compile; then
17987           xxx=`$run ./try`
17988           case "$xxx" in
17989           semun) val="$define" ;;
17990           esac
17991       fi
17992       $rm_try
17993       set d_semctl_semun
17994       eval $setvar
17995       ;;
17996     esac
17997     case "$d_semctl_semun" in
17998     $define)
17999         echo "You can use union semun for semctl IPC_STAT." >&4
18000         also='also'
18001         ;;
18002     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
18003         also=''
18004         ;;
18005     esac
18006
18007     : see whether semctl IPC_STAT can use struct semid_ds pointer
18008     case "$d_semctl_semid_ds" in
18009     '')
18010       val="$undef"
18011       $cat > try.c <<'END'
18012 #include <sys/types.h>
18013 #include <sys/ipc.h>
18014 #include <sys/sem.h>
18015 #include <sys/stat.h>
18016 #include "tryh.h"
18017 #include <stdio.h>
18018 #include <errno.h>
18019 #ifndef errno
18020 extern int errno;
18021 #endif
18022 int main() {
18023     struct semid_ds arg;
18024     int sem, st;
18025
18026 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18027     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18028     if (sem > -1) {
18029 #       ifdef IPC_STAT
18030         st = semctl(sem, 0, IPC_STAT, &arg);
18031         if (st == 0)
18032             printf("semid_ds\n");
18033         else
18034 #       endif /* IPC_STAT */
18035             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18036 #       ifdef IPC_RMID
18037         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18038 #       endif /* IPC_RMID */
18039             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18040     } else
18041 #endif /* IPC_PRIVATE && ... */
18042         printf("semget failed: errno = %d\n", errno);
18043
18044     return 0;
18045 }
18046 END
18047       set try
18048       if eval $compile; then
18049           xxx=`$run ./try`
18050           case "$xxx" in
18051           semid_ds) val="$define" ;;
18052           esac
18053       fi
18054       $rm_try
18055       set d_semctl_semid_ds
18056       eval $setvar
18057       ;;
18058     esac
18059     case "$d_semctl_semid_ds" in
18060     $define)
18061         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18062         ;;
18063     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18064         ;;
18065     esac
18066     ;;
18067 *)  val="$undef"
18068
18069     # We do not have the full sem*(2) library, so assume we can not
18070     # use either.
18071
18072     set d_semctl_semun
18073     eval $setvar
18074
18075     set d_semctl_semid_ds
18076     eval $setvar
18077     ;;
18078 esac
18079 $rm_try tryh.h
18080
18081 : see if sendmsg exists
18082 set sendmsg d_sendmsg
18083 eval $inlibc
18084
18085 : see if setegid exists
18086 set setegid d_setegid
18087 eval $inlibc
18088
18089 : see if seteuid exists
18090 set seteuid d_seteuid
18091 eval $inlibc
18092
18093 : see if setgrent exists
18094 set setgrent d_setgrent
18095 eval $inlibc
18096
18097 : see if setgrent_r exists
18098 set setgrent_r d_setgrent_r
18099 eval $inlibc
18100 case "$d_setgrent_r" in
18101 "$define")
18102         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18103         case "$d_setgrent_r_proto:$usethreads" in
18104         ":define")      d_setgrent_r_proto=define
18105                 set d_setgrent_r_proto setgrent_r $hdrs
18106                 eval $hasproto ;;
18107         *)      ;;
18108         esac
18109         case "$d_setgrent_r_proto" in
18110         define)
18111         case "$setgrent_r_proto" in
18112         ''|0) try='int setgrent_r(FILE**);'
18113         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18114         esac
18115         case "$setgrent_r_proto" in
18116         ''|0) try='void setgrent_r(FILE**);'
18117         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18118         esac
18119         case "$setgrent_r_proto" in
18120         ''|0)   d_setgrent_r=undef
18121                 setgrent_r_proto=0
18122                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18123         * )     case "$setgrent_r_proto" in
18124                 REENTRANT_PROTO*) ;;
18125                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18126                 esac
18127                 echo "Prototype: $try" ;;
18128         esac
18129         ;;
18130         *)      case "$usethreads" in
18131                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18132                 esac
18133                 d_setgrent_r=undef
18134                 setgrent_r_proto=0
18135                 ;;
18136         esac
18137         ;;
18138 *)      setgrent_r_proto=0
18139         ;;
18140 esac
18141
18142 : see if sethostent exists
18143 set sethostent d_sethent
18144 eval $inlibc
18145
18146 : see if sethostent_r exists
18147 set sethostent_r d_sethostent_r
18148 eval $inlibc
18149 case "$d_sethostent_r" in
18150 "$define")
18151         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18152         case "$d_sethostent_r_proto:$usethreads" in
18153         ":define")      d_sethostent_r_proto=define
18154                 set d_sethostent_r_proto sethostent_r $hdrs
18155                 eval $hasproto ;;
18156         *)      ;;
18157         esac
18158         case "$d_sethostent_r_proto" in
18159         define)
18160         case "$sethostent_r_proto" in
18161         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18162         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18163         esac
18164         case "$sethostent_r_proto" in
18165         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18166         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18167         esac
18168         case "$sethostent_r_proto" in
18169         ''|0)   d_sethostent_r=undef
18170                 sethostent_r_proto=0
18171                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18172         * )     case "$sethostent_r_proto" in
18173                 REENTRANT_PROTO*) ;;
18174                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18175                 esac
18176                 echo "Prototype: $try" ;;
18177         esac
18178         ;;
18179         *)      case "$usethreads" in
18180                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18181                 esac
18182                 d_sethostent_r=undef
18183                 sethostent_r_proto=0
18184                 ;;
18185         esac
18186         ;;
18187 *)      sethostent_r_proto=0
18188         ;;
18189 esac
18190
18191 : see if setitimer exists
18192 set setitimer d_setitimer
18193 eval $inlibc
18194
18195 : see if setlinebuf exists
18196 set setlinebuf d_setlinebuf
18197 eval $inlibc
18198
18199 : see if setlocale exists
18200 set setlocale d_setlocale
18201 eval $inlibc
18202
18203 : see if locale.h is available
18204 set locale.h i_locale
18205 eval $inhdr
18206
18207 : see if setlocale_r exists
18208 set setlocale_r d_setlocale_r
18209 eval $inlibc
18210 case "$d_setlocale_r" in
18211 "$define")
18212         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18213         case "$d_setlocale_r_proto:$usethreads" in
18214         ":define")      d_setlocale_r_proto=define
18215                 set d_setlocale_r_proto setlocale_r $hdrs
18216                 eval $hasproto ;;
18217         *)      ;;
18218         esac
18219         case "$d_setlocale_r_proto" in
18220         define)
18221         case "$setlocale_r_proto" in
18222         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18223         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18224         esac
18225         case "$setlocale_r_proto" in
18226         ''|0)   d_setlocale_r=undef
18227                 setlocale_r_proto=0
18228                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18229         * )     case "$setlocale_r_proto" in
18230                 REENTRANT_PROTO*) ;;
18231                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18232                 esac
18233                 echo "Prototype: $try" ;;
18234         esac
18235         ;;
18236         *)      case "$usethreads" in
18237                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18238                 esac
18239                 d_setlocale_r=undef
18240                 setlocale_r_proto=0
18241                 ;;
18242         esac
18243         ;;
18244 *)      setlocale_r_proto=0
18245         ;;
18246 esac
18247
18248 : see if setnetent exists
18249 set setnetent d_setnent
18250 eval $inlibc
18251
18252 : see if setnetent_r exists
18253 set setnetent_r d_setnetent_r
18254 eval $inlibc
18255 case "$d_setnetent_r" in
18256 "$define")
18257         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18258         case "$d_setnetent_r_proto:$usethreads" in
18259         ":define")      d_setnetent_r_proto=define
18260                 set d_setnetent_r_proto setnetent_r $hdrs
18261                 eval $hasproto ;;
18262         *)      ;;
18263         esac
18264         case "$d_setnetent_r_proto" in
18265         define)
18266         case "$setnetent_r_proto" in
18267         ''|0) try='int setnetent_r(int, struct netent_data*);'
18268         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18269         esac
18270         case "$setnetent_r_proto" in
18271         ''|0) try='void setnetent_r(int, struct netent_data*);'
18272         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18273         esac
18274         case "$setnetent_r_proto" in
18275         ''|0)   d_setnetent_r=undef
18276                 setnetent_r_proto=0
18277                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18278         * )     case "$setnetent_r_proto" in
18279                 REENTRANT_PROTO*) ;;
18280                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18281                 esac
18282                 echo "Prototype: $try" ;;
18283         esac
18284         ;;
18285         *)      case "$usethreads" in
18286                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18287                 esac
18288                 d_setnetent_r=undef
18289                 setnetent_r_proto=0
18290                 ;;
18291         esac
18292         ;;
18293 *)      setnetent_r_proto=0
18294         ;;
18295 esac
18296
18297 : see if setprotoent exists
18298 set setprotoent d_setpent
18299 eval $inlibc
18300
18301 : see if setpgid exists
18302 set setpgid d_setpgid
18303 eval $inlibc
18304
18305 : see if setpgrp2 exists
18306 set setpgrp2 d_setpgrp2
18307 eval $inlibc
18308
18309 : see if setpriority exists
18310 set setpriority d_setprior
18311 eval $inlibc
18312
18313 : see if setproctitle exists
18314 set setproctitle d_setproctitle
18315 eval $inlibc
18316
18317 : see if setprotoent_r exists
18318 set setprotoent_r d_setprotoent_r
18319 eval $inlibc
18320 case "$d_setprotoent_r" in
18321 "$define")
18322         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18323         case "$d_setprotoent_r_proto:$usethreads" in
18324         ":define")      d_setprotoent_r_proto=define
18325                 set d_setprotoent_r_proto setprotoent_r $hdrs
18326                 eval $hasproto ;;
18327         *)      ;;
18328         esac
18329         case "$d_setprotoent_r_proto" in
18330         define)
18331         case "$setprotoent_r_proto" in
18332         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18333         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18334         esac
18335         case "$setprotoent_r_proto" in
18336         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18337         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18338         esac
18339         case "$setprotoent_r_proto" in
18340         ''|0)   d_setprotoent_r=undef
18341                 setprotoent_r_proto=0
18342                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18343         * )     case "$setprotoent_r_proto" in
18344                 REENTRANT_PROTO*) ;;
18345                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18346                 esac
18347                 echo "Prototype: $try" ;;
18348         esac
18349         ;;
18350         *)      case "$usethreads" in
18351                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18352                 esac
18353                 d_setprotoent_r=undef
18354                 setprotoent_r_proto=0
18355                 ;;
18356         esac
18357         ;;
18358 *)      setprotoent_r_proto=0
18359         ;;
18360 esac
18361
18362 : see if setpwent exists
18363 set setpwent d_setpwent
18364 eval $inlibc
18365
18366 : see if setpwent_r exists
18367 set setpwent_r d_setpwent_r
18368 eval $inlibc
18369 case "$d_setpwent_r" in
18370 "$define")
18371         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18372         case "$d_setpwent_r_proto:$usethreads" in
18373         ":define")      d_setpwent_r_proto=define
18374                 set d_setpwent_r_proto setpwent_r $hdrs
18375                 eval $hasproto ;;
18376         *)      ;;
18377         esac
18378         case "$d_setpwent_r_proto" in
18379         define)
18380         case "$setpwent_r_proto" in
18381         ''|0) try='int setpwent_r(FILE**);'
18382         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18383         esac
18384         case "$setpwent_r_proto" in
18385         ''|0) try='void setpwent_r(FILE**);'
18386         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18387         esac
18388         case "$setpwent_r_proto" in
18389         ''|0)   d_setpwent_r=undef
18390                 setpwent_r_proto=0
18391                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18392         * )     case "$setpwent_r_proto" in
18393                 REENTRANT_PROTO*) ;;
18394                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18395                 esac
18396                 echo "Prototype: $try" ;;
18397         esac
18398         ;;
18399         *)      case "$usethreads" in
18400                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18401                 esac
18402                 d_setpwent_r=undef
18403                 setpwent_r_proto=0
18404                 ;;
18405         esac
18406         ;;
18407 *)      setpwent_r_proto=0
18408         ;;
18409 esac
18410
18411 : see if setregid exists
18412 set setregid d_setregid
18413 eval $inlibc
18414 set setresgid d_setresgid
18415 eval $inlibc
18416
18417 : see if setreuid exists
18418 set setreuid d_setreuid
18419 eval $inlibc
18420 set setresuid d_setresuid
18421 eval $inlibc
18422
18423 : see if setrgid exists
18424 set setrgid d_setrgid
18425 eval $inlibc
18426
18427 : see if setruid exists
18428 set setruid d_setruid
18429 eval $inlibc
18430
18431 : see if setservent exists
18432 set setservent d_setsent
18433 eval $inlibc
18434
18435 : see if setservent_r exists
18436 set setservent_r d_setservent_r
18437 eval $inlibc
18438 case "$d_setservent_r" in
18439 "$define")
18440         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18441         case "$d_setservent_r_proto:$usethreads" in
18442         ":define")      d_setservent_r_proto=define
18443                 set d_setservent_r_proto setservent_r $hdrs
18444                 eval $hasproto ;;
18445         *)      ;;
18446         esac
18447         case "$d_setservent_r_proto" in
18448         define)
18449         case "$setservent_r_proto" in
18450         ''|0) try='int setservent_r(int, struct servent_data*);'
18451         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18452         esac
18453         case "$setservent_r_proto" in
18454         ''|0) try='void setservent_r(int, struct servent_data*);'
18455         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18456         esac
18457         case "$setservent_r_proto" in
18458         ''|0)   d_setservent_r=undef
18459                 setservent_r_proto=0
18460                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18461         * )     case "$setservent_r_proto" in
18462                 REENTRANT_PROTO*) ;;
18463                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18464                 esac
18465                 echo "Prototype: $try" ;;
18466         esac
18467         ;;
18468         *)      case "$usethreads" in
18469                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18470                 esac
18471                 d_setservent_r=undef
18472                 setservent_r_proto=0
18473                 ;;
18474         esac
18475         ;;
18476 *)      setservent_r_proto=0
18477         ;;
18478 esac
18479
18480 : see if setsid exists
18481 set setsid d_setsid
18482 eval $inlibc
18483
18484 : see if setvbuf exists
18485 set setvbuf d_setvbuf
18486 eval $inlibc
18487
18488 : see if shmctl exists
18489 set shmctl d_shmctl
18490 eval $inlibc
18491
18492 : see if shmget exists
18493 set shmget d_shmget
18494 eval $inlibc
18495
18496 : see if shmat exists
18497 set shmat d_shmat
18498 eval $inlibc
18499 : see what shmat returns
18500 case "$d_shmat" in
18501 "$define")
18502         $cat >shmat.c <<'END'
18503 #include <sys/shm.h>
18504 void *shmat();
18505 END
18506         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18507                 shmattype='void *'
18508         else
18509                 shmattype='char *'
18510         fi
18511         echo "and it returns ($shmattype)." >&4
18512         : see if a prototype for shmat is available
18513         xxx=`./findhdr sys/shm.h`
18514         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18515         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18516                 val="$define"
18517         else
18518                 val="$undef"
18519         fi
18520         $rm -f shmat.[co]
18521         ;;
18522 *)
18523         val="$undef"
18524         ;;
18525 esac
18526 set d_shmatprototype
18527 eval $setvar
18528
18529 : see if shmdt exists
18530 set shmdt d_shmdt
18531 eval $inlibc
18532
18533 : see how much of the 'shm*(2)' library is present.
18534 h_shm=true
18535 echo " "
18536 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18537 *"$undef"*) h_shm=false;;
18538 esac
18539 case "$osname" in
18540 freebsd)
18541     case "`ipcs 2>&1`" in
18542     "SVID shared memory"*"not configured"*)
18543         echo "Your $osname does not have the shm*(2) configured." >&4
18544         h_shm=false
18545         val="$undef"
18546         set shmctl d_shmctl
18547         eval $setvar
18548         set shmget d_shmget
18549         eval $setvar
18550         set shmat d_shmat
18551         eval $setvar
18552         set shmdt d_shmdt
18553         eval $setvar
18554         ;;
18555     esac
18556     ;;
18557 esac
18558 : we could also check for sys/ipc.h ...
18559 if $h_shm && $test `./findhdr sys/shm.h`; then
18560         echo "You have the full shm*(2) library." >&4
18561         val="$define"
18562 else
18563         echo "You don't have the full shm*(2) library." >&4
18564         val="$undef"
18565 fi
18566 set d_shm
18567 eval $setvar
18568
18569 : see if we have sigaction
18570 echo " "
18571 if set sigaction val -f d_sigaction; eval $csym; $val; then
18572         echo 'sigaction() found.' >&4
18573         $cat > try.c <<EOP
18574 #include <stdio.h>
18575 #include <sys/types.h>
18576 #include <signal.h>
18577 #$i_stdlib I_STDLIB
18578 #ifdef I_STDLIB
18579 #include <stdlib.h>
18580 #endif
18581 int main()
18582 {
18583     struct sigaction act, oact;
18584     act.sa_flags = 0;
18585     oact.sa_handler = 0;
18586     /* so that act and oact are used */
18587     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18588 }
18589 EOP
18590         set try
18591         if eval $compile_ok; then
18592                 val="$define"
18593         else
18594                 echo "But you don't seem to have a usable struct sigaction." >&4
18595                 val="$undef"
18596         fi
18597 else
18598         echo 'sigaction NOT found.' >&4
18599         val="$undef"
18600 fi
18601 set d_sigaction; eval $setvar
18602 $rm_try
18603
18604 : see if this is a sunmath.h system
18605 set sunmath.h i_sunmath
18606 eval $inhdr
18607
18608 : see if signbit exists
18609 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18610 $cat >try.c <<EOCP
18611 #$i_math I_MATH
18612 #$i_sunmath I_SUNMATH
18613 #ifdef I_MATH
18614 #  include <math.h>
18615 #endif
18616 #ifdef I_SUNMATH  /* Solaris special math library */
18617 #  include <sunmath.h>
18618 #endif
18619 #define NV $nvtype
18620 int main(int argc, char **argv)
18621 {
18622     NV x = 0.0;
18623     NV y = -0.0;
18624     if ((signbit(x) == 0) && (signbit(y) != 0))
18625         return 0;
18626     else
18627         return 1;
18628 }
18629 EOCP
18630 val="$undef"
18631 set try
18632 if eval $compile; then
18633     if $run ./try; then
18634         $echo "Yes." >&4
18635         val="$define"
18636     else
18637         $echo "Signbit seems to be available, but doesn't work as I expected."
18638         $echo "I won't use it." >&4
18639         val="$undef"
18640     fi
18641 else
18642     $echo "Nope." >&4
18643     dflt="$undef"
18644 fi
18645 set d_signbit
18646 eval $setvar
18647 $rm_try
18648
18649 : see if sigprocmask exists
18650 set sigprocmask d_sigprocmask
18651 eval $inlibc
18652
18653 : see if sigsetjmp exists
18654 echo " "
18655 case "$d_sigsetjmp" in
18656 '')
18657         $cat >try.c <<EOP
18658 #include <setjmp.h>
18659 #$i_stdlib I_STDLIB
18660 #ifdef I_STDLIB
18661 #include <stdlib.h>
18662 #endif
18663 sigjmp_buf env;
18664 int set = 1;
18665 int main()
18666 {
18667         if (sigsetjmp(env,1))
18668                 exit(set);
18669         set = 0;
18670         siglongjmp(env, 1);
18671         exit(1);
18672 }
18673 EOP
18674         set try
18675         if eval $compile; then
18676                 if $run ./try >/dev/null 2>&1; then
18677                         echo "POSIX sigsetjmp found." >&4
18678                         val="$define"
18679                 else
18680                         $cat >&4 <<EOM
18681 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18682 I'll ignore them.
18683 EOM
18684                         val="$undef"
18685                 fi
18686         else
18687                 echo "sigsetjmp not found." >&4
18688                 val="$undef"
18689         fi
18690         ;;
18691 *) val="$d_sigsetjmp"
18692         case "$d_sigsetjmp" in
18693         $define) echo "POSIX sigsetjmp found." >&4;;
18694         $undef) echo "sigsetjmp not found." >&4;;
18695         esac
18696         ;;
18697 esac
18698 set d_sigsetjmp
18699 eval $setvar
18700 $rm_try
18701
18702 : see if snprintf exists
18703 set snprintf d_snprintf
18704 eval $inlibc
18705
18706 : see if vsnprintf exists
18707 set vsnprintf d_vsnprintf
18708 eval $inlibc
18709
18710 case "$d_snprintf-$d_vsnprintf" in
18711 "$define-$define")
18712     $cat <<EOM
18713 Checking whether your snprintf() and vsnprintf() work okay...
18714 EOM
18715     $cat >try.c <<'EOCP'
18716 /* v?snprintf testing logic courtesy of Russ Allbery.
18717  * According to C99:
18718  * - if the buffer is too short it still must be \0-terminated
18719  * - if the buffer is too short the potentially required length
18720  *   must be returned and not -1
18721  * - if the buffer is NULL the potentially required length
18722  *   must be returned and not -1 or core dump
18723  */
18724 #include <stdio.h>
18725 #include <stdarg.h>
18726
18727 char buf[2];
18728
18729 int test (char *format, ...)
18730 {
18731     va_list args;
18732     int count;
18733
18734     va_start (args, format);
18735     count = vsnprintf (buf, sizeof buf, format, args);
18736     va_end (args);
18737     return count;
18738 }
18739
18740 int main ()
18741 {
18742     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18743              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18744 }
18745 EOCP
18746     set try
18747     if eval $compile; then
18748         `$run ./try`
18749         case "$?" in
18750         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18751         *) cat <<EOM >&4
18752 Your snprintf() and snprintf() don't seem to be working okay.
18753 EOM
18754            d_snprintf="$undef"
18755            d_vsnprintf="$undef"
18756            ;;
18757         esac
18758     else
18759         echo "(I can't seem to compile the test program--assuming they don't)"
18760         d_snprintf="$undef"
18761         d_vsnprintf="$undef"
18762     fi
18763     $rm_try
18764     ;;
18765 esac
18766
18767 : see if sockatmark exists
18768 set sockatmark d_sockatmark
18769 eval $inlibc
18770
18771 : see if prototype for sockatmark is available
18772 echo " "
18773 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18774 eval $hasproto
18775
18776 : see if socks5_init exists
18777 set socks5_init d_socks5_init
18778 eval $inlibc
18779
18780 : see if sprintf returns the length of the string in the buffer as per ANSI
18781 $echo "Checking whether sprintf returns the length of the string..." >&4
18782 $cat <<EOP >try.c
18783 #include <stdio.h>
18784 #$i_stdlib I_STDLIB
18785 #ifdef I_STDLIB
18786 #include <stdlib.h>
18787 #endif
18788 #$i_string I_STRING
18789 #ifdef I_STRING
18790 #  include <string.h>
18791 #else
18792 #  include <strings.h>
18793 #endif
18794 #$i_math I_MATH
18795 #ifdef I_MATH
18796 #include <math.h>
18797 #endif
18798
18799 char buffer[256];
18800
18801 int check (size_t expect, int test) {
18802   size_t got = strlen(buffer);
18803   if (expect == got)
18804     return 0;
18805
18806   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18807        test, buffer);
18808   exit (test);
18809 }
18810
18811 int main(int argc, char **argv) {
18812   int test = 0;
18813
18814   check(sprintf(buffer, ""), ++test);
18815   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18816   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18817
18818   return 0;
18819 }
18820 EOP
18821 set try
18822
18823 if eval $compile; then
18824     xxx="`$run ./try`"
18825     case "$?" in
18826         0) cat >&4 <<EOM
18827 sprintf returns the length of the string (as ANSI says it should)
18828 EOM
18829         d_sprintf_returns_strlen="$define"
18830         ;;
18831         *) cat >&4 <<EOM
18832 sprintf does not return the length of the string (how old is this system?)
18833 EOM
18834         d_sprintf_returns_strlen="$undef"
18835         ;;
18836     esac
18837 else
18838     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18839     d_sprintf_returns_strlen="$undef"
18840 fi
18841 $rm_try
18842
18843 : see if srand48_r exists
18844 set srand48_r d_srand48_r
18845 eval $inlibc
18846 case "$d_srand48_r" in
18847 "$define")
18848         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18849         case "$d_srand48_r_proto:$usethreads" in
18850         ":define")      d_srand48_r_proto=define
18851                 set d_srand48_r_proto srand48_r $hdrs
18852                 eval $hasproto ;;
18853         *)      ;;
18854         esac
18855         case "$d_srand48_r_proto" in
18856         define)
18857         case "$srand48_r_proto" in
18858         ''|0) try='int srand48_r(long, struct drand48_data*);'
18859         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18860         esac
18861         case "$srand48_r_proto" in
18862         ''|0)   d_srand48_r=undef
18863                 srand48_r_proto=0
18864                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18865         * )     case "$srand48_r_proto" in
18866                 REENTRANT_PROTO*) ;;
18867                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18868                 esac
18869                 echo "Prototype: $try" ;;
18870         esac
18871         ;;
18872         *)      case "$usethreads" in
18873                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18874                 esac
18875                 d_srand48_r=undef
18876                 srand48_r_proto=0
18877                 ;;
18878         esac
18879         ;;
18880 *)      srand48_r_proto=0
18881         ;;
18882 esac
18883
18884 : see if srandom_r exists
18885 set srandom_r d_srandom_r
18886 eval $inlibc
18887 case "$d_srandom_r" in
18888 "$define")
18889         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18890         case "$d_srandom_r_proto:$usethreads" in
18891         ":define")      d_srandom_r_proto=define
18892                 set d_srandom_r_proto srandom_r $hdrs
18893                 eval $hasproto ;;
18894         *)      ;;
18895         esac
18896         case "$d_srandom_r_proto" in
18897         define)
18898         case "$srandom_r_proto" in
18899         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18900         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18901         esac
18902         case "$srandom_r_proto" in
18903         ''|0)   d_srandom_r=undef
18904                 srandom_r_proto=0
18905                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18906         * )     case "$srandom_r_proto" in
18907                 REENTRANT_PROTO*) ;;
18908                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18909                 esac
18910                 echo "Prototype: $try" ;;
18911         esac
18912         ;;
18913         *)      case "$usethreads" in
18914                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18915                 esac
18916                 d_srandom_r=undef
18917                 srandom_r_proto=0
18918                 ;;
18919         esac
18920         ;;
18921 *)      srandom_r_proto=0
18922         ;;
18923 esac
18924
18925 : see if prototype for setresgid is available
18926 echo " "
18927 set d_sresgproto setresgid $i_unistd unistd.h
18928 eval $hasproto
18929
18930 : see if prototype for setresuid is available
18931 echo " "
18932 set d_sresuproto setresuid $i_unistd unistd.h
18933 eval $hasproto
18934
18935 : see if stat exists
18936 set stat d_stat
18937 eval $inlibc
18938
18939 : see if sys/stat.h is available
18940 set sys/stat.h i_sysstat
18941 eval $inhdr
18942
18943 : see if stat knows about block sizes
18944 echo " "
18945 echo "Checking to see if your struct stat has st_blocks field..." >&4
18946 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18947 eval $hasfield
18948
18949 : see if this is a sys/vfs.h system
18950 set sys/vfs.h i_sysvfs
18951 eval $inhdr
18952
18953 : see if this is a sys/statfs.h system
18954 set sys/statfs.h i_sysstatfs
18955 eval $inhdr
18956
18957 : Check for statfs_s
18958 echo " "
18959 echo "Checking to see if your system supports struct statfs..." >&4
18960 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
18961 eval $hasstruct
18962 case "$d_statfs_s" in
18963 "$define")      echo "Yes, it does."   ;;
18964 *)              echo "No, it doesn't." ;;
18965 esac
18966
18967
18968 : see if struct statfs knows about f_flags
18969 case "$d_statfs_s" in
18970 define)
18971         echo " "
18972         echo "Checking to see if your struct statfs has f_flags field..." >&4
18973         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
18974         eval $hasfield
18975         ;;
18976 *)      val="$undef"
18977         set d_statfs_f_flags
18978         eval $setvar
18979         ;;
18980 esac
18981 case "$d_statfs_f_flags" in
18982 "$define")      echo "Yes, it does."   ;;
18983 *)              echo "No, it doesn't." ;;
18984 esac
18985
18986 : see what flavor, if any, of static inline is supported
18987 echo " "
18988 echo "Checking to see if your system supports static inline..."
18989 $cat > try.c <<'EOCP'
18990 #include <stdlib.h>
18991 extern int f_via_a(int x);
18992 extern int f_via_b(int x);
18993 int main(int argc, char **argv)
18994 {
18995     int y;
18996
18997     y = f_via_a(0);
18998 #ifdef USE_B
18999     y = f_via_b(0);
19000 #endif
19001     if (y == 42) {
19002         return EXIT_SUCCESS;
19003     }
19004     else {
19005         return EXIT_FAILURE;
19006     }
19007 }
19008 EOCP
19009 $cat > a.c <<'EOCP'
19010 static INLINE int f(int x) {
19011     int y;
19012     y = x + 42;
19013     return y;
19014 }
19015
19016 int f_via_a(int x)
19017 {
19018     return f(x);
19019 }
19020 EOCP
19021 $cat > b.c <<'EOCP'
19022 extern int f(int x);
19023
19024 int f_via_b(int x)
19025 {
19026     return f(x);
19027 }
19028 EOCP
19029
19030 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19031 case "$perl_static_inline" in
19032 '')     # Check the various possibilities, and break out on success.
19033         # For gcc, prefer __inline__, which will still permit
19034         # cflags.SH to add in -ansi.
19035         case "$gccversion" in
19036                 '') xxx="inline __inline__ __inline _inline";;
19037                 *)  xxx="__inline__ inline __inline _inline";;
19038         esac
19039         for inline in $xxx; do
19040                 set try -DINLINE=$inline a.c
19041                 if eval $compile && $run ./try; then
19042                         # Now make sure there is no external linkage of static
19043                         # functions
19044                         set try -DINLINE=$inline -DUSE_B a.c b.c
19045                         if eval $compile && $run ./try; then
19046                                 $echo "Your compiler supports static $inline, " >&4
19047                                 $echo "but it also creates an external definition," >&4
19048                                 $echo "so I won't use it." >&4
19049                                 val=$undef
19050                         else
19051                                 $echo "Your compiler supports static $inline." >&4
19052                                 val=$define
19053                                 perl_static_inline="static $inline";
19054                                 break;
19055                         fi
19056                 else
19057                         $echo "Your compiler does NOT support static $inline." >&4
19058                         val="$undef"
19059                 fi
19060         done
19061         ;;
19062 *inline*) # Some variant of inline exists.
19063         echo "Keeping your $hint value of $perl_static_inline."
19064         val=$define
19065         ;;
19066 static)  # No inline capabilities
19067         echo "Keeping your $hint value of $perl_static_inline."
19068         val=$undef
19069         ;;
19070 *)  # Unrecognized previous value -- blindly trust the supplied
19071         # value and hope it makes sense.  Use old value for
19072         # d_static_inline, if there is one.
19073         echo "Keeping your $hint value of $perl_static_inline."
19074         case "$d_static_inline" in
19075                 '') val=$define ;;
19076                 *)  val=$d_static_inline ;;
19077         esac
19078         ;;
19079 esac
19080 # Fallback to plain 'static' if nothing worked.
19081 case "$perl_static_inline" in
19082 '')
19083         perl_static_inline="static"
19084         val=$undef
19085         ;;
19086 esac
19087 set d_static_inline
19088 eval $setvar
19089 $rm -f a.[co] b.[co]
19090 $rm_try
19091
19092 : Check stream access
19093 $cat >&4 <<EOM
19094 Checking how to access stdio streams by file descriptor number...
19095 EOM
19096 case "$stdio_stream_array" in
19097 '')     $cat >try.c <<EOCP
19098 #include <stdio.h>
19099 int main() {
19100   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19101     printf("yes\n");
19102 }
19103 EOCP
19104         for s in _iob __iob __sF
19105         do
19106                 set try -DSTDIO_STREAM_ARRAY=$s
19107                 if eval $compile; then
19108                         case "`$run ./try`" in
19109                         yes)    stdio_stream_array=$s; break ;;
19110                         esac
19111                 fi
19112         done
19113         $rm_try
19114 esac
19115 case "$stdio_stream_array" in
19116 '')     $cat >&4 <<EOM
19117 I can't figure out how to access stdio streams by file descriptor number.
19118 EOM
19119         d_stdio_stream_array="$undef"
19120         ;;
19121 *)      $cat >&4 <<EOM
19122 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19123 EOM
19124         d_stdio_stream_array="$define"
19125         ;;
19126 esac
19127
19128 : see if strcoll exists
19129 set strcoll d_strcoll
19130 eval $inlibc
19131
19132 : check for structure copying
19133 echo " "
19134 echo "Checking to see if your C compiler can copy structs..." >&4
19135 $cat >try.c <<'EOCP'
19136 int main()
19137 {
19138         struct blurfl {
19139                 int dyick;
19140         } foo, bar;
19141
19142         foo = bar;
19143 }
19144 EOCP
19145 if $cc -c try.c >/dev/null 2>&1 ; then
19146         val="$define"
19147         echo "Yup, it can."
19148 else
19149         val="$undef"
19150         echo "Nope, it can't."
19151 fi
19152 set d_strctcpy
19153 eval $setvar
19154 $rm_try
19155
19156 : see if strerror and/or sys_errlist[] exist
19157 echo " "
19158 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19159     if set strerror val -f d_strerror; eval $csym; $val; then
19160                 echo 'strerror() found.' >&4
19161                 d_strerror="$define"
19162                 d_strerrm='strerror(e)'
19163                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19164                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19165                         d_syserrlst="$define"
19166                 else
19167                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19168                         d_syserrlst="$undef"
19169                 fi
19170     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19171                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19172                 echo 'strerror() found in string header.' >&4
19173                 d_strerror="$define"
19174                 d_strerrm='strerror(e)'
19175                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19176                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19177                                 d_syserrlst="$define"
19178                 else
19179                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19180                         d_syserrlst="$undef"
19181                 fi
19182     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19183                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19184                 d_strerror="$undef"
19185                 d_syserrlst="$define"
19186                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19187     else
19188                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19189                 d_strerror="$undef"
19190                 d_syserrlst="$undef"
19191                 d_strerrm='"unknown"'
19192     fi
19193 fi
19194
19195 : see if strerror_r exists
19196 set strerror_r d_strerror_r
19197 eval $inlibc
19198 case "$d_strerror_r" in
19199 "$define")
19200         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19201         case "$d_strerror_r_proto:$usethreads" in
19202         ":define")      d_strerror_r_proto=define
19203                 set d_strerror_r_proto strerror_r $hdrs
19204                 eval $hasproto ;;
19205         *)      ;;
19206         esac
19207         case "$d_strerror_r_proto" in
19208         define)
19209         case "$strerror_r_proto" in
19210         ''|0) try='int strerror_r(int, char*, size_t);'
19211         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19212         esac
19213         case "$strerror_r_proto" in
19214         ''|0) try='int strerror_r(int, char*, int);'
19215         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19216         esac
19217         case "$strerror_r_proto" in
19218         ''|0) try='char* strerror_r(int, char*, size_t);'
19219         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19220         esac
19221         case "$strerror_r_proto" in
19222         ''|0)   d_strerror_r=undef
19223                 strerror_r_proto=0
19224                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19225         * )     case "$strerror_r_proto" in
19226                 REENTRANT_PROTO*) ;;
19227                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19228                 esac
19229                 echo "Prototype: $try" ;;
19230         esac
19231         ;;
19232         *)      case "$usethreads" in
19233                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19234                 esac
19235                 d_strerror_r=undef
19236                 strerror_r_proto=0
19237                 ;;
19238         esac
19239         ;;
19240 *)      strerror_r_proto=0
19241         ;;
19242 esac
19243
19244 : see if strftime exists
19245 set strftime d_strftime
19246 eval $inlibc
19247
19248 : see if strlcat exists
19249 set strlcat d_strlcat
19250 eval $inlibc
19251
19252 : see if strlcpy exists
19253 set strlcpy d_strlcpy
19254 eval $inlibc
19255
19256 : see if strtod exists
19257 set strtod d_strtod
19258 eval $inlibc
19259
19260 : see if strtol exists
19261 set strtol d_strtol
19262 eval $inlibc
19263
19264 : see if strtold exists
19265 set strtold d_strtold
19266 eval $inlibc
19267
19268 : see if strtoll exists
19269 set strtoll d_strtoll
19270 eval $inlibc
19271
19272 case "$d_longlong-$d_strtoll" in
19273 "$define-$define")
19274         $cat <<EOM
19275 Checking whether your strtoll() works okay...
19276 EOM
19277         $cat >try.c <<'EOCP'
19278 #include <errno.h>
19279 #ifdef __hpux
19280 #define strtoll __strtoll
19281 #endif
19282 #ifdef __EMX__
19283 #define strtoll _strtoll
19284 #endif
19285 #include <stdio.h>
19286 extern long long int strtoll(char *s, char **, int);
19287 static int bad = 0;
19288 int check(char *s, long long ell, int een) {
19289         long long gll;
19290         errno = 0;
19291         gll = strtoll(s, 0, 10);
19292         if (!((gll == ell) && (errno == een)))
19293                 bad++;
19294 }
19295 int main() {
19296         check(" 1",                                      1LL, 0);
19297         check(" 0",                                      0LL, 0);
19298         check("-1",                                     -1LL, 0);
19299         check("-9223372036854775808", -9223372036854775808LL, 0);
19300         check("-9223372036854775808", -9223372036854775808LL, 0);
19301         check(" 9223372036854775807",  9223372036854775807LL, 0);
19302         check("-9223372036854775808", -9223372036854775808LL, 0);
19303         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19304         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19305         if (!bad)
19306                 printf("ok\n");
19307 }
19308 EOCP
19309         set try
19310         if eval $compile; then
19311                 yyy=`$run ./try`
19312                 case "$yyy" in
19313                 ok) echo "Your strtoll() seems to be working okay." ;;
19314                 *) cat <<EOM >&4
19315 Your strtoll() doesn't seem to be working okay.
19316 EOM
19317                    d_strtoll="$undef"
19318                    ;;
19319                 esac
19320         else
19321                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19322                 d_strtoll="$undef"
19323         fi
19324         ;;
19325 esac
19326
19327 : see if strtoq exists
19328 set strtoq d_strtoq
19329 eval $inlibc
19330
19331 : see if strtoul exists
19332 set strtoul d_strtoul
19333 eval $inlibc
19334
19335 case "$d_strtoul" in
19336 "$define")
19337         $cat <<EOM
19338 Checking whether your strtoul() works okay...
19339 EOM
19340         $cat >try.c <<'EOCP'
19341 #include <errno.h>
19342 #include <stdio.h>
19343 extern unsigned long int strtoul(char *s, char **, int);
19344 static int bad = 0;
19345 void check(char *s, unsigned long eul, int een) {
19346         unsigned long gul;
19347         errno = 0;
19348         gul = strtoul(s, 0, 10);
19349         if (!((gul == eul) && (errno == een)))
19350                 bad++;
19351 }
19352 int main() {
19353         check(" 1", 1L, 0);
19354         check(" 0", 0L, 0);
19355 EOCP
19356         case "$longsize" in
19357         8)
19358             $cat >>try.c <<'EOCP'
19359         check("18446744073709551615", 18446744073709551615UL, 0);
19360         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19361 #if 0 /* strtoul() for /^-/ strings is undefined. */
19362         check("-1", 18446744073709551615UL, 0);
19363         check("-18446744073709551614", 2, 0);
19364         check("-18446744073709551615", 1, 0);
19365         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19366         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19367 #endif
19368 EOCP
19369                 ;;
19370         4)
19371                     $cat >>try.c <<'EOCP'
19372         check("4294967295", 4294967295UL, 0);
19373         check("4294967296", 4294967295UL, ERANGE);
19374 #if 0 /* strtoul() for /^-/ strings is undefined. */
19375         check("-1", 4294967295UL, 0);
19376         check("-4294967294", 2, 0);
19377         check("-4294967295", 1, 0);
19378         check("-4294967296", 4294967295UL, ERANGE);
19379         check("-4294967297", 4294967295UL, ERANGE);
19380 #endif
19381 EOCP
19382                 ;;
19383         *)
19384 : Should we write these tests to be more portable by sprintf-ing
19385 : ~0 and then manipulating that char string as input for strtol?
19386                 ;;
19387         esac
19388         $cat >>try.c <<'EOCP'
19389         if (!bad)
19390                 printf("ok\n");
19391         return 0;
19392 }
19393 EOCP
19394         set try
19395         if eval $compile; then
19396                 case "`$run ./try`" in
19397                 ok) echo "Your strtoul() seems to be working okay." ;;
19398                 *) cat <<EOM >&4
19399 Your strtoul() doesn't seem to be working okay.
19400 EOM
19401                    d_strtoul="$undef"
19402                    ;;
19403                 esac
19404         else
19405                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19406                 d_strtoul="$undef"
19407         fi
19408         ;;
19409 esac
19410
19411 : see if strtoull exists
19412 set strtoull d_strtoull
19413 eval $inlibc
19414
19415 case "$d_longlong-$d_strtoull" in
19416 "$define-$define")
19417         $cat <<EOM
19418 Checking whether your strtoull() works okay...
19419 EOM
19420         $cat >try.c <<'EOCP'
19421 #include <errno.h>
19422 #ifdef __hpux
19423 #define strtoull __strtoull
19424 #endif
19425 #include <stdio.h>
19426 extern unsigned long long int strtoull(char *s, char **, int);
19427 static int bad = 0;
19428 int check(char *s, long long eull, int een) {
19429         long long gull;
19430         errno = 0;
19431         gull = strtoull(s, 0, 10);
19432         if (!((gull == eull) && (errno == een)))
19433                 bad++;
19434 }
19435 int main() {
19436         check(" 1",                                        1LL, 0);
19437         check(" 0",                                        0LL, 0);
19438         check("18446744073709551615",  18446744073709551615ULL, 0);
19439         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19440 #if 0 /* strtoull() for /^-/ strings is undefined. */
19441         check("-1",                    18446744073709551615ULL, 0);
19442         check("-18446744073709551614",                     2LL, 0);
19443         check("-18446744073709551615",                     1LL, 0);
19444         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19445         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19446 #endif
19447         if (!bad)
19448                 printf("ok\n");
19449 }
19450 EOCP
19451         set try
19452         if eval $compile; then
19453                 case "`$run ./try`" in
19454                 ok) echo "Your strtoull() seems to be working okay." ;;
19455                 *) cat <<EOM >&4
19456 Your strtoull() doesn't seem to be working okay.
19457 EOM
19458                    d_strtoull="$undef"
19459                    ;;
19460                 esac
19461         else
19462                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19463                 d_strtoull="$undef"
19464         fi
19465         ;;
19466 esac
19467
19468 : see if strtouq exists
19469 set strtouq d_strtouq
19470 eval $inlibc
19471
19472 case "$d_strtouq" in
19473 "$define")
19474         $cat <<EOM
19475 Checking whether your strtouq() works okay...
19476 EOM
19477         $cat >try.c <<'EOCP'
19478 #include <errno.h>
19479 #include <stdio.h>
19480 extern unsigned long long int strtouq(char *s, char **, int);
19481 static int bad = 0;
19482 void check(char *s, unsigned long long eull, int een) {
19483         unsigned long long gull;
19484         errno = 0;
19485         gull = strtouq(s, 0, 10);
19486         if (!((gull == eull) && (errno == een)))
19487                 bad++;
19488 }
19489 int main() {
19490         check(" 1",                                        1LL, 0);
19491         check(" 0",                                        0LL, 0);
19492         check("18446744073709551615",  18446744073709551615ULL, 0);
19493         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19494 #if 0 /* strtouq() for /^-/ strings is undefined. */
19495         check("-1",                    18446744073709551615ULL, 0);
19496         check("-18446744073709551614",                     2LL, 0);
19497         check("-18446744073709551615",                     1LL, 0);
19498         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19499         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19500 #endif
19501         if (!bad)
19502                 printf("ok\n");
19503         return 0;
19504 }
19505 EOCP
19506         set try
19507         if eval $compile; then
19508                 case "`$run ./try`" in
19509                 ok) echo "Your strtouq() seems to be working okay." ;;
19510                 *) cat <<EOM >&4
19511 Your strtouq() doesn't seem to be working okay.
19512 EOM
19513                    d_strtouq="$undef"
19514                    ;;
19515                 esac
19516         else
19517                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19518                 d_strtouq="$undef"
19519         fi
19520         ;;
19521 esac
19522
19523 : see if strxfrm exists
19524 set strxfrm d_strxfrm
19525 eval $inlibc
19526
19527 : see if symlink exists
19528 set symlink d_symlink
19529 eval $inlibc
19530
19531 : see if syscall exists
19532 set syscall d_syscall
19533 eval $inlibc
19534
19535 : see if prototype for syscall is available
19536 echo " "
19537 set d_syscallproto syscall $i_unistd unistd.h
19538 eval $hasproto
19539
19540 : see if sysconf exists
19541 set sysconf d_sysconf
19542 eval $inlibc
19543
19544 : see if system exists
19545 set system d_system
19546 eval $inlibc
19547
19548 : see if tcgetpgrp exists
19549 set tcgetpgrp d_tcgetpgrp
19550 eval $inlibc
19551
19552 : see if tcsetpgrp exists
19553 set tcsetpgrp d_tcsetpgrp
19554 eval $inlibc
19555
19556 : see if prototype for telldir is available
19557 echo " "
19558 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19559 eval $hasproto
19560
19561 : see if tgamma exists
19562 set tgamma d_tgamma
19563 eval $inlibc
19564
19565 : see if time exists
19566 echo " "
19567 if test "X$d_time" = X -o X"$timetype" = X; then
19568     if set time val -f d_time; eval $csym; $val; then
19569                 echo 'time() found.' >&4
19570                 val="$define"
19571                 rp="What is the type returned by time() on this system?"
19572                 set time_t timetype long stdio.h sys/types.h
19573                 eval $typedef_ask
19574     else
19575                 echo 'time() not found, hope that will do.' >&4
19576                 val="$undef"
19577                 timetype='int';
19578     fi
19579     set d_time
19580     eval $setvar
19581 fi
19582
19583 : see if timegm exists
19584 set timegm d_timegm
19585 eval $inlibc
19586
19587 : see if this is a sys/times.h system
19588 set sys/times.h i_systimes
19589 eval $inhdr
19590
19591 : see if times exists
19592 echo " "
19593 if set times val -f d_times; eval $csym; $val; then
19594         echo 'times() found.' >&4
19595         d_times="$define"
19596         inc=''
19597         case "$i_systimes" in
19598         "$define") inc='sys/times.h';;
19599         esac
19600         rp="What is the type returned by times() on this system?"
19601         set clock_t clocktype long stdio.h sys/types.h $inc
19602         eval $typedef_ask
19603 else
19604         echo 'times() NOT found, hope that will do.' >&4
19605         d_times="$undef"
19606         clocktype='int'
19607 fi
19608
19609 : see if tmpnam_r exists
19610 set tmpnam_r d_tmpnam_r
19611 eval $inlibc
19612 case "$d_tmpnam_r" in
19613 "$define")
19614         hdrs="$i_systypes sys/types.h define stdio.h "
19615         case "$d_tmpnam_r_proto:$usethreads" in
19616         ":define")      d_tmpnam_r_proto=define
19617                 set d_tmpnam_r_proto tmpnam_r $hdrs
19618                 eval $hasproto ;;
19619         *)      ;;
19620         esac
19621         case "$d_tmpnam_r_proto" in
19622         define)
19623         case "$tmpnam_r_proto" in
19624         ''|0) try='char* tmpnam_r(char*);'
19625         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19626         esac
19627         case "$tmpnam_r_proto" in
19628         ''|0)   d_tmpnam_r=undef
19629                 tmpnam_r_proto=0
19630                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19631         * )     case "$tmpnam_r_proto" in
19632                 REENTRANT_PROTO*) ;;
19633                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19634                 esac
19635                 echo "Prototype: $try" ;;
19636         esac
19637         ;;
19638         *)      case "$usethreads" in
19639                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19640                 esac
19641                 d_tmpnam_r=undef
19642                 tmpnam_r_proto=0
19643                 ;;
19644         esac
19645         ;;
19646 *)      tmpnam_r_proto=0
19647         ;;
19648 esac
19649
19650 : see if trunc exists
19651 set trunc d_trunc
19652 eval $inlibc
19653
19654 : see if truncate exists
19655 set truncate d_truncate
19656 eval $inlibc
19657
19658 : see if ttyname_r exists
19659 set ttyname_r d_ttyname_r
19660 eval $inlibc
19661 case "$d_ttyname_r" in
19662 "$define")
19663         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19664         case "$d_ttyname_r_proto:$usethreads" in
19665         ":define")      d_ttyname_r_proto=define
19666                 set d_ttyname_r_proto ttyname_r $hdrs
19667                 eval $hasproto ;;
19668         *)      ;;
19669         esac
19670         case "$d_ttyname_r_proto" in
19671         define)
19672         case "$ttyname_r_proto" in
19673         ''|0) try='int ttyname_r(int, char*, size_t);'
19674         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19675         esac
19676         case "$ttyname_r_proto" in
19677         ''|0) try='int ttyname_r(int, char*, int);'
19678         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19679         esac
19680         case "$ttyname_r_proto" in
19681         ''|0) try='char* ttyname_r(int, char*, int);'
19682         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19683         esac
19684         case "$ttyname_r_proto" in
19685         ''|0)   d_ttyname_r=undef
19686                 ttyname_r_proto=0
19687                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19688         * )     case "$ttyname_r_proto" in
19689                 REENTRANT_PROTO*) ;;
19690                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19691                 esac
19692                 echo "Prototype: $try" ;;
19693         esac
19694         ;;
19695         *)      case "$usethreads" in
19696                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19697                 esac
19698                 d_ttyname_r=undef
19699                 ttyname_r_proto=0
19700                 ;;
19701         esac
19702         ;;
19703 *)      ttyname_r_proto=0
19704         ;;
19705 esac
19706
19707 : see if tzname[] exists
19708 echo " "
19709 if set tzname val -a d_tzname; eval $csym; $val; then
19710         val="$define"
19711         echo 'tzname[] found.' >&4
19712 else
19713         val="$undef"
19714         echo 'tzname[] NOT found.' >&4
19715 fi
19716 set d_tzname
19717 eval $setvar
19718
19719 : Check if is a multiplatform env
19720 case "$osname" in
19721 darwin) multiarch="$define" ;;
19722 esac
19723 case "$multiarch" in
19724 ''|[nN]*) multiarch="$undef" ;;
19725 esac
19726
19727 : check for ordering of bytes in a UV
19728 echo " "
19729 case "$multiarch" in
19730 *$define*)
19731         $cat <<EOM
19732 You seem to be doing a multiarchitecture build,
19733 skipping the byteorder check.
19734
19735 EOM
19736         byteorder='ffff'
19737         ;;
19738 *)
19739         case "$byteorder" in
19740         '')
19741                 $cat <<'EOM'
19742 In the following, larger digits indicate more significance.  A big-endian
19743 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19744 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19745 machines may have weird orders like 3412.  A Cray will report 87654321,
19746 an Alpha will report 12345678. If the test program works the default is
19747 probably right.
19748 I'm now running the test program...
19749 EOM
19750                 $cat >try.c <<EOCP
19751 #include <stdio.h>
19752 #$i_stdlib I_STDLIB
19753 #ifdef I_STDLIB
19754 #include <stdlib.h>
19755 #endif
19756 #include <sys/types.h>
19757 typedef $uvtype UV;
19758 int main()
19759 {
19760         int i;
19761         union {
19762                 UV l;
19763                 char c[$uvsize];
19764         } u;
19765
19766         if ($uvsize > 4)
19767                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19768         else
19769                 u.l = (UV)0x04030201;
19770         for (i = 0; i < $uvsize; i++)
19771                 printf("%c", u.c[i]+'0');
19772         printf("\n");
19773         exit(0);
19774 }
19775 EOCP
19776                 xxx_prompt=y
19777                 set try
19778                 if eval $compile && $run ./try > /dev/null; then
19779                         dflt=`$run ./try`
19780                         case "$dflt" in
19781                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19782                                 echo "(The test program ran ok.)"
19783                                 echo "byteorder=$dflt"
19784                                 xxx_prompt=n
19785                         ;;
19786                         ????|????????) echo "(The test program ran ok.)" ;;
19787                         *) echo "(The test program didn't run right for some reason.)" ;;
19788                         esac
19789                 else
19790                         dflt='4321'
19791                         cat <<'EOM'
19792 (I can't seem to compile the test program.  Guessing big-endian...)
19793 EOM
19794                 fi
19795                 case "$xxx_prompt" in
19796                 y)
19797                         rp="What is the order of bytes in $uvtype?"
19798                         . ./myread
19799                         byteorder="$ans"
19800                         ;;
19801                 *)      byteorder=$dflt
19802                         ;;
19803                 esac
19804                 ;;
19805         esac
19806         $rm_try
19807         ;;
19808 esac
19809
19810 : Checking 32bit alignedness
19811 $cat <<EOM
19812
19813 Checking to see whether you can access character data unalignedly...
19814 EOM
19815 case "$d_u32align" in
19816 '')   $cat >try.c <<EOCP
19817 #include <stdio.h>
19818 #$i_stdlib I_STDLIB
19819 #ifdef I_STDLIB
19820 #include <stdlib.h>
19821 #endif
19822 #define U32 $u32type
19823 #define BYTEORDER 0x$byteorder
19824 #define U8 $u8type
19825 #include <signal.h>
19826 #ifdef SIGBUS
19827 $signal_t bletch(int s) { exit(4); }
19828 #endif
19829 int main() {
19830 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19831     volatile U8 buf[8];
19832     volatile U32 *up;
19833     int i;
19834
19835     if (sizeof(U32) != 4) {
19836         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19837         exit(1);
19838     }
19839
19840     fflush(stdout);
19841
19842 #ifdef SIGBUS
19843     signal(SIGBUS, bletch);
19844 #endif
19845
19846     buf[0] = 0;
19847     buf[1] = 0;
19848     buf[2] = 0;
19849     buf[3] = 1;
19850     buf[4] = 0;
19851     buf[5] = 0;
19852     buf[6] = 0;
19853     buf[7] = 1;
19854
19855     for (i = 0; i < 4; i++) {
19856         up = (U32*)(buf + i);
19857         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19858                (*up == 1 << (8*(3-i)))  /* little-endian */
19859               )
19860            )
19861         {
19862             printf("read failed (%x)\n", *up);
19863             exit(2);
19864         }
19865     }
19866
19867     /* write test */
19868     for (i = 0; i < 4; i++) {
19869         up = (U32*)(buf + i);
19870         *up = 0xBeef;
19871         if (*up != 0xBeef) {
19872             printf("write failed (%x)\n", *up);
19873             exit(3);
19874         }
19875     }
19876
19877     exit(0);
19878 #else
19879     printf("1\n");
19880     exit(1);
19881 #endif
19882     return 0;
19883 }
19884 EOCP
19885 set try
19886 if eval $compile_ok; then
19887         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19888         $run ./try 2>&1 >/dev/null
19889         case "$?" in
19890         0)      cat >&4 <<EOM
19891 You can access character data pretty unalignedly.
19892 EOM
19893                 d_u32align="$undef"
19894                 ;;
19895         *)      cat >&4 <<EOM
19896 It seems that you must access character data in an aligned manner.
19897 EOM
19898                 d_u32align="$define"
19899                 ;;
19900         esac
19901 else
19902         rp='Can you access character data at unaligned addresses?'
19903         dflt='n'
19904         . ./myread
19905         case "$ans" in
19906         [yY]*)  d_u32align="$undef"  ;;
19907         *)      d_u32align="$define" ;;
19908         esac
19909 fi
19910 $rm_try
19911 ;;
19912 esac
19913
19914 : see if ualarm exists
19915 set ualarm d_ualarm
19916 eval $inlibc
19917
19918 : see if umask exists
19919 set umask d_umask
19920 eval $inlibc
19921
19922 : see if unordered exists
19923 set unordered d_unordered
19924 eval $inlibc
19925
19926 : see if unsetenv exists
19927 set unsetenv d_unsetenv
19928 eval $inlibc
19929
19930 : see if usleep exists
19931 set usleep d_usleep
19932 eval $inlibc
19933
19934 : see if prototype for usleep is available
19935 echo " "
19936 set d_usleepproto usleep $i_unistd unistd.h
19937 eval $hasproto
19938
19939 : see if ustat exists
19940 set ustat d_ustat
19941 eval $inlibc
19942
19943 : see if closedir exists
19944 set closedir d_closedir
19945 eval $inlibc
19946
19947 case "$d_closedir" in
19948 "$define")
19949         echo " "
19950         echo "Checking whether closedir() returns a status..." >&4
19951         cat > try.c <<EOM
19952 #$i_dirent I_DIRENT             /**/
19953 #$i_sysdir I_SYS_DIR            /**/
19954 #$i_sysndir I_SYS_NDIR          /**/
19955 #$i_systypes I_SYS_TYPES        /**/
19956
19957 #if defined(I_SYS_TYPES)
19958 #include <sys/types.h>
19959 #endif
19960 #if defined(I_DIRENT)
19961 #include <dirent.h>
19962 #else
19963 #ifdef I_SYS_NDIR
19964 #include <sys/ndir.h>
19965 #else
19966 #ifdef I_SYS_DIR
19967 #ifdef hp9000s500
19968 #include <ndir.h>       /* may be wrong in the future */
19969 #else
19970 #include <sys/dir.h>
19971 #endif
19972 #endif
19973 #endif
19974 #endif
19975 int main() { return closedir(opendir(".")); }
19976 EOM
19977         set try
19978         if eval $compile_ok; then
19979                 if $run ./try > /dev/null 2>&1 ; then
19980                         echo "Yes, it does."
19981                         val="$undef"
19982                 else
19983                         echo "No, it doesn't."
19984                         val="$define"
19985                 fi
19986         else
19987                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19988                 val="$define"
19989         fi
19990         ;;
19991 *)
19992         val="$undef";
19993         ;;
19994 esac
19995 set d_void_closedir
19996 eval $setvar
19997 $rm_try
19998
19999 : see if there is a wait4
20000 set wait4 d_wait4
20001 eval $inlibc
20002
20003 : see if waitpid exists
20004 set waitpid d_waitpid
20005 eval $inlibc
20006
20007 : look for wcscmp
20008 echo " "
20009 $cat >try.c <<'EOCP'
20010 #include <stdio.h>
20011 #include <wchar.h>
20012 int main ()
20013 {
20014     wchar_t *s = L" ";
20015     return (wcscmp (s, s) ? 1 : 0);
20016     }
20017 EOCP
20018 set try
20019 val="$undef"
20020 if eval $compile; then
20021     `$run ./try`
20022     case "$?" in
20023         0)  echo "A working wcscmp() found." >&4
20024             val="$define" ;;
20025         *)  echo "wcscmp() found, but it doesn't work" >&4
20026             ;;
20027         esac
20028 else
20029     echo "wcscmp() NOT found." >&4
20030     fi
20031 set d_wcscmp
20032 eval $setvar
20033 $rm_try
20034
20035 : see if wcstombs exists
20036 set wcstombs d_wcstombs
20037 eval $inlibc
20038
20039 : look for wcsxfrm
20040 echo " "
20041 $cat >try.c <<'EOCP'
20042 #include <errno.h>
20043 #include <wchar.h>
20044 int main ()
20045 {
20046     wchar_t dst[4], *src = L" ";
20047     errno = 0;
20048     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20049     }
20050 EOCP
20051 set try
20052 val="$undef"
20053 if eval $compile; then
20054     `$run ./try`
20055     case "$?" in
20056         0)  echo "A working wcsxfrm() found." >&4
20057             val="$define" ;;
20058         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20059             ;;
20060         esac
20061 else
20062     echo "wcsxfrm() NOT found." >&4
20063     fi
20064 set d_wcsxfrm
20065 eval $setvar
20066 $rm_try
20067
20068 : see if wctomb exists
20069 set wctomb d_wctomb
20070 eval $inlibc
20071
20072 : see if writev exists
20073 set writev d_writev
20074 eval $inlibc
20075
20076 : check for alignment requirements
20077 echo " "
20078 case "$alignbytes" in
20079     '') echo "Checking alignment constraints..." >&4
20080         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
20081             $cat >try.c <<'EOCP'
20082 typedef long double NV;
20083 EOCP
20084         else
20085             $cat >try.c <<'EOCP'
20086 typedef double NV;
20087 EOCP
20088         fi
20089         $cat >>try.c <<'EOCP'
20090 #include <stdio.h>
20091 struct foobar {
20092     char foo;
20093     NV bar;
20094 } try_algn;
20095 int main()
20096 {
20097     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20098     return(0);
20099 }
20100 EOCP
20101         set try
20102         if eval $compile_ok; then
20103             dflt=`$run ./try`
20104         else
20105             dflt='8'
20106             echo "(I can't seem to compile the test program...)"
20107         fi
20108         case "$multiarch" in
20109             *$define*)
20110                 : The usual safe value is 8, but Darwin with -Duselongdouble
20111                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20112                 : Configure to pick a larger value if needed.
20113                 if $test "$dflt" -lt 8; then
20114                     dflt='8'
20115                     echo "Setting alignment to 8 for multiarch support.">&4
20116                 fi
20117                 ;;
20118         esac
20119         ;;
20120     *) dflt="$alignbytes"
20121         ;;
20122 esac
20123 rp="Doubles must be aligned on a how-many-byte boundary?"
20124 . ./myread
20125 alignbytes="$ans"
20126 $rm_try
20127
20128 : set the base revision
20129 baserev=5.0
20130
20131 : length of character in bytes. Is always 1, otherwise it is not C
20132 : This used to be a test using sizeof
20133 charsize=1
20134
20135 : Check for the number of bits in a character
20136 case "$charbits" in
20137 '')     echo "Checking how long a character is (in bits)..." >&4
20138         $cat >try.c <<EOCP
20139 #include <stdio.h>
20140 int main ()
20141 {
20142     int n;
20143     unsigned char c;
20144     for (c = 1, n = 0; c; c <<= 1, n++) ;
20145     printf ("%d\n", n);
20146     return (0);
20147     }
20148 EOCP
20149         set try
20150         if eval $compile_ok; then
20151                 dflt=`$run ./try`
20152         else
20153                 dflt='8'
20154                 echo "(I can't seem to compile the test program.  Guessing...)"
20155         fi
20156         ;;
20157 *)
20158         dflt="$charbits"
20159         ;;
20160 esac
20161 rp="What is the length of a character (in bits)?"
20162 . ./myread
20163 charbits="$ans"
20164 $rm_try
20165 case "$charbits" in
20166 8)      ;;
20167 *)      cat >&4 << EOM
20168 Your system has an unsigned character size of $charbits bits, which
20169 is rather unusual (normally it is 8 bits).  Perl likely will not work
20170 correctly on your system, with subtle bugs in various places.
20171 EOM
20172         rp='Do you really want to continue?'
20173         dflt='n'
20174         . ./myread
20175         case "$ans" in
20176                 [yY])   echo >&4 "Okay, continuing."    ;;
20177                 *)      exit 1                          ;;
20178         esac
20179 esac
20180
20181 : how do we concatenate cpp tokens here?
20182 echo " "
20183 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20184 $cat >cpp_stuff.c <<'EOCP'
20185 #define RCAT(a,b)a/**/b
20186 #define ACAT(a,b)a ## b
20187 RCAT(Rei,ser)
20188 ACAT(Cir,cus)
20189 EOCP
20190 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20191 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20192         echo "Oh!  Smells like ANSI's been here." >&4
20193         echo "We can catify or stringify, separately or together!"
20194         cpp_stuff=42
20195 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20196         echo "Ah, yes!  The good old days!" >&4
20197         echo "However, in the good old days we don't know how to stringify and"
20198         echo "catify at the same time."
20199         cpp_stuff=1
20200 else
20201         $cat >&4 <<EOM
20202 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20203 You're going to have to edit the values of CAT[2-5] in config.h...
20204 EOM
20205         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20206 fi
20207 $rm -f cpp_stuff.*
20208
20209 : see if this is a db.h system
20210 set db.h i_db
20211 eval $inhdr
20212
20213 case "$i_db" in
20214 $define)
20215         : Check db version.
20216         echo " "
20217         echo "Checking Berkeley DB version ..." >&4
20218         $cat >try.c <<EOCP
20219 #$d_const HASCONST
20220 #ifndef HASCONST
20221 #define const
20222 #endif
20223 #include <sys/types.h>
20224 #include <stdio.h>
20225 #$i_stdlib I_STDLIB
20226 #ifdef I_STDLIB
20227 #include <stdlib.h>
20228 #endif
20229 #include <db.h>
20230 int main(int argc, char *argv[])
20231 {
20232 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20233     int Major, Minor, Patch ;
20234     unsigned long Version ;
20235     (void)db_version(&Major, &Minor, &Patch) ;
20236     if (argc == 2) {
20237         printf("%d %d %d %d %d %d\n",
20238                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20239                Major, Minor, Patch);
20240         exit(0);
20241     }
20242     printf("You have Berkeley DB Version 2 or greater.\n");
20243
20244     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20245                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20246     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20247                 Major, Minor, Patch) ;
20248
20249     /* check that db.h & libdb are compatible */
20250     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20251         printf("db.h and libdb are incompatible.\n") ;
20252         exit(3);
20253     }
20254
20255     printf("db.h and libdb are compatible.\n") ;
20256
20257     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20258                 + DB_VERSION_PATCH ;
20259
20260     /* needs to be >= 2.3.4 */
20261     if (Version < 2003004) {
20262     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20263         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20264         exit(2);
20265     }
20266
20267     exit(0);
20268 #else
20269 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20270     if (argc == 2) {
20271         printf("1 0 0\n");
20272         exit(0);
20273     }
20274     printf("You have Berkeley DB Version 1.\n");
20275     exit(0);    /* DB version < 2: the coast is clear. */
20276 #else
20277     exit(1);    /* <db.h> not Berkeley DB? */
20278 #endif
20279 #endif
20280 }
20281 EOCP
20282         set try
20283         if eval $compile_ok && $run ./try; then
20284                 echo 'Looks OK.' >&4
20285                 set `$run ./try 1`
20286                 db_version_major=$1
20287                 db_version_minor=$2
20288                 db_version_patch=$3
20289         else
20290                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20291                 i_db=$undef
20292                 case " $libs " in
20293                 *"-ldb "*)
20294                         : Remove db from list of libraries to use
20295                         echo "Removing unusable -ldb from library list" >&4
20296                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20297                         shift
20298                         libs="$*"
20299                         echo "libs = $libs" >&4
20300                         ;;
20301                 esac
20302         fi
20303         $rm_try
20304         ;;
20305 esac
20306
20307 case "$i_db" in
20308 define)
20309         : Check the return type needed for hash
20310         echo " "
20311         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20312         $cat >try.c <<EOCP
20313 #$d_const HASCONST
20314 #ifndef HASCONST
20315 #define const
20316 #endif
20317 #include <sys/types.h>
20318 #include <db.h>
20319
20320 #ifndef DB_VERSION_MAJOR
20321 u_int32_t hash_cb (const void* ptr, size_t size)
20322 {
20323 }
20324 HASHINFO info;
20325 int main()
20326 {
20327         info.hash = hash_cb;
20328 }
20329 #endif
20330 EOCP
20331         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20332                 if $contains warning try.out >>/dev/null 2>&1 ; then
20333                         db_hashtype='int'
20334                 else
20335                         db_hashtype='u_int32_t'
20336                 fi
20337         else
20338                 : XXX Maybe we should just give up here.
20339                 db_hashtype=u_int32_t
20340                 $cat try.out >&4
20341                 echo "Help:  I can't seem to compile the db test program." >&4
20342                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20343         fi
20344         $rm_try
20345         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20346         ;;
20347 *)      db_hashtype=u_int32_t
20348         ;;
20349 esac
20350 case "$i_db" in
20351 define)
20352         : Check the return type needed for prefix
20353         echo " "
20354         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20355         cat >try.c <<EOCP
20356 #$d_const HASCONST
20357 #ifndef HASCONST
20358 #define const
20359 #endif
20360 #include <sys/types.h>
20361 #include <db.h>
20362
20363 #ifndef DB_VERSION_MAJOR
20364 size_t prefix_cb (const DBT *key1, const DBT *key2)
20365 {
20366 }
20367 BTREEINFO info;
20368 int main()
20369 {
20370         info.prefix = prefix_cb;
20371 }
20372 #endif
20373 EOCP
20374         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20375                 if $contains warning try.out >>/dev/null 2>&1 ; then
20376                         db_prefixtype='int'
20377                 else
20378                         db_prefixtype='size_t'
20379                 fi
20380         else
20381                 db_prefixtype='size_t'
20382                 : XXX Maybe we should just give up here.
20383                 $cat try.out >&4
20384                 echo "Help:  I can't seem to compile the db test program." >&4
20385                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20386         fi
20387         $rm_try
20388         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20389         ;;
20390 *)      db_prefixtype='size_t'
20391         ;;
20392 esac
20393
20394 : Check what kind of inf/nan your system has
20395 $echo "Checking the kind of infinities and nans you have..." >&4
20396 $cat >try.c <<EOP
20397 #define DOUBLESIZE $doublesize
20398 #$d_longdbl HAS_LONG_DOUBLE
20399 #ifdef HAS_LONG_DOUBLE
20400 #define LONGDBLSIZE $longdblsize
20401 #define LONGDBLKIND $longdblkind
20402 #endif
20403 #$i_math I_MATH
20404 #ifdef I_MATH
20405 #include <math.h>
20406 #endif
20407 #include <stdio.h>
20408 /* Note that whether the sign bit is on or off
20409  * for NaN depends on the CPU/FPU, and possibly
20410  * can be affected by the build toolchain.
20411  *
20412  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20413  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20414  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20415  * (respectively) as opposed to the more usual
20416  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20417  */
20418 static void bytes(unsigned char *p, unsigned int n) {
20419   int i;
20420   for (i = 0; i < n; i++) {
20421     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20422   }
20423 }
20424 int main(int argc, char *argv[]) {
20425    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20426     * because some compilers are 'smart' and not only warn but refuse to
20427     * compile such 'illegal' values. */
20428    double dinf = exp(1e9);
20429    double dnan = sqrt(-1.0);
20430 #ifdef HAS_LONG_DOUBLE
20431    long double ldinf = (long double)exp(1e9);
20432    long double ldnan = (long double)sqrt(-1.0);
20433 #endif
20434   if (argc == 2) {
20435     switch (argv[1][0]) {
20436     case '1': bytes(&dinf, sizeof(dinf)); break;
20437     case '2': bytes(&dnan, sizeof(dnan)); break;
20438 #ifdef HAS_LONG_DOUBLE
20439 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20440 /* the 80-bit long doubles might have garbage in their excess bytes */
20441     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20442 # endif
20443     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20444     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20445 #endif
20446     }
20447   }
20448   return 0;
20449 }
20450 EOP
20451 set try
20452 if eval $compile; then
20453     doubleinfbytes=`$run ./try 1`
20454     doublenanbytes=`$run ./try 2`
20455     case "$d_longdbl" in
20456     $define)
20457       longdblinfbytes=`$run ./try 3`
20458       longdblnanbytes=`$run ./try 4`
20459       ;;
20460     esac
20461 else
20462     # Defaults in case the above test program failed.
20463     case "$doublekind" in
20464     1) # IEEE 754 32-bit LE
20465        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20466        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20467        ;;
20468     2) # IEEE 754 32-bit BE
20469        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20470        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20471        ;;
20472     3) # IEEE 754 64-bit LE
20473        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20474        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20475        ;;
20476     4) # IEEE 754 64-bit BE
20477        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20478        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20479        ;;
20480     5) # IEEE 754 128-bit LE
20481        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20482        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20483        ;;
20484     6) # IEEE 754 128-bit BE
20485        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20486        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20487        ;;
20488     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20489        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20490        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20491        ;;
20492     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20493        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20494        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20495        ;;
20496     *) # No idea.
20497        doubleinfbytes=$undef
20498        doublenanbytes=$undef
20499        ;;
20500     esac
20501     case "$longdblkind" in
20502     1) # IEEE 754 128-bit LE
20503        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20504        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20505        ;;
20506     2) # IEEE 754 128-bit BE
20507        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20508        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20509        ;;
20510     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20511        case "$longdblsize" in
20512        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20513            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20514            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20515            ;;
20516        16) # x86_64
20517            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20518            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20519            ;;
20520        *)  # No idea.
20521            longdblinfbytes=$undef
20522            longdblnanbytes=$undef
20523        ;;
20524        esac
20525        ;;
20526     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20527        case "$longdblsize" in
20528        12) # 32-bit system
20529            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20530            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20531            ;;
20532        16) # 64-bit system
20533            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20534            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20535            ;;
20536        *)  # No idea.
20537            longdblinfbytes=$undef
20538            longdblnanbytes=$undef
20539        ;;
20540        esac
20541        ;;
20542     5) # 128-bit LE "double double"
20543        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20544        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20545        ;;
20546     6) # 128-bit BE "double double"
20547        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20548        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20549        ;;
20550     *) # No idea.
20551        longdblinfbytes=$undef
20552        longdblnanbytes=$undef
20553        ;;
20554     esac
20555 fi
20556 $rm_try
20557
20558 : Check the length of the double mantissa
20559 $echo "Checking how many mantissa bits your doubles have..." >&4
20560 $cat >try.c <<EOP
20561 #$i_float I_FLOAT
20562 #$i_sunmath I_SUNMATH
20563 #ifdef I_FLOAT
20564 # include <float.h>
20565 #endif
20566 #ifdef I_SUNMATH
20567 # include <sunmath.h>
20568 #endif
20569 #ifdef DBL_MANT_DIG
20570 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20571 #endif
20572 #include <stdio.h>
20573 int main(int argc, char *argv[]) {
20574 #ifdef BITS
20575   printf("%d\n", BITS);
20576 #endif
20577   return 0;
20578 }
20579 EOP
20580 set try
20581 if eval $compile; then
20582     doublemantbits=`$run ./try`
20583 else
20584     doublemantbits="$undef"
20585 fi
20586 $rm_try
20587
20588 : Check the length of the longdouble mantissa
20589 $echo "Checking how many mantissa bits your long doubles have..." >&4
20590 $cat >try.c <<EOP
20591 #$i_float I_FLOAT
20592 #$i_sunmath I_SUNMATH
20593 #ifdef I_FLOAT
20594 # include <float.h>
20595 #endif
20596 #ifdef I_SUNMATH
20597 # include <sunmath.h>
20598 #endif
20599 #$d_longdbl HAS_LONG_DOUBLE
20600 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20601 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20602 /* This format has no implicit bit.  Beware, however, that for
20603  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20604  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20605  * and the top bit must have been one since 387, zero is plain invalid.
20606  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20607 #  define BITS LDBL_MANT_DIG
20608 # elif ($longdblkind == 5 || $longdblkind == 6) /* double double */
20609 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20610  * reason e.g. Irix thinks 107.  But in any case, we want only
20611  * the number of real bits, the implicit bits are of no interest.  */
20612 #  define BITS 2 * (DBL_MANT_DIG - 1)
20613 # else
20614 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20615 # endif
20616 #endif
20617 #include <stdio.h>
20618 int main(int argc, char *argv[]) {
20619 #ifdef BITS
20620   printf("%d\n", BITS);
20621 #endif
20622   return 0;
20623 }
20624 EOP
20625 set try
20626 if eval $compile; then
20627     longdblmantbits=`$run ./try`
20628 else
20629     longdblmantbits="$undef"
20630 fi
20631 $rm_try
20632
20633 : Check the length of the NV mantissa
20634 $echo "Checking how many mantissa bits your NVs have..." >&4
20635 if test "X$usequadmath" = "X$define"; then
20636   nvmantbits=112 # 128-1-15
20637 else
20638   if test "X$nvsize" = "X$doublesize"; then
20639     nvmantbits="$doublemantbits"
20640   else
20641      if test "X$nvsize" = "X$longdblsize"; then
20642        nvmantbits="$longdblmantbits"
20643      else
20644        nvmantbits="$undef"
20645      fi
20646   fi
20647 fi
20648
20649 : How can we generate normalized random numbers ?
20650 echo " "
20651 echo "Using our internal random number implementation..." >&4
20652
20653 case "$ccflags" in
20654 *-Dmy_rand=*|*-Dmy_srand=*)
20655         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20656         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20657         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20658         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20659         ;;
20660 esac
20661
20662 randfunc=Perl_drand48
20663 drand01="Perl_drand48()"
20664 seedfunc="Perl_drand48_init"
20665 randbits=48
20666 randseedtype=U32
20667
20668 : Determine if this is an EBCDIC system
20669 echo " "
20670 echo "Determining whether or not we are on an EBCDIC system..." >&4
20671 $cat >try.c <<'EOM'
20672 int main()
20673 {
20674   if ('M'==0xd4) return 0;
20675   return 1;
20676 }
20677 EOM
20678
20679 val=$undef
20680 set try
20681 if eval $compile_ok; then
20682         if $run ./try; then
20683                 echo "You seem to speak EBCDIC." >&4
20684                 val="$define"
20685         else
20686                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20687         fi
20688 else
20689         echo "I'm unable to compile the test program." >&4
20690         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20691 fi
20692 $rm_try
20693 set ebcdic
20694 eval $setvar
20695
20696 : Check how to flush
20697 echo " "
20698 $cat >&4 <<EOM
20699 Checking how to flush all pending stdio output...
20700 EOM
20701 # I only know how to find the first 32 possibly open files on SunOS.
20702 # See also hints/sunos_4_1.sh and util.c  --AD
20703 case "$osname" in
20704 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20705 esac
20706 $cat >>try.c <<EOCP
20707 #include <stdio.h>
20708 #$i_stdlib I_STDLIB
20709 #ifdef I_STDLIB
20710 #include <stdlib.h>
20711 #endif
20712 #$i_unistd I_UNISTD
20713 #ifdef I_UNISTD
20714 # include <unistd.h>
20715 #endif
20716 #$d_sysconf HAS_SYSCONF
20717 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20718 #ifdef HAS_STDIO_STREAM_ARRAY
20719 # define STDIO_STREAM_ARRAY $stdio_stream_array
20720 #endif
20721 int main() {
20722   FILE* p;
20723   unlink("try.out");
20724   p = fopen("try.out", "w");
20725 #ifdef TRY_FPUTC
20726   fputc('x', p);
20727 #else
20728 # ifdef TRY_FPRINTF
20729   fprintf(p, "x");
20730 # endif
20731 #endif
20732 #ifdef TRY_FFLUSH_NULL
20733   fflush(NULL);
20734 #endif
20735 #ifdef TRY_FFLUSH_ALL
20736   {
20737     long open_max = -1;
20738 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20739     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20740 # else
20741 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20742     open_max = sysconf(_SC_OPEN_MAX);
20743 #  else
20744 #   ifdef FOPEN_MAX
20745     open_max = FOPEN_MAX;
20746 #   else
20747 #    ifdef OPEN_MAX
20748     open_max = OPEN_MAX;
20749 #    else
20750 #     ifdef _NFILE
20751     open_max = _NFILE;
20752 #     endif
20753 #    endif
20754 #   endif
20755 #  endif
20756 # endif
20757 # ifdef HAS_STDIO_STREAM_ARRAY
20758     if (open_max > 0) {
20759       long i;
20760       for (i = 0; i < open_max; i++)
20761             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20762                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20763                 STDIO_STREAM_ARRAY[i]._flag)
20764                 fflush(&STDIO_STREAM_ARRAY[i]);
20765     }
20766   }
20767 # endif
20768 #endif
20769   _exit(42);
20770 }
20771 EOCP
20772 : first we have to find out how _not_ to flush
20773 $to try.c
20774 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20775     output=''
20776     set try -DTRY_FPUTC
20777     if eval $compile; then
20778             $run ./try 2>/dev/null
20779             code="$?"
20780             $from try.out
20781             if $test ! -s try.out -a "X$code" = X42; then
20782                 output=-DTRY_FPUTC
20783             fi
20784     fi
20785     case "$output" in
20786     '')
20787             set try -DTRY_FPRINTF
20788             if eval $compile; then
20789                     $run ./try 2>/dev/null
20790                     code="$?"
20791                     $from try.out
20792                     if $test ! -s try.out -a "X$code" = X42; then
20793                         output=-DTRY_FPRINTF
20794                     fi
20795             fi
20796         ;;
20797     esac
20798 fi
20799 : check for fflush NULL behavior
20800 case "$fflushNULL" in
20801 '')     set try -DTRY_FFLUSH_NULL $output
20802         if eval $compile; then
20803                 $run ./try 2>/dev/null
20804                 code="$?"
20805                 $from try.out
20806                 if $test -s try.out -a "X$code" = X42; then
20807                         fflushNULL="`$cat try.out`"
20808                 else
20809                         if $test "X$code" != X42; then
20810                                 $cat >&4 <<EOM
20811 (If this test failed, don't worry, we'll try another method shortly.)
20812 EOM
20813                         fi
20814                 fi
20815         fi
20816         $rm -f core try.core core.try.*
20817         case "$fflushNULL" in
20818         x)      $cat >&4 <<EOM
20819 Your fflush(NULL) works okay for output streams.
20820 Let's see if it clobbers input pipes...
20821 EOM
20822 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20823 # bug that improperly flushes the input end of pipes.  So we avoid the
20824 # autoflush on fork/system/exec support for now. :-(
20825 $cat >tryp.c <<EOCP
20826 #include <stdio.h>
20827 int
20828 main(int argc, char **argv)
20829 {
20830     char buf[1024];
20831     int i;
20832     char *bp = buf;
20833     while (1) {
20834         while ((i = getc(stdin)) != -1
20835                && (*bp++ = i) != '\n'
20836                && bp < &buf[1024])
20837         /* DO NOTHING */ ;
20838         *bp = '\0';
20839         fprintf(stdout, "%s", buf);
20840         fflush(NULL);
20841         if (i == -1)
20842             return 0;
20843         bp = buf;
20844     }
20845 }
20846 EOCP
20847                 fflushNULL="$define"
20848                 set tryp
20849                 if eval $compile; then
20850                     $rm -f tryp.out
20851                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20852                     if $test "X$targethost" != X; then
20853                         $to tryp.c
20854                         $to tryp
20855                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20856                     else
20857                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20858                     fi
20859                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20860                        $cat >&4 <<EOM
20861 fflush(NULL) seems to behave okay with input streams.
20862 EOM
20863                         fflushNULL="$define"
20864                     else
20865                         $cat >&4 <<EOM
20866 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20867 EOM
20868                         fflushNULL="$undef"
20869                     fi
20870                 fi
20871                 $rm -f core tryp.c tryp.core core.tryp.*
20872                 ;;
20873         '')     $cat >&4 <<EOM
20874 Your fflush(NULL) isn't working (contrary to ANSI C).
20875 EOM
20876                 fflushNULL="$undef"
20877                 ;;
20878         *)      $cat >&4 <<EOM
20879 Cannot figure out whether your fflush(NULL) works or not.
20880 I'm assuming it doesn't (contrary to ANSI C).
20881 EOM
20882                 fflushNULL="$undef"
20883                 ;;
20884         esac
20885         ;;
20886 $define|true|[yY]*)
20887         fflushNULL="$define"
20888         ;;
20889 *)
20890         fflushNULL="$undef"
20891         ;;
20892 esac
20893 : check explicit looping only if NULL did not work, and if the pipe
20894 : bug does not show up on an explicit flush too
20895 case "$fflushNULL" in
20896 "$undef")
20897         $cat >tryp.c <<EOCP
20898 #include <stdio.h>
20899 int
20900 main(int argc, char **argv)
20901 {
20902     char buf[1024];
20903     int i;
20904     char *bp = buf;
20905     while (1) {
20906         while ((i = getc(stdin)) != -1
20907                && (*bp++ = i) != '\n'
20908                && bp < &buf[1024])
20909         /* DO NOTHING */ ;
20910         *bp = '\0';
20911         fprintf(stdout, "%s", buf);
20912         fflush(stdin);
20913         if (i == -1)
20914             return 0;
20915         bp = buf;
20916     }
20917 }
20918 EOCP
20919         set tryp
20920         if eval $compile; then
20921             $rm -f tryp.out
20922             if $test "X$targethost" != X; then
20923                 $to tryp.c
20924                 $to tryp
20925                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20926             else
20927                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20928             fi
20929             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20930                $cat >&4 <<EOM
20931 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20932 EOM
20933                 : now check for fflushall behaviour
20934                 case "$fflushall" in
20935                 '')     set try -DTRY_FFLUSH_ALL $output
20936                         if eval $compile; then
20937                                 $cat >&4 <<EOM
20938 (Now testing the other method--but note that this also may fail.)
20939 EOM
20940                                 $run ./try 2>/dev/null
20941                                 code=$?
20942                                 $from try.out
20943                                 if $test -s try.out -a "X$code" = X42; then
20944                                         fflushall="`$cat try.out`"
20945                                 fi
20946                         fi
20947                         $rm_try
20948                         case "$fflushall" in
20949                         x)      $cat >&4 <<EOM
20950 Whew. Flushing explicitly all the stdio streams works.
20951 EOM
20952                                 fflushall="$define"
20953                                 ;;
20954                         '')     $cat >&4 <<EOM
20955 Sigh. Flushing explicitly all the stdio streams doesn't work.
20956 EOM
20957                                 fflushall="$undef"
20958                                 ;;
20959                         *)      $cat >&4 <<EOM
20960 Cannot figure out whether flushing stdio streams explicitly works or not.
20961 I'm assuming it doesn't.
20962 EOM
20963                                 fflushall="$undef"
20964                                 ;;
20965                         esac
20966                         ;;
20967                 "$define"|true|[yY]*)
20968                         fflushall="$define"
20969                         ;;
20970                 *)
20971                         fflushall="$undef"
20972                         ;;
20973                 esac
20974             else
20975                 $cat >&4 <<EOM
20976 All is futile.  Even fflush(stdin) clobbers input pipes!
20977 EOM
20978                 fflushall="$undef"
20979             fi
20980         else
20981             fflushall="$undef"
20982         fi
20983         $rm -f core tryp.c tryp.core core.tryp.*
20984         ;;
20985 *)      fflushall="$undef"
20986         ;;
20987 esac
20988
20989 case "$fflushNULL$fflushall" in
20990 undefundef)
20991         $cat <<EOM
20992 OK, I give up.  I cannot figure out how to flush pending stdio output.
20993 We won't be flushing handles at all before fork/exec/popen.
20994 EOM
20995         ;;
20996 esac
20997 $rm_try tryp
20998
20999 : Store the full pathname to the ar program for use in the C program
21000 : Respect a hint or command line value for full_ar.
21001 case "$full_ar" in
21002 '') full_ar=$ar ;;
21003 esac
21004
21005 : Store the full pathname to the sed program for use in the C program
21006 full_sed=$sed
21007
21008 : see what type gids are declared as in the kernel
21009 echo " "
21010 echo "Looking for the type for group ids returned by getgid()."
21011 set gid_t gidtype xxx stdio.h sys/types.h
21012 eval $typedef
21013 case "$gidtype" in
21014 xxx)
21015         xxx=`./findhdr sys/user.h`
21016         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21017         case $1 in
21018         unsigned) dflt="$1 $2" ;;
21019         *) dflt="$1" ;;
21020         esac
21021         ;;
21022 *) dflt="$gidtype";;
21023 esac
21024 case "$gidtype" in
21025 gid_t) echo "gid_t found." ;;
21026 *)      rp="What is the type for group ids returned by getgid()?"
21027         . ./myread
21028         gidtype="$ans"
21029         ;;
21030 esac
21031
21032 : Check the size of GID
21033 echo " "
21034 case "$gidtype" in
21035 *_t) zzz="$gidtype"     ;;
21036 *)   zzz="gid"          ;;
21037 esac
21038 echo "Checking the size of $zzz..." >&4
21039 cat > try.c <<EOCP
21040 #include <sys/types.h>
21041 #include <stdio.h>
21042 #$i_stdlib I_STDLIB
21043 #ifdef I_STDLIB
21044 #include <stdlib.h>
21045 #endif
21046 int main() {
21047     printf("%d\n", (int)sizeof($gidtype));
21048     exit(0);
21049 }
21050 EOCP
21051 set try
21052 if eval $compile_ok; then
21053         yyy=`$run ./try`
21054         case "$yyy" in
21055         '')     gidsize=4
21056                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21057                 ;;
21058         *)      gidsize=$yyy
21059                 echo "Your $zzz is $gidsize bytes long."
21060                 ;;
21061         esac
21062 else
21063         gidsize=4
21064         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21065 fi
21066
21067
21068 : Check if GID is signed
21069 echo " "
21070 case "$gidtype" in
21071 *_t) zzz="$gidtype"     ;;
21072 *)   zzz="gid"          ;;
21073 esac
21074 echo "Checking the sign of $zzz..." >&4
21075 cat > try.c <<EOCP
21076 #include <sys/types.h>
21077 #include <stdio.h>
21078 int main() {
21079         $gidtype foo = -1;
21080         if (foo < 0)
21081                 printf("-1\n");
21082         else
21083                 printf("1\n");
21084 }
21085 EOCP
21086 set try
21087 if eval $compile; then
21088         yyy=`$run ./try`
21089         case "$yyy" in
21090         '')     gidsign=1
21091                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21092                 ;;
21093         *)      gidsign=$yyy
21094                 case "$gidsign" in
21095                  1) echo "Your $zzz is unsigned." ;;
21096                 -1) echo "Your $zzz is signed."   ;;
21097                 esac
21098                 ;;
21099         esac
21100 else
21101         gidsign=1
21102         echo "(I can't compile the test program--guessing unsigned.)" >&4
21103 fi
21104
21105
21106 : Check 64bit sizes
21107 echo " "
21108
21109 if $test X"$quadtype" != X; then
21110
21111 echo "Checking how to print 64-bit integers..." >&4
21112
21113 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21114         $cat >try.c <<'EOCP'
21115 #include <sys/types.h>
21116 #include <stdio.h>
21117 int main() {
21118   int q = 12345678901;
21119   printf("%ld\n", q);
21120 }
21121 EOCP
21122         set try
21123         if eval $compile; then
21124                 yyy=`$run ./try`
21125                 case "$yyy" in
21126                 12345678901)
21127                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21128                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21129                         echo "We will use %d."
21130                         ;;
21131                 esac
21132         fi
21133 fi
21134
21135 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21136         $cat >try.c <<'EOCP'
21137 #include <sys/types.h>
21138 #include <stdio.h>
21139 int main() {
21140   long q = 12345678901;
21141   printf("%ld\n", q);
21142 }
21143 EOCP
21144         set try
21145         if eval $compile; then
21146                 yyy=`$run ./try`
21147                 case "$yyy" in
21148                 12345678901)
21149                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21150                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21151                         echo "We will use %ld."
21152                         ;;
21153                 esac
21154         fi
21155 fi
21156
21157 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21158         $cat >try.c <<'EOCP'
21159 #include <sys/types.h>
21160 #include <inttypes.h>
21161 #include <stdio.h>
21162 int main() {
21163   int64_t q = 12345678901;
21164   printf("%" PRId64 "\n", q);
21165 }
21166 EOCP
21167         set try
21168         if eval $compile; then
21169                 yyy=`$run ./try`
21170                 case "$yyy" in
21171                 12345678901)
21172                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21173                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21174                         echo "We will use the C9X style."
21175                         ;;
21176                 esac
21177         fi
21178 fi
21179
21180 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21181         $cat >try.c <<EOCP
21182 #include <sys/types.h>
21183 #include <stdio.h>
21184 int main() {
21185   $quadtype q = 12345678901;
21186   printf("%Ld\n", q);
21187 }
21188 EOCP
21189         set try
21190         if eval $compile; then
21191                 yyy=`$run ./try`
21192                 case "$yyy" in
21193                 12345678901)
21194                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21195                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21196                         echo "We will use %Ld."
21197                         ;;
21198                 esac
21199         fi
21200 fi
21201
21202 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21203         $cat >try.c <<'EOCP'
21204 #include <sys/types.h>
21205 #include <stdio.h>
21206 int main() {
21207   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21208   printf("%lld\n", q);
21209 }
21210 EOCP
21211         set try
21212         if eval $compile; then
21213                 yyy=`$run ./try`
21214                 case "$yyy" in
21215                 12345678901)
21216                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21217                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21218                         echo "We will use the %lld style."
21219                         ;;
21220                 esac
21221         fi
21222 fi
21223
21224 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21225         $cat >try.c <<EOCP
21226 #include <sys/types.h>
21227 #include <stdio.h>
21228 int main() {
21229   $quadtype q = 12345678901;
21230   printf("%qd\n", q);
21231 }
21232 EOCP
21233         set try
21234         if eval $compile; then
21235                 yyy=`$run ./try`
21236                 case "$yyy" in
21237                 12345678901)
21238                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21239                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21240                         echo "We will use %qd."
21241                         ;;
21242                 esac
21243         fi
21244 fi
21245
21246 if $test X"$sPRId64" = X; then
21247         echo "Cannot figure out how to print 64-bit integers." >&4
21248 fi
21249 $rm_try
21250
21251 fi
21252
21253 case "$sPRId64" in
21254 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21255         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21256         ;;
21257 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21258         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21259         ;;
21260 esac
21261
21262 : Check format strings for internal types
21263 echo " "
21264 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21265
21266 if $test X"$ivsize" = X8; then
21267         ivdformat="$sPRId64"
21268         uvuformat="$sPRIu64"
21269         uvoformat="$sPRIo64"
21270         uvxformat="$sPRIx64"
21271         uvXUformat="$sPRIXU64"
21272 else
21273         if $test X"$ivsize" = X"$longsize"; then
21274                 ivdformat='"ld"'
21275                 uvuformat='"lu"'
21276                 uvoformat='"lo"'
21277                 uvxformat='"lx"'
21278                 uvXUformat='"lX"'
21279         else
21280                 if $test X"$ivsize" = X"$intsize"; then
21281                         ivdformat='"d"'
21282                         uvuformat='"u"'
21283                         uvoformat='"o"'
21284                         uvxformat='"x"'
21285                         uvXUformat='"X"'
21286                 else
21287                         : far out
21288                         if $test X"$ivsize" = X"$shortsize"; then
21289                                 ivdformat='"hd"'
21290                                 uvuformat='"hu"'
21291                                 uvoformat='"ho"'
21292                                 uvxformat='"hx"'
21293                                 uvXUformat='"hX"'
21294                         fi
21295                 fi
21296         fi
21297 fi
21298
21299 if $test X"$usequadmath" = X"$define"; then
21300     nveformat='"Qe"'
21301     nvfformat='"Qf"'
21302     nvgformat='"Qg"'
21303     nvEUformat='"QE"'
21304     nvFUformat='"QF"'
21305     nvGUformat='"QG"'
21306 else
21307     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21308         nveformat="$sPRIeldbl"
21309         nvfformat="$sPRIfldbl"
21310         nvgformat="$sPRIgldbl"
21311         nvEUformat="$sPRIEUldbl"
21312         nvFUformat="$sPRIFUldbl"
21313         nvGUformat="$sPRIGUldbl"
21314     else
21315         nveformat='"e"'
21316         nvfformat='"f"'
21317         nvgformat='"g"'
21318         nvEUformat='"E"'
21319         nvFUformat='"F"'
21320         nvGUformat='"G"'
21321     fi
21322 fi
21323
21324 case "$ivdformat" in
21325 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21326     exit 1
21327     ;;
21328 esac
21329
21330 : Check format string for GID
21331
21332 echo " "
21333 $echo "Checking the format string to be used for gids..." >&4
21334
21335 case "$gidsign" in
21336 -1)     if $test X"$gidsize" = X"$ivsize"; then
21337                 gidformat="$ivdformat"
21338         else
21339                 if $test X"$gidsize" = X"$longsize"; then
21340                         gidformat='"ld"'
21341                 else
21342                         if $test X"$gidsize" = X"$intsize"; then
21343                                 gidformat='"d"'
21344                         else
21345                                 if $test X"$gidsize" = X"$shortsize"; then
21346                                         gidformat='"hd"'
21347                                 fi
21348                         fi
21349                 fi
21350         fi
21351         ;;
21352 *)      if $test X"$gidsize" = X"$uvsize"; then
21353                 gidformat="$uvuformat"
21354         else
21355                 if $test X"$gidsize" = X"$longsize"; then
21356                         gidformat='"lu"'
21357                 else
21358                         if $test X"$gidsize" = X"$intsize"; then
21359                                 gidformat='"u"'
21360                         else
21361                                 if $test X"$gidsize" = X"$shortsize"; then
21362                                         gidformat='"hu"'
21363                                 fi
21364                         fi
21365                 fi
21366         fi
21367         ;;
21368 esac
21369
21370 : see if getgroups exists
21371 set getgroups d_getgrps
21372 eval $inlibc
21373
21374 : see if setgroups exists
21375 set setgroups d_setgrps
21376 eval $inlibc
21377
21378 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21379 echo " "
21380 case "$d_getgrps$d_setgrps" in
21381 *define*)
21382         case "$groupstype" in
21383         '') dflt="$gidtype" ;;
21384         *)  dflt="$groupstype" ;;
21385         esac
21386         $cat <<EOM
21387 What type of pointer is the second argument to getgroups() and setgroups()?
21388 Usually this is the same as group ids, $gidtype, but not always.
21389
21390 EOM
21391         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21392         . ./myread
21393         groupstype="$ans"
21394         ;;
21395 *)  groupstype="$gidtype";;
21396 esac
21397
21398 : check whether make sets MAKE
21399 echo " "
21400 echo "Checking if your $make program sets \$(MAKE)..." >&4
21401 case "$make_set_make" in
21402 '')
21403         $sed 's/^X //' > testmake.mak << 'EOF'
21404 Xall:
21405 X       @echo 'maketemp="$(MAKE)"'
21406 EOF
21407         case "`$make -f testmake.mak 2>/dev/null`" in
21408         *maketemp=*) make_set_make='#' ;;
21409         *)      make_set_make="MAKE=$make" ;;
21410         esac
21411         $rm -f testmake.mak
21412         ;;
21413 esac
21414 case "$make_set_make" in
21415 '#') echo "Yup, it does.";;
21416 *) echo "Nope, it doesn't.";;
21417 esac
21418
21419 : see what type is used for mode_t
21420 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21421 set mode_t modetype int stdio.h sys/types.h
21422 eval $typedef_ask
21423
21424 : see if we need va_copy
21425 echo " "
21426 case "$i_stdarg" in
21427 "$define")
21428         $cat >try.c <<EOCP
21429 #include <stdarg.h>
21430 #include <stdio.h>
21431 #$i_stdlib I_STDLIB
21432 #ifdef I_STDLIB
21433 #include <stdlib.h>
21434 #endif
21435 #include <signal.h>
21436
21437 int
21438 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21439 {
21440   return vfprintf(f, fmt, *valp);
21441 }
21442
21443 int
21444 myvfprintf(FILE *f, const  char *fmt, va_list val)
21445 {
21446   return ivfprintf(f, fmt, &val);
21447 }
21448
21449 int
21450 myprintf(char *fmt, ...)
21451 {
21452   va_list val;
21453   va_start(val, fmt);
21454   return myvfprintf(stdout, fmt, val);
21455 }
21456
21457 int
21458 main(int ac, char **av)
21459 {
21460   signal(SIGSEGV, exit);
21461
21462   myprintf("%s%cs all right, then\n", "that", '\'');
21463   exit(0);
21464 }
21465 EOCP
21466         set try
21467         if eval $compile && $run ./try 2>&1 >/dev/null; then
21468                 case "`$run ./try`" in
21469                 "that's all right, then")
21470                         okay=yes
21471                         ;;
21472                 esac
21473         fi
21474         case "$okay" in
21475         yes)    echo "It seems that you don't need va_copy()." >&4
21476                 need_va_copy="$undef"
21477                 ;;
21478         *)      echo "It seems that va_copy() or similar will be needed." >&4
21479                 need_va_copy="$define"
21480                 ;;
21481         esac
21482         $rm_try
21483         ;;
21484 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21485         need_va_copy="$undef"
21486         ;;
21487 esac
21488
21489 : see what type is used for size_t
21490 rp="What is the type used for the length parameter for string functions?"
21491 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21492 eval $typedef_ask
21493
21494 : check for type of arguments to gethostbyaddr.
21495 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21496         case "$d_gethbyaddr" in
21497         $define)
21498                 $cat <<EOM
21499
21500 Checking to see what type of arguments are accepted by gethostbyaddr().
21501 EOM
21502                 hdrs="$define sys/types.h
21503                         $d_socket sys/socket.h
21504                         $i_niin netinet/in.h
21505                         $i_netdb netdb.h
21506                         $i_unistd unistd.h"
21507                 : The first arg can 'char *' or 'void *'
21508                 : The second arg is some of integral type
21509                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21510                         for yyy in size_t long int; do
21511                                 case "$netdb_host_type" in
21512                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21513                                         if ./protochk "$try" $hdrs; then
21514                                                 echo "Your system accepts $xxx for the first arg."
21515                                                 echo "...and $yyy for the second arg."
21516                                                 netdb_host_type="$xxx"
21517                                                 netdb_hlen_type="$yyy"
21518                                         fi
21519                                         ;;
21520                                 esac
21521                         done
21522                 done
21523                 : In case none of those worked, prompt the user.
21524                 case "$netdb_host_type" in
21525                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21526                         dflt='char *'
21527                         . ./myread
21528                         netdb_host_type=$ans
21529                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21530                         dflt="$sizetype"
21531                         . ./myread
21532                         netdb_hlen_type=$ans
21533                         ;;
21534                 esac
21535                 ;;
21536         *)      : no gethostbyaddr, so pick harmless defaults
21537                 netdb_host_type='char *'
21538                 netdb_hlen_type="$sizetype"
21539                 ;;
21540         esac
21541         # Remove the "const" if needed. -- but then we'll have a
21542         # prototype clash!
21543         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21544 fi
21545
21546 : check for type of argument to gethostbyname.
21547 if test "X$netdb_name_type" = X ; then
21548         case "$d_gethbyname" in
21549         $define)
21550                 $cat <<EOM
21551
21552 Checking to see what type of argument is accepted by gethostbyname().
21553 EOM
21554                 hdrs="$define sys/types.h
21555                         $d_socket sys/socket.h
21556                         $i_niin netinet/in.h
21557                         $i_netdb netdb.h
21558                         $i_unistd unistd.h"
21559                 for xxx in "const char *" "char *"; do
21560                         case "$netdb_name_type" in
21561                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21562                                 if ./protochk "$try" $hdrs; then
21563                                         echo "Your system accepts $xxx."
21564                                         netdb_name_type="$xxx"
21565                                 fi
21566                                 ;;
21567                         esac
21568                 done
21569                 : In case none of those worked, prompt the user.
21570                 case "$netdb_name_type" in
21571                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21572                         dflt='char *'
21573                         . ./myread
21574                         netdb_name_type=$ans
21575                         ;;
21576                 esac
21577                 ;;
21578         *)      : no gethostbyname, so pick harmless default
21579                 netdb_name_type='char *'
21580                 ;;
21581         esac
21582 fi
21583
21584 : check for type of 1st argument to getnetbyaddr.
21585 if test "X$netdb_net_type" = X ; then
21586         case "$d_getnbyaddr" in
21587         $define)
21588                 $cat <<EOM
21589
21590 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21591 EOM
21592                 hdrs="$define sys/types.h
21593                         $d_socket sys/socket.h
21594                         $i_niin netinet/in.h
21595                         $i_netdb netdb.h
21596                         $i_unistd unistd.h"
21597                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21598                         case "$netdb_net_type" in
21599                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21600                                 if ./protochk "$try" $hdrs; then
21601                                         echo "Your system accepts $xxx."
21602                                         netdb_net_type="$xxx"
21603                                 fi
21604                                 ;;
21605                         esac
21606                 done
21607                 : In case none of those worked, prompt the user.
21608                 case "$netdb_net_type" in
21609                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21610                         dflt='long'
21611                         . ./myread
21612                         netdb_net_type=$ans
21613                         ;;
21614                 esac
21615                 ;;
21616         *)      : no getnetbyaddr, so pick harmless default
21617                 netdb_net_type='long'
21618                 ;;
21619         esac
21620 fi
21621 : locate the preferred pager for this system
21622 fn=f/
21623 case "$pager" in
21624 '')
21625         dflt=''
21626         case "$pg" in
21627         /*) dflt=$pg;;
21628         [a-zA-Z]:/*) dflt=$pg;;
21629         esac
21630         case "$more" in
21631         /*) dflt=$more;;
21632         [a-zA-Z]:/*) dflt=$more;;
21633         esac
21634         case "$less" in
21635         /*) dflt=$less;;
21636         [a-zA-Z]:/*) dflt=$less;;
21637         esac
21638         case "$dflt" in
21639         '') dflt=/usr/ucb/more;;
21640         esac
21641         ;;
21642 *)      dflt="$pager"
21643         ;;
21644 esac
21645 fn="f/($dflt)"
21646 echo " "
21647 rp='What pager is used on your system?'
21648 . ./getfile
21649 pager="$ans"
21650
21651 : see what type pids are declared as in the kernel
21652 rp="What is the type of process ids on this system?"
21653 set pid_t pidtype int stdio.h sys/types.h
21654 eval $typedef_ask
21655
21656 : see if ar generates random libraries by itself
21657 echo " "
21658 echo "Checking how to generate random libraries on your machine..." >&4
21659 echo 'int bar1() { return bar2(); }' > bar1.c
21660 echo 'int bar2() { return 2; }' > bar2.c
21661 $cat > foo.c <<EOP
21662 #$i_stdlib I_STDLIB
21663 #ifdef I_STDLIB
21664 #include <stdlib.h>
21665 #endif
21666 int main() { printf("%d\n", bar1()); exit(0); }
21667 EOP
21668 $cc $ccflags -c bar1.c >/dev/null 2>&1
21669 $cc $ccflags -c bar2.c >/dev/null 2>&1
21670 $cc $ccflags -c foo.c >/dev/null 2>&1
21671 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21672 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21673         $run ./foobar >/dev/null 2>&1; then
21674         echo "$ar appears to generate random libraries itself."
21675         orderlib=false
21676         if [ "X$ranlib" = "X" ]; then
21677             ranlib=":"
21678         fi
21679 elif $ar s bar$_a >/dev/null 2>&1 &&
21680         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21681         $run ./foobar >/dev/null 2>&1; then
21682                 echo "a table of contents needs to be added with '$ar s'."
21683                 orderlib=false
21684                 ranlib="$ar s"
21685 elif $ar ts bar$_a >/dev/null 2>&1 &&
21686         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21687         $run ./foobar >/dev/null 2>&1; then
21688                 echo "a table of contents needs to be added with '$ar ts'."
21689                 orderlib=false
21690                 ranlib="$ar ts"
21691 else
21692         case "$ranlib" in
21693         :) ranlib='';;
21694         '')
21695                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21696                 $test -f $ranlib || ranlib=''
21697                 ;;
21698         esac
21699         if $test -n "$ranlib"; then
21700                 echo "your system has '$ranlib'; we'll use that."
21701                 orderlib=false
21702         else
21703                 echo "your system doesn't seem to support random libraries"
21704                 echo "so we'll use lorder and tsort to order the libraries."
21705                 orderlib=true
21706                 ranlib=":"
21707         fi
21708 fi
21709 $rm -f foo* bar*
21710
21711 : see if this is a values.h system
21712 set values.h i_values
21713 eval $inhdr
21714
21715 : Check the max offset that gmtime and localtime accept
21716 echo "Checking max offsets that gmtime () accepts"
21717
21718 case $i_values in
21719     define) yyy="#include <values.h>" ;;
21720     *)      yyy="" ;;
21721     esac
21722
21723 case "$sGMTIME_min/$sGMTIME_max" in
21724     0/0|/)
21725         $cat >try.c <<EOCP
21726 #include <sys/types.h>
21727 #include <stdio.h>
21728 #include <time.h>
21729 $yyy
21730
21731 int i;
21732 struct tm *tmp;
21733 time_t pt;
21734
21735 void gm_check (time_t t, int min_year, int max_year)
21736 {
21737     tmp = gmtime (&t);
21738     if ( tmp == NULL ||
21739         /* Check tm_year overflow */
21740          tmp->tm_year < min_year || tmp->tm_year > max_year)
21741         tmp = NULL;
21742     else
21743         pt = t;
21744     } /* gm_check */
21745
21746 int check_max ()
21747 {
21748     tmp = NULL;
21749     pt  = 0;
21750 #ifdef MAXLONG
21751     gm_check (MAXLONG, 69, 0x7fffffff);
21752 #endif
21753     if (tmp == NULL || tmp->tm_year < 0) {
21754         for (i = 63; i >= 0; i--) {
21755             time_t x = pt | ((time_t)1 << i);
21756             if (x < 0 || x < pt) continue;
21757             gm_check (x, 69, 0x7fffffff);
21758             }
21759         }
21760     printf ("sGMTIME_max=%ld\n", pt);
21761     return (0);
21762     } /* check_max */
21763
21764 int check_min ()
21765 {
21766     tmp = NULL;
21767     pt  = 0;
21768 #ifdef MINLONG
21769     gm_check (MINLONG, -1900, 70);
21770 #endif
21771     if (tmp == NULL) {
21772         for (i = 36; i >= 0; i--) {
21773             time_t x = pt - ((time_t)1 << i);
21774             if (x > 0) continue;
21775             gm_check (x, -1900, 70);
21776             }
21777         }
21778     printf ("sGMTIME_min=%ld\n", pt);
21779     return (0);
21780     } /* check_min */
21781
21782 int main (int argc, char *argv[])
21783 {
21784     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21785     check_max ();
21786     check_min ();
21787     return (0);
21788     } /* main */
21789 EOCP
21790         set try
21791         if eval $compile; then
21792             eval `$run ./try 2>/dev/null`
21793         else
21794             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21795             fi
21796         $rm_try
21797         ;;
21798     esac
21799
21800 echo "Checking max offsets that localtime () accepts"
21801
21802 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21803     0/0|/)
21804         $cat >try.c <<EOCP
21805 #include <sys/types.h>
21806 #include <stdio.h>
21807 #include <time.h>
21808 $yyy
21809
21810 int i;
21811 struct tm *tmp;
21812 time_t pt;
21813
21814 void local_check (time_t t, int min_year, int max_year)
21815 {
21816     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21817         tmp = NULL;
21818     else
21819         tmp = localtime (&t);
21820     if ( tmp == NULL ||
21821         /* Check tm_year overflow */
21822          tmp->tm_year < min_year || tmp->tm_year > max_year)
21823         tmp = NULL;
21824     else
21825         pt = t;
21826     } /* local_check */
21827
21828 int check_max ()
21829 {
21830     tmp = NULL;
21831     pt  = 0;
21832 #ifdef MAXLONG
21833     local_check (MAXLONG, 69, 0x7fffffff);
21834 #endif
21835     if (tmp == NULL || tmp->tm_year < 0) {
21836         for (i = 63; i >= 0; i--) {
21837             time_t x = pt | ((time_t)1 << i);
21838             if (x < 0 || x < pt) continue;
21839             local_check (x, 69, 0x7fffffff);
21840             }
21841         }
21842     printf ("sLOCALTIME_max=%ld\n", pt);
21843     return (0);
21844    } /* check_max */
21845
21846 int check_min ()
21847 {
21848     tmp = NULL;
21849     pt  = 0;
21850 #ifdef MINLONG
21851     local_check (MINLONG, -1900, 70);
21852 #endif
21853     if (tmp == NULL) {
21854         for (i = 36; i >= 0; i--) {
21855             time_t x = pt - ((time_t)1 << i);
21856             if (x > 0) continue;
21857             local_check (x, -1900, 70);
21858             }
21859         }
21860     printf ("sLOCALTIME_min=%ld\n", pt);
21861     return (0);
21862     } /* check_min */
21863
21864 int main (int argc, char *argv[])
21865 {
21866     check_max ();
21867     check_min ();
21868     return (0);
21869     } /* main */
21870 EOCP
21871         set try
21872         if eval $compile; then
21873             eval `$run ./try 2>/dev/null`
21874         else
21875             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21876             fi
21877         $rm_try
21878         ;;
21879     esac
21880
21881 : check for type of arguments to select.
21882 case "$selecttype" in
21883 '') case "$d_select" in
21884         $define)
21885                 echo " "
21886                 $cat <<EOM
21887 Checking to see what type of arguments are accepted by select().
21888 EOM
21889                 hdrs="$define sys/types.h
21890                         $i_systime sys/time.h
21891                         $i_sysselct sys/select.h
21892                         $d_socket sys/socket.h"
21893                 : The first arg can be int, unsigned, or size_t
21894                 : The last arg may or may not be 'const'
21895                 val=''
21896                 : void pointer has been seen but using that
21897                 : breaks the selectminbits test
21898                 for xxx in 'fd_set *' 'int *'; do
21899                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21900                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21901                                         case "$val" in
21902                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21903                                                 if ./protochk "$try" $hdrs; then
21904                                                         echo "Your system accepts $xxx."
21905                                                         val="$xxx"
21906                                                 fi
21907                                                 ;;
21908                                         esac
21909                                 done
21910                         done
21911                 done
21912                 case "$val" in
21913                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21914                         case "$d_fd_set" in
21915                                 $define) dflt="fd_set *" ;;
21916                                 *)              dflt="int *" ;;
21917                         esac
21918                         . ./myread
21919                         val=$ans
21920                         ;;
21921                 esac
21922                 selecttype="$val"
21923                 ;;
21924         *)      : no select, so pick a harmless default
21925                 selecttype='int *'
21926                 ;;
21927         esac
21928         ;;
21929 esac
21930
21931 : check for the select 'width'
21932 case "$selectminbits" in
21933 '') safebits=`expr $ptrsize \* 8`
21934     case "$d_select" in
21935         $define)
21936                 $cat <<EOM
21937
21938 Checking to see on how many bits at a time your select() operates...
21939 EOM
21940                 $cat >try.c <<EOCP
21941 #include <sys/types.h>
21942 #$i_time I_TIME
21943 #$i_systime I_SYS_TIME
21944 #$i_systimek I_SYS_TIME_KERNEL
21945 #ifdef I_TIME
21946 #   include <time.h>
21947 #endif
21948 #ifdef I_SYS_TIME
21949 #   ifdef I_SYS_TIME_KERNEL
21950 #       define KERNEL
21951 #   endif
21952 #   include <sys/time.h>
21953 #   ifdef I_SYS_TIME_KERNEL
21954 #       undef KERNEL
21955 #   endif
21956 #endif
21957 #$i_sysselct I_SYS_SELECT
21958 #ifdef I_SYS_SELECT
21959 #include <sys/select.h>
21960 #endif
21961 #$d_socket HAS_SOCKET
21962 #ifdef HAS_SOCKET
21963 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21964 #endif
21965 #include <stdio.h>
21966 #$i_stdlib I_STDLIB
21967 #ifdef I_STDLIB
21968 #include <stdlib.h>
21969 #endif
21970 $selecttype b;
21971 #define S sizeof(*(b))
21972 #define MINBITS 64
21973 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21974 #define NBITS  (NBYTES * 8)
21975 int main() {
21976     char *s = (char *)malloc(NBYTES);
21977     struct timeval t;
21978     int i;
21979     FILE* fp;
21980     int fd;
21981
21982     if (!s)
21983         exit(1);
21984     fclose(stdin);
21985     fp = fopen("try.c", "r");
21986     if (fp == 0)
21987       exit(2);
21988     fd = fileno(fp);
21989     if (fd < 0)
21990       exit(3);
21991     b = ($selecttype)s;
21992     for (i = 0; i < NBITS; i++)
21993         FD_SET(i, b);
21994     t.tv_sec  = 0;
21995     t.tv_usec = 0;
21996     select(fd + 1, b, 0, 0, &t);
21997     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21998     free(s);
21999     printf("%d\n", i + 1);
22000     return 0;
22001 }
22002 EOCP
22003                 set try
22004                 if eval $compile_ok; then
22005                         selectminbits=`$run ./try 2>/dev/null`
22006                         case "$selectminbits" in
22007                         '')     cat >&4 <<EOM
22008 Cannot figure out on how many bits at a time your select() operates.
22009 I'll play safe and guess it is $safebits bits.
22010 EOM
22011                                 selectminbits=$safebits
22012                                 bits="$safebits bits"
22013                                 ;;
22014                         1)      bits="1 bit" ;;
22015                         *)      bits="$selectminbits bits" ;;
22016                         esac
22017                         echo "Your select() operates on $bits at a time." >&4
22018                 else
22019                         rp='What is the minimum number of bits your select() operates on?'
22020                         case "$byteorder" in
22021                         12345678)       dflt=64 ;;
22022                         1234)           dflt=32 ;;
22023                         *)              dflt=1  ;;
22024                         esac
22025                         . ./myread
22026                         val=$ans
22027                         selectminbits="$val"
22028                 fi
22029                 $rm_try
22030                 ;;
22031         *)      : no select, so pick a harmless default
22032                 selectminbits=$safebits
22033                 ;;
22034         esac
22035         ;;
22036 esac
22037
22038 : Trace out the files included by signal.h, then look for SIGxxx names.
22039 case "$sig_num_init" in
22040 '')
22041 if [ "X$fieldn" = X ]; then
22042         : Just make some guesses.  We check them later.
22043         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22044 else
22045         xxx=`echo '#include <signal.h>' |
22046         $cppstdin $cppminus $cppflags 2>/dev/null |
22047         $grep '^[       ]*#.*include' |
22048         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22049                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22050 fi
22051 xxxfiles=''
22052 for xx in $xxx /dev/null ; do
22053         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22054 done
22055 case "$xxxfiles" in
22056 '')     xxxfiles=`./findhdr signal.h` ;;
22057 esac
22058 xxx=`awk '
22059 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22060         print substr($2, 4, 20)
22061 }
22062 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22063         print substr($3, 4, 20)
22064 }' $xxxfiles`
22065 : Append some common names just in case the awk scan failed.
22066 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22067 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22068 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22069 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22070 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22071
22072 : generate a few handy files for later
22073 $cat > signal.c <<EOCP
22074 #include <sys/types.h>
22075 #include <signal.h>
22076 #$i_stdlib I_STDLIB
22077 #ifdef I_STDLIB
22078 #include <stdlib.h>
22079 #endif
22080 #include <stdio.h>
22081 int main() {
22082
22083 /* Strange style to avoid deeply-nested #if/#else/#endif */
22084 #ifndef NSIG
22085 #  ifdef _NSIG
22086 #    define NSIG (_NSIG)
22087 #  endif
22088 #endif
22089
22090 #ifndef NSIG
22091 #  ifdef SIGMAX
22092 #    define NSIG (SIGMAX+1)
22093 #  endif
22094 #endif
22095
22096 #ifndef NSIG
22097 #  ifdef SIG_MAX
22098 #    define NSIG (SIG_MAX+1)
22099 #  endif
22100 #endif
22101
22102 #ifndef NSIG
22103 #  ifdef _SIG_MAX
22104 #    define NSIG (_SIG_MAX+1)
22105 #  endif
22106 #endif
22107
22108 #ifndef NSIG
22109 #  ifdef MAXSIG
22110 #    define NSIG (MAXSIG+1)
22111 #  endif
22112 #endif
22113
22114 #ifndef NSIG
22115 #  ifdef MAX_SIG
22116 #    define NSIG (MAX_SIG+1)
22117 #  endif
22118 #endif
22119
22120 #ifndef NSIG
22121 #  ifdef SIGARRAYSIZE
22122 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22123 #  endif
22124 #endif
22125
22126 #ifndef NSIG
22127 #  ifdef _sys_nsig
22128 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22129 #  endif
22130 #endif
22131
22132 /* Default to some arbitrary number that's big enough to get most
22133    of the common signals.
22134 */
22135 #ifndef NSIG
22136 #    define NSIG 50
22137 #endif
22138
22139 printf("NSIG %d\n", NSIG);
22140
22141 #ifndef JUST_NSIG
22142
22143 EOCP
22144
22145 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22146 {
22147         printf "#ifdef SIG"; printf $1; printf "\n"
22148         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22149         printf $1; printf ");\n"
22150         printf "#endif\n"
22151 }
22152 END {
22153         printf "#endif /* JUST_NSIG */\n";
22154         printf "exit(0);\n}\n";
22155 }
22156 ' >>signal.c
22157 $cat >signal.awk <<'EOP'
22158 BEGIN { ndups = 0 }
22159 $1 ~ /^NSIG$/ { nsig = $2 }
22160 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22161     if ($2 > maxsig) { maxsig = $2 }
22162     if (sig_name[$2]) {
22163         dup_name[ndups] = $1
22164         dup_num[ndups] = $2
22165         ndups++
22166     }
22167     else {
22168         sig_name[$2] = $1
22169         sig_num[$2] = $2
22170     }
22171 }
22172 END {
22173     if (nsig == 0) {
22174         nsig = maxsig + 1
22175     }
22176     printf("NSIG %d\n", nsig);
22177     for (n = 1; n < nsig; n++) {
22178         if (sig_name[n]) {
22179             printf("%s %d\n", sig_name[n], sig_num[n])
22180         }
22181         else {
22182             printf("NUM%d %d\n", n, n)
22183         }
22184     }
22185     for (n = 0; n < ndups; n++) {
22186         printf("%s %d\n", dup_name[n], dup_num[n])
22187     }
22188 }
22189 EOP
22190 $cat >signal_cmd <<EOS
22191 $startsh
22192 if $test -s signal.lst; then
22193     echo "Using your existing signal.lst file"
22194         exit 0
22195 fi
22196 xxx="$xxx"
22197 EOS
22198 $cat >>signal_cmd <<'EOS'
22199
22200 set signal
22201 if eval $compile_ok; then
22202         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22203                 $uniq | $awk -f signal.awk >signal.lst
22204 else
22205         echo "(I can't seem be able to compile the whole test program)" >&4
22206         echo "(I'll try it in little pieces.)" >&4
22207         set signal -DJUST_NSIG
22208         if eval $compile_ok; then
22209                 $run ./signal$_exe > signal.nsg
22210                 $cat signal.nsg
22211         else
22212                 echo "I can't seem to figure out how many signals you have." >&4
22213                 echo "Guessing 50." >&4
22214                 echo 'NSIG 50' > signal.nsg
22215         fi
22216         : Now look at all the signal names, one at a time.
22217         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22218                 $cat > signal.c <<EOCP
22219 #include <sys/types.h>
22220 #include <signal.h>
22221 #include <stdio.h>
22222 int main() {
22223 printf("$xx %d\n", SIG${xx});
22224 return 0;
22225 }
22226 EOCP
22227                 set signal
22228                 if eval $compile; then
22229                         echo "SIG${xx} found."
22230                         $run ./signal$_exe  >> signal.ls1
22231                 else
22232                         echo "SIG${xx} NOT found."
22233                 fi
22234         done
22235         if $test -s signal.ls1; then
22236                 $cat signal.nsg signal.ls1 |
22237                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22238         fi
22239
22240 fi
22241 if $test -s signal.lst; then
22242         :
22243 else
22244         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22245         echo 'kill -l' >signal
22246         set X `csh -f <signal`
22247         $rm -f signal
22248         shift
22249         case $# in
22250         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22251         esac
22252         echo $@ | $tr ' ' $trnl | \
22253             $awk '{ printf "%s %d\n", $1, ++s; }
22254                   END { printf "NSIG %d\n", ++s }' >signal.lst
22255 fi
22256 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22257 EOS
22258 chmod a+x signal_cmd
22259 $eunicefix signal_cmd
22260
22261 : generate list of signal names
22262 echo " "
22263 case "$sig_name_init" in
22264 '') doinit=yes ;;
22265 *)  case "$sig_num_init" in
22266     ''|*,*) doinit=yes ;;
22267     esac ;;
22268 esac
22269 case "$doinit" in
22270 yes)
22271         echo "Generating a list of signal names and numbers..." >&4
22272         . ./signal_cmd
22273         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22274         sig_name=`$awk 'BEGIN { printf "ZERO " }
22275                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22276         sig_num=`$awk  'BEGIN { printf "0 " }
22277                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22278         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22279                              !/^NSIG/   { printf "\"%s\", ", $1 }
22280                              END        { printf "0\n" }' signal.lst`
22281         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22282                              !/^NSIG/   { printf "%d, ", $2}
22283                              END        { printf "0\n"}' signal.lst`
22284         ;;
22285 esac
22286 echo "The following $sig_count signals are available:"
22287 echo " "
22288 echo $sig_name | $awk \
22289 'BEGIN { linelen = 0 }
22290 {
22291         for (i = 1; i <= NF; i++) {
22292                 name = "SIG" $i " "
22293                 linelen = linelen + length(name)
22294                 if (linelen > 70) {
22295                         printf "\n"
22296                         linelen = length(name)
22297                 }
22298                 printf "%s", name
22299         }
22300         printf "\n"
22301 }'
22302 sig_size=`echo $sig_name | awk '{print NF}'`
22303 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22304 ;;
22305 esac
22306
22307 : Check size of size
22308 echo " "
22309 case "$sizetype" in
22310 *_t) zzz="$sizetype"    ;;
22311 *)   zzz="filesize"     ;;
22312 esac
22313 echo "Checking the size of $zzz..." >&4
22314 cat > try.c <<EOCP
22315 #include <sys/types.h>
22316 #include <stdio.h>
22317 #$i_stdlib I_STDLIB
22318 #ifdef I_STDLIB
22319 #include <stdlib.h>
22320 #endif
22321 int main() {
22322     printf("%d\n", (int)sizeof($sizetype));
22323     exit(0);
22324 }
22325 EOCP
22326 set try
22327 if eval $compile_ok; then
22328         yyy=`$run ./try`
22329         case "$yyy" in
22330         '')     sizesize=4
22331                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22332                 ;;
22333         *)      sizesize=$yyy
22334                 echo "Your $zzz size is $sizesize bytes."
22335                 ;;
22336         esac
22337 else
22338         sizesize=4
22339         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22340 fi
22341
22342
22343 : check for socklen_t
22344 echo " "
22345 echo "Checking to see if you have socklen_t..." >&4
22346 $cat >try.c <<EOCP
22347 #include <sys/types.h>
22348 #$d_socket HAS_SOCKET
22349 #ifdef HAS_SOCKET
22350 #include <sys/socket.h>
22351 #endif
22352 int main() { socklen_t x = 16; }
22353 EOCP
22354 set try
22355 if eval $compile; then
22356         val="$define"
22357         echo "You have socklen_t."
22358 else
22359         val="$undef"
22360         echo "You do not have socklen_t."
22361         case "$sizetype" in
22362         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22363         esac
22364 fi
22365 $rm_try
22366 set d_socklen_t
22367 eval $setvar
22368
22369 : see if this is a socks.h system
22370 set socks.h i_socks
22371 eval $inhdr
22372
22373 : check for type of the size argument to socket calls
22374 case "$d_socket" in
22375 "$define")
22376         $cat <<EOM
22377
22378 Checking to see what type is the last argument of accept().
22379 EOM
22380         yyy=''
22381         case "$d_socklen_t" in
22382         "$define") yyy="$yyy socklen_t"
22383         esac
22384         yyy="$yyy $sizetype int long unsigned"
22385         for xxx in $yyy; do
22386                 case "$socksizetype" in
22387                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22388                         case "$usesocks" in
22389                         "$define")
22390                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22391                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22392                                         socksizetype="$xxx"
22393                                 fi
22394                                 ;;
22395                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22396                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22397                                         socksizetype="$xxx"
22398                                 fi
22399                                 ;;
22400                         esac
22401                         ;;
22402                 esac
22403         done
22404 : In case none of those worked, prompt the user.
22405         case "$socksizetype" in
22406         '')     rp='What is the type for socket address structure sizes?'
22407                 dflt='int'
22408                 . ./myread
22409                 socksizetype=$ans
22410                 ;;
22411         esac
22412         ;;
22413 *)      : no sockets, so pick relatively harmless default
22414         socksizetype='int'
22415         ;;
22416 esac
22417
22418 : see what type is used for signed size_t
22419 set ssize_t ssizetype int stdio.h sys/types.h
22420 eval $typedef
22421 dflt="$ssizetype"
22422 $cat > try.c <<EOM
22423 #include <stdio.h>
22424 #$i_stdlib I_STDLIB
22425 #ifdef I_STDLIB
22426 #include <stdlib.h>
22427 #endif
22428 #include <sys/types.h>
22429 #define Size_t $sizetype
22430 #define SSize_t $dflt
22431 int main()
22432 {
22433         if (sizeof(Size_t) == sizeof(SSize_t))
22434                 printf("$dflt\n");
22435         else if (sizeof(Size_t) == sizeof(int))
22436                 printf("int\n");
22437         else
22438                 printf("long\n");
22439         exit(0);
22440 }
22441 EOM
22442 echo " "
22443 set try
22444 if eval $compile_ok && $run ./try > /dev/null; then
22445         ssizetype=`$run ./try`
22446         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22447 else
22448         $cat >&4 <<EOM
22449 Help! I can't compile and run the ssize_t test program: please enlighten me!
22450 (This is probably a misconfiguration in your system or libraries, and
22451 you really ought to fix it.  Still, I'll try anyway.)
22452
22453 I need a type that is the same size as $sizetype, but is guaranteed to
22454 be signed.  Common values are ssize_t, int and long.
22455
22456 EOM
22457         rp="What signed type is the same size as $sizetype?"
22458         . ./myread
22459         ssizetype="$ans"
22460 fi
22461 $rm_try
22462
22463 : Check the size of st_ino
22464 $echo " "
22465 $echo "Checking the size of st_ino..." >&4
22466 $cat > try.c <<EOCP
22467 #include <sys/stat.h>
22468 #include <stdio.h>
22469 #$i_stdlib I_STDLIB
22470 #ifdef I_STDLIB
22471 #include <stdlib.h>
22472 #endif
22473 int main() {
22474     struct stat st;
22475     printf("%d\n", (int)sizeof(st.st_ino));
22476     exit(0);
22477 }
22478 EOCP
22479 set try
22480 if eval $compile_ok; then
22481         val=`$run ./try`
22482         case "$val" in
22483         '')     st_ino_size=4
22484                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22485                 ;;
22486         *)      st_ino_size=$val
22487                 $echo "Your st_ino is $st_ino_size bytes long."
22488                 ;;
22489         esac
22490 else
22491         st_ino_size=4
22492         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22493 fi
22494 $rm_try
22495
22496 : Check if st_ino is signed
22497 $echo " "
22498 $echo "Checking the sign of st_ino..." >&4
22499 $cat > try.c <<EOCP
22500 #include <sys/stat.h>
22501 #include <stdio.h>
22502 int main() {
22503         struct stat foo;
22504         foo.st_ino = -1;
22505         if (foo.st_ino < 0)
22506                 printf("-1\n");
22507         else
22508                 printf("1\n");
22509 }
22510 EOCP
22511 set try
22512 if eval $compile; then
22513         val=`$run ./try`
22514         case "$val" in
22515         '')     st_ino_sign=1
22516                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22517                 ;;
22518         *)      st_ino_sign=$val
22519                 case "$st_ino_sign" in
22520                  1) $echo "Your st_ino is unsigned." ;;
22521                 -1) $echo "Your st_ino is signed."   ;;
22522                 esac
22523                 ;;
22524         esac
22525 else
22526         st_ino_sign=1
22527         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22528 fi
22529 $rm_try
22530
22531 : see what type of char stdio uses.
22532 echo " "
22533 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22534 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22535         echo "Your stdio uses unsigned chars." >&4
22536         stdchar="unsigned char"
22537 else
22538         echo "Your stdio uses signed chars." >&4
22539         stdchar="char"
22540 fi
22541 $rm -f stdioh
22542
22543 : see what type uids are declared as in the kernel
22544 echo " "
22545 echo "Looking for the type for user ids returned by getuid()."
22546 set uid_t uidtype xxx stdio.h sys/types.h
22547 eval $typedef
22548 case "$uidtype" in
22549 xxx)
22550         xxx=`./findhdr sys/user.h`
22551         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22552         case $1 in
22553         unsigned) dflt="$1 $2" ;;
22554         *) dflt="$1" ;;
22555         esac
22556         ;;
22557 *) dflt="$uidtype";;
22558 esac
22559 case "$uidtype" in
22560 uid_t)  echo "uid_t found." ;;
22561 *)      rp="What is the type for user ids returned by getuid()?"
22562         . ./myread
22563         uidtype="$ans"
22564         ;;
22565 esac
22566
22567 : Check size of UID
22568 echo " "
22569 case "$uidtype" in
22570 *_t) zzz="$uidtype"     ;;
22571 *)   zzz="uid"          ;;
22572 esac
22573 echo "Checking the size of $zzz..." >&4
22574 cat > try.c <<EOCP
22575 #include <sys/types.h>
22576 #include <stdio.h>
22577 #$i_stdlib I_STDLIB
22578 #ifdef I_STDLIB
22579 #include <stdlib.h>
22580 #endif
22581 int main() {
22582     printf("%d\n", (int)sizeof($uidtype));
22583     exit(0);
22584 }
22585 EOCP
22586 set try
22587 if eval $compile_ok; then
22588         yyy=`$run ./try`
22589         case "$yyy" in
22590         '')     uidsize=4
22591                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22592                 ;;
22593         *)      uidsize=$yyy
22594                 echo "Your $zzz is $uidsize bytes long."
22595                 ;;
22596         esac
22597 else
22598         uidsize=4
22599         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22600 fi
22601
22602 : Check if UID is signed
22603 echo " "
22604 case "$uidtype" in
22605 *_t) zzz="$uidtype"     ;;
22606 *)   zzz="uid"          ;;
22607 esac
22608 echo "Checking the sign of $zzz..." >&4
22609 cat > try.c <<EOCP
22610 #include <sys/types.h>
22611 #include <stdio.h>
22612 int main() {
22613         $uidtype foo = -1;
22614         if (foo < 0)
22615                 printf("-1\n");
22616         else
22617                 printf("1\n");
22618 }
22619 EOCP
22620 set try
22621 if eval $compile; then
22622         yyy=`$run ./try`
22623         case "$yyy" in
22624         '')     uidsign=1
22625                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22626                 ;;
22627         *)      uidsign=$yyy
22628                 case "$uidsign" in
22629                  1) echo "Your $zzz is unsigned." ;;
22630                 -1) echo "Your $zzz is signed."   ;;
22631                 esac
22632                 ;;
22633         esac
22634 else
22635         uidsign=1
22636         echo "(I can't compile the test program--guessing unsigned.)" >&4
22637 fi
22638
22639
22640 : Check format string for UID
22641 echo " "
22642 $echo "Checking the format string to be used for uids..." >&4
22643
22644 case "$uidsign" in
22645 -1)     if $test X"$uidsize" = X"$ivsize"; then
22646                 uidformat="$ivdformat"
22647         else
22648                 if $test X"$uidsize" = X"$longsize"; then
22649                         uidformat='"ld"'
22650                 else
22651                         if $test X"$uidsize" = X"$intsize"; then
22652                                 uidformat='"d"'
22653                         else
22654                                 if $test X"$uidsize" = X"$shortsize"; then
22655                                         uidformat='"hd"'
22656                                 fi
22657                         fi
22658                 fi
22659         fi
22660         ;;
22661 *)      if $test X"$uidsize" = X"$uvsize"; then
22662                 uidformat="$uvuformat"
22663         else
22664                 if $test X"$uidsize" = X"$longsize"; then
22665                         uidformat='"lu"'
22666                 else
22667                         if $test X"$uidsize" = X"$intsize"; then
22668                                 uidformat='"u"'
22669                         else
22670                                 if $test X"$uidsize" = X"$shortsize"; then
22671                                         uidformat='"hu"'
22672                                 fi
22673                         fi
22674                 fi
22675         fi
22676         ;;
22677 esac
22678
22679 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22680 echo " "
22681 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22682 $cat >try.c <<'EOM'
22683 /* Intentionally a long probe as I'd like to sanity check that the exact
22684    approach is going to work, as thinking it will work, but only having it
22685    part working at runtime is worse than not having it.  */
22686
22687 #include <sys/types.h>
22688 #include <sys/sysctl.h>
22689 #include <sys/param.h>
22690 #include <stdio.h>
22691 #include <string.h>
22692 #include <stdlib.h>
22693 #include <unistd.h>
22694
22695 int
22696 main(int argc, char **argv) {
22697     char *buffer;
22698     char *argv_leaf = strrchr(argv[0], '/');
22699     char *buffer_leaf;
22700     size_t size = 0;
22701     int mib[4];
22702
22703     mib[0] = CTL_KERN;
22704     mib[1] = KERN_PROC;
22705     mib[2] = KERN_PROC_PATHNAME;
22706     mib[3] = -1;
22707
22708     if (!argv_leaf) {
22709         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22710         return 1;
22711     }
22712
22713     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22714         perror("sysctl");
22715         return 2;
22716     }
22717
22718     if (size < strlen(argv_leaf) + 1) {
22719         fprintf(stderr, "size %lu is too short for a path\n",
22720                 (unsigned long) size);
22721         return 3;
22722     }
22723
22724     if (size > MAXPATHLEN * MAXPATHLEN) {
22725         fprintf(stderr, "size %lu is too long for a path\n",
22726                 (unsigned long) size);
22727         return 4;
22728     }
22729
22730     buffer = malloc(size);
22731     if (!buffer) {
22732         perror("malloc");
22733         return 5;
22734     }
22735
22736     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22737         perror("sysctl");
22738         return 6;
22739     }
22740
22741     if (strlen(buffer) + 1 != size) {
22742         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22743                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22744         return 7;
22745     }
22746
22747
22748     if (*buffer != '/') {
22749         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22750         return 8;
22751     }
22752
22753     if (strstr(buffer, "/./")) {
22754         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22755         return 9;
22756     }
22757
22758     if (strstr(buffer, "/../")) {
22759         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22760         return 10;
22761     }
22762
22763     buffer_leaf = strrchr(buffer, '/');
22764     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22765         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22766         return 11;
22767     }
22768
22769     free(buffer);
22770
22771     return 0;
22772 }
22773 EOM
22774
22775 val=$undef
22776 set try
22777 if eval $compile; then
22778         if $run ./try; then
22779                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22780                 val="$define"
22781         else
22782                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22783                 val="$undef"
22784         fi
22785 else
22786         echo "I'm unable to compile the test program." >&4
22787         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22788         val="$undef"
22789 fi
22790 $rm_try
22791 set usekernprocpathname
22792 eval $setvar
22793
22794 : Determine if we can use _NSGetExecutablePath to find executing program
22795 echo " "
22796 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22797 $cat >try.c <<'EOM'
22798 /* Intentionally a long probe as I'd like to sanity check that the exact
22799    approach is going to work, as thinking it will work, but only having it
22800    part working at runtime is worse than not having it.  */
22801 #include <mach-o/dyld.h>
22802 #include <stdio.h>
22803 #include <stdlib.h>
22804 #include <sys/param.h>
22805 #include <string.h>
22806
22807 int
22808 main(int argc, char **argv) {
22809     char buf[1];
22810     uint32_t size = sizeof(buf);
22811     int result;
22812     char *buffer;
22813     char *tidied;
22814     char *argv_leaf = strrchr(argv[0], '/');
22815     char *tidied_leaf;
22816
22817     if (!argv_leaf) {
22818         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22819         return 1;
22820     }
22821
22822     _NSGetExecutablePath(buf, &size);
22823     if (size > MAXPATHLEN * MAXPATHLEN) {
22824         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22825                 (unsigned int) size);
22826         return 2;
22827     }
22828
22829     buffer = malloc(size);
22830     if (!buffer) {
22831         perror("malloc");
22832         return 3;
22833     }
22834
22835     result = _NSGetExecutablePath(buffer, &size);
22836     if (result != 0) {
22837         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22838                 result, (unsigned int) size);
22839         return 4;
22840     }
22841
22842     tidied = realpath(buffer, NULL);
22843     if (!tidied) {
22844         perror("realpath");
22845         return 5;
22846     }
22847
22848     free(buffer);
22849
22850     if (*tidied != '/') {
22851         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22852         return 6;
22853     }
22854
22855     if (strstr(tidied, "/./")) {
22856         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22857         return 7;
22858     }
22859
22860     if (strstr(tidied, "/../")) {
22861         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22862         return 8;
22863     }
22864
22865     tidied_leaf = strrchr(tidied, '/');
22866     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22867         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22868         return 9;
22869     }
22870
22871     free(tidied);
22872
22873     return 0;
22874 }
22875 EOM
22876
22877 val=$undef
22878 set try
22879 if eval $compile; then
22880         if $run ./try; then
22881                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22882                 val="$define"
22883         else
22884                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22885         fi
22886 else
22887         echo "I'm unable to compile the test program." >&4
22888         echo "I'll assume no _NSGetExecutablePath here." >&4
22889 fi
22890 $rm_try
22891 set usensgetexecutablepath
22892 eval $setvar
22893
22894 : Check if site customization support was requested
22895 case "$usesitecustomize" in
22896     $define|true|[Yy]*)
22897         usesitecustomize="$define"
22898         ;;
22899     *)
22900         usesitecustomize="$undef"
22901         ;;
22902     esac
22903
22904 : see if prototypes support variable argument declarations
22905 echo " "
22906 case "$prototype$i_stdarg" in
22907 $define$define)
22908         echo "It appears we'll be able to prototype varargs functions." >&4
22909         val="$define"
22910         ;;
22911 *)
22912         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22913         val="$undef"
22914         ;;
22915 esac
22916 set vaproto
22917 eval $setvar
22918
22919 : determine compiler compiler
22920 case "$yacc" in
22921 '')
22922         dflt=yacc;;
22923 *)
22924         dflt="$yacc";;
22925 esac
22926 echo " "
22927 comp='yacc'
22928 if $test -f "$byacc$_exe"; then
22929         dflt="$byacc"
22930         comp="byacc or $comp"
22931 fi
22932 if $test -f "$bison$_exe"; then
22933         comp="$comp or bison -y"
22934 fi
22935 rp="Which compiler compiler ($comp) shall I use?"
22936 . ./myread
22937 yacc="$ans"
22938 case "$yacc" in
22939 *bis*)
22940         case "$yacc" in
22941         *-y*) ;;
22942         *)
22943                 yacc="$yacc -y"
22944                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22945                 ;;
22946         esac
22947         ;;
22948 esac
22949
22950 : see if this is a assert.h system
22951 set assert.h i_assert
22952 eval $inhdr
22953
22954 : see if this is a bfd.h system
22955 set bfd.h i_bfd
22956 eval $inhdr
22957
22958 : see if this is an execinfo.h system
22959 set execinfo.h i_execinfo
22960 eval $inhdr
22961
22962 : see if this is a fenv.h system
22963 set fenv.h i_fenv
22964 eval $inhdr
22965
22966 : see if this is a fp.h system
22967 set fp.h i_fp
22968 eval $inhdr
22969
22970 : see if this is a fp_class.h system
22971 set fp_class.h i_fp_class
22972 eval $inhdr
22973
22974 : see if gdbm.h is available
22975 set gdbm.h t_gdbm
22976 eval $inhdr
22977 case "$t_gdbm" in
22978 $define)
22979         : see if gdbm_open exists
22980         set gdbm_open d_gdbm_open
22981         eval $inlibc
22982         case "$d_gdbm_open" in
22983         $undef)
22984                 t_gdbm="$undef"
22985                 echo "We won't be including <gdbm.h>"
22986                 ;;
22987         esac
22988         ;;
22989 esac
22990 val="$t_gdbm"
22991 set i_gdbm
22992 eval $setvar
22993
22994 : see if this is a ieeefp.h system
22995 case "$i_ieeefp" in
22996 '' ) set ieeefp.h i_ieeefp
22997      eval $inhdr
22998      ;;
22999 esac
23000
23001 : see if this is a libutil.h system
23002 set libutil.h i_libutil
23003 eval $inhdr
23004
23005 : see if mach cthreads are available
23006 if test "X$usethreads" = "X$define"; then
23007         set mach/cthreads.h i_machcthr
23008         eval $inhdr
23009 else
23010         i_machcthr="$undef"
23011 fi
23012
23013 : see if this is a mntent.h system
23014 set mntent.h i_mntent
23015 eval $inhdr
23016
23017 : see if net/errno.h is available
23018 val=''
23019 set net/errno.h val
23020 eval $inhdr
23021
23022 : Unfortunately, it causes problems on some systems.  Arrgh.
23023 case "$val" in
23024 $define)
23025         cat > try.c <<'EOM'
23026 #include <stdio.h>
23027 #include <errno.h>
23028 #include <net/errno.h>
23029 int func()
23030 {
23031         return ENOTSOCK;
23032 }
23033 EOM
23034         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23035                 echo "We'll be including <net/errno.h>." >&4
23036         else
23037                 echo "We won't be including <net/errno.h>." >&4
23038                 val="$undef"
23039         fi
23040         $rm_try
23041         ;;
23042 esac
23043 set i_neterrno
23044 eval $setvar
23045
23046 : see if netinet/tcp.h is available
23047 set netinet/tcp.h i_netinettcp
23048 eval $inhdr
23049
23050 : see if this is a poll.h system
23051 set poll.h i_poll
23052 eval $inhdr
23053
23054 : see if this is a prot.h system
23055 set prot.h i_prot
23056 eval $inhdr
23057
23058 : Preprocessor symbols
23059 echo " "
23060 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23061 $cat <<'EOSH' > Cppsym.know
23062 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23063 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23064 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23065 arch_pwr ardent ARM ARM32 atarist att386 att3b
23066 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23067 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23068 byteorder byte_order
23069 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23070 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23071 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23072 ELF encore EPI EXTENSIONS
23073 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23074 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23075 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23076 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23077 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
23078 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23079 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23080 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23081 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23082 ksr1
23083 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23084 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23085 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23086 luna88k Lynx
23087 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23088 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23089 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23090 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23091 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
23092 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23093 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23094 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23095 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23096 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23097 ns32000 ns32016 ns32332 ns32k nsc32000
23098 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23099 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23100 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23101 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23102 QK_USER QNX
23103 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23104 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23105 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23106 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23107 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23108 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23109 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23110 SYSV4 SYSV5 sysV68 sysV88
23111 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23112 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23113 tower32_800 tower32_850 tss
23114 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23115 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23116 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23117 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23118 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23119 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23120 uxpm uxps
23121 vax venix VMESA vms
23122 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23123 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23124 z8000 zarch
23125 EOSH
23126 # Maybe put other stuff here too.
23127 ./tr '-' '_' <<EOSH >>Cppsym.know
23128 $osname
23129 EOSH
23130 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23131 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23132 $cat Cppsym.know > Cppsym.c
23133 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23134 $rm -f Cppsym.a Cppsym.b Cppsym.c
23135 cat <<EOSH > Cppsym
23136 $startsh
23137 if $test \$# -gt 0; then
23138     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23139     if $test -s Cppsym.got; then
23140         $rm -f Cppsym.got
23141         exit 0
23142     fi
23143     $rm -f Cppsym.got
23144     exit 1
23145 else
23146     $tr " " "$trnl" | ./Cppsym.try
23147     exit 0
23148 fi
23149 EOSH
23150 chmod +x Cppsym
23151 $eunicefix Cppsym
23152 cat <<EOSH > Cppsym.try
23153 $startsh
23154 cat <<'EOCP' > try.c
23155 #include <stdio.h>
23156 #if cpp_stuff == 1
23157 #define STRINGIFY(a)    "a"
23158 #endif
23159 #if cpp_stuff == 42
23160 #define StGiFy(a)  #a
23161 #define STRINGIFY(a)    StGiFy(a)
23162 #endif
23163 #if $cpp_stuff != 1 && $cpp_stuff != 42
23164 #   include "Bletch: How does this C preprocessor stringify macros?"
23165 #endif
23166 int main() {
23167 EOCP
23168 $awk \\
23169 EOSH
23170 cat <<'EOSH' >> Cppsym.try
23171 'length($1) > 0 {
23172     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23173     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23174     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23175     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23176 }'       >> try.c
23177 echo 'return 0;}' >> try.c
23178 EOSH
23179 cat <<EOSH >> Cppsym.try
23180 ccflags="$ccflags"
23181 case "$osname-$gccversion" in
23182 irix-) ccflags="\$ccflags -woff 1178" ;;
23183 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23184 esac
23185 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
23186 EOSH
23187 chmod +x Cppsym.try
23188 $eunicefix Cppsym.try
23189 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23190 : Add in any Linux cpp "predefined macros":
23191 case "$osname::$gccversion" in
23192   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23193     tHdrH=_tmpHdr
23194     rm -f $tHdrH'.h' $tHdrH
23195     touch $tHdrH'.h'
23196     # Filter out macro arguments, such as Linux's __INT8_C(c)
23197     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23198        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23199        if [ -s $tHdrH'_cppsym.real' ]; then
23200           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23201        fi
23202     fi
23203     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23204   ;;
23205 esac
23206 : now check the C compiler for additional symbols
23207 postprocess_cc_v=''
23208 case "$osname" in
23209 aix) postprocess_cc_v="|$tr , ' '" ;;
23210 esac
23211 $cat >ccsym <<EOS
23212 $startsh
23213 $cat >tmp.c <<EOF
23214 extern int foo;
23215 EOF
23216 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23217 do
23218         case "\$i" in
23219         -D*) echo "\$i" | $sed 's/^-D//';;
23220         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23221         esac
23222 done
23223 $rm_try
23224 EOS
23225 postprocess_cc_v=''
23226 chmod +x ccsym
23227 $eunicefix ccsym
23228 ./ccsym > ccsym1.raw
23229 if $test -s ccsym1.raw; then
23230     $sort ccsym1.raw | $uniq >ccsym.raw
23231 else
23232     mv ccsym1.raw ccsym.raw
23233 fi
23234
23235 $awk '/\=/ { print $0; next }
23236         { print $0"=1" }' ccsym.raw >ccsym.list
23237 $comm -13 Cppsym.true ccsym.list >ccsym.own
23238 $comm -12 Cppsym.true ccsym.list >ccsym.com
23239 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23240 also=''
23241 if $test -z ccsym.raw; then
23242         echo "Your C compiler doesn't seem to define any symbols!" >&4
23243         echo " "
23244         echo "However, your C preprocessor defines the following symbols:"
23245         $cat Cppsym.true
23246         ccsymbols=''
23247         cppsymbols=`$cat Cppsym.true`
23248         cppsymbols=`echo $cppsymbols`
23249         cppccsymbols="$cppsymbols"
23250 else
23251         if $test -s ccsym.com; then
23252                 echo "Your C compiler and pre-processor define these symbols:"
23253                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23254                 also='also '
23255                 symbols='ones'
23256                 cppccsymbols=`$cat ccsym.com`
23257                 cppccsymbols=`echo $cppccsymbols`
23258                 $test "$silent" || sleep 1
23259         fi
23260         if $test -s ccsym.cpp; then
23261                 $test "$also" && echo " "
23262                 echo "Your C pre-processor ${also}defines the following symbols:"
23263                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23264                 also='further '
23265                 cppsymbols=`$cat ccsym.cpp`
23266                 cppsymbols=`echo $cppsymbols`
23267                 $test "$silent" || sleep 1
23268         fi
23269         if $test -s ccsym.own; then
23270                 $test "$also" && echo " "
23271                 echo "Your C compiler ${also}defines the following cpp symbols:"
23272                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23273                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23274                 ccsymbols=`$cat ccsym.own`
23275                 ccsymbols=`echo $ccsymbols`
23276                 $test "$silent" || sleep 1
23277         fi
23278 fi
23279
23280 : add -D_FORTIFY_SOURCE if feasible and not already there
23281 case "$gccversion" in
23282 [45].*) case "$optimize$ccflags" in
23283         *-O*)   case "$ccflags$cppsymbols" in
23284                 *_FORTIFY_SOURCE=*) # Don't add it again.
23285                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23286                         ;;
23287                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23288                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23289                         ;;
23290                 esac
23291                 ;;
23292         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23293                 ;;
23294         esac
23295         ;;
23296 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23297         ;;
23298 esac
23299
23300 : see if this is a termio system
23301 val="$undef"
23302 val2="$undef"
23303 val3="$undef"
23304 if $test `./findhdr termios.h`; then
23305     set tcsetattr i_termios
23306     eval $inlibc
23307     val3="$i_termios"
23308 fi
23309 echo " "
23310 case "$val3" in
23311     "$define") echo "You have POSIX termios.h... good!" >&4;;
23312     *)  if ./Cppsym pyr; then
23313             case "`$run /bin/universe`" in
23314                 ucb) if $test `./findhdr sgtty.h`; then
23315                         val2="$define"
23316                         echo "<sgtty.h> found." >&4
23317                     else
23318                         echo "System is pyramid with BSD universe."
23319                         ./warn "<sgtty.h> not found--you could have problems."
23320                     fi;;
23321                 *)  if $test `./findhdr termio.h`; then
23322                         val="$define"
23323                         echo "<termio.h> found." >&4
23324                     else
23325                         echo "System is pyramid with USG universe."
23326                         ./warn "<termio.h> not found--you could have problems."
23327                     fi;;
23328             esac
23329         elif ./usg; then
23330             if $test `./findhdr termio.h`; then
23331                 echo "<termio.h> found." >&4
23332                 val="$define"
23333             elif $test `./findhdr sgtty.h`; then
23334                 echo "<sgtty.h> found." >&4
23335                 val2="$define"
23336             else
23337                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23338             fi
23339         else
23340             if $test `./findhdr sgtty.h`; then
23341                 echo "<sgtty.h> found." >&4
23342                 val2="$define"
23343             elif $test `./findhdr termio.h`; then
23344                 echo "<termio.h> found." >&4
23345                 val="$define"
23346             else
23347                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23348             fi
23349         fi;;
23350 esac
23351 set i_termio; eval $setvar
23352 val=$val2; set i_sgtty; eval $setvar
23353 val=$val3; set i_termios; eval $setvar
23354
23355 : see if stdbool is available
23356 : we want a real compile instead of Inhdr because some Solaris systems
23357 : have stdbool.h, but it can only be used if the compiler indicates it
23358 : is sufficiently c99-compliant.
23359 echo " "
23360 $cat >try.c <<EOCP
23361 #include <stdio.h>
23362 #include <stdbool.h>
23363 int func(bool x)
23364 {
23365     return x ? 1 : 0;
23366 }
23367 int main(int argc, char **argv)
23368 {
23369     return func(0);
23370 }
23371 EOCP
23372 set try
23373 if eval $compile; then
23374         echo "<stdbool.h> found." >&4
23375         val="$define"
23376 else
23377         echo "<stdbool.h> NOT found." >&4
23378         val="$undef"
23379 fi
23380 $rm_try
23381 set i_stdbool
23382 eval $setvar
23383
23384 : see if stddef is available
23385 set stddef.h i_stddef
23386 eval $inhdr
23387
23388 : see if stdint is available
23389 set stdint.h i_stdint
23390 eval $inhdr
23391
23392 : see if sys/access.h is available
23393 set sys/access.h i_sysaccess
23394 eval $inhdr
23395
23396 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23397 set sys/filio.h i_sysfilio
23398 eval $inhdr
23399 echo " "
23400 if $test `./findhdr sys/ioctl.h`; then
23401         val="$define"
23402         echo '<sys/ioctl.h> found.' >&4
23403 else
23404         val="$undef"
23405         if $test $i_sysfilio = "$define"; then
23406             echo '<sys/ioctl.h> NOT found.' >&4
23407         else
23408                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23409                 $test $i_termio = "$define" && xxx="termio.h"
23410                 $test $i_termios = "$define" && xxx="termios.h"
23411 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23412         fi
23413 fi
23414 set i_sysioctl
23415 eval $setvar
23416
23417 : see if socket ioctl defs are in sys/sockio.h
23418 echo " "
23419 xxx=`./findhdr sys/sockio.h`
23420 if $test "$xxx"; then
23421         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23422                 val="$define"
23423                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23424         else
23425                 val="$undef"
23426                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23427         fi
23428 else
23429         val="$undef"
23430         $cat <<EOM
23431 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23432 EOM
23433 fi
23434 set i_syssockio
23435 eval $setvar
23436
23437 : see if this is a syslog.h system
23438 set syslog.h i_syslog
23439 eval $inhdr
23440
23441 : see if this is a sys/mode.h system
23442 set sys/mode.h i_sysmode
23443 eval $inhdr
23444
23445 : see if there is a sys/poll.h file
23446 set sys/poll.h i_syspoll
23447 eval $inhdr
23448
23449 : see if sys/resource.h has to be included
23450 set sys/resource.h i_sysresrc
23451 eval $inhdr
23452
23453 : see if sys/security.h is available
23454 set sys/security.h i_syssecrt
23455 eval $inhdr
23456
23457 : see if this is a sys/statvfs.h system
23458 set sys/statvfs.h i_sysstatvfs
23459 eval $inhdr
23460
23461 : see if this is a sys/un.h system
23462 set sys/un.h i_sysun
23463 eval $inhdr
23464
23465 : see if this is a sys/utsname.h system
23466 set sys/utsname.h i_sysutsname
23467 eval $inhdr
23468
23469 : see if this is a syswait system
23470 set sys/wait.h i_syswait
23471 eval $inhdr
23472
23473 : see if this is a ustat.h system
23474 set ustat.h i_ustat
23475 eval $inhdr
23476
23477 : see if this is an utime system
23478 set utime.h i_utime
23479 eval $inhdr
23480
23481 : see if this is a vfork system
23482 case "$d_vfork" in
23483 "$define")
23484         set vfork.h i_vfork
23485         eval $inhdr
23486         ;;
23487 *)
23488         i_vfork="$undef"
23489         ;;
23490 esac
23491
23492 : Check extensions
23493 echo " "
23494 echo "Looking for extensions..." >&4
23495 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23496 : contain old or inaccurate or duplicate values.
23497 nonxs_extensions=''
23498 xs_extensions=''
23499 : We do not use find because it might not be available.
23500 : We do not just use MANIFEST because the user may have dropped
23501 : some additional extensions into the source tree and expect them
23502 : to be built.
23503
23504 : Function to recursively find available extensions, ignoring DynaLoader
23505 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23506 : In 5.10.1 and later, extensions are stored in directories
23507 : like File-Glob instead of the older File/Glob/.
23508 find_extensions='
23509     for xxx in *; do
23510         case "$xxx" in
23511             DynaLoader|dynaload) ;;
23512             *)
23513             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23514             case "$this_ext" in
23515                 Scalar/List/Utils) this_ext="List/Util" ;;
23516                 PathTools)         this_ext="Cwd"       ;;
23517             esac;
23518             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23519             if $contains " $this_ext " "$tdir/$$.tmp"; then
23520                 echo >&4;
23521                 echo "Duplicate directories detected for extension $xxx" >&4;
23522                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23523                 case "$knowitall" in
23524                 "") dflt=y;;
23525                 *) dflt=n;;
23526                 esac;
23527                 . ../UU/myread;
23528                 case "$ans" in
23529                 n*|N*) ;;
23530                 *) echo >&4;
23531                     echo "Ok.  Stopping Configure." >&4;
23532                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23533                     exit 1;;
23534                 esac;
23535                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23536             fi;
23537             $ls -1 "$xxx" > "$tdir/$$.tmp";
23538             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23539                 xs_extensions="$xs_extensions $this_ext";
23540             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23541                 xs_extensions="$xs_extensions $this_ext";
23542             elif $test -d "$xxx"; then
23543                 nonxs_extensions="$nonxs_extensions $this_ext";
23544             fi;
23545             $rm -f "$tdir/$$.tmp";
23546             ;;
23547         esac;
23548     done'
23549 tdir=`pwd`
23550 cd "$rsrc/cpan"
23551 set X
23552 shift
23553 eval $find_extensions
23554 cd "$rsrc/dist"
23555 set X
23556 shift
23557 eval $find_extensions
23558 cd "$rsrc/ext"
23559 set X
23560 shift
23561 eval $find_extensions
23562 set X $xs_extensions
23563 shift
23564 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23565 set X $nonxs_extensions
23566 shift
23567 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23568 cd "$tdir"
23569 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23570
23571 : Now see which are supported on this system.
23572 avail_ext=''
23573 for xxx in $xs_extensions ; do
23574         case "$xxx" in
23575         Amiga*)
23576                 case "$osname" in
23577                 amigaos) avail_ext="$avail_ext $xxx" ;;
23578                 esac
23579                 ;;
23580         DB_File|db_file)
23581                 case "$i_db" in
23582                 $define) avail_ext="$avail_ext $xxx" ;;
23583                 esac
23584                 ;;
23585         GDBM_File|gdbm_fil)
23586                 case "$i_gdbm" in
23587                 $define) avail_ext="$avail_ext $xxx" ;;
23588                 esac
23589                 ;;
23590         I18N/Langinfo|i18n_lan)
23591                 case "$i_langinfo$d_nl_langinfo" in
23592                 $define$define) avail_ext="$avail_ext $xxx" ;;
23593                 esac
23594                 ;;
23595         IPC/SysV|ipc/sysv)
23596                 : XXX Do we need a useipcsysv variable here
23597                 case "${d_msg}${d_sem}${d_shm}" in
23598                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23599                 esac
23600                 ;;
23601         NDBM_File|ndbm_fil)
23602                 case "$d_ndbm" in
23603                 $define)
23604                     case "$osname-$use64bitint" in
23605                     hpux-define)
23606                         case "$libs" in
23607                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23608                         esac
23609                         ;;
23610                     *) avail_ext="$avail_ext $xxx" ;;
23611                     esac
23612                     ;;
23613                 esac
23614                 ;;
23615         ODBM_File|odbm_fil)
23616                 case "${i_dbm}${i_rpcsvcdbm}" in
23617                 *"${define}"*)
23618                     case "$d_cplusplus" in
23619                     define) ;; # delete as a function name will not work
23620                     *)  case "$osname-$use64bitint" in
23621                         hpux-define)
23622                             case "$libs" in
23623                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23624                             esac
23625                             ;;
23626                         *) avail_ext="$avail_ext $xxx" ;;
23627                         esac
23628                         ;;
23629                     esac
23630                     ;;
23631                 esac
23632                 ;;
23633         Opcode|opcode)
23634                 case "$useopcode" in
23635                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23636                 esac
23637                 ;;
23638         POSIX|posix)
23639                 case "$useposix" in
23640                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23641                 esac
23642                 ;;
23643         Socket|socket)
23644                 case "$d_socket" in
23645                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23646                 esac
23647                 ;;
23648         Sys/Syslog|sys/syslog)
23649                 case $osname in
23650                         amigaos) ;; # not really very useful on AmigaOS
23651                         *)
23652                         : XXX syslog requires socket
23653                         case "$d_socket" in
23654                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23655                         esac
23656                         ;;
23657                 esac
23658                 ;;
23659         Thread|thread)
23660                 case "$usethreads" in
23661                 true|$define|y)
23662                         case "$use5005threads" in
23663                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23664                         esac
23665                 esac
23666                 ;;
23667         threads|threads/shared)
23668                 # threads and threads::shared are special cases.
23669                 # To stop people from asking "Perl 5.8.0 was supposed
23670                 # to have this new fancy threads implementation but my
23671                 # perl doesn't have it" and from people trying to
23672                 # (re)install the threads module using CPAN.pm and
23673                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23674                 # the threads.pm and threads/shared.pm will always be
23675                 # there, croaking informatively ("you need to rebuild
23676                 # all of Perl with threads, sorry") when threads haven't
23677                 # been compiled in.
23678                 # --jhi
23679                 avail_ext="$avail_ext $xxx"
23680                 ;;
23681         VMS*)
23682                 ;;
23683         Win32*)
23684                 case "$osname" in
23685                 cygwin) avail_ext="$avail_ext $xxx" ;;
23686                 esac
23687                 ;;
23688         XS/APItest|xs/apitest)
23689                 # This is just for testing.  Skip it unless we have dynamic loading.
23690
23691                 case "$usedl" in
23692                 $define) avail_ext="$avail_ext $xxx" ;;
23693                 esac
23694                 ;;
23695         XS/Typemap|xs/typemap)
23696                 # This is just for testing.  Skip it unless we have dynamic loading.
23697                 case "$usedl" in
23698                 $define) avail_ext="$avail_ext $xxx" ;;
23699                 esac
23700                 ;;
23701         *)      avail_ext="$avail_ext $xxx"
23702                 ;;
23703         esac
23704 done
23705
23706 set X $avail_ext
23707 shift
23708 avail_ext="$*"
23709
23710 case "$onlyextensions" in
23711 '') ;;
23712 *)  keepextensions=''
23713     echo "You have requested that only certain extensions be included..." >&4
23714     for i in $onlyextensions; do
23715         case " $avail_ext " in
23716         *" $i "*)
23717             echo "Keeping extension $i."
23718             keepextensions="$keepextensions $i"
23719             ;;
23720         *) echo "Ignoring extension $i." ;;
23721         esac
23722     done
23723     avail_ext="$keepextensions"
23724     ;;
23725 esac
23726
23727 case "$noextensions" in
23728 '') ;;
23729 *)  keepextensions=''
23730     echo "You have requested that certain extensions be ignored..." >&4
23731     for i in $avail_ext; do
23732         case " $noextensions " in
23733         *" $i "*) echo "Ignoring extension $i." ;;
23734         *) echo "Keeping extension $i.";
23735            keepextensions="$keepextensions $i"
23736            ;;
23737         esac
23738     done
23739     avail_ext="$keepextensions"
23740     ;;
23741 esac
23742
23743 : Now see which nonxs extensions are supported on this system.
23744 : For now assume all are.
23745 nonxs_ext=''
23746 for xxx in $nonxs_extensions ; do
23747         case "$xxx" in
23748         VMS*)
23749                 ;;
23750         *)      nonxs_ext="$nonxs_ext $xxx"
23751                 ;;
23752         esac
23753 done
23754
23755 set X $nonxs_ext
23756 shift
23757 nonxs_ext="$*"
23758
23759 case $usedl in
23760 $define)
23761         $cat <<EOM
23762 A number of extensions are supplied with $package.  You may choose to
23763 compile these extensions for dynamic loading (the default), compile
23764 them into the $package executable (static loading), or not include
23765 them at all.  Answer "none" to include no extensions.
23766 Note that DynaLoader is always built and need not be mentioned here.
23767
23768 EOM
23769         case "$dynamic_ext" in
23770         '')
23771                 : Exclude those listed in static_ext
23772                 dflt=''
23773                 for xxx in $avail_ext; do
23774                         case " $static_ext " in
23775                         *" $xxx "*) ;;
23776                         *) dflt="$dflt $xxx" ;;
23777                         esac
23778                 done
23779                 set X $dflt
23780                 shift
23781                 dflt="$*"
23782                 ;;
23783         *)      dflt="$dynamic_ext"
23784                 # Perhaps we are reusing an old out-of-date config.sh.
23785                 case "$hint" in
23786                 previous)
23787                         if test X"$dynamic_ext" != X"$avail_ext"; then
23788                                 $cat <<EOM
23789 NOTICE:  Your previous config.sh list may be incorrect.
23790 The extensions now available to you are
23791         ${avail_ext}
23792 but the default list from your previous config.sh is
23793         ${dynamic_ext}
23794
23795 EOM
23796                         fi
23797                         ;;
23798                 esac
23799                 ;;
23800         esac
23801         case "$dflt" in
23802         '')     dflt=none;;
23803         esac
23804         rp="What extensions do you wish to load dynamically?"
23805         . ./myread
23806         case "$ans" in
23807         none) dynamic_ext=' ' ;;
23808         *) dynamic_ext="$ans" ;;
23809         esac
23810
23811         case "$static_ext" in
23812         '')
23813                 : Exclude those already listed in dynamic linking
23814                 dflt=''
23815                 for xxx in $avail_ext; do
23816                         case " $dynamic_ext " in
23817                         *" $xxx "*) ;;
23818                         *) dflt="$dflt $xxx" ;;
23819                         esac
23820                 done
23821                 set X $dflt
23822                 shift
23823                 dflt="$*"
23824                 ;;
23825         *)  dflt="$static_ext"
23826                 ;;
23827         esac
23828
23829         case "$dflt" in
23830         '')     dflt=none;;
23831         esac
23832         rp="What extensions do you wish to load statically?"
23833         . ./myread
23834         case "$ans" in
23835         none) static_ext=' ' ;;
23836         *) static_ext="$ans" ;;
23837         esac
23838         ;;
23839 *)
23840         $cat <<EOM
23841 A number of extensions are supplied with $package.  Answer "none"
23842 to include no extensions.
23843 Note that DynaLoader is always built and need not be mentioned here.
23844
23845 EOM
23846         case "$static_ext" in
23847         '') dflt="$avail_ext" ;;
23848         *)      dflt="$static_ext"
23849                 # Perhaps we are reusing an old out-of-date config.sh.
23850                 case "$hint" in
23851                 previous)
23852                         if test X"$static_ext" != X"$avail_ext"; then
23853                                 $cat <<EOM
23854 NOTICE:  Your previous config.sh list may be incorrect.
23855 The extensions now available to you are
23856         ${avail_ext}
23857 but the default list from your previous config.sh is
23858         ${static_ext}
23859
23860 EOM
23861                         fi
23862                         ;;
23863                 esac
23864                 ;;
23865         esac
23866         : Exclude those that are not xs extensions
23867         case "$dflt" in
23868         '')     dflt=none;;
23869         esac
23870         rp="What extensions do you wish to include?"
23871         . ./myread
23872         case "$ans" in
23873         none) static_ext=' ' ;;
23874         *) static_ext="$ans" ;;
23875         esac
23876         ;;
23877 esac
23878 #
23879 # Encode is a special case.  If we are building Encode as a static
23880 # extension, we need to explicitly list its subextensions as well.
23881 # For other nested extensions, this is handled automatically by
23882 # the appropriate Makefile.PL.
23883 case " $static_ext " in
23884         *" Encode "*) # Add the subextensions of Encode
23885         cd "$rsrc/cpan"
23886         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23887                 static_ext="$static_ext Encode/$xxx"
23888                 known_extensions="$known_extensions Encode/$xxx"
23889         done
23890         cd "$tdir"
23891         ;;
23892 esac
23893
23894 set X $dynamic_ext $static_ext $nonxs_ext
23895 shift
23896 extensions="$*"
23897
23898 # Sanity check:  We require an extension suitable for use with
23899 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23900 # should show up as failures in the test suite, but it's helpful to
23901 # catch them now.) The 'extensions' list is normally sorted
23902 # alphabetically, so we need to accept either
23903 #    DB_File ... Fcntl ... IO  ....
23904 # or something like
23905 #    Fcntl ... NDBM_File ... IO  ....
23906 case " $extensions"  in
23907 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23908 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23909 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23910 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23911    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23912    ;;
23913 esac
23914
23915 : Remove libraries needed only for extensions
23916 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23917 : The exception is SunOS 4.x, which needs them.
23918 case "${osname}X${osvers}" in
23919 sunos*X4*)
23920     perllibs="$libs"
23921     ;;
23922 *) case "$usedl" in
23923     $define|true|[yY]*)
23924             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23925             shift
23926             perllibs="$*"
23927             ;;
23928     *)  perllibs="$libs"
23929             ;;
23930     esac
23931     ;;
23932 esac
23933
23934 : Remove build directory name from cppstdin so it can be used from
23935 : either the present location or the final installed location.
23936 echo " "
23937 : Get out of the UU directory to get correct path name.
23938 cd ..
23939 case "$cppstdin" in
23940 `pwd`/cppstdin)
23941         echo "Stripping down cppstdin path name"
23942         cppstdin=cppstdin
23943         ;;
23944 esac
23945 cd UU
23946
23947 : end of configuration questions
23948 echo " "
23949 echo "End of configuration questions."
23950 echo " "
23951
23952 : back to where it started
23953 if test -d ../UU; then
23954         cd ..
23955 fi
23956
23957 : configuration may be unconditionally patched via a 'config.arch' file
23958 if $test -f config.arch; then
23959         echo "I see a config.arch file, loading it." >&4
23960         . ./config.arch
23961 fi
23962
23963 : configuration may be patched via a 'config.over' file
23964 if $test -f config.over; then
23965         echo " "
23966         dflt=y
23967         rp='I see a config.over file.  Do you wish to load it?'
23968         . UU/myread
23969         case "$ans" in
23970         n*) echo "OK, I'll ignore it.";;
23971         *)      . ./config.over
23972                 echo "Configuration override changes have been loaded."
23973                 ;;
23974         esac
23975 fi
23976
23977 : in case they want portability, strip down executable paths
23978 case "$d_portable" in
23979 "$define")
23980         echo " "
23981         echo "Stripping down executable paths..." >&4
23982         for file in $loclist $trylist; do
23983                 eval temp=\$$file
23984                 eval $file=`basename $temp`
23985         done
23986         ;;
23987 esac
23988
23989 : create config.sh file
23990 echo " "
23991 echo "Creating config.sh..." >&4
23992 $spitshell <<EOT >config.sh
23993 $startsh
23994 #
23995 # This file was produced by running the Configure script. It holds all the
23996 # definitions figured out by Configure. Should you modify one of these values,
23997 # do not forget to propagate your changes by running "Configure -der". You may
23998 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23999 #
24000
24001 # Package name      : $package
24002 # Source directory  : $src
24003 # Configuration time: $cf_time
24004 # Configured by     : $cf_by
24005 # Target system     : $myuname
24006
24007 EOT
24008 : Add in command line options if available
24009 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24010
24011 $spitshell <<EOT >>config.sh
24012
24013 Author='$Author'
24014 Date='$Date'
24015 Header='$Header'
24016 Id='$Id'
24017 Locker='$Locker'
24018 Log='$Log'
24019 RCSfile='$RCSfile'
24020 Revision='$Revision'
24021 Source='$Source'
24022 State='$State'
24023 _a='$_a'
24024 _exe='$_exe'
24025 _o='$_o'
24026 afs='$afs'
24027 afsroot='$afsroot'
24028 alignbytes='$alignbytes'
24029 ansi2knr='$ansi2knr'
24030 aphostname='$aphostname'
24031 api_revision='$api_revision'
24032 api_subversion='$api_subversion'
24033 api_version='$api_version'
24034 api_versionstring='$api_versionstring'
24035 ar='$ar'
24036 archlib='$archlib'
24037 archlibexp='$archlibexp'
24038 archname64='$archname64'
24039 archname='$archname'
24040 archobjs='$archobjs'
24041 asctime_r_proto='$asctime_r_proto'
24042 awk='$awk'
24043 baserev='$baserev'
24044 bash='$bash'
24045 bin='$bin'
24046 bin_ELF='$bin_ELF'
24047 binexp='$binexp'
24048 bison='$bison'
24049 byacc='$byacc'
24050 byteorder='$byteorder'
24051 c='$c'
24052 castflags='$castflags'
24053 cat='$cat'
24054 cc='$cc'
24055 cccdlflags='$cccdlflags'
24056 ccdlflags='$ccdlflags'
24057 ccflags='$ccflags'
24058 ccflags_uselargefiles='$ccflags_uselargefiles'
24059 ccname='$ccname'
24060 ccsymbols='$ccsymbols'
24061 ccversion='$ccversion'
24062 cf_by='$cf_by'
24063 cf_email='$cf_email'
24064 cf_time='$cf_time'
24065 charbits='$charbits'
24066 charsize='$charsize'
24067 chgrp='$chgrp'
24068 chmod='$chmod'
24069 chown='$chown'
24070 clocktype='$clocktype'
24071 comm='$comm'
24072 compress='$compress'
24073 contains='$contains'
24074 cp='$cp'
24075 cpio='$cpio'
24076 cpp='$cpp'
24077 cpp_stuff='$cpp_stuff'
24078 cppccsymbols='$cppccsymbols'
24079 cppflags='$cppflags'
24080 cpplast='$cpplast'
24081 cppminus='$cppminus'
24082 cpprun='$cpprun'
24083 cppstdin='$cppstdin'
24084 cppsymbols='$cppsymbols'
24085 crypt_r_proto='$crypt_r_proto'
24086 cryptlib='$cryptlib'
24087 csh='$csh'
24088 ctermid_r_proto='$ctermid_r_proto'
24089 ctime_r_proto='$ctime_r_proto'
24090 d_Gconvert='$d_Gconvert'
24091 d_PRIEUldbl='$d_PRIEUldbl'
24092 d_PRIFUldbl='$d_PRIFUldbl'
24093 d_PRIGUldbl='$d_PRIGUldbl'
24094 d_PRIXU64='$d_PRIXU64'
24095 d_PRId64='$d_PRId64'
24096 d_PRIeldbl='$d_PRIeldbl'
24097 d_PRIfldbl='$d_PRIfldbl'
24098 d_PRIgldbl='$d_PRIgldbl'
24099 d_PRIi64='$d_PRIi64'
24100 d_PRIo64='$d_PRIo64'
24101 d_PRIu64='$d_PRIu64'
24102 d_PRIx64='$d_PRIx64'
24103 d_SCNfldbl='$d_SCNfldbl'
24104 d__fwalk='$d__fwalk'
24105 d_access='$d_access'
24106 d_accessx='$d_accessx'
24107 d_acosh='$d_acosh'
24108 d_aintl='$d_aintl'
24109 d_alarm='$d_alarm'
24110 d_archlib='$d_archlib'
24111 d_asctime64='$d_asctime64'
24112 d_asctime_r='$d_asctime_r'
24113 d_asinh='$d_asinh'
24114 d_atanh='$d_atanh'
24115 d_atolf='$d_atolf'
24116 d_atoll='$d_atoll'
24117 d_attribute_deprecated='$d_attribute_deprecated'
24118 d_attribute_format='$d_attribute_format'
24119 d_attribute_malloc='$d_attribute_malloc'
24120 d_attribute_nonnull='$d_attribute_nonnull'
24121 d_attribute_noreturn='$d_attribute_noreturn'
24122 d_attribute_pure='$d_attribute_pure'
24123 d_attribute_unused='$d_attribute_unused'
24124 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24125 d_backtrace='$d_backtrace'
24126 d_bcmp='$d_bcmp'
24127 d_bcopy='$d_bcopy'
24128 d_bsd='$d_bsd'
24129 d_bsdgetpgrp='$d_bsdgetpgrp'
24130 d_bsdsetpgrp='$d_bsdsetpgrp'
24131 d_builtin_choose_expr='$d_builtin_choose_expr'
24132 d_builtin_expect='$d_builtin_expect'
24133 d_bzero='$d_bzero'
24134 d_c99_variadic_macros='$d_c99_variadic_macros'
24135 d_casti32='$d_casti32'
24136 d_castneg='$d_castneg'
24137 d_cbrt='$d_cbrt'
24138 d_charvspr='$d_charvspr'
24139 d_chown='$d_chown'
24140 d_chroot='$d_chroot'
24141 d_chsize='$d_chsize'
24142 d_class='$d_class'
24143 d_clearenv='$d_clearenv'
24144 d_closedir='$d_closedir'
24145 d_cmsghdr_s='$d_cmsghdr_s'
24146 d_const='$d_const'
24147 d_copysign='$d_copysign'
24148 d_copysignl='$d_copysignl'
24149 d_cplusplus='$d_cplusplus'
24150 d_crypt='$d_crypt'
24151 d_crypt_r='$d_crypt_r'
24152 d_csh='$d_csh'
24153 d_ctermid='$d_ctermid'
24154 d_ctermid_r='$d_ctermid_r'
24155 d_ctime64='$d_ctime64'
24156 d_ctime_r='$d_ctime_r'
24157 d_cuserid='$d_cuserid'
24158 d_dbl_dig='$d_dbl_dig'
24159 d_dbminitproto='$d_dbminitproto'
24160 d_difftime64='$d_difftime64'
24161 d_difftime='$d_difftime'
24162 d_dir_dd_fd='$d_dir_dd_fd'
24163 d_dirfd='$d_dirfd'
24164 d_dirnamlen='$d_dirnamlen'
24165 d_dladdr='$d_dladdr'
24166 d_dlerror='$d_dlerror'
24167 d_dlopen='$d_dlopen'
24168 d_dlsymun='$d_dlsymun'
24169 d_dosuid='$d_dosuid'
24170 d_drand48_r='$d_drand48_r'
24171 d_drand48proto='$d_drand48proto'
24172 d_dup2='$d_dup2'
24173 d_eaccess='$d_eaccess'
24174 d_endgrent='$d_endgrent'
24175 d_endgrent_r='$d_endgrent_r'
24176 d_endhent='$d_endhent'
24177 d_endhostent_r='$d_endhostent_r'
24178 d_endnent='$d_endnent'
24179 d_endnetent_r='$d_endnetent_r'
24180 d_endpent='$d_endpent'
24181 d_endprotoent_r='$d_endprotoent_r'
24182 d_endpwent='$d_endpwent'
24183 d_endpwent_r='$d_endpwent_r'
24184 d_endsent='$d_endsent'
24185 d_endservent_r='$d_endservent_r'
24186 d_eofnblk='$d_eofnblk'
24187 d_erf='$d_erf'
24188 d_erfc='$d_erfc'
24189 d_eunice='$d_eunice'
24190 d_exp2='$d_exp2'
24191 d_expm1='$d_expm1'
24192 d_faststdio='$d_faststdio'
24193 d_fchdir='$d_fchdir'
24194 d_fchmod='$d_fchmod'
24195 d_fchown='$d_fchown'
24196 d_fcntl='$d_fcntl'
24197 d_fcntl_can_lock='$d_fcntl_can_lock'
24198 d_fd_macros='$d_fd_macros'
24199 d_fd_set='$d_fd_set'
24200 d_fdim='$d_fdim'
24201 d_fds_bits='$d_fds_bits'
24202 d_fegetround='$d_fegetround'
24203 d_fgetpos='$d_fgetpos'
24204 d_finite='$d_finite'
24205 d_finitel='$d_finitel'
24206 d_flexfnam='$d_flexfnam'
24207 d_flock='$d_flock'
24208 d_flockproto='$d_flockproto'
24209 d_fma='$d_fma'
24210 d_fmax='$d_fmax'
24211 d_fmin='$d_fmin'
24212 d_fork='$d_fork'
24213 d_fp_class='$d_fp_class'
24214 d_fp_classify='$d_fp_classify'
24215 d_fp_classl='$d_fp_classl'
24216 d_fpathconf='$d_fpathconf'
24217 d_fpclass='$d_fpclass'
24218 d_fpclassify='$d_fpclassify'
24219 d_fpclassl='$d_fpclassl'
24220 d_fpgetround='$d_fpgetround'
24221 d_fpos64_t='$d_fpos64_t'
24222 d_frexpl='$d_frexpl'
24223 d_fs_data_s='$d_fs_data_s'
24224 d_fseeko='$d_fseeko'
24225 d_fsetpos='$d_fsetpos'
24226 d_fstatfs='$d_fstatfs'
24227 d_fstatvfs='$d_fstatvfs'
24228 d_fsync='$d_fsync'
24229 d_ftello='$d_ftello'
24230 d_ftime='$d_ftime'
24231 d_futimes='$d_futimes'
24232 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24233 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24234 d_getaddrinfo='$d_getaddrinfo'
24235 d_getcwd='$d_getcwd'
24236 d_getespwnam='$d_getespwnam'
24237 d_getfsstat='$d_getfsstat'
24238 d_getgrent='$d_getgrent'
24239 d_getgrent_r='$d_getgrent_r'
24240 d_getgrgid_r='$d_getgrgid_r'
24241 d_getgrnam_r='$d_getgrnam_r'
24242 d_getgrps='$d_getgrps'
24243 d_gethbyaddr='$d_gethbyaddr'
24244 d_gethbyname='$d_gethbyname'
24245 d_gethent='$d_gethent'
24246 d_gethname='$d_gethname'
24247 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24248 d_gethostbyname_r='$d_gethostbyname_r'
24249 d_gethostent_r='$d_gethostent_r'
24250 d_gethostprotos='$d_gethostprotos'
24251 d_getitimer='$d_getitimer'
24252 d_getlogin='$d_getlogin'
24253 d_getlogin_r='$d_getlogin_r'
24254 d_getmnt='$d_getmnt'
24255 d_getmntent='$d_getmntent'
24256 d_getnameinfo='$d_getnameinfo'
24257 d_getnbyaddr='$d_getnbyaddr'
24258 d_getnbyname='$d_getnbyname'
24259 d_getnent='$d_getnent'
24260 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24261 d_getnetbyname_r='$d_getnetbyname_r'
24262 d_getnetent_r='$d_getnetent_r'
24263 d_getnetprotos='$d_getnetprotos'
24264 d_getpagsz='$d_getpagsz'
24265 d_getpbyname='$d_getpbyname'
24266 d_getpbynumber='$d_getpbynumber'
24267 d_getpent='$d_getpent'
24268 d_getpgid='$d_getpgid'
24269 d_getpgrp2='$d_getpgrp2'
24270 d_getpgrp='$d_getpgrp'
24271 d_getppid='$d_getppid'
24272 d_getprior='$d_getprior'
24273 d_getprotobyname_r='$d_getprotobyname_r'
24274 d_getprotobynumber_r='$d_getprotobynumber_r'
24275 d_getprotoent_r='$d_getprotoent_r'
24276 d_getprotoprotos='$d_getprotoprotos'
24277 d_getprpwnam='$d_getprpwnam'
24278 d_getpwent='$d_getpwent'
24279 d_getpwent_r='$d_getpwent_r'
24280 d_getpwnam_r='$d_getpwnam_r'
24281 d_getpwuid_r='$d_getpwuid_r'
24282 d_getsbyname='$d_getsbyname'
24283 d_getsbyport='$d_getsbyport'
24284 d_getsent='$d_getsent'
24285 d_getservbyname_r='$d_getservbyname_r'
24286 d_getservbyport_r='$d_getservbyport_r'
24287 d_getservent_r='$d_getservent_r'
24288 d_getservprotos='$d_getservprotos'
24289 d_getspnam='$d_getspnam'
24290 d_getspnam_r='$d_getspnam_r'
24291 d_gettimeod='$d_gettimeod'
24292 d_gmtime64='$d_gmtime64'
24293 d_gmtime_r='$d_gmtime_r'
24294 d_gnulibc='$d_gnulibc'
24295 d_grpasswd='$d_grpasswd'
24296 d_hasmntopt='$d_hasmntopt'
24297 d_htonl='$d_htonl'
24298 d_hypot='$d_hypot'
24299 d_ilogb='$d_ilogb'
24300 d_ilogbl='$d_ilogbl'
24301 d_inc_version_list='$d_inc_version_list'
24302 d_index='$d_index'
24303 d_inetaton='$d_inetaton'
24304 d_inetntop='$d_inetntop'
24305 d_inetpton='$d_inetpton'
24306 d_int64_t='$d_int64_t'
24307 d_ip_mreq='$d_ip_mreq'
24308 d_ip_mreq_source='$d_ip_mreq_source'
24309 d_ipv6_mreq='$d_ipv6_mreq'
24310 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24311 d_isascii='$d_isascii'
24312 d_isblank='$d_isblank'
24313 d_isfinite='$d_isfinite'
24314 d_isfinitel='$d_isfinitel'
24315 d_isinf='$d_isinf'
24316 d_isinfl='$d_isinfl'
24317 d_isless='$d_isless'
24318 d_isnan='$d_isnan'
24319 d_isnanl='$d_isnanl'
24320 d_isnormal='$d_isnormal'
24321 d_j0='$d_j0'
24322 d_j0l='$d_j0l'
24323 d_killpg='$d_killpg'
24324 d_lc_monetary_2008='$d_lc_monetary_2008'
24325 d_lchown='$d_lchown'
24326 d_ldbl_dig='$d_ldbl_dig'
24327 d_ldexpl='$d_ldexpl'
24328 d_lgamma='$d_lgamma'
24329 d_lgamma_r='$d_lgamma_r'
24330 d_libm_lib_version='$d_libm_lib_version'
24331 d_libname_unique='$d_libname_unique'
24332 d_link='$d_link'
24333 d_llrint='$d_llrint'
24334 d_llrintl='$d_llrintl'
24335 d_llround='$d_llround'
24336 d_llroundl='$d_llroundl'
24337 d_localtime64='$d_localtime64'
24338 d_localtime_r='$d_localtime_r'
24339 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24340 d_locconv='$d_locconv'
24341 d_lockf='$d_lockf'
24342 d_log1p='$d_log1p'
24343 d_log2='$d_log2'
24344 d_logb='$d_logb'
24345 d_longdbl='$d_longdbl'
24346 d_longlong='$d_longlong'
24347 d_lrint='$d_lrint'
24348 d_lrintl='$d_lrintl'
24349 d_lround='$d_lround'
24350 d_lroundl='$d_lroundl'
24351 d_lseekproto='$d_lseekproto'
24352 d_lstat='$d_lstat'
24353 d_madvise='$d_madvise'
24354 d_malloc_good_size='$d_malloc_good_size'
24355 d_malloc_size='$d_malloc_size'
24356 d_mblen='$d_mblen'
24357 d_mbstowcs='$d_mbstowcs'
24358 d_mbtowc='$d_mbtowc'
24359 d_memchr='$d_memchr'
24360 d_memcmp='$d_memcmp'
24361 d_memcpy='$d_memcpy'
24362 d_memmove='$d_memmove'
24363 d_memset='$d_memset'
24364 d_mkdir='$d_mkdir'
24365 d_mkdtemp='$d_mkdtemp'
24366 d_mkfifo='$d_mkfifo'
24367 d_mkstemp='$d_mkstemp'
24368 d_mkstemps='$d_mkstemps'
24369 d_mktime64='$d_mktime64'
24370 d_mktime='$d_mktime'
24371 d_mmap='$d_mmap'
24372 d_modfl='$d_modfl'
24373 d_modfl_pow32_bug='$d_modfl_pow32_bug'
24374 d_modflproto='$d_modflproto'
24375 d_mprotect='$d_mprotect'
24376 d_msg='$d_msg'
24377 d_msg_ctrunc='$d_msg_ctrunc'
24378 d_msg_dontroute='$d_msg_dontroute'
24379 d_msg_oob='$d_msg_oob'
24380 d_msg_peek='$d_msg_peek'
24381 d_msg_proxy='$d_msg_proxy'
24382 d_msgctl='$d_msgctl'
24383 d_msgget='$d_msgget'
24384 d_msghdr_s='$d_msghdr_s'
24385 d_msgrcv='$d_msgrcv'
24386 d_msgsnd='$d_msgsnd'
24387 d_msync='$d_msync'
24388 d_munmap='$d_munmap'
24389 d_mymalloc='$d_mymalloc'
24390 d_nan='$d_nan'
24391 d_ndbm='$d_ndbm'
24392 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24393 d_nearbyint='$d_nearbyint'
24394 d_nextafter='$d_nextafter'
24395 d_nexttoward='$d_nexttoward'
24396 d_nice='$d_nice'
24397 d_nl_langinfo='$d_nl_langinfo'
24398 d_nv_preserves_uv='$d_nv_preserves_uv'
24399 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24400 d_off64_t='$d_off64_t'
24401 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24402 d_oldpthreads='$d_oldpthreads'
24403 d_oldsock='$d_oldsock'
24404 d_open3='$d_open3'
24405 d_pathconf='$d_pathconf'
24406 d_pause='$d_pause'
24407 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24408 d_phostname='$d_phostname'
24409 d_pipe='$d_pipe'
24410 d_poll='$d_poll'
24411 d_portable='$d_portable'
24412 d_prctl='$d_prctl'
24413 d_prctl_set_name='$d_prctl_set_name'
24414 d_printf_format_null='$d_printf_format_null'
24415 d_procselfexe='$d_procselfexe'
24416 d_pseudofork='$d_pseudofork'
24417 d_pthread_atfork='$d_pthread_atfork'
24418 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24419 d_pthread_yield='$d_pthread_yield'
24420 d_ptrdiff_t='$d_ptrdiff_t'
24421 d_pwage='$d_pwage'
24422 d_pwchange='$d_pwchange'
24423 d_pwclass='$d_pwclass'
24424 d_pwcomment='$d_pwcomment'
24425 d_pwexpire='$d_pwexpire'
24426 d_pwgecos='$d_pwgecos'
24427 d_pwpasswd='$d_pwpasswd'
24428 d_pwquota='$d_pwquota'
24429 d_qgcvt='$d_qgcvt'
24430 d_quad='$d_quad'
24431 d_random_r='$d_random_r'
24432 d_re_comp='$d_re_comp'
24433 d_readdir64_r='$d_readdir64_r'
24434 d_readdir='$d_readdir'
24435 d_readdir_r='$d_readdir_r'
24436 d_readlink='$d_readlink'
24437 d_readv='$d_readv'
24438 d_recvmsg='$d_recvmsg'
24439 d_regcmp='$d_regcmp'
24440 d_regcomp='$d_regcomp'
24441 d_remainder='$d_remainder'
24442 d_remquo='$d_remquo'
24443 d_rename='$d_rename'
24444 d_rewinddir='$d_rewinddir'
24445 d_rint='$d_rint'
24446 d_rmdir='$d_rmdir'
24447 d_round='$d_round'
24448 d_safebcpy='$d_safebcpy'
24449 d_safemcpy='$d_safemcpy'
24450 d_sanemcmp='$d_sanemcmp'
24451 d_sbrkproto='$d_sbrkproto'
24452 d_scalbn='$d_scalbn'
24453 d_scalbnl='$d_scalbnl'
24454 d_sched_yield='$d_sched_yield'
24455 d_scm_rights='$d_scm_rights'
24456 d_seekdir='$d_seekdir'
24457 d_select='$d_select'
24458 d_sem='$d_sem'
24459 d_semctl='$d_semctl'
24460 d_semctl_semid_ds='$d_semctl_semid_ds'
24461 d_semctl_semun='$d_semctl_semun'
24462 d_semget='$d_semget'
24463 d_semop='$d_semop'
24464 d_sendmsg='$d_sendmsg'
24465 d_setegid='$d_setegid'
24466 d_seteuid='$d_seteuid'
24467 d_setgrent='$d_setgrent'
24468 d_setgrent_r='$d_setgrent_r'
24469 d_setgrps='$d_setgrps'
24470 d_sethent='$d_sethent'
24471 d_sethostent_r='$d_sethostent_r'
24472 d_setitimer='$d_setitimer'
24473 d_setlinebuf='$d_setlinebuf'
24474 d_setlocale='$d_setlocale'
24475 d_setlocale_r='$d_setlocale_r'
24476 d_setnent='$d_setnent'
24477 d_setnetent_r='$d_setnetent_r'
24478 d_setpent='$d_setpent'
24479 d_setpgid='$d_setpgid'
24480 d_setpgrp2='$d_setpgrp2'
24481 d_setpgrp='$d_setpgrp'
24482 d_setprior='$d_setprior'
24483 d_setproctitle='$d_setproctitle'
24484 d_setprotoent_r='$d_setprotoent_r'
24485 d_setpwent='$d_setpwent'
24486 d_setpwent_r='$d_setpwent_r'
24487 d_setregid='$d_setregid'
24488 d_setresgid='$d_setresgid'
24489 d_setresuid='$d_setresuid'
24490 d_setreuid='$d_setreuid'
24491 d_setrgid='$d_setrgid'
24492 d_setruid='$d_setruid'
24493 d_setsent='$d_setsent'
24494 d_setservent_r='$d_setservent_r'
24495 d_setsid='$d_setsid'
24496 d_setvbuf='$d_setvbuf'
24497 d_shm='$d_shm'
24498 d_shmat='$d_shmat'
24499 d_shmatprototype='$d_shmatprototype'
24500 d_shmctl='$d_shmctl'
24501 d_shmdt='$d_shmdt'
24502 d_shmget='$d_shmget'
24503 d_sigaction='$d_sigaction'
24504 d_signbit='$d_signbit'
24505 d_sigprocmask='$d_sigprocmask'
24506 d_sigsetjmp='$d_sigsetjmp'
24507 d_sin6_scope_id='$d_sin6_scope_id'
24508 d_sitearch='$d_sitearch'
24509 d_snprintf='$d_snprintf'
24510 d_sockaddr_in6='$d_sockaddr_in6'
24511 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24512 d_sockatmark='$d_sockatmark'
24513 d_sockatmarkproto='$d_sockatmarkproto'
24514 d_socket='$d_socket'
24515 d_socklen_t='$d_socklen_t'
24516 d_sockpair='$d_sockpair'
24517 d_socks5_init='$d_socks5_init'
24518 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24519 d_sqrtl='$d_sqrtl'
24520 d_srand48_r='$d_srand48_r'
24521 d_srandom_r='$d_srandom_r'
24522 d_sresgproto='$d_sresgproto'
24523 d_sresuproto='$d_sresuproto'
24524 d_stat='$d_stat'
24525 d_statblks='$d_statblks'
24526 d_statfs_f_flags='$d_statfs_f_flags'
24527 d_statfs_s='$d_statfs_s'
24528 d_static_inline='$d_static_inline'
24529 d_statvfs='$d_statvfs'
24530 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24531 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24532 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24533 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24534 d_stdio_stream_array='$d_stdio_stream_array'
24535 d_stdiobase='$d_stdiobase'
24536 d_stdstdio='$d_stdstdio'
24537 d_strchr='$d_strchr'
24538 d_strcoll='$d_strcoll'
24539 d_strctcpy='$d_strctcpy'
24540 d_strerrm='$d_strerrm'
24541 d_strerror='$d_strerror'
24542 d_strerror_r='$d_strerror_r'
24543 d_strftime='$d_strftime'
24544 d_strlcat='$d_strlcat'
24545 d_strlcpy='$d_strlcpy'
24546 d_strtod='$d_strtod'
24547 d_strtol='$d_strtol'
24548 d_strtold='$d_strtold'
24549 d_strtoll='$d_strtoll'
24550 d_strtoq='$d_strtoq'
24551 d_strtoul='$d_strtoul'
24552 d_strtoull='$d_strtoull'
24553 d_strtouq='$d_strtouq'
24554 d_strxfrm='$d_strxfrm'
24555 d_suidsafe='$d_suidsafe'
24556 d_symlink='$d_symlink'
24557 d_syscall='$d_syscall'
24558 d_syscallproto='$d_syscallproto'
24559 d_sysconf='$d_sysconf'
24560 d_sysernlst='$d_sysernlst'
24561 d_syserrlst='$d_syserrlst'
24562 d_system='$d_system'
24563 d_tcgetpgrp='$d_tcgetpgrp'
24564 d_tcsetpgrp='$d_tcsetpgrp'
24565 d_telldir='$d_telldir'
24566 d_telldirproto='$d_telldirproto'
24567 d_tgamma='$d_tgamma'
24568 d_time='$d_time'
24569 d_timegm='$d_timegm'
24570 d_times='$d_times'
24571 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24572 d_tm_tm_zone='$d_tm_tm_zone'
24573 d_tmpnam_r='$d_tmpnam_r'
24574 d_trunc='$d_trunc'
24575 d_truncate='$d_truncate'
24576 d_truncl='$d_truncl'
24577 d_ttyname_r='$d_ttyname_r'
24578 d_tzname='$d_tzname'
24579 d_u32align='$d_u32align'
24580 d_ualarm='$d_ualarm'
24581 d_umask='$d_umask'
24582 d_uname='$d_uname'
24583 d_union_semun='$d_union_semun'
24584 d_unordered='$d_unordered'
24585 d_unsetenv='$d_unsetenv'
24586 d_usleep='$d_usleep'
24587 d_usleepproto='$d_usleepproto'
24588 d_ustat='$d_ustat'
24589 d_vendorarch='$d_vendorarch'
24590 d_vendorbin='$d_vendorbin'
24591 d_vendorlib='$d_vendorlib'
24592 d_vendorscript='$d_vendorscript'
24593 d_vfork='$d_vfork'
24594 d_void_closedir='$d_void_closedir'
24595 d_voidsig='$d_voidsig'
24596 d_voidtty='$d_voidtty'
24597 d_volatile='$d_volatile'
24598 d_vprintf='$d_vprintf'
24599 d_vsnprintf='$d_vsnprintf'
24600 d_wait4='$d_wait4'
24601 d_waitpid='$d_waitpid'
24602 d_wcscmp='$d_wcscmp'
24603 d_wcstombs='$d_wcstombs'
24604 d_wcsxfrm='$d_wcsxfrm'
24605 d_wctomb='$d_wctomb'
24606 d_writev='$d_writev'
24607 d_xenix='$d_xenix'
24608 date='$date'
24609 db_hashtype='$db_hashtype'
24610 db_prefixtype='$db_prefixtype'
24611 db_version_major='$db_version_major'
24612 db_version_minor='$db_version_minor'
24613 db_version_patch='$db_version_patch'
24614 direntrytype='$direntrytype'
24615 dlext='$dlext'
24616 dlsrc='$dlsrc'
24617 doubleinfbytes='$doubleinfbytes'
24618 doublekind='$doublekind'
24619 doublemantbits='$doublemantbits'
24620 doublenanbytes='$doublenanbytes'
24621 doublesize='$doublesize'
24622 drand01='$drand01'
24623 drand48_r_proto='$drand48_r_proto'
24624 dtrace='$dtrace'
24625 dynamic_ext='$dynamic_ext'
24626 eagain='$eagain'
24627 ebcdic='$ebcdic'
24628 echo='$echo'
24629 egrep='$egrep'
24630 emacs='$emacs'
24631 endgrent_r_proto='$endgrent_r_proto'
24632 endhostent_r_proto='$endhostent_r_proto'
24633 endnetent_r_proto='$endnetent_r_proto'
24634 endprotoent_r_proto='$endprotoent_r_proto'
24635 endpwent_r_proto='$endpwent_r_proto'
24636 endservent_r_proto='$endservent_r_proto'
24637 eunicefix='$eunicefix'
24638 exe_ext='$exe_ext'
24639 expr='$expr'
24640 extensions='$extensions'
24641 extern_C='$extern_C'
24642 extras='$extras'
24643 fflushNULL='$fflushNULL'
24644 fflushall='$fflushall'
24645 find='$find'
24646 firstmakefile='$firstmakefile'
24647 flex='$flex'
24648 fpossize='$fpossize'
24649 fpostype='$fpostype'
24650 freetype='$freetype'
24651 from='$from'
24652 full_ar='$full_ar'
24653 full_csh='$full_csh'
24654 full_sed='$full_sed'
24655 gccansipedantic='$gccansipedantic'
24656 gccosandvers='$gccosandvers'
24657 gccversion='$gccversion'
24658 getgrent_r_proto='$getgrent_r_proto'
24659 getgrgid_r_proto='$getgrgid_r_proto'
24660 getgrnam_r_proto='$getgrnam_r_proto'
24661 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24662 gethostbyname_r_proto='$gethostbyname_r_proto'
24663 gethostent_r_proto='$gethostent_r_proto'
24664 getlogin_r_proto='$getlogin_r_proto'
24665 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24666 getnetbyname_r_proto='$getnetbyname_r_proto'
24667 getnetent_r_proto='$getnetent_r_proto'
24668 getprotobyname_r_proto='$getprotobyname_r_proto'
24669 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24670 getprotoent_r_proto='$getprotoent_r_proto'
24671 getpwent_r_proto='$getpwent_r_proto'
24672 getpwnam_r_proto='$getpwnam_r_proto'
24673 getpwuid_r_proto='$getpwuid_r_proto'
24674 getservbyname_r_proto='$getservbyname_r_proto'
24675 getservbyport_r_proto='$getservbyport_r_proto'
24676 getservent_r_proto='$getservent_r_proto'
24677 getspnam_r_proto='$getspnam_r_proto'
24678 gidformat='$gidformat'
24679 gidsign='$gidsign'
24680 gidsize='$gidsize'
24681 gidtype='$gidtype'
24682 glibpth='$glibpth'
24683 gmake='$gmake'
24684 gmtime_r_proto='$gmtime_r_proto'
24685 gnulibc_version='$gnulibc_version'
24686 grep='$grep'
24687 groupcat='$groupcat'
24688 groupstype='$groupstype'
24689 gzip='$gzip'
24690 h_fcntl='$h_fcntl'
24691 h_sysfile='$h_sysfile'
24692 hint='$hint'
24693 hostcat='$hostcat'
24694 hostgenerate='$hostgenerate'
24695 hostosname='$hostosname'
24696 hostperl='$hostperl'
24697 html1dir='$html1dir'
24698 html1direxp='$html1direxp'
24699 html3dir='$html3dir'
24700 html3direxp='$html3direxp'
24701 i16size='$i16size'
24702 i16type='$i16type'
24703 i32size='$i32size'
24704 i32type='$i32type'
24705 i64size='$i64size'
24706 i64type='$i64type'
24707 i8size='$i8size'
24708 i8type='$i8type'
24709 i_arpainet='$i_arpainet'
24710 i_assert='$i_assert'
24711 i_bfd='$i_bfd'
24712 i_bsdioctl='$i_bsdioctl'
24713 i_crypt='$i_crypt'
24714 i_db='$i_db'
24715 i_dbm='$i_dbm'
24716 i_dirent='$i_dirent'
24717 i_dlfcn='$i_dlfcn'
24718 i_execinfo='$i_execinfo'
24719 i_fcntl='$i_fcntl'
24720 i_fenv='$i_fenv'
24721 i_float='$i_float'
24722 i_fp='$i_fp'
24723 i_fp_class='$i_fp_class'
24724 i_gdbm='$i_gdbm'
24725 i_gdbm_ndbm='$i_gdbm_ndbm'
24726 i_gdbmndbm='$i_gdbmndbm'
24727 i_grp='$i_grp'
24728 i_ieeefp='$i_ieeefp'
24729 i_inttypes='$i_inttypes'
24730 i_langinfo='$i_langinfo'
24731 i_libutil='$i_libutil'
24732 i_limits='$i_limits'
24733 i_locale='$i_locale'
24734 i_machcthr='$i_machcthr'
24735 i_malloc='$i_malloc'
24736 i_mallocmalloc='$i_mallocmalloc'
24737 i_math='$i_math'
24738 i_memory='$i_memory'
24739 i_mntent='$i_mntent'
24740 i_ndbm='$i_ndbm'
24741 i_netdb='$i_netdb'
24742 i_neterrno='$i_neterrno'
24743 i_netinettcp='$i_netinettcp'
24744 i_niin='$i_niin'
24745 i_poll='$i_poll'
24746 i_prot='$i_prot'
24747 i_pthread='$i_pthread'
24748 i_pwd='$i_pwd'
24749 i_quadmath='$i_quadmath'
24750 i_rpcsvcdbm='$i_rpcsvcdbm'
24751 i_sgtty='$i_sgtty'
24752 i_shadow='$i_shadow'
24753 i_socks='$i_socks'
24754 i_stdarg='$i_stdarg'
24755 i_stdbool='$i_stdbool'
24756 i_stddef='$i_stddef'
24757 i_stdint='$i_stdint'
24758 i_stdlib='$i_stdlib'
24759 i_string='$i_string'
24760 i_sunmath='$i_sunmath'
24761 i_sysaccess='$i_sysaccess'
24762 i_sysdir='$i_sysdir'
24763 i_sysfile='$i_sysfile'
24764 i_sysfilio='$i_sysfilio'
24765 i_sysin='$i_sysin'
24766 i_sysioctl='$i_sysioctl'
24767 i_syslog='$i_syslog'
24768 i_sysmman='$i_sysmman'
24769 i_sysmode='$i_sysmode'
24770 i_sysmount='$i_sysmount'
24771 i_sysndir='$i_sysndir'
24772 i_sysparam='$i_sysparam'
24773 i_syspoll='$i_syspoll'
24774 i_sysresrc='$i_sysresrc'
24775 i_syssecrt='$i_syssecrt'
24776 i_sysselct='$i_sysselct'
24777 i_syssockio='$i_syssockio'
24778 i_sysstat='$i_sysstat'
24779 i_sysstatfs='$i_sysstatfs'
24780 i_sysstatvfs='$i_sysstatvfs'
24781 i_systime='$i_systime'
24782 i_systimek='$i_systimek'
24783 i_systimes='$i_systimes'
24784 i_systypes='$i_systypes'
24785 i_sysuio='$i_sysuio'
24786 i_sysun='$i_sysun'
24787 i_sysutsname='$i_sysutsname'
24788 i_sysvfs='$i_sysvfs'
24789 i_syswait='$i_syswait'
24790 i_termio='$i_termio'
24791 i_termios='$i_termios'
24792 i_time='$i_time'
24793 i_unistd='$i_unistd'
24794 i_ustat='$i_ustat'
24795 i_utime='$i_utime'
24796 i_values='$i_values'
24797 i_varargs='$i_varargs'
24798 i_varhdr='$i_varhdr'
24799 i_vfork='$i_vfork'
24800 ignore_versioned_solibs='$ignore_versioned_solibs'
24801 inc_version_list='$inc_version_list'
24802 inc_version_list_init='$inc_version_list_init'
24803 incpath='$incpath'
24804 incpth='$incpth'
24805 inews='$inews'
24806 initialinstalllocation='$initialinstalllocation'
24807 installarchlib='$installarchlib'
24808 installbin='$installbin'
24809 installhtml1dir='$installhtml1dir'
24810 installhtml3dir='$installhtml3dir'
24811 installman1dir='$installman1dir'
24812 installman3dir='$installman3dir'
24813 installprefix='$installprefix'
24814 installprefixexp='$installprefixexp'
24815 installprivlib='$installprivlib'
24816 installscript='$installscript'
24817 installsitearch='$installsitearch'
24818 installsitebin='$installsitebin'
24819 installsitehtml1dir='$installsitehtml1dir'
24820 installsitehtml3dir='$installsitehtml3dir'
24821 installsitelib='$installsitelib'
24822 installsiteman1dir='$installsiteman1dir'
24823 installsiteman3dir='$installsiteman3dir'
24824 installsitescript='$installsitescript'
24825 installstyle='$installstyle'
24826 installusrbinperl='$installusrbinperl'
24827 installvendorarch='$installvendorarch'
24828 installvendorbin='$installvendorbin'
24829 installvendorhtml1dir='$installvendorhtml1dir'
24830 installvendorhtml3dir='$installvendorhtml3dir'
24831 installvendorlib='$installvendorlib'
24832 installvendorman1dir='$installvendorman1dir'
24833 installvendorman3dir='$installvendorman3dir'
24834 installvendorscript='$installvendorscript'
24835 intsize='$intsize'
24836 issymlink='$issymlink'
24837 ivdformat='$ivdformat'
24838 ivsize='$ivsize'
24839 ivtype='$ivtype'
24840 known_extensions='$known_extensions'
24841 ksh='$ksh'
24842 ld='$ld'
24843 ld_can_script='$ld_can_script'
24844 lddlflags='$lddlflags'
24845 ldflags='$ldflags'
24846 ldflags_uselargefiles='$ldflags_uselargefiles'
24847 ldlibpthname='$ldlibpthname'
24848 less='$less'
24849 lib_ext='$lib_ext'
24850 libc='$libc'
24851 libperl='$libperl'
24852 libpth='$libpth'
24853 libs='$libs'
24854 libsdirs='$libsdirs'
24855 libsfiles='$libsfiles'
24856 libsfound='$libsfound'
24857 libspath='$libspath'
24858 libswanted='$libswanted'
24859 libswanted_uselargefiles='$libswanted_uselargefiles'
24860 line='$line'
24861 lint='$lint'
24862 lkflags='$lkflags'
24863 ln='$ln'
24864 lns='$lns'
24865 localtime_r_proto='$localtime_r_proto'
24866 locincpth='$locincpth'
24867 loclibpth='$loclibpth'
24868 longdblinfbytes='$longdblinfbytes'
24869 longdblkind='$longdblkind'
24870 longdblmantbits='$longdblmantbits'
24871 longdblnanbytes='$longdblnanbytes'
24872 longdblsize='$longdblsize'
24873 longlongsize='$longlongsize'
24874 longsize='$longsize'
24875 lp='$lp'
24876 lpr='$lpr'
24877 ls='$ls'
24878 lseeksize='$lseeksize'
24879 lseektype='$lseektype'
24880 mail='$mail'
24881 mailx='$mailx'
24882 make='$make'
24883 make_set_make='$make_set_make'
24884 mallocobj='$mallocobj'
24885 mallocsrc='$mallocsrc'
24886 malloctype='$malloctype'
24887 man1dir='$man1dir'
24888 man1direxp='$man1direxp'
24889 man1ext='$man1ext'
24890 man3dir='$man3dir'
24891 man3direxp='$man3direxp'
24892 man3ext='$man3ext'
24893 mips_type='$mips_type'
24894 mistrustnm='$mistrustnm'
24895 mkdir='$mkdir'
24896 mmaptype='$mmaptype'
24897 modetype='$modetype'
24898 more='$more'
24899 multiarch='$multiarch'
24900 mv='$mv'
24901 myarchname='$myarchname'
24902 mydomain='$mydomain'
24903 myhostname='$myhostname'
24904 myuname='$myuname'
24905 n='$n'
24906 need_va_copy='$need_va_copy'
24907 netdb_hlen_type='$netdb_hlen_type'
24908 netdb_host_type='$netdb_host_type'
24909 netdb_name_type='$netdb_name_type'
24910 netdb_net_type='$netdb_net_type'
24911 nm='$nm'
24912 nm_opt='$nm_opt'
24913 nm_so_opt='$nm_so_opt'
24914 nonxs_ext='$nonxs_ext'
24915 nroff='$nroff'
24916 nvEUformat='$nvEUformat'
24917 nvFUformat='$nvFUformat'
24918 nvGUformat='$nvGUformat'
24919 nv_overflows_integers_at='$nv_overflows_integers_at'
24920 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24921 nveformat='$nveformat'
24922 nvfformat='$nvfformat'
24923 nvgformat='$nvgformat'
24924 nvmantbits='$nvmantbits'
24925 nvsize='$nvsize'
24926 nvtype='$nvtype'
24927 o_nonblock='$o_nonblock'
24928 obj_ext='$obj_ext'
24929 old_pthread_create_joinable='$old_pthread_create_joinable'
24930 optimize='$optimize'
24931 orderlib='$orderlib'
24932 osname='$osname'
24933 osvers='$osvers'
24934 otherlibdirs='$otherlibdirs'
24935 package='$package'
24936 pager='$pager'
24937 passcat='$passcat'
24938 patchlevel='$patchlevel'
24939 path_sep='$path_sep'
24940 perl5='$perl5'
24941 perl='$perl'
24942 perl_patchlevel='$perl_patchlevel'
24943 perl_static_inline='$perl_static_inline'
24944 perladmin='$perladmin'
24945 perllibs='$perllibs'
24946 perlpath='$perlpath'
24947 pg='$pg'
24948 phostname='$phostname'
24949 pidtype='$pidtype'
24950 plibpth='$plibpth'
24951 pmake='$pmake'
24952 pr='$pr'
24953 prefix='$prefix'
24954 prefixexp='$prefixexp'
24955 privlib='$privlib'
24956 privlibexp='$privlibexp'
24957 procselfexe='$procselfexe'
24958 prototype='$prototype'
24959 ptrsize='$ptrsize'
24960 quadkind='$quadkind'
24961 quadtype='$quadtype'
24962 randbits='$randbits'
24963 randfunc='$randfunc'
24964 random_r_proto='$random_r_proto'
24965 randseedtype='$randseedtype'
24966 ranlib='$ranlib'
24967 rd_nodata='$rd_nodata'
24968 readdir64_r_proto='$readdir64_r_proto'
24969 readdir_r_proto='$readdir_r_proto'
24970 revision='$revision'
24971 rm='$rm'
24972 rm_try='$rm_try'
24973 rmail='$rmail'
24974 run='$run'
24975 runnm='$runnm'
24976 sGMTIME_max='$sGMTIME_max'
24977 sGMTIME_min='$sGMTIME_min'
24978 sLOCALTIME_max='$sLOCALTIME_max'
24979 sLOCALTIME_min='$sLOCALTIME_min'
24980 sPRIEUldbl='$sPRIEUldbl'
24981 sPRIFUldbl='$sPRIFUldbl'
24982 sPRIGUldbl='$sPRIGUldbl'
24983 sPRIXU64='$sPRIXU64'
24984 sPRId64='$sPRId64'
24985 sPRIeldbl='$sPRIeldbl'
24986 sPRIfldbl='$sPRIfldbl'
24987 sPRIgldbl='$sPRIgldbl'
24988 sPRIi64='$sPRIi64'
24989 sPRIo64='$sPRIo64'
24990 sPRIu64='$sPRIu64'
24991 sPRIx64='$sPRIx64'
24992 sSCNfldbl='$sSCNfldbl'
24993 sched_yield='$sched_yield'
24994 scriptdir='$scriptdir'
24995 scriptdirexp='$scriptdirexp'
24996 sed='$sed'
24997 seedfunc='$seedfunc'
24998 selectminbits='$selectminbits'
24999 selecttype='$selecttype'
25000 sendmail='$sendmail'
25001 setgrent_r_proto='$setgrent_r_proto'
25002 sethostent_r_proto='$sethostent_r_proto'
25003 setlocale_r_proto='$setlocale_r_proto'
25004 setnetent_r_proto='$setnetent_r_proto'
25005 setprotoent_r_proto='$setprotoent_r_proto'
25006 setpwent_r_proto='$setpwent_r_proto'
25007 setservent_r_proto='$setservent_r_proto'
25008 sh='$sh'
25009 shar='$shar'
25010 sharpbang='$sharpbang'
25011 shmattype='$shmattype'
25012 shortsize='$shortsize'
25013 shrpenv='$shrpenv'
25014 shsharp='$shsharp'
25015 sig_count='$sig_count'
25016 sig_name='$sig_name'
25017 sig_name_init='$sig_name_init'
25018 sig_num='$sig_num'
25019 sig_num_init='$sig_num_init'
25020 sig_size='$sig_size'
25021 signal_t='$signal_t'
25022 sitearch='$sitearch'
25023 sitearchexp='$sitearchexp'
25024 sitebin='$sitebin'
25025 sitebinexp='$sitebinexp'
25026 sitehtml1dir='$sitehtml1dir'
25027 sitehtml1direxp='$sitehtml1direxp'
25028 sitehtml3dir='$sitehtml3dir'
25029 sitehtml3direxp='$sitehtml3direxp'
25030 sitelib='$sitelib'
25031 sitelib_stem='$sitelib_stem'
25032 sitelibexp='$sitelibexp'
25033 siteman1dir='$siteman1dir'
25034 siteman1direxp='$siteman1direxp'
25035 siteman3dir='$siteman3dir'
25036 siteman3direxp='$siteman3direxp'
25037 siteprefix='$siteprefix'
25038 siteprefixexp='$siteprefixexp'
25039 sitescript='$sitescript'
25040 sitescriptexp='$sitescriptexp'
25041 sizesize='$sizesize'
25042 sizetype='$sizetype'
25043 sleep='$sleep'
25044 smail='$smail'
25045 so='$so'
25046 sockethdr='$sockethdr'
25047 socketlib='$socketlib'
25048 socksizetype='$socksizetype'
25049 sort='$sort'
25050 spackage='$spackage'
25051 spitshell='$spitshell'
25052 srand48_r_proto='$srand48_r_proto'
25053 srandom_r_proto='$srandom_r_proto'
25054 src='$src'
25055 ssizetype='$ssizetype'
25056 st_ino_sign='$st_ino_sign'
25057 st_ino_size='$st_ino_size'
25058 startperl='$startperl'
25059 startsh='$startsh'
25060 static_ext='$static_ext'
25061 stdchar='$stdchar'
25062 stdio_base='$stdio_base'
25063 stdio_bufsiz='$stdio_bufsiz'
25064 stdio_cnt='$stdio_cnt'
25065 stdio_filbuf='$stdio_filbuf'
25066 stdio_ptr='$stdio_ptr'
25067 stdio_stream_array='$stdio_stream_array'
25068 strerror_r_proto='$strerror_r_proto'
25069 strings='$strings'
25070 submit='$submit'
25071 subversion='$subversion'
25072 sysman='$sysman'
25073 sysroot='$sysroot'
25074 tail='$tail'
25075 tar='$tar'
25076 targetarch='$targetarch'
25077 targetdir='$targetdir'
25078 targetenv='$targetenv'
25079 targethost='$targethost'
25080 targetmkdir='$targetmkdir'
25081 targetport='$targetport'
25082 targetsh='$targetsh'
25083 tbl='$tbl'
25084 tee='$tee'
25085 test='$test'
25086 timeincl='$timeincl'
25087 timetype='$timetype'
25088 tmpnam_r_proto='$tmpnam_r_proto'
25089 to='$to'
25090 touch='$touch'
25091 tr='$tr'
25092 trnl='$trnl'
25093 troff='$troff'
25094 ttyname_r_proto='$ttyname_r_proto'
25095 u16size='$u16size'
25096 u16type='$u16type'
25097 u32size='$u32size'
25098 u32type='$u32type'
25099 u64size='$u64size'
25100 u64type='$u64type'
25101 u8size='$u8size'
25102 u8type='$u8type'
25103 uidformat='$uidformat'
25104 uidsign='$uidsign'
25105 uidsize='$uidsize'
25106 uidtype='$uidtype'
25107 uname='$uname'
25108 uniq='$uniq'
25109 uquadtype='$uquadtype'
25110 use5005threads='$use5005threads'
25111 use64bitall='$use64bitall'
25112 use64bitint='$use64bitint'
25113 usecbacktrace='$usecbacktrace'
25114 usecrosscompile='$usecrosscompile'
25115 usedevel='$usedevel'
25116 usedl='$usedl'
25117 usedtrace='$usedtrace'
25118 usefaststdio='$usefaststdio'
25119 useithreads='$useithreads'
25120 usekernprocpathname='$usekernprocpathname'
25121 uselargefiles='$uselargefiles'
25122 uselongdouble='$uselongdouble'
25123 usemallocwrap='$usemallocwrap'
25124 usemorebits='$usemorebits'
25125 usemultiplicity='$usemultiplicity'
25126 usemymalloc='$usemymalloc'
25127 usenm='$usenm'
25128 usensgetexecutablepath='$usensgetexecutablepath'
25129 useopcode='$useopcode'
25130 useperlio='$useperlio'
25131 useposix='$useposix'
25132 usequadmath='$usequadmath'
25133 usereentrant='$usereentrant'
25134 userelocatableinc='$userelocatableinc'
25135 useshrplib='$useshrplib'
25136 usesitecustomize='$usesitecustomize'
25137 usesocks='$usesocks'
25138 usethreads='$usethreads'
25139 usevendorprefix='$usevendorprefix'
25140 useversionedarchname='$useversionedarchname'
25141 usevfork='$usevfork'
25142 usrinc='$usrinc'
25143 uuname='$uuname'
25144 uvXUformat='$uvXUformat'
25145 uvoformat='$uvoformat'
25146 uvsize='$uvsize'
25147 uvtype='$uvtype'
25148 uvuformat='$uvuformat'
25149 uvxformat='$uvxformat'
25150 vaproto='$vaproto'
25151 vendorarch='$vendorarch'
25152 vendorarchexp='$vendorarchexp'
25153 vendorbin='$vendorbin'
25154 vendorbinexp='$vendorbinexp'
25155 vendorhtml1dir='$vendorhtml1dir'
25156 vendorhtml1direxp='$vendorhtml1direxp'
25157 vendorhtml3dir='$vendorhtml3dir'
25158 vendorhtml3direxp='$vendorhtml3direxp'
25159 vendorlib='$vendorlib'
25160 vendorlib_stem='$vendorlib_stem'
25161 vendorlibexp='$vendorlibexp'
25162 vendorman1dir='$vendorman1dir'
25163 vendorman1direxp='$vendorman1direxp'
25164 vendorman3dir='$vendorman3dir'
25165 vendorman3direxp='$vendorman3direxp'
25166 vendorprefix='$vendorprefix'
25167 vendorprefixexp='$vendorprefixexp'
25168 vendorscript='$vendorscript'
25169 vendorscriptexp='$vendorscriptexp'
25170 version='$version'
25171 version_patchlevel_string='$version_patchlevel_string'
25172 versiononly='$versiononly'
25173 vi='$vi'
25174 xlibpth='$xlibpth'
25175 yacc='$yacc'
25176 yaccflags='$yaccflags'
25177 zcat='$zcat'
25178 zip='$zip'
25179 EOT
25180
25181 : add special variables
25182 $test -f $src/patchlevel.h && \
25183 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25184 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25185 echo "PERL_CONFIG_SH=true" >>config.sh
25186
25187 : propagate old symbols
25188 if $test -f UU/config.sh; then
25189         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25190         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25191                 config.sh config.sh UU/oldconfig.sh |\
25192                 $sort | $uniq -u >UU/oldsyms
25193         set X `$cat UU/oldsyms`
25194         shift
25195         case $# in
25196         0) ;;
25197         *)
25198                 $cat <<EOM
25199 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25200 EOM
25201                 echo ": Variables propagated from previous config.sh file." >>config.sh
25202                 for sym in `$cat UU/oldsyms`; do
25203                         echo "    Propagating $hint variable "'$'"$sym..."
25204                         eval 'tmp="$'"${sym}"'"'
25205                         echo "$tmp" | \
25206                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25207                 done
25208                 ;;
25209         esac
25210 fi
25211
25212 : preserve RCS keywords in files with variable substitution, grrr
25213 Id='$Id'
25214
25215 : Finish up by extracting the .SH files
25216 case "$alldone" in
25217 exit)
25218         $rm -rf UU
25219         echo "Extraction done."
25220         exit 0
25221         ;;
25222 cont)
25223         ;;
25224 '')
25225         dflt=''
25226         nostick=true
25227         $cat <<EOM
25228
25229 If you'd like to make any changes to the config.sh file before I begin
25230 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25231
25232 EOM
25233         rp="Press return or use a shell escape to edit config.sh:"
25234         . UU/myread
25235         nostick=''
25236         case "$ans" in
25237         '') ;;
25238         *) : in case they cannot read
25239                 sh 1>&4 -c "$ans";;
25240         esac
25241         ;;
25242 esac
25243
25244 : if this fails, just run all the .SH files by hand
25245 . ./config.sh
25246
25247 echo " "
25248 exec 1>&4
25249 pwd=`pwd`
25250 . ./UU/extract
25251 cd "$pwd"
25252
25253 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25254         dflt=y
25255         case "$silent" in
25256         true) ;;
25257         *)
25258                 $cat <<EOM
25259
25260 Now you need to generate make dependencies by running "$make depend".
25261 You might prefer to run it in background: "$make depend > makedepend.out &"
25262 It can take a while, so you might not want to run it right now.
25263
25264 EOM
25265                 ;;
25266         esac
25267         rp="Run $make depend now?"
25268         . UU/myread
25269         case "$ans" in
25270         y*)
25271                 $make depend && echo "Now you must run '$make'."
25272                 ;;
25273         *)
25274                 echo "You must run '$make depend' then '$make'."
25275                 ;;
25276         esac
25277 elif test -f [Mm]akefile; then
25278         echo " "
25279         echo "Now you must run a $make."
25280 else
25281         echo "Configure done."
25282 fi
25283
25284 if $test -f Policy.sh; then
25285     $cat <<EOM
25286
25287 If you compile $package on a different machine or from a different object
25288 directory, copy the Policy.sh file from this object directory to the
25289 new one before you run Configure -- this will help you with most of
25290 the policy defaults.
25291
25292 EOM
25293 fi
25294 if $test -f config.msg; then
25295     echo "Hmm.  I also noted the following information while running:"
25296     echo " "
25297     $cat config.msg >&4
25298     $rm -f config.msg
25299 fi
25300 $rm -f kit*isdone ark*isdone
25301 $rm -rf UU
25302
25303 : End of Configure
25304