]> perl5.git.perl.org Git - perl5.git/blob - Configure This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Deparse: exclude two new test files
[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 should use metaconfig. Perl uses a modified version of this
17 # tool, and this, together with the metaconfig units, are available
18 # in the git repository:
19 #    $ git clone https://github.com/Perl/metaconfig metaconfig
20 # The original dist package (including metaconfig) is available on github:
21 #    $ git clone https://github.com/rmanfredi/dist.git dist-git
22 #
23 # Though this script was generated by metaconfig from metaunits, it is
24 # OK to send patches against Configure itself (but not to commit them
25 # to blead). It's up to
26 # the Configure maintainers to backport the patch to the metaunits if it
27 # is accepted. Exceptions to this rule, and more information, is in
28 # Porting/pumpkin.pod.
29
30 # Generated using [metaconfig 3.5 PL0]
31 # with additional metaconfig patches from https://github.com/Perl/metaconfig
32
33 cat >c1$$ <<EOF
34 ARGGGHHHH!!!!!
35
36 SCO csh still thinks true is false.  Write to SCO today and tell them that next
37 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
38
39 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
40 we'd have to do is go in and swap the && and || tokens, wherever they are.)
41
42 [End of diatribe. We now return you to your regularly scheduled programming...]
43 EOF
44 cat >c2$$ <<EOF
45
46 OOPS!  You naughty creature!  You didn't run Configure with sh!
47 I will attempt to remedy the situation by running sh for you...
48 EOF
49
50 true || cat c1$$ c2$$
51 true || exec sh $0 $argv:q
52
53 (exit $?0) || cat c2$$
54 (exit $?0) || exec sh $0 $argv:q
55 rm -f c1$$ c2$$
56
57 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
58         cat <<EOF
59 ***
60 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
61 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
62 *** Please read the README.plan9 for further instructions.
63 *** Cannot continue, aborting.
64 ***
65 EOF
66         exit 1
67 fi
68
69 if test -f /sys/utilities/MultiView ; then
70         # AmigaOS, test -c for /dev/null is not useful
71         :
72 elif test ! -c /dev/null ; then
73         cat <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin|*msys) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 hostgenerate=''
212 hostosname=''
213 hostperl=''
214 run=''
215 targetarch=''
216 targetdir=''
217 targetenv=''
218 targethost=''
219 targetmkdir=''
220 targetport=''
221 to=''
222 usecrosscompile=''
223 extern_C=''
224 mistrustnm=''
225 usedevel=''
226 perllibs=''
227 dynamic_ext=''
228 extensions=''
229 known_extensions=''
230 nonxs_ext=''
231 static_ext=''
232 uselanginfo=''
233 useopcode=''
234 useposix=''
235 extras=''
236 d_bsd=''
237 d_eunice=''
238 d_xenix=''
239 eunicefix=''
240 ar=''
241 awk=''
242 bash=''
243 bison=''
244 byacc=''
245 cat=''
246 chgrp=''
247 chmod=''
248 chown=''
249 comm=''
250 compress=''
251 cp=''
252 cpio=''
253 cpp=''
254 csh=''
255 date=''
256 echo=''
257 egrep=''
258 emacs=''
259 expr=''
260 find=''
261 flex=''
262 gmake=''
263 grep=''
264 gzip=''
265 inews=''
266 ksh=''
267 less=''
268 line=''
269 lint=''
270 ln=''
271 lp=''
272 lpr=''
273 ls=''
274 mail=''
275 mailx=''
276 make=''
277 mkdir=''
278 more=''
279 mv=''
280 nm=''
281 nroff=''
282 perl=''
283 pg=''
284 pmake=''
285 pr=''
286 rm=''
287 rmail=''
288 sed=''
289 sendmail=''
290 shar=''
291 sleep=''
292 smail=''
293 sort=''
294 submit=''
295 tail=''
296 tar=''
297 tbl=''
298 tee=''
299 test=''
300 touch=''
301 tr=''
302 troff=''
303 uname=''
304 uniq=''
305 uuname=''
306 vi=''
307 zcat=''
308 zip=''
309 full_ar=''
310 full_sed=''
311 libswanted=''
312 hint=''
313 myuname=''
314 osname=''
315 osvers=''
316 Author=''
317 Date=''
318 Header=''
319 Id=''
320 Locker=''
321 Log=''
322 RCSfile=''
323 Revision=''
324 Source=''
325 State=''
326 sysroot=''
327 _a=''
328 _exe=''
329 _o=''
330 archobjs=''
331 exe_ext=''
332 firstmakefile=''
333 lib_ext=''
334 obj_ext=''
335 path_sep=''
336 rm_try=''
337 afs=''
338 afsroot=''
339 alignbytes=''
340 archlib=''
341 archlibexp=''
342 d_archlib=''
343 installarchlib=''
344 archname=''
345 myarchname=''
346 useversionedarchname=''
347 d_atolf=''
348 d_atoll=''
349 baserev=''
350 bin=''
351 binexp=''
352 initialinstalllocation=''
353 installbin=''
354 userelocatableinc=''
355 byteorder=''
356 cc=''
357 ccflags=''
358 cppflags=''
359 ldflags=''
360 lkflags=''
361 locincpth=''
362 optimize=''
363 cf_email=''
364 cf_by=''
365 cf_time=''
366 charbits=''
367 charsize=''
368 compiler_warning=''
369 contains=''
370 cpp_stuff=''
371 cpplast=''
372 cppminus=''
373 cpprun=''
374 cppstdin=''
375 d__fwalk=''
376 d_accept4=''
377 d_access=''
378 d_accessx=''
379 d_acosh=''
380 d_aintl=''
381 d_alarm=''
382 asctime_r_proto=''
383 d_asctime_r=''
384 d_asinh=''
385 d_atanh=''
386 d_attribute_always_inline=''
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_visibility=''
395 d_attribute_warn_unused_result=''
396 d_printf_format_null=''
397 d_backtrace=''
398 d_non_int_bitfields=''
399 d_builtin_choose_expr=''
400 d_builtin_expect=''
401 d_builtin_add_overflow=''
402 d_builtin_mul_overflow=''
403 d_builtin_sub_overflow=''
404 d_c99_variadic_macros=''
405 d_casti32=''
406 castflags=''
407 d_castneg=''
408 d_cbrt=''
409 d_chown=''
410 d_chroot=''
411 d_chsize=''
412 d_class=''
413 d_clearenv=''
414 d_closedir=''
415 d_void_closedir=''
416 d_cmsghdr_s=''
417 d_copysign=''
418 d_copysignl=''
419 d_cplusplus=''
420 cryptlib=''
421 d_crypt=''
422 crypt_r_proto=''
423 d_crypt_r=''
424 d_csh=''
425 full_csh=''
426 d_ctermid=''
427 ctermid_r_proto=''
428 d_ctermid_r=''
429 ctime_r_proto=''
430 d_ctime_r=''
431 d_cuserid=''
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_dup3=''
447 d_eaccess=''
448 d_endgrent=''
449 d_endgrent_r=''
450 endgrent_r_proto=''
451 d_endhent=''
452 d_endhostent_r=''
453 endhostent_r_proto=''
454 d_endnent=''
455 d_endnetent_r=''
456 endnetent_r_proto=''
457 d_endpent=''
458 d_endprotoent_r=''
459 endprotoent_r_proto=''
460 d_endpwent=''
461 d_endpwent_r=''
462 endpwent_r_proto=''
463 d_endsent=''
464 d_endservent_r=''
465 endservent_r_proto=''
466 d_erf=''
467 d_erfc=''
468 d_exp2=''
469 d_expm1=''
470 d_faststdio=''
471 d_fchdir=''
472 d_fchmod=''
473 d_fchown=''
474 d_fcntl=''
475 d_fcntl_can_lock=''
476 d_fd_macros=''
477 d_fd_set=''
478 d_fds_bits=''
479 d_fdclose=''
480 d_fdim=''
481 d_fegetround=''
482 d_ffs=''
483 d_ffsl=''
484 d_fgetpos=''
485 d_finite=''
486 d_finitel=''
487 d_flexfnam=''
488 d_flock=''
489 d_flockproto=''
490 d_fma=''
491 d_fmax=''
492 d_fmin=''
493 d_fork=''
494 d_fp_class=''
495 d_fp_classl=''
496 d_fpclass=''
497 d_fp_classify=''
498 d_fpclassify=''
499 d_fpclassl=''
500 d_fpgetround=''
501 d_fpos64_t=''
502 d_frexpl=''
503 d_fs_data_s=''
504 d_fchmodat=''
505 d_linkat=''
506 d_openat=''
507 d_renameat=''
508 d_unlinkat=''
509 d_fseeko=''
510 d_fsetpos=''
511 d_fstatfs=''
512 d_fsync=''
513 d_ftello=''
514 d_ftime=''
515 d_gettimeod=''
516 d_futimes=''
517 d_gai_strerror=''
518 d_Gconvert=''
519 d_getaddrinfo=''
520 d_getcwd=''
521 d_getenv_preserves_other_thread=''
522 d_getespwnam=''
523 d_getfsstat=''
524 d_getgrent=''
525 d_getgrent_r=''
526 getgrent_r_proto=''
527 d_getgrgid_r=''
528 getgrgid_r_proto=''
529 d_getgrnam_r=''
530 getgrnam_r_proto=''
531 d_getgrps=''
532 d_gethbyaddr=''
533 d_gethbyname=''
534 d_gethent=''
535 aphostname=''
536 d_gethname=''
537 d_phostname=''
538 d_uname=''
539 d_gethostbyaddr_r=''
540 gethostbyaddr_r_proto=''
541 d_gethostbyname_r=''
542 gethostbyname_r_proto=''
543 d_gethostent_r=''
544 gethostent_r_proto=''
545 d_gethostprotos=''
546 d_getitimer=''
547 d_getlogin=''
548 d_getlogin_r=''
549 getlogin_r_proto=''
550 d_getmnt=''
551 d_getmntent=''
552 d_getnameinfo=''
553 d_getnbyaddr=''
554 d_getnbyname=''
555 d_getnent=''
556 d_getnetbyaddr_r=''
557 getnetbyaddr_r_proto=''
558 d_getnetbyname_r=''
559 getnetbyname_r_proto=''
560 d_getnetent_r=''
561 getnetent_r_proto=''
562 d_getnetprotos=''
563 d_getpagsz=''
564 d_getpent=''
565 d_getpgid=''
566 d_getpgrp2=''
567 d_bsdgetpgrp=''
568 d_getpgrp=''
569 d_getppid=''
570 d_getprior=''
571 d_getpbyname=''
572 d_getpbynumber=''
573 d_getprotobyname_r=''
574 getprotobyname_r_proto=''
575 d_getprotobynumber_r=''
576 getprotobynumber_r_proto=''
577 d_getprotoent_r=''
578 getprotoent_r_proto=''
579 d_getprotoprotos=''
580 d_getprpwnam=''
581 d_getpwent=''
582 d_getpwent_r=''
583 getpwent_r_proto=''
584 d_getpwnam_r=''
585 getpwnam_r_proto=''
586 d_getpwuid_r=''
587 getpwuid_r_proto=''
588 d_getsent=''
589 d_getservbyname_r=''
590 getservbyname_r_proto=''
591 d_getservbyport_r=''
592 getservbyport_r_proto=''
593 d_getservent_r=''
594 getservent_r_proto=''
595 d_getservprotos=''
596 d_getspnam=''
597 d_getspnam_r=''
598 getspnam_r_proto=''
599 d_getsbyname=''
600 d_getsbyport=''
601 d_gmtime_r=''
602 gmtime_r_proto=''
603 d_gnulibc=''
604 gnulibc_version=''
605 d_hasmntopt=''
606 d_htonl=''
607 d_hypot=''
608 d_ilogb=''
609 d_ilogbl=''
610 d_inetaton=''
611 d_inetntop=''
612 d_inetpton=''
613 d_int64_t=''
614 d_isascii=''
615 d_isblank=''
616 d_isfinite=''
617 d_isfinitel=''
618 d_isinf=''
619 d_isinfl=''
620 d_isless=''
621 d_isnan=''
622 d_isnanl=''
623 d_isnormal=''
624 d_j0=''
625 d_j0l=''
626 d_killpg=''
627 d_lc_monetary_2008=''
628 d_lchown=''
629 d_ldbl_dig=''
630 d_lgamma=''
631 d_lgamma_r=''
632 d_libm_lib_version=''
633 d_link=''
634 d_llrint=''
635 d_llrintl=''
636 d_llround=''
637 d_llroundl=''
638 d_localeconv_l=''
639 d_localtime_r=''
640 d_localtime_r_needs_tzset=''
641 localtime_r_proto=''
642 d_locconv=''
643 d_lockf=''
644 d_log1p=''
645 d_log2=''
646 d_logb=''
647 d_ldexpl=''
648 d_long_double_style_ieee=''
649 d_long_double_style_ieee_doubledouble=''
650 d_long_double_style_ieee_extended=''
651 d_long_double_style_ieee_std=''
652 d_long_double_style_vax=''
653 d_longdbl=''
654 longdblkind=''
655 longdblsize=''
656 d_longlong=''
657 longlongsize=''
658 d_lrint=''
659 d_lrintl=''
660 d_lround=''
661 d_lroundl=''
662 d_lseekproto=''
663 d_lstat=''
664 d_madvise=''
665 d_malloc_good_size=''
666 d_malloc_size=''
667 d_malloc_usable_size=''
668 d_mblen=''
669 d_mbrlen=''
670 d_mbrtowc=''
671 d_mbstowcs=''
672 d_mbtowc=''
673 d_memmem=''
674 d_memrchr=''
675 d_mkdir=''
676 d_mkdtemp=''
677 d_mkfifo=''
678 d_mkostemp=''
679 d_mkstemp=''
680 d_mkstemps=''
681 d_mktime=''
682 d_mmap=''
683 mmaptype=''
684 d_modfl=''
685 d_modflproto=''
686 d_mprotect=''
687 d_msg=''
688 d_msgctl=''
689 d_msgget=''
690 d_msghdr_s=''
691 d_msgrcv=''
692 d_msgsnd=''
693 d_msync=''
694 d_munmap=''
695 d_nan=''
696 d_nanosleep=''
697 d_nearbyint=''
698 d_duplocale=''
699 d_freelocale=''
700 d_newlocale=''
701 d_querylocale=''
702 d_uselocale=''
703 i_xlocale=''
704 xlocale_needed=''
705 d_nextafter=''
706 d_nexttoward=''
707 d_nice=''
708 d_nl_langinfo=''
709 d_nl_langinfo_l=''
710 d_off64_t=''
711 d_open3=''
712 d_fpathconf=''
713 d_pathconf=''
714 d_pause=''
715 d_pipe2=''
716 d_pipe=''
717 d_poll=''
718 d_portable=''
719 d_prctl=''
720 d_prctl_set_name=''
721 d_procselfexe=''
722 procselfexe=''
723 d_old_pthread_create_joinable=''
724 old_pthread_create_joinable=''
725 d_pthread_atfork=''
726 d_pthread_attr_setscope=''
727 d_pthread_yield=''
728 d_sched_yield=''
729 sched_yield=''
730 d_ptrdiff_t=''
731 d_qgcvt=''
732 d_random_r=''
733 random_r_proto=''
734 d_readdir64_r=''
735 readdir64_r_proto=''
736 d_readdir=''
737 d_rewinddir=''
738 d_seekdir=''
739 d_telldir=''
740 d_readdir_r=''
741 readdir_r_proto=''
742 d_readlink=''
743 d_readv=''
744 d_recvmsg=''
745 d_re_comp=''
746 d_regcmp=''
747 d_regcomp=''
748 d_remainder=''
749 d_remquo=''
750 d_rename=''
751 d_rint=''
752 d_rmdir=''
753 d_round=''
754 d_sbrkproto=''
755 d_scalbn=''
756 d_scalbnl=''
757 d_select=''
758 d_sem=''
759 d_semctl=''
760 d_semget=''
761 d_semop=''
762 d_sendmsg=''
763 d_setegid=''
764 d_setenv=''
765 d_seteuid=''
766 d_setgrent=''
767 d_setgrent_r=''
768 setgrent_r_proto=''
769 d_setgrps=''
770 d_sethent=''
771 d_sethostent_r=''
772 sethostent_r_proto=''
773 d_setitimer=''
774 d_setlinebuf=''
775 d_has_C_UTF8=''
776 d_setlocale=''
777 d_setlocale_accepts_any_locale_name=''
778 d_setlocale_r=''
779 setlocale_r_proto=''
780 d_setnent=''
781 d_setnetent_r=''
782 setnetent_r_proto=''
783 d_setpent=''
784 d_setpgid=''
785 d_setpgrp2=''
786 d_bsdsetpgrp=''
787 d_setpgrp=''
788 d_setprior=''
789 d_setproctitle=''
790 d_setprotoent_r=''
791 setprotoent_r_proto=''
792 d_setpwent=''
793 d_setpwent_r=''
794 setpwent_r_proto=''
795 d_setregid=''
796 d_setresgid=''
797 d_setresuid=''
798 d_setreuid=''
799 d_setrgid=''
800 d_setruid=''
801 d_setsent=''
802 d_setservent_r=''
803 setservent_r_proto=''
804 d_setsid=''
805 d_setvbuf=''
806 d_shm=''
807 d_shmat=''
808 d_shmatprototype=''
809 shmattype=''
810 d_shmctl=''
811 d_shmdt=''
812 d_shmget=''
813 d_sigaction=''
814 d_siginfo_si_addr=''
815 d_siginfo_si_band=''
816 d_siginfo_si_errno=''
817 d_siginfo_si_fd=''
818 d_siginfo_si_pid=''
819 d_siginfo_si_status=''
820 d_siginfo_si_uid=''
821 d_siginfo_si_value=''
822 d_signbit=''
823 d_sigprocmask=''
824 d_sigsetjmp=''
825 usesitecustomize=''
826 d_snprintf=''
827 d_vsnprintf=''
828 d_sockatmark=''
829 d_sockatmarkproto=''
830 d_ip_mreq=''
831 d_ip_mreq_source=''
832 d_ipv6_mreq=''
833 d_ipv6_mreq_source=''
834 d_msg_ctrunc=''
835 d_msg_dontroute=''
836 d_msg_oob=''
837 d_msg_peek=''
838 d_msg_proxy=''
839 d_oldsock=''
840 d_scm_rights=''
841 d_sin6_scope_id=''
842 d_sockaddr_in6=''
843 d_sockaddr_sa_len=''
844 d_sockaddr_storage=''
845 d_socket=''
846 d_sockpair=''
847 sockethdr=''
848 socketlib=''
849 d_socklen_t=''
850 d_socks5_init=''
851 d_sqrtl=''
852 d_srand48_r=''
853 srand48_r_proto=''
854 d_srandom_r=''
855 srandom_r_proto=''
856 d_sresgproto=''
857 d_sresuproto=''
858 d_stat=''
859 d_statblks=''
860 d_statfs_f_flags=''
861 d_statfs_s=''
862 d_static_inline=''
863 perl_static_inline=''
864 d_fstatvfs=''
865 d_statvfs=''
866 d_stdio_cnt_lval=''
867 d_stdio_ptr_lval=''
868 d_stdio_ptr_lval_nochange_cnt=''
869 d_stdio_ptr_lval_sets_cnt=''
870 d_stdiobase=''
871 d_stdstdio=''
872 stdio_base=''
873 stdio_bufsiz=''
874 stdio_cnt=''
875 stdio_filbuf=''
876 stdio_ptr=''
877 d_strcoll=''
878 d_sysernlst=''
879 d_syserrlst=''
880 d_strerror_l=''
881 d_strerror_r=''
882 strerror_r_proto=''
883 d_strftime=''
884 d_strlcat=''
885 d_strlcpy=''
886 d_strnlen=''
887 d_strtod=''
888 d_strtod_l=''
889 d_strtol=''
890 d_strtold=''
891 d_strtold_l=''
892 d_strtoll=''
893 d_strtoq=''
894 d_strtoul=''
895 d_strtoull=''
896 d_strtouq=''
897 d_strxfrm=''
898 d_strxfrm_l=''
899 d_symlink=''
900 d_syscall=''
901 d_syscallproto=''
902 d_sysconf=''
903 d_system=''
904 d_tcgetpgrp=''
905 d_tcsetpgrp=''
906 d_telldirproto=''
907 d_tgamma=''
908 d_thread_local=''
909 perl_thread_local=''
910 d_time=''
911 timetype=''
912 d_asctime64=''
913 d_ctime64=''
914 d_difftime64=''
915 d_gmtime64=''
916 d_localtime64=''
917 d_mktime64=''
918 d_timegm=''
919 clocktype=''
920 d_times=''
921 d_tmpnam_r=''
922 tmpnam_r_proto=''
923 d_towlower=''
924 d_towupper=''
925 d_trunc=''
926 d_truncate=''
927 d_truncl=''
928 d_ttyname_r=''
929 ttyname_r_proto=''
930 d_tzname=''
931 d_u32align=''
932 d_ualarm=''
933 d_umask=''
934 d_semctl_semid_ds=''
935 d_semctl_semun=''
936 d_union_semun=''
937 d_unordered=''
938 d_unsetenv=''
939 d_usleep=''
940 d_usleepproto=''
941 d_ustat=''
942 d_pseudofork=''
943 d_vfork=''
944 usevfork=''
945 d_voidsig=''
946 signal_t=''
947 d_wait4=''
948 d_waitpid=''
949 d_wcrtomb=''
950 d_wcscmp=''
951 d_wcstombs=''
952 d_wcsxfrm=''
953 d_wctomb=''
954 d_writev=''
955 default_inc_excludes_dot=''
956 d_perl_lc_all_category_positions_init=''
957 d_perl_lc_all_separator=''
958 d_perl_lc_all_uses_name_value_pairs=''
959 perl_lc_all_category_positions_init=''
960 perl_lc_all_separator=''
961 dlext=''
962 bin_ELF=''
963 cccdlflags=''
964 ccdlflags=''
965 dlsrc=''
966 ld=''
967 ld_can_script=''
968 lddlflags=''
969 usedl=''
970 doublesize=''
971 dtraceobject=''
972 dtracexnolibs=''
973 ebcdic=''
974 fflushNULL=''
975 fflushall=''
976 fpossize=''
977 fpostype=''
978 gccansipedantic=''
979 gccosandvers=''
980 gccversion=''
981 gidformat=''
982 gidsign=''
983 gidsize=''
984 gidtype=''
985 groupstype=''
986 h_fcntl=''
987 h_sysfile=''
988 html1dir=''
989 html1direxp=''
990 installhtml1dir=''
991 html3dir=''
992 html3direxp=''
993 installhtml3dir=''
994 i_arpainet=''
995 i_bfd=''
996 i_crypt=''
997 db_hashtype=''
998 db_prefixtype=''
999 db_version_major=''
1000 db_version_minor=''
1001 db_version_patch=''
1002 i_db=''
1003 i_dbm=''
1004 i_rpcsvcdbm=''
1005 d_dirnamlen=''
1006 direntrytype=''
1007 i_dirent=''
1008 i_dlfcn=''
1009 i_execinfo=''
1010 i_fcntl=''
1011 i_fenv=''
1012 i_fp=''
1013 i_fp_class=''
1014 i_gdbm=''
1015 d_grpasswd=''
1016 i_grp=''
1017 i_ieeefp=''
1018 i_inttypes=''
1019 i_langinfo=''
1020 i_libutil=''
1021 i_locale=''
1022 i_machcthr=''
1023 i_malloc=''
1024 i_mallocmalloc=''
1025 i_mntent=''
1026 d_gdbm_ndbm_h_uses_prototypes=''
1027 d_gdbmndbm_h_uses_prototypes=''
1028 d_ndbm=''
1029 d_ndbm_h_uses_prototypes=''
1030 i_gdbm_ndbm=''
1031 i_gdbmndbm=''
1032 i_ndbm=''
1033 i_netdb=''
1034 i_neterrno=''
1035 i_netinettcp=''
1036 i_niin=''
1037 i_sysin=''
1038 i_poll=''
1039 i_prot=''
1040 i_pthread=''
1041 d_pwage=''
1042 d_pwchange=''
1043 d_pwclass=''
1044 d_pwcomment=''
1045 d_pwexpire=''
1046 d_pwgecos=''
1047 d_pwpasswd=''
1048 d_pwquota=''
1049 i_pwd=''
1050 i_quadmath=''
1051 i_shadow=''
1052 i_socks=''
1053 i_stdbool=''
1054 i_stdint=''
1055 i_stdlib=''
1056 i_sunmath=''
1057 i_sysaccess=''
1058 i_sysdir=''
1059 i_sysfile=''
1060 d_voidtty=''
1061 i_bsdioctl=''
1062 i_sysfilio=''
1063 i_sysioctl=''
1064 i_syssockio=''
1065 i_syslog=''
1066 i_sysmman=''
1067 i_sysmode=''
1068 i_sysmount=''
1069 i_sysndir=''
1070 i_sysparam=''
1071 i_syspoll=''
1072 i_sysresrc=''
1073 i_syssecrt=''
1074 i_sysselct=''
1075 i_sysstat=''
1076 i_sysstatfs=''
1077 i_sysstatvfs=''
1078 i_syssyscall=''
1079 i_systimes=''
1080 i_systypes=''
1081 i_sysuio=''
1082 i_sysun=''
1083 i_sysutsname=''
1084 i_sysvfs=''
1085 i_syswait=''
1086 i_sgtty=''
1087 i_termio=''
1088 i_termios=''
1089 d_tm_tm_gmtoff=''
1090 d_tm_tm_zone=''
1091 i_systime=''
1092 i_systimek=''
1093 i_time=''
1094 timeincl=''
1095 i_unistd=''
1096 i_ustat=''
1097 i_utime=''
1098 i_vfork=''
1099 i_wchar=''
1100 i_wctype=''
1101 d_inc_version_list=''
1102 inc_version_list=''
1103 inc_version_list_init=''
1104 doubleinfbytes=''
1105 doublenanbytes=''
1106 longdblinfbytes=''
1107 longdblnanbytes=''
1108 installprefix=''
1109 installprefixexp=''
1110 installstyle=''
1111 installusrbinperl=''
1112 intsize=''
1113 longsize=''
1114 shortsize=''
1115 issymlink=''
1116 libc=''
1117 ldlibpthname=''
1118 libperl=''
1119 shrpenv=''
1120 useshrplib=''
1121 glibpth=''
1122 incpth=''
1123 libpth=''
1124 loclibpth=''
1125 plibpth=''
1126 xlibpth=''
1127 ignore_versioned_solibs=''
1128 libs=''
1129 libsdirs=''
1130 libsfiles=''
1131 libsfound=''
1132 libspath=''
1133 lns=''
1134 d_PRIEUldbl=''
1135 d_PRIFUldbl=''
1136 d_PRIGUldbl=''
1137 d_PRIeldbl=''
1138 d_PRIfldbl=''
1139 d_PRIgldbl=''
1140 d_SCNfldbl=''
1141 d_double_has_inf=''
1142 d_double_has_nan=''
1143 d_double_has_negative_zero=''
1144 d_double_has_subnormals=''
1145 d_double_style_cray=''
1146 d_double_style_ibm=''
1147 d_double_style_ieee=''
1148 d_double_style_vax=''
1149 doublekind=''
1150 sPRIEUldbl=''
1151 sPRIFUldbl=''
1152 sPRIGUldbl=''
1153 sPRIeldbl=''
1154 sPRIfldbl=''
1155 sPRIgldbl=''
1156 sSCNfldbl=''
1157 lseeksize=''
1158 lseektype=''
1159 make_set_make=''
1160 d_mymalloc=''
1161 freetype=''
1162 mallocobj=''
1163 mallocsrc=''
1164 malloctype=''
1165 usemallocwrap=''
1166 usemymalloc=''
1167 installman1dir=''
1168 man1dir=''
1169 man1direxp=''
1170 man1ext=''
1171 installman3dir=''
1172 man3dir=''
1173 man3direxp=''
1174 man3ext=''
1175 doublemantbits=''
1176 longdblmantbits=''
1177 nvmantbits=''
1178 modetype=''
1179 multiarch=''
1180 mydomain=''
1181 myhostname=''
1182 phostname=''
1183 c=''
1184 n=''
1185 d_eofnblk=''
1186 eagain=''
1187 o_nonblock=''
1188 rd_nodata=''
1189 need_va_copy=''
1190 netdb_hlen_type=''
1191 netdb_host_type=''
1192 netdb_name_type=''
1193 netdb_net_type=''
1194 groupcat=''
1195 hostcat=''
1196 passcat=''
1197 orderlib=''
1198 ranlib=''
1199 d_perl_otherlibdirs=''
1200 otherlibdirs=''
1201 package=''
1202 spackage=''
1203 pager=''
1204 api_revision=''
1205 api_subversion=''
1206 api_version=''
1207 api_versionstring=''
1208 patchlevel=''
1209 perl_patchlevel=''
1210 revision=''
1211 subversion=''
1212 version=''
1213 version_patchlevel_string=''
1214 perl5=''
1215 perladmin=''
1216 perlpath=''
1217 i32dformat=''
1218 u32XUformat=''
1219 u32oformat=''
1220 u32uformat=''
1221 u32xformat=''
1222 d_nv_preserves_uv=''
1223 d_nv_zero_is_allbits_zero=''
1224 i16size=''
1225 i16type=''
1226 i32size=''
1227 i32type=''
1228 i64size=''
1229 i64type=''
1230 i8size=''
1231 i8type=''
1232 ivsize=''
1233 ivtype=''
1234 nv_overflows_integers_at=''
1235 nv_preserves_uv_bits=''
1236 nvsize=''
1237 nvtype=''
1238 u16size=''
1239 u16type=''
1240 u32size=''
1241 u32type=''
1242 u64size=''
1243 u64type=''
1244 u8size=''
1245 u8type=''
1246 uvsize=''
1247 uvtype=''
1248 ivdformat=''
1249 nvEUformat=''
1250 nvFUformat=''
1251 nvGUformat=''
1252 nveformat=''
1253 nvfformat=''
1254 nvgformat=''
1255 uvXUformat=''
1256 uvoformat=''
1257 uvuformat=''
1258 uvxformat=''
1259 pidtype=''
1260 prefix=''
1261 prefixexp=''
1262 installprivlib=''
1263 privlib=''
1264 privlibexp=''
1265 ptrsize=''
1266 d_PRIXU64=''
1267 d_PRId64=''
1268 d_PRIi64=''
1269 d_PRIo64=''
1270 d_PRIu64=''
1271 d_PRIx64=''
1272 sPRIXU64=''
1273 sPRId64=''
1274 sPRIi64=''
1275 sPRIo64=''
1276 sPRIu64=''
1277 sPRIx64=''
1278 d_quad=''
1279 quadkind=''
1280 quadtype=''
1281 uquadtype=''
1282 drand01=''
1283 randbits=''
1284 randfunc=''
1285 randseedtype=''
1286 seedfunc=''
1287 installscript=''
1288 scriptdir=''
1289 scriptdirexp=''
1290 selectminbits=''
1291 selecttype=''
1292 sh=''
1293 targetsh=''
1294 sig_count=''
1295 sig_name=''
1296 sig_name_init=''
1297 sig_num=''
1298 sig_num_init=''
1299 sig_size=''
1300 d_sitearch=''
1301 installsitearch=''
1302 sitearch=''
1303 sitearchexp=''
1304 installsitebin=''
1305 sitebin=''
1306 sitebinexp=''
1307 installsitehtml1dir=''
1308 sitehtml1dir=''
1309 sitehtml1direxp=''
1310 installsitehtml3dir=''
1311 sitehtml3dir=''
1312 sitehtml3direxp=''
1313 installsitelib=''
1314 sitelib=''
1315 sitelib_stem=''
1316 sitelibexp=''
1317 installsiteman1dir=''
1318 siteman1dir=''
1319 siteman1direxp=''
1320 installsiteman3dir=''
1321 siteman3dir=''
1322 siteman3direxp=''
1323 siteprefix=''
1324 siteprefixexp=''
1325 installsitescript=''
1326 sitescript=''
1327 sitescriptexp=''
1328 sizesize=''
1329 sizetype=''
1330 d_libname_unique=''
1331 so=''
1332 socksizetype=''
1333 sharpbang=''
1334 shsharp=''
1335 spitshell=''
1336 src=''
1337 ssizetype=''
1338 st_dev_sign=''
1339 st_dev_size=''
1340 st_ino_sign=''
1341 st_ino_size=''
1342 startperl=''
1343 startsh=''
1344 stdchar=''
1345 d_stdio_stream_array=''
1346 stdio_stream_array=''
1347 sysman=''
1348 sGMTIME_max=''
1349 sGMTIME_min=''
1350 sLOCALTIME_max=''
1351 sLOCALTIME_min=''
1352 trnl=''
1353 uidformat=''
1354 uidsign=''
1355 uidsize=''
1356 uidtype=''
1357 archname64=''
1358 use64bitall=''
1359 use64bitint=''
1360 usecbacktrace=''
1361 usedefaultstrict=''
1362 dtrace=''
1363 usedtrace=''
1364 usefaststdio=''
1365 usekernprocpathname=''
1366 ccflags_uselargefiles=''
1367 ldflags_uselargefiles=''
1368 libswanted_uselargefiles=''
1369 uselargefiles=''
1370 uselongdouble=''
1371 usemorebits=''
1372 usemultiplicity=''
1373 nm_opt=''
1374 nm_so_opt=''
1375 runnm=''
1376 usenm=''
1377 usensgetexecutablepath=''
1378 useperlio=''
1379 usequadmath=''
1380 usesocks=''
1381 d_oldpthreads=''
1382 useithreads=''
1383 usereentrant=''
1384 usethreads=''
1385 incpath=''
1386 mips_type=''
1387 usrinc=''
1388 d_vendorarch=''
1389 installvendorarch=''
1390 vendorarch=''
1391 vendorarchexp=''
1392 d_vendorbin=''
1393 installvendorbin=''
1394 vendorbin=''
1395 vendorbinexp=''
1396 installvendorhtml1dir=''
1397 vendorhtml1dir=''
1398 vendorhtml1direxp=''
1399 installvendorhtml3dir=''
1400 vendorhtml3dir=''
1401 vendorhtml3direxp=''
1402 d_vendorlib=''
1403 installvendorlib=''
1404 vendorlib=''
1405 vendorlib_stem=''
1406 vendorlibexp=''
1407 installvendorman1dir=''
1408 vendorman1dir=''
1409 vendorman1direxp=''
1410 installvendorman3dir=''
1411 vendorman3dir=''
1412 vendorman3direxp=''
1413 usevendorprefix=''
1414 vendorprefix=''
1415 vendorprefixexp=''
1416 d_vendorscript=''
1417 installvendorscript=''
1418 vendorscript=''
1419 vendorscriptexp=''
1420 versiononly=''
1421 yacc=''
1422 yaccflags=''
1423 CONFIG=''
1424
1425 : Detect odd OSs
1426 define='define'
1427 undef='undef'
1428 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1429 rmlist=''
1430
1431 : We must find out about Eunice early
1432 eunicefix=':'
1433 if test -f /etc/unixtovms; then
1434         eunicefix=/etc/unixtovms
1435 fi
1436 if test -f /etc/unixtovms.exe; then
1437         eunicefix=/etc/unixtovms.exe
1438 fi
1439
1440 : Set executable suffix now -- needed before hints available
1441 if test -f "/libs/version.library"; then
1442 : Amiga OS
1443     _exe=""
1444 elif test -f "/system/gnu_library/bin/ar.pm"; then
1445 : Stratus VOS
1446     _exe=".pm"
1447 elif test -n "$DJGPP"; then
1448 : DOS DJGPP
1449     _exe=".exe"
1450 elif test -f /kern/cookiejar; then
1451 : MiNT
1452     _exe=""
1453 elif test -d c:/. -o -n "$is_os2" ; then
1454 : OS/2 or cygwin
1455     _exe=".exe"
1456 fi
1457
1458 groupstype=''
1459 i_whoami=''
1460 : Possible local include directories to search.
1461 : Set locincpth to "" in a hint file to defeat local include searches.
1462 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1463 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1464 :
1465 : no include file wanted by default
1466 inclwanted=''
1467
1468 : Enable -DEBUGGING and -DDEBUGGING from the command line
1469 EBUGGING=''
1470 DEBUGGING=''
1471
1472 : Trailing extension.  Override this in a hint file, if needed.
1473 : Extra object files, if any, needed on this platform.
1474 archobjs=''
1475 libnames=''
1476 : change the next line if compiling for Xenix/286 on Xenix/386
1477 xlibpth='/usr/lib/386 /lib/386'
1478 : Possible local library directories to search.
1479 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1480 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1481
1482 : general looking path for locating libraries
1483 glibpth="/lib /usr/lib $xlibpth"
1484 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1485 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1486 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1487 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1488
1489 : Private path used by Configure to find libraries.  Its value
1490 : is prepended to libpth. This variable takes care of special
1491 : machines, like the mips.  Usually, it should be empty.
1492 plibpth=''
1493
1494 : default library list
1495 libswanted=''
1496 : some systems want to use only the non-versioned libso:s
1497 ignore_versioned_solibs=''
1498 ccname=''
1499 ccversion=''
1500 perllibs=''
1501 : set useposix=false in your hint file to disable the POSIX extension.
1502 useposix=true
1503 : set useopcode=false in your hint file to disable the Opcode extension.
1504 useopcode=true
1505 : set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1506 uselanginfo=true
1507 archname64=''
1508 ccflags_uselargefiles=''
1509 ldflags_uselargefiles=''
1510 libswanted_uselargefiles=''
1511 : set usemultiplicity on the Configure command line to enable multiplicity.
1512 : set usesocks on the Configure command line to enable socks.
1513 archname=''
1514 : set usethreads on the Configure command line to enable threads.
1515 usereentrant='undef'
1516 : List of libraries we want.
1517 : If anyone needs extra -lxxx, put those in a hint file.
1518 libswanted="cl pthread socket bind inet ndbm gdbm dbm db malloc dl ld"
1519 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1520 : We probably want to search /usr/shlib before most other libraries.
1521 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1522 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1523 glibpth="/usr/shlib $glibpth"
1524 : Do not use vfork unless overridden by a hint file.
1525 usevfork=false
1526
1527 : Find the basic shell for Bourne shell scripts
1528 case "$sh" in
1529 '')
1530         case "$SYSTYPE" in
1531         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1532         *) xxx='/bin/sh';;
1533         esac
1534         if test -f "$xxx"; then
1535                 sh="$xxx"
1536         else
1537                 : Build up a list and do a single loop so we can 'break' out.
1538                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1539                 for xxx in sh bash ksh pdksh ash; do
1540                         for p in $pth; do
1541                                 try="$try ${p}/${xxx}"
1542                         done
1543                 done
1544                 for xxx in $try; do
1545                         if test -f "$xxx"; then
1546                                 sh="$xxx";
1547                                 break
1548                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1549                                 sh="$xxx";
1550                                 break
1551                         elif test -f "$xxx.exe"; then
1552                                 sh="$xxx";
1553                                 break
1554                         fi
1555                 done
1556         fi
1557         ;;
1558 esac
1559
1560 case "$sh" in
1561 '')     cat >&2 <<EOM
1562 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1563
1564 Usually it's in /bin/sh.  How did you even get this far?
1565 Please report this issue at https://github.com/Perl/perl5/issues
1566 and we'll try to straighten this all out.
1567 EOM
1568         exit 1
1569         ;;
1570 esac
1571
1572 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1573 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1574 targetsh=$sh
1575
1576 : see if sh knows # comments
1577 if `$sh -c '#' >/dev/null 2>&1`; then
1578         shsharp=true
1579         spitshell=cat
1580         xcat=/bin/cat
1581         test -f $xcat$_exe || xcat=/usr/bin/cat
1582         if test ! -f $xcat$_exe; then
1583                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1584                         if test -f $p/cat$_exe; then
1585                                 xcat=$p/cat
1586                                 break
1587                         fi
1588                 done
1589                 if test ! -f $xcat$_exe; then
1590                         echo "Can't find cat anywhere!"
1591                         exit 1
1592                 fi
1593         fi
1594         echo "#!$xcat" >sharp
1595         $eunicefix sharp
1596         chmod +x sharp
1597         ./sharp > today 2>/dev/null
1598         if test -s today; then
1599                 sharpbang='#!'
1600         else
1601                 echo "#! $xcat" > sharp
1602                 $eunicefix sharp
1603                 chmod +x sharp
1604                 ./sharp > today 2>/dev/null
1605                 if test -s today; then
1606                         sharpbang='#! '
1607                 else
1608                         sharpbang=': use '
1609                 fi
1610         fi
1611 else
1612         echo " "
1613         echo "Your $sh doesn't grok # comments--I will strip them later on."
1614         shsharp=false
1615         cd ..
1616         echo "exec grep -v '^[  ]*#'" >spitshell
1617         chmod +x spitshell
1618         $eunicefix spitshell
1619         spitshell=`pwd`/spitshell
1620         cd UU
1621         echo "I presume that if # doesn't work, #! won't work either!"
1622         sharpbang=': use '
1623 fi
1624 rm -f sharp today
1625
1626 : figure out how to guarantee sh startup
1627 case "$startsh" in
1628 '') startsh=${sharpbang}${sh} ;;
1629 *)
1630 esac
1631 cat >sharp <<EOSS
1632 $startsh
1633 set abc
1634 test "$?abc" != 1
1635 EOSS
1636
1637 chmod +x sharp
1638 $eunicefix sharp
1639 if ./sharp; then
1640         : echo "Yup, it does."
1641 else
1642         echo "Hmm... '$startsh' does not guarantee sh startup..."
1643         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1644 fi
1645 rm -f sharp
1646
1647 : Save command line options in file UU/cmdline.opt for later use in
1648 : generating config.sh.
1649 cat > cmdline.opt <<EOSH
1650 : Configure command line arguments.
1651 config_arg0='$0'
1652 config_args='$*'
1653 config_argc=$#
1654 EOSH
1655 argn=1
1656 args_exp=''
1657 args_sep=''
1658 for arg in "$@"; do
1659         cat >>cmdline.opt <<EOSH
1660 config_arg$argn='$arg'
1661 EOSH
1662         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1663 $arg
1664 EOC
1665         arg_exp=`cat cmdl.opt`
1666         args_exp="$args_exp$args_sep'$arg_exp'"
1667         argn=`expr $argn + 1`
1668         args_sep=' '
1669 done
1670 rm -f cmdl.opt
1671
1672 : produce awk script to parse command line options
1673 cat >options.awk <<'EOF'
1674 BEGIN {
1675         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1676
1677         len = length(optstr);
1678         for (i = 1; i <= len; i++) {
1679                 c = substr(optstr, i, 1);
1680                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1681                 if (a == ":") {
1682                         arg[c] = 1;
1683                         i++;
1684                 }
1685                 opt[c] = 1;
1686         }
1687 }
1688 {
1689         expect = 0;
1690         str = $0;
1691         if (substr(str, 1, 1) != "-") {
1692                 printf("'%s'\n", str);
1693                 next;
1694         }
1695         len = length($0);
1696         for (i = 2; i <= len; i++) {
1697                 c = substr(str, i, 1);
1698                 if (!opt[c]) {
1699                         printf("-%s\n", substr(str, i));
1700                         next;
1701                 }
1702                 printf("-%s\n", c);
1703                 if (arg[c]) {
1704                         if (i < len)
1705                                 printf("'%s'\n", substr(str, i + 1));
1706                         else
1707                                 expect = 1;
1708                         next;
1709                 }
1710         }
1711 }
1712 END {
1713         if (expect)
1714                 print "?";
1715 }
1716 EOF
1717
1718 : process the command line options
1719 set X `for arg in "$@"; do echo "X$arg"; done |
1720         sed -e s/X// | awk -f options.awk`
1721 eval "set $*"
1722 shift
1723 rm -f options.awk
1724
1725 : set up default values
1726 fastread=''
1727 reuseval=false
1728 config_sh=''
1729 alldone=''
1730 error=''
1731 silent=''
1732 extractsh=''
1733 knowitall=''
1734 rm -f optdef.sh posthint.sh
1735 cat >optdef.sh <<EOS
1736 $startsh
1737 EOS
1738
1739
1740 : option parsing
1741 while test $# -gt 0; do
1742         case "$1" in
1743         -d) shift; fastread=yes;;
1744         -e) shift; alldone=cont;;
1745         -f)
1746                 shift
1747                 cd ..
1748                 if test -r "$1"; then
1749                         config_sh="$1"
1750                 else
1751                         echo "$me: cannot read config file $1." >&2
1752                         error=true
1753                 fi
1754                 cd UU
1755                 shift;;
1756         --help|\
1757         -h) shift; error=true;;
1758         -r) shift; reuseval=true;;
1759         -s) shift; silent=true; realsilent=true;;
1760         -E) shift; alldone=exit;;
1761         -K) shift; knowitall=true;;
1762         -O) shift;;
1763         -S) shift; silent=true; extractsh=true;;
1764         -D)
1765                 shift
1766                 case "$1" in
1767                 *=)
1768                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1769                         echo "$me: ignoring -D $1" >&2
1770                         ;;
1771                 *=*) echo "$1" | \
1772                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1773                 *) echo "$1='define'" >> optdef.sh;;
1774                 esac
1775                 shift
1776                 ;;
1777         -U)
1778                 shift
1779                 case "$1" in
1780                 *=) echo "$1" >> optdef.sh;;
1781                 *=*)
1782                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1783                         echo "$me: ignoring -U $1" >&2
1784                         ;;
1785                 *) echo "$1='undef'" >> optdef.sh;;
1786                 esac
1787                 shift
1788                 ;;
1789         -A)
1790             shift
1791             xxx=''
1792             yyy="$1"
1793             zzz=''
1794             uuu=undef
1795             case "$yyy" in
1796             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1797                  case "$zzz" in
1798                  *:*) zzz='' ;;
1799                  *)   xxx=append
1800                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1801                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1802                  esac
1803                  ;;
1804             esac
1805             case "$xxx" in
1806             '')  case "$yyy" in
1807                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1808                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1809                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1810                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1811                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1812                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1813                  esac
1814                  ;;
1815             esac
1816             case "$xxx" in
1817             append)
1818                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1819             clear)
1820                 echo "$yyy=''"                  >> posthint.sh ;;
1821             define)
1822                 case "$zzz" in
1823                 '') zzz=define ;;
1824                 esac
1825                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1826             eval)
1827                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1828             prepend)
1829                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1830             undef)
1831                 case "$zzz" in
1832                 '') zzz="$uuu" ;;
1833                 esac
1834                 echo "$yyy=$zzz"                >> posthint.sh ;;
1835             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1836             esac
1837             shift
1838             ;;
1839         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1840             exit 0;;
1841         --) break;;
1842         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1843         *) break;;
1844         esac
1845 done
1846
1847 case "$error" in
1848 true)
1849         cat >&2 <<EOM
1850 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1851                  [-U symbol] [-U symbol=] [-A command:symbol...]
1852   -d : use defaults for all answers.
1853   -e : go on without questioning past the production of config.sh.
1854   -f : specify an alternate default configuration file.
1855   -h : print this help message and exit (with an error status).
1856   -r : reuse C symbols value if possible (skips costly nm extraction).
1857   -s : silent mode, only echoes questions and essential information.
1858   -D : define symbol to have some value:
1859          -D symbol                symbol gets the value 'define'
1860          -D symbol='some value'   symbol is set to 'some value'
1861        common used examples (see INSTALL for more info):
1862          -Duse64bitint            use 64bit integers
1863          -Duse64bitall            use 64bit integers and pointers
1864          -Dusethreads             use thread support
1865          -Dinc_version_list=none  do not include older perl trees in @INC
1866          -DEBUGGING=none          DEBUGGING options
1867          -Dcc=gcc                 choose your compiler
1868          -Dprefix=/opt/perl5      choose your destination
1869   -E : stop at the end of questions, after having produced config.sh.
1870   -K : do not use unless you know what you are doing.
1871   -O : ignored for backward compatibility
1872   -S : perform variable substitutions on all .SH files (can mix with -f)
1873   -U : undefine symbol:
1874          -U symbol    symbol gets the value 'undef'
1875          -U symbol=   symbol gets completely empty
1876        e.g.:  -Uversiononly
1877   -A : manipulate symbol after the platform specific hints have been applied:
1878          -A append:symbol=value   append value to symbol
1879          -A symbol=value          like append:, but with a separating space
1880          -A define:symbol=value   define symbol to have value
1881          -A clear:symbol          define symbol to be ''
1882          -A define:symbol         define symbol to be 'define'
1883          -A eval:symbol=value     define symbol to be eval of value
1884          -A prepend:symbol=value  prepend value to symbol
1885          -A undef:symbol          define symbol to be 'undef'
1886          -A undef:symbol=         define symbol to be ''
1887        e.g.:  -A prepend:libswanted='cl pthread '
1888               -A ccflags=-DSOME_MACRO
1889   -V : print version number and exit (with a zero status).
1890 EOM
1891         exit 1
1892         ;;
1893 esac
1894
1895 : Sanity checks
1896 case "$fastread$alldone" in
1897 yescont|yesexit) ;;
1898 *)
1899         case "$extractsh" in
1900         true) ;;
1901         *)
1902                 if test ! -t 0; then
1903                         echo "Say 'sh Configure', not 'sh <Configure'"
1904                         exit 1
1905                 fi
1906                 ;;
1907         esac
1908         ;;
1909 esac
1910
1911 exec 4>&1
1912 case "$silent" in
1913 true) exec 1>/dev/null;;
1914 esac
1915
1916 : run the defines and the undefines, if any, but leave the file out there...
1917 touch optdef.sh
1918 grep '\\' optdef.sh >/dev/null 2>&1
1919 if test $? = 0; then
1920     echo "Configure does not support \\ in -D arguments"
1921     exit 1
1922 fi
1923 . ./optdef.sh
1924 : create the posthint manipulation script and leave the file out there...
1925 touch posthint.sh
1926
1927 : set package name
1928 package='perl5'
1929 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1930 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1931 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1932 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1933 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1934 esac
1935
1936 : Some greps do not return status, grrr.
1937 echo "grimblepritz" >grimble
1938 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1939         contains=contains
1940 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1941         contains=grep
1942 else
1943         contains=contains
1944 fi
1945 rm -f grimble
1946 : the following should work in any shell
1947 case "$contains" in
1948 contains*)
1949         echo " " >&4
1950         echo "AGH!  Grep doesn't return a status.  Attempting remedial action." >&4
1951         cat >contains <<'EOSS'
1952 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1953 EOSS
1954 contains=./contains
1955 chmod +x $contains
1956 esac
1957
1958 : Find the path to the source tree
1959 case "$src" in
1960 '') case "$0" in
1961     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1962          case "$src" in
1963          /*)    ;;
1964          .)     ;;
1965          *)     src=`cd ../$src && pwd` ;;
1966          esac
1967          ;;
1968     *)   src='.';;
1969     esac;;
1970 esac
1971 case "$src" in
1972 '')     src=/
1973         rsrc=/
1974         ;;
1975 /*)     rsrc="$src";;
1976 *)      rsrc="../$src";;
1977 esac
1978 if test -f $rsrc/Configure && \
1979         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1980 then
1981    : found it, so we are ok.
1982 else
1983         rsrc=''
1984         for src in . .. ../.. ../../.. ../../../..; do
1985                 if test -f ../$src/Configure && \
1986                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1987                 then
1988                         rsrc=../$src
1989                         break
1990                 fi
1991         done
1992 fi
1993 case "$rsrc" in
1994 '')
1995         cat <<EOM >&4
1996
1997 Sorry, I can't seem to locate the source dir for $package.  Please start
1998 Configure with an explicit path -- i.e. /some/path/Configure.
1999
2000 EOM
2001         exit 1
2002         ;;
2003 ../.)   rsrc='..';;
2004 *)
2005         echo " "
2006         echo "Sources for $package found in \"$src\"." >&4
2007         ;;
2008 esac
2009
2010 : script used to extract .SH files with variable substitutions
2011 cat >extract <<'EOS'
2012 PERL_CONFIG_SH=true
2013 echo "Doing variable substitutions on .SH files..."
2014 if test -f MANIFEST; then
2015         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
2016 else
2017         echo "(Looking for .SH files under the source directory.)"
2018         set x `(cd "$src"; find . -name "*.SH" -print)`
2019 fi
2020 shift
2021 case $# in
2022 0) set x `(cd "$src"; echo *.SH)`; shift;;
2023 esac
2024 if test ! -f "$src/$1"; then
2025         shift
2026 fi
2027 mkdir_p='
2028 name=$1;
2029 create="";
2030 while test $name; do
2031         if test ! -d "$name"; then
2032                 create="$name $create";
2033                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2034                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2035         else
2036                 name="";
2037         fi;
2038 done;
2039 for file in $create; do
2040         mkdir $file;
2041 done
2042 '
2043 for file in $*; do
2044         case "$src" in
2045         ".")
2046                 case "$file" in
2047                 */*)
2048                         dir=`expr X$file : 'X\(.*\)/'`
2049                         file=`expr X$file : 'X.*/\(.*\)'`
2050                         (cd "$dir" && . ./$file)
2051                         ;;
2052                 *)
2053                         . ./$file
2054                         ;;
2055                 esac
2056                 ;;
2057         *)
2058                 case "$file" in
2059                 */*)
2060                         dir=`expr X$file : 'X\(.*\)/'`
2061                         file=`expr X$file : 'X.*/\(.*\)'`
2062                         (set x $dir; shift; eval $mkdir_p)
2063                         sh <"$src/$dir/$file"
2064                         ;;
2065                 *)
2066                         sh <"$src/$file"
2067                         ;;
2068                 esac
2069                 ;;
2070         esac
2071 done
2072 if test -f "$src/config_h.SH"; then
2073         if test ! -f config.h; then
2074         : oops, they left it out of MANIFEST, probably, so do it anyway.
2075         . "$src/config_h.SH"
2076         fi
2077 fi
2078 EOS
2079
2080 : extract files and exit if asked to do so
2081 case "$extractsh" in
2082 true)
2083         case "$realsilent" in
2084         true) ;;
2085         *) exec 1>&4;;
2086         esac
2087         case "$config_sh" in
2088         '') config_sh='config.sh';;
2089         esac
2090         echo " "
2091         echo "Fetching answers from $config_sh..."
2092         cd ..
2093         . $config_sh
2094         . UU/optdef.sh
2095         echo " "
2096         . UU/extract
2097         rm -rf UU
2098         echo "Extraction done."
2099         exit 0
2100         ;;
2101 esac
2102
2103 : Eunice requires " " instead of "", can you believe it
2104 echo " "
2105 : Here we go...
2106 echo "Beginning of configuration questions for $package."
2107
2108 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2109
2110 : first determine how to suppress newline on echo command
2111 echo " "
2112 echo "Checking echo to see how to suppress newlines..."
2113 (echo "hi there\c" ; echo " ") >.echotmp
2114 if $contains c .echotmp >/dev/null 2>&1 ; then
2115         echo "...using -n."
2116         n='-n'
2117         c=''
2118 else
2119         cat <<'EOM'
2120 ...using \c
2121 EOM
2122         n=''
2123         c='\c'
2124 fi
2125 echo $n "The star should be here-->$c"
2126 echo '*'
2127 rm -f .echotmp
2128
2129 : Now test for existence of everything in MANIFEST
2130 echo " "
2131 if test -f "$rsrc/MANIFEST"; then
2132         echo "First let's make sure your kit is complete.  Checking..." >&4
2133         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2134                 (split -l 50 2>/dev/null || split -50)
2135         rm -f missing
2136         tmppwd=`pwd`
2137         for filelist in x??; do
2138                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2139                         >/dev/null 2>>"$tmppwd/missing")
2140         done
2141         if test -s missing; then
2142                 cat missing >&4
2143                 cat >&4 <<'EOM'
2144
2145 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2146
2147 You have the option of continuing the configuration process, despite the
2148 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2149 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2150 and contact the author (https://github.com/Perl/perl5/issues).
2151
2152 EOM
2153                 echo $n "Continue? [n] $c" >&4
2154                 read ans
2155                 case "$ans" in
2156                 y*)
2157                         echo "Continuing..." >&4
2158                         rm -f missing
2159                         ;;
2160                 *)
2161                         echo "ABORTING..." >&4
2162                         kill $$
2163                         ;;
2164                 esac
2165         else
2166                 echo "Looks good..."
2167         fi
2168 else
2169         echo "There is no MANIFEST file.  I hope your kit is complete !"
2170 fi
2171 rm -f missing x??
2172
2173 : Find the appropriate value for a newline for tr
2174 if test -n "$DJGPP"; then
2175        trnl='\012'
2176 fi
2177 if test X"$trnl" = X; then
2178         case "`echo foo | tr '\n' x 2>/dev/null`" in
2179         foox) trnl='\n' ;;
2180         esac
2181 fi
2182 if test X"$trnl" = X; then
2183         case "`echo foo | tr '\012' x 2>/dev/null`" in
2184         foox) trnl='\012' ;;
2185         esac
2186 fi
2187 if test X"$trnl" = X; then
2188        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2189        fooxy) trnl='\n\r' ;;
2190        esac
2191 fi
2192 if test X"$trnl" = X; then
2193         cat <<EOM >&2
2194
2195 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2196
2197 EOM
2198         exit 1
2199 fi
2200
2201 : compute the number of columns on the terminal for proper question formatting
2202 case "$COLUMNS" in
2203 '') COLUMNS='80';;
2204 esac
2205
2206 : set up the echo used in my read
2207 myecho="case \"\$xxxm\" in
2208 '') echo $n \"\$rp $c\" >&4;;
2209 *) case \"\$rp\" in
2210         '') echo $n \"[\$xxxm] $c\";;
2211         *)
2212                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2213                         echo \"\$rp\" >&4
2214                         echo $n \"[\$xxxm] $c\" >&4
2215                 else
2216                         echo $n \"\$rp [\$xxxm] $c\" >&4
2217                 fi
2218                 ;;
2219         esac;;
2220 esac"
2221
2222 : now set up to do reads with possible shell escape and default assignment
2223 cat <<EOSC >myread
2224 $startsh
2225 xxxm=\$dflt
2226 $myecho
2227 ans='!'
2228 counter=42
2229 case "\$fastread" in
2230 yes) case "\$dflt" in
2231         '') ;;
2232         *) ans='';
2233                 case "\$silent-\$rp" in
2234                 true-) ;;
2235                 *) echo " " >&4;;
2236                 esac;;
2237         esac;;
2238 *) case "\$silent" in
2239         true) case "\$rp" in
2240                 '') ans='';;
2241                 esac;;
2242         esac;;
2243 esac
2244 while expr "X\$ans" : "X!" >/dev/null; do
2245         read answ
2246         set x \$xxxm
2247         shift
2248         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2249         case  "\$answ" in
2250         "!")
2251                 sh 1>&4
2252                 echo " "
2253                 $myecho
2254                 ;;
2255         !*)
2256                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2257                 shift
2258                 sh 1>&4 -c "\$*"
2259                 echo " "
2260                 $myecho
2261                 ;;
2262         "\$ans")
2263                 case "\$ans" in
2264                 \\&*)
2265                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2266                         shift
2267                         case "\$1" in
2268                         -d)
2269                                 fastread=yes
2270                                 echo "(OK, I'll run with -d after this question.)" >&4
2271                                 ;;
2272                         -*)
2273                                 echo "*** Sorry, \$1 not supported yet." >&4
2274                                 ;;
2275                         esac
2276                         $myecho
2277                         ans=!
2278                         ;;
2279                 esac;;
2280         *)
2281                 case "\$aok" in
2282                 y)
2283                         echo "*** Substitution done -- please confirm."
2284                         xxxm="\$ans"
2285                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2286                         xxxm="\$ans"
2287                         ans=!
2288                         ;;
2289                 *)
2290                         echo "*** Error -- try again."
2291                         ans=!
2292                         ;;
2293                 esac
2294                 $myecho
2295                 ;;
2296         esac
2297         case "\$ans\$xxxm\$nostick" in
2298         '')
2299                 ans=!
2300                 $myecho
2301                 ;;
2302         esac
2303         counter=\`echo \$counter | awk '{ print --\$0 }'\`
2304         if [ \$counter = 0 ]; then
2305                 echo >&4
2306                 echo >&4 Too many attempts asking the same question.  Giving up.
2307                 exit 1
2308         fi
2309 done
2310 case "\$ans" in
2311 '') ans="\$xxxm";;
2312 esac
2313 EOSC
2314
2315 : create .config dir to save info across Configure sessions
2316 test -d ../.config || mkdir ../.config
2317 cat >../.config/README <<EOF
2318 This directory created by Configure to save information that should
2319 persist across sessions for $package.
2320
2321 You may safely delete it if you wish.
2322 EOF
2323
2324 : See if we are using a devel version and want that
2325 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2326 case "$usedevel" in
2327 $define|true|[yY]*)
2328     usedevel="$define" ;;
2329 *) case "$xversion" in
2330    *[13579])
2331         cat >&4 <<EOH
2332 *** WHOA THERE!!! ***
2333
2334     This is an UNSTABLE DEVELOPMENT release.
2335     The version of this $package distribution is $xversion, that is, odd,
2336     (as opposed to even) and that signifies a development release.
2337     If you want a maintenance release, you want an even-numbered version.
2338
2339     Do ***NOT*** install this into production use.
2340     Data corruption and crashes are possible.
2341
2342     It is most seriously suggested that you do not continue any further
2343     unless you want to help in developing and debugging Perl.
2344
2345     If you *still* want to build perl, you can answer 'y' now,
2346     or pass -Dusedevel to Configure.
2347
2348 EOH
2349         rp='Do you really want to continue?'
2350         dflt='n'
2351         . ./myread
2352         case "$ans" in
2353         [yY]) echo >&4 "Okay, continuing."
2354               usedevel="$define" ;;
2355         *) echo >&4 "Okay, bye."
2356            exit 1
2357            ;;
2358         esac
2359         ;;
2360     esac
2361     usedevel="$undef"
2362     ;;
2363 esac
2364 case "$usedevel" in
2365 $define|true|[yY]*)
2366         case "$versiononly" in
2367         '') versiononly="$define" ;;
2368         esac
2369         case "$installusrbinperl" in
2370         '') installusrbinperl="$undef" ;;
2371         esac
2372         ;;
2373 esac
2374
2375 : general instructions
2376 needman=true
2377 firsttime=true
2378 user=`(logname) 2>/dev/null`
2379 case "$user" in
2380 '') user=`whoami 2>&1`;;
2381 esac
2382 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2383         firsttime=false
2384         echo " "
2385         rp='Would you like to see the instructions?'
2386         dflt=n
2387         . ./myread
2388         case "$ans" in
2389         [yY]*) ;;
2390         *) needman=false;;
2391         esac
2392 fi
2393 if $needman; then
2394         cat <<EOH
2395
2396 This installation shell script will examine your system and ask you questions
2397 to determine how the perl5 package should be installed. If you get
2398 stuck on a question, you may use a ! shell escape to start a subshell or
2399 execute a command.  Many of the questions will have default answers in square
2400 brackets; typing carriage return will give you the default.
2401
2402 On some of the questions which ask for file or directory names you are allowed
2403 to use the ~name construct to specify the login directory belonging to "name",
2404 even if you don't have a shell which knows about that.  Questions where this is
2405 allowed will be marked "(~name ok)".
2406
2407 EOH
2408         rp=''
2409         dflt='Type carriage return to continue'
2410         . ./myread
2411         cat <<'EOH'
2412
2413 The prompter used in this script allows you to use shell variables and
2414 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2415 in the default answer, as if the default line was a set of arguments given to a
2416 script shell.  This means you may also use $* to repeat the whole default line,
2417 so you do not have to re-type everything to add something to the default.
2418
2419 Every time there is a substitution, you will have to confirm.  If there is an
2420 error (e.g. an unmatched backtick), the default answer will remain unchanged
2421 and you will be prompted again.
2422
2423 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2424 the questions and use the computed defaults (or the previous answers if there
2425 was already a config.sh file). Type 'Configure -h' for a list of options.
2426 You may also start interactively and then answer '& -d' at any prompt to turn
2427 on the non-interactive behaviour for the remainder of the execution.
2428
2429 EOH
2430         . ./myread
2431         cat <<EOH
2432
2433 Much effort has been expended to ensure that this shell script will run on any
2434 Unix system.  If despite that it blows up on yours, your best bet is to edit
2435 Configure and run it again.  If you can't run Configure for some reason,
2436 you'll have to generate a config.sh file by hand.  Whatever problems you
2437 have, let me (https://github.com/Perl/perl5/issues) know how I blew it.
2438
2439 This installation script affects things in two ways:
2440
2441 1) it may do direct variable substitutions on some of the files included
2442    in this kit.
2443 2) it builds a config.h file for inclusion in C programs.  You may edit
2444    any of these files as the need arises after running this script.
2445
2446 If you make a mistake on a question, there is no easy way to back up to it
2447 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2448 files.  Configure will offer to let you do this before it runs the SH files.
2449
2450 EOH
2451         dflt='Type carriage return to continue'
2452         . ./myread
2453         case "$firsttime" in
2454         true) echo $user >>../.config/instruct;;
2455         esac
2456 fi
2457
2458 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2459 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2460 if test "X$sysroot" = X; then
2461     sysroot=""
2462 else
2463     case "$cc" in
2464         *gcc*|*g++*)
2465             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2466             # _sysroot is used in places where we need --sysroot=foo
2467             # but using the rest of the flags could cause issues.
2468             _sysroot="--sysroot=$sysroot";
2469             case "$ccflags" in
2470                 *sysroot*) ;;
2471                 'undef'|*)
2472                 ccflags="$ccflags $_sysroot"
2473             esac
2474             case "$ldflags" in
2475                 *sysroot*) ;;
2476                 'undef'|*)
2477                 ldflags="$ldflags $_sysroot"
2478             esac
2479             case "$cppflags" in
2480                 *sysroot*) ;;
2481                 'undef'|*)
2482                 cppflags="$cppflags $_sysroot"
2483             esac
2484             # lddlflags updated below in lddlflags section;
2485             # same with cccdlflags
2486             ;;
2487     esac
2488
2489     # Adjust some defaults to also use $sysroot
2490     for var in xlibpth loclibpth locincpth glibpth; do
2491         eval xxx=\$$var
2492         eval $var=''
2493         for path in $xxx; do
2494             eval $var=\"\$$var $sysroot$path\"
2495         done
2496     done
2497
2498 fi
2499
2500 : find out where common programs are
2501 echo " "
2502 echo "Locating common programs..." >&4
2503 cat <<EOSC >loc
2504 $startsh
2505 case \$# in
2506 0) exit 1;;
2507 esac
2508 thing=\$1
2509 shift
2510 dflt=\$1
2511 shift
2512 for dir in \$*; do
2513         case "\$thing" in
2514         .)
2515         if test -d \$dir/\$thing; then
2516                 echo \$dir
2517                 exit 0
2518         fi
2519         ;;
2520         *)
2521         for thisthing in \$dir/\$thing; do
2522                 : just loop through to pick last item
2523         done
2524         if test -f \$thisthing; then
2525                 echo \$thisthing
2526                 exit 0
2527         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2528                 echo \$thisthing
2529                 exit 0
2530         elif test -f \$dir/\$thing.exe; then
2531                 if test -n "$DJGPP"; then
2532                         echo \$dir/\$thing.exe
2533                 elif test "$eunicefix" != ":"; then
2534                         : on Eunice apparently
2535                         echo \$dir/\$thing
2536                 fi
2537                 exit 0
2538         fi
2539         ;;
2540         esac
2541 done
2542 echo \$dflt
2543 exit 1
2544 EOSC
2545 chmod +x loc
2546 $eunicefix loc
2547 loclist="
2548 awk
2549 cat
2550 chmod
2551 comm
2552 cp
2553 echo
2554 expr
2555 grep
2556 ls
2557 mkdir
2558 rm
2559 sed
2560 sort
2561 touch
2562 tr
2563 uniq
2564 "
2565 trylist="
2566 ar
2567 bison
2568 byacc
2569 cpp
2570 csh
2571 date
2572 egrep
2573 gmake
2574 gzip
2575 less
2576 ln
2577 make
2578 more
2579 nm
2580 nroff
2581 perl
2582 pg
2583 test
2584 uname
2585 zip
2586 "
2587 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2588 pth="$pth $sysroot/lib $sysroot/usr/lib"
2589 for file in $loclist; do
2590         eval xxx=\$$file
2591         case "$xxx" in
2592         /*|?:[\\/]*)
2593                 if test -f "$xxx"; then
2594                         : ok
2595                 else
2596                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2597                         xxx=`./loc $file $file $pth`
2598                 fi
2599                 ;;
2600         '') xxx=`./loc $file $file $pth`;;
2601         *) xxx=`./loc $xxx $xxx $pth`;;
2602         esac
2603         eval $file=$xxx$_exe
2604         eval _$file=$xxx
2605         case "$xxx" in
2606         /*)
2607                 echo $file is in $xxx.
2608                 ;;
2609         ?:[\\/]*)
2610                 echo $file is in $xxx.
2611                 ;;
2612         *)
2613                 echo "I don't know where '$file' is, and my life depends on it." >&4
2614                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2615
2616                 test -f /etc/debian_version && echo "Run \"apt install build-essential\" to install make and friends" >&4
2617                 test -f /etc/SUSE-brand     && echo "Run \"zypper install 'pattern:devel_C_C++'\" to install make and friends" >&4
2618                 test -f /etc/redhat-release && echo "Run \"yum groupinstall 'Development Tools'\" to install make and friends" >&4
2619                 test -f /etc/fedora-release && echo "Run \"dnf group install 'Development Tools'\" to install make and friends" >&4
2620                 exit 1
2621                 ;;
2622         esac
2623 done
2624 echo " "
2625 echo "Don't worry if any of the following aren't found..."
2626 say=offhand
2627 for file in $trylist; do
2628         eval xxx=\$$file
2629         case "$xxx" in
2630         /*|?:[\\/]*)
2631                 if test -f "$xxx"; then
2632                         : ok
2633                 else
2634                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2635                         xxx=`./loc $file $file $pth`
2636                 fi
2637                 ;;
2638         '') xxx=`./loc $file $file $pth`;;
2639         *) xxx=`./loc $xxx $xxx $pth`;;
2640         esac
2641         eval $file=$xxx$_exe
2642         eval _$file=$xxx
2643         case "$xxx" in
2644         /*)
2645                 echo $file is in $xxx.
2646                 ;;
2647         ?:[\\/]*)
2648                 echo $file is in $xxx.
2649                 ;;
2650         *)
2651                 echo "I don't see $file out there, $say."
2652                 say=either
2653                 ;;
2654         esac
2655 done
2656 case "$egrep" in
2657 egrep)
2658         echo "Substituting grep for egrep."
2659         egrep=$grep
2660         _egrep=$grep
2661         ;;
2662 esac
2663 case "$less" in
2664 '')     ;;
2665 *)      if $less -R </dev/null >/dev/null 2>&1; then
2666                echo "Substituting less -R for less."
2667                less="$less -R"
2668                _less=$less
2669         fi
2670         ;;
2671 esac
2672 case "$ln" in
2673 ln)
2674         echo "Substituting cp for ln."
2675         ln=$cp
2676         _ln=$cp
2677         ;;
2678 esac
2679 case "$make" in
2680 make)
2681         case "$gmake" in
2682         gmake)
2683         echo "I can't find make or gmake, and my life depends on it." >&4
2684         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2685         exit 1
2686         ;;
2687         esac
2688         ;;
2689 esac
2690 case "$gmake" in
2691 gmake)  ;;
2692 *)      # We can't have osname yet.
2693         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2694                 # Assume that gmake, if found, is definitely GNU make
2695                 # and prefer it over the system make.
2696                 echo "Substituting gmake for make."
2697                 make=$gmake
2698                 _make=$gmake
2699         fi
2700         ;;
2701 esac
2702 case "$test" in
2703 test)
2704         echo "Hopefully test is built into your sh."
2705         ;;
2706 *)
2707         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2708                 echo "Using the test built into your sh."
2709                 test=test
2710                 _test=test
2711         fi
2712         ;;
2713 esac
2714 case "$echo" in
2715 echo)
2716         echo "Hopefully echo is built into your sh."
2717         ;;
2718 '') ;;
2719 *)
2720         echo " "
2721 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2722         $echo $n "hi there$c" >foo1
2723         echo $n "hi there$c" >foo2
2724         if cmp foo1 foo2 >/dev/null 2>&1; then
2725                 echo "They are compatible.  In fact, they may be identical."
2726         else
2727                 case "$n" in
2728                 '-n') n='' c='\c';;
2729                 *) n='-n' c='';;
2730                 esac
2731                 cat <<FOO
2732 They are not compatible!  You are probably running ksh on a non-USG system.
2733 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2734 have echo built in and we may have to run some Bourne shell scripts.  That
2735 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2736
2737 FOO
2738                 $echo $n "The star should be here-->$c"
2739                 $echo "*"
2740         fi
2741         $rm -f foo1 foo2
2742         ;;
2743 esac
2744
2745 # This question was auctioned at YAPC::Europe-2007 in Vienna
2746 # I never promised you could answer it. I only auctioned the question.
2747 cat <<FOO
2748 The following message is sponsored by
2749
2750   Dresden.pm<--The stars should be here.
2751
2752 Dear Perl user, system administrator or package
2753 maintainer, the Perl community sends greetings to
2754 you. Do you (emblematical) greet back [Y/n]? n
2755
2756 FOO
2757
2758 : Check what type of C compiler we use
2759 cat <<EOS >trygcc
2760 $startsh
2761 EOS
2762 cat <<'EOSC' >>trygcc
2763 case "$cc" in
2764 '') ;;
2765 *)  $rm -f try try.*
2766     $cat >try.c <<EOM
2767 int main(int argc, char *argv[]) {
2768   return 0;
2769 }
2770 EOM
2771     if $cc -o try $ccflags $ldflags try.c; then
2772        :
2773     else
2774         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2775         despair=yes
2776         trygcc=yes
2777         case "$cc" in
2778         *gcc*) trygcc=no ;;
2779         esac
2780         # Skip this test because it gives a false match on output like:
2781         #    ./trygcc: line 23: cc: command not found
2782         # case "`$cc -v -c try.c 2>&1`" in
2783         # *gcc*) trygcc=no ;;
2784         # esac
2785         if $test X"$trygcc" = Xyes; then
2786             if gcc -o try -c try.c; then
2787                 echo " "
2788                 echo "You seem to have a working gcc, though." >&4
2789                 # Switching compilers may undo the work of hints files.
2790                 # The most common problem is -D_REENTRANT for threads.
2791                 # This heuristic catches that case, but gets false positives
2792                 # if -Dusethreads was not actually specified.  Better to
2793                 # bail out here with a useful message than fail
2794                 # mysteriously later. Should we perhaps just try to
2795                 # re-invoke Configure -Dcc=gcc config_args ?
2796                 if $test -f usethreads.cbu; then
2797                         $cat >&4 <<EOM
2798
2799 *** However, any setting of the C compiler flags (e.g. for thread support)
2800 *** will be lost.  It may be necessary for you to restart Configure and
2801 *** add -Dcc=gcc to your Configure command line.
2802
2803 EOM
2804                         rp="Would you like to go ahead and try gcc anyway?"
2805                         dflt=n
2806                 else
2807                         rp="Would you like to use it?"
2808                         dflt=y
2809                 fi
2810                 if $test -f myread; then
2811                     . ./myread
2812                 else
2813                     if $test -f UU/myread; then
2814                         . ./UU/myread
2815                     else
2816                         echo "Cannot find myread, sorry.  Aborting." >&4
2817                         exit 1
2818                     fi
2819                 fi
2820                 case "$ans" in
2821                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2822                 esac
2823             fi
2824         fi
2825     fi
2826     $rm -f try try.*
2827     ;;
2828 esac
2829 EOSC
2830
2831 cat <<EOS >checkcc
2832 $startsh
2833 EOS
2834 cat <<'EOSC' >>checkcc
2835 case "$cc" in
2836 '') ;;
2837 *)  $rm -f try try.*
2838     $cat >try.c <<EOM
2839 int main(int argc, char *argv[]) {
2840   return 0;
2841 }
2842 EOM
2843     if $cc -o try $ccflags $ldflags try.c; then
2844        :
2845     else
2846         if $test X"$despair" = Xyes; then
2847            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2848         fi
2849         $cat >&4 <<EOM
2850 You need to find a working C compiler.
2851 Either (purchase and) install the C compiler supplied by your OS vendor,
2852 or for a free C compiler try http://gcc.gnu.org/
2853 I cannot continue any further, aborting.
2854 EOM
2855         exit 1
2856     fi
2857     $rm -f try try.*
2858     ;;
2859 esac
2860 EOSC
2861
2862 : determine whether symbolic links are supported
2863 echo " "
2864 $touch blurfl
2865 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2866         echo "Symbolic links are supported." >&4
2867         lns="$ln -s"
2868 else
2869         echo "Symbolic links are NOT supported." >&4
2870         lns="$ln"
2871 fi
2872 $rm -f blurfl sym
2873
2874 : determine whether symbolic links are supported
2875 echo " "
2876 case "$lns" in
2877 *"ln"*" -s")
2878         echo "Checking how to test for symbolic links..." >&4
2879         $lns blurfl sym
2880         if $test "X$issymlink" = X; then
2881                 case "$newsh" in
2882                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2883                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2884                 esac
2885                 if test $? = 0; then
2886                         issymlink="test -h"
2887                 else
2888                         echo "Your builtin 'test -h' may be broken." >&4
2889                         case "$test" in
2890                         /*)     ;;
2891                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2892                                 for p in $pth
2893                                 do
2894                                         if test -f "$p/$test"; then
2895                                                 test="$p/$test"
2896                                                 break
2897                                         fi
2898                                 done
2899                                 ;;
2900                         esac
2901                         case "$test" in
2902                         /*)
2903                                 echo "Trying external '$test -h'." >&4
2904                                 issymlink="$test -h"
2905                                 if $test ! -h sym >/dev/null 2>&1; then
2906                                         echo "External '$test -h' is broken, too." >&4
2907                                         issymlink=''
2908                                 fi
2909                                 ;;
2910                         *)      issymlink='' ;;
2911                         esac
2912                 fi
2913         fi
2914         if $test "X$issymlink" = X; then
2915                 if $test -L sym 2>/dev/null; then
2916                         issymlink="$test -L"
2917                         echo "The builtin '$test -L' worked." >&4
2918                 fi
2919         fi
2920         if $test "X$issymlink" != X; then
2921                 echo "You can test for symbolic links with '$issymlink'." >&4
2922         else
2923                 echo "I do not know how you can test for symbolic links." >&4
2924         fi
2925         $rm -f blurfl sym
2926         ;;
2927 *)      echo "No symbolic links, so not testing for their testing..." >&4
2928         ;;
2929 esac
2930
2931 : Make symlinks util
2932 case "$mksymlinks" in
2933 $define|true|[yY]*)
2934         case "$src" in
2935         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2936                 exit 1
2937                 ;;
2938         *)      case "$lns:$issymlink" in
2939                 *"ln"*" -s:"*"test -"?)
2940                         echo "Creating the symbolic links..." >&4
2941                         cd ..
2942                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2943                         awk 'NF == 1 {
2944                                 dir=".";
2945                                 file=$1 "";
2946                              }
2947                              NF == 2 {
2948                                 dir=$1 "";
2949                                 file=$2 "";
2950                              }
2951                              {
2952                                  print "# dir = ", dir, "file = ", file
2953                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2954                              } END {
2955                                  for (d in mf) {
2956                                      if (d != ".") { print("mkdir -p "d) }
2957                                      print("ln -sf "mf[d]" "d);
2958                                  }
2959                              }' source="$src" > UU/mksymlinks.$$
2960                         sh UU/mksymlinks.$$
2961                         rm UU/mksymlinks.$$
2962                         # Sanity check 1.
2963                         if test ! -d t/base; then
2964                                 echo "Failed to create the subdirectories.  Aborting." >&4
2965                                 exit 1
2966                         fi
2967                         # Sanity check 2.
2968                         if test ! -f t/base/lex.t; then
2969                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2970                                 exit 1
2971                         fi
2972                         if test ! -f win32/win32.c; then
2973                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2974                                 exit 1
2975                         fi
2976                         cd UU
2977                         ;;
2978                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2979                         ;;
2980                 esac
2981                 ;;
2982         esac
2983         ;;
2984 esac
2985
2986 : Check for Cross-Compilation
2987 if $test "X$targethost" = "X"; then
2988     targethost=""
2989 fi
2990 if $test "X$targetenv" = "X"; then
2991     targetenv=""
2992 fi
2993 case "$usecrosscompile" in
2994 $define|true|[yY]*)
2995         $echo "Cross-compiling..."
2996         croak=''
2997         case "$cc" in
2998         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2999             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
3000             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
3001             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
3002             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
3003             # leave out ld, choosing it is more complex
3004             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
3005             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
3006             # We are in a weird spot. Just before us, some values
3007             # were 'saved', to be restored after the hints are
3008             # run.  This means that the changes we made to ar,
3009             # nm and ranlib will get reverted.
3010             # To avoid that, we hijack the saving mechanism and
3011             # have it save our new values.
3012             for file in ar nm ranlib; do
3013                 eval xxx=\$$file
3014                 eval $file=$xxx$_exe
3015                 eval _$file=$xxx
3016             done
3017         ;;
3018         esac
3019         case "$targetarch" in
3020         '') echo "Targetarch not defined." >&4; croak=y ;;
3021         *)  echo "Using targetarch $targetarch." >&4 ;;
3022         esac
3023         case "$targethost" in
3024         '') echo "Targethost not defined." >&4; croak=n ;;
3025         *)  echo "Using targethost $targethost." >&4
3026         esac
3027         locincpth=' '
3028         loclibpth=' '
3029         case "$croak" in
3030         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
3031         esac
3032     : compile a host miniperl and generate_uudmap, unless we got passed them
3033     if $test "X$hostperl" = X; then
3034       echo "Building host miniperl and generate_uudmap binaries" >&4
3035       before_host=`pwd`
3036       cd ..
3037       cd $src
3038       src=`pwd`
3039       rm -rf $src/host
3040       mkdir $src/host
3041       cd $src/host
3042       $src/Configure -des -Dusedevel -Dmksymlinks
3043       $make miniperl
3044       case "$hostgenerate" in
3045       '') $make generate_uudmap
3046           hostgenerate=$src/host/generate_uudmap
3047           ;;
3048        "$undef") hostgenerate=''
3049           ;;
3050       esac
3051       hostperl=$src/host/miniperl
3052       cd $before_host
3053     fi
3054     hostosname=`$hostperl -le 'print $^O'`
3055     ;;
3056 *)
3057     usecrosscompile="$undef"
3058     ;;
3059 esac
3060
3061 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3062 case "$targethost" in
3063     '') echo "Checking for cross-compile" >&4
3064     case "$usecrosscompile$multiarch" in
3065        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3066          if [ -f Makefile ]; then
3067            echo " "
3068            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3069          else
3070            echo "Configure done."
3071          fi
3072        exit 0
3073        ;;
3074      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3075         run=''
3076         to=:
3077         from=:
3078         ;;
3079     esac
3080     ;;
3081     *) echo "Using targethost $targethost." >&4
3082         case "$src" in
3083         /*) run=$src/Cross/run
3084             targetmkdir=$src/Cross/mkdir
3085             to=$src/Cross/to
3086             from=$src/Cross/from
3087             ;;
3088         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3089             run=$pwd/Cross/run
3090             targetmkdir=$pwd/Cross/mkdir
3091             to=$pwd/Cross/to
3092             from=$pwd/Cross/from
3093             ;;
3094         esac
3095         case "$targetrun" in
3096         '') targetrun=ssh ;;
3097         esac
3098         case "$targetto" in
3099         '') targetto=scp ;;
3100         esac
3101         case "$targetfrom" in
3102         '') targetfrom=scp ;;
3103         esac
3104         run=$run-$targetrun
3105         to=$to-$targetto
3106         from=$from-$targetfrom
3107         case "$targetdir" in
3108         '')  targetdir=/tmp
3109              echo "Guessing targetdir $targetdir." >&4
3110              ;;
3111         esac
3112         case "$targetuser" in
3113         '')  targetuser=root
3114              echo "Guessing targetuser $targetuser." >&4
3115              ;;
3116         esac
3117         case "$targetport" in
3118         '')  targetport=22
3119              echo "Guessing targetport $targetport." >&4
3120              ;;
3121         esac
3122         case "$targetfrom" in
3123         scp)    q=-q ;;
3124         *)      q='' ;;
3125         esac
3126         case "$targetrun" in
3127         ssh|rsh)
3128             cat >$run <<EOF
3129 #!/bin/sh
3130 env=''
3131 case "\$1" in
3132 -cwd)
3133   shift
3134   cwd=\$1
3135   shift
3136   ;;
3137 esac
3138 case "\$1" in
3139 -env)
3140   shift
3141   env=\$1
3142   shift
3143   ;;
3144 esac
3145 case "\$cwd" in
3146 '') cwd=$targetdir ;;
3147 esac
3148 exe=\$1
3149 shift
3150 $to \$exe
3151 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3152 EOF
3153             ;;
3154         adb)
3155             $touch $run
3156             ;;
3157         *)  echo "Unknown targetrun '$targetrun'" >&4
3158             exit 1
3159             ;;
3160         esac
3161         case "$targetmkdir" in
3162         */Cross/mkdir)
3163             cat >$targetmkdir <<EOF
3164 #!/bin/sh
3165 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3166 EOF
3167             $chmod a+rx $targetmkdir
3168             ;;
3169         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3170             exit 1
3171             ;;
3172         esac
3173         case "$targetto" in
3174         scp|rcp)
3175             cat >$to <<EOF
3176 #!/bin/sh
3177 for f in \$@
3178 do
3179   case "\$f" in
3180   /*)
3181     $targetmkdir \`dirname \$f\`
3182     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3183     ;;
3184   *)
3185     $targetmkdir $targetdir/\`dirname \$f\`
3186     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3187     ;;
3188   esac
3189 done
3190 exit 0
3191 EOF
3192             ;;
3193         cp) cat >$to <<EOF
3194 #!/bin/sh
3195 for f in \$@
3196 do
3197   case "\$f" in
3198   /*)
3199     $mkdir -p $targetdir/\`dirname \$f\`
3200     $cp \$f $targetdir/\$f || exit 1
3201     ;;
3202   *)
3203     $targetmkdir $targetdir/\`dirname \$f\`
3204     $cp \$f $targetdir/\$f || exit 1
3205     ;;
3206   esac
3207 done
3208 exit 0
3209 EOF
3210             ;;
3211         *)  echo "Unknown targetto '$targetto'" >&4
3212             exit 1
3213             ;;
3214         esac
3215         case "$targetfrom" in
3216         scp|rcp)
3217           cat >$from <<EOF
3218 #!/bin/sh
3219 for f in \$@
3220 do
3221   $rm -f \$f
3222   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3223 done
3224 exit 0
3225 EOF
3226             ;;
3227         cp) cat >$from <<EOF
3228 #!/bin/sh
3229 for f in \$@
3230 do
3231   $rm -f \$f
3232   cp $targetdir/\$f . || exit 1
3233 done
3234 exit 0
3235 EOF
3236             ;;
3237         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3238             exit 1
3239             ;;
3240         esac
3241         if $test ! -f $run; then
3242             echo "Target 'run' script '$run' not found." >&4
3243         else
3244             $chmod a+rx $run
3245         fi
3246         if $test ! -f $to; then
3247             echo "Target 'to' script '$to' not found." >&4
3248         else
3249             $chmod a+rx $to
3250         fi
3251         if $test ! -f $from; then
3252             echo "Target 'from' script '$from' not found." >&4
3253         else
3254             $chmod a+rx $from
3255         fi
3256         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3257             exit 1
3258         fi
3259         cat >&4 <<EOF
3260 Using '$run' for remote execution,
3261 and '$from' and '$to'
3262 for remote file transfer.
3263 EOF
3264         ;;
3265 *)      run=''
3266         to=:
3267         from=:
3268         usecrosscompile="$undef"
3269         targetarch=''
3270         ;;
3271 esac
3272
3273 : see whether [:lower:] and [:upper:] are supported character classes
3274 echo " "
3275 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3276 ABYZ-abyz)
3277         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3278         up='[:upper:]'
3279         low='[:lower:]'
3280         ;;
3281 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3282         # (0xd9 and 0xe2), therefore that is a nice testing point.
3283         if test "X$up" = X -o "X$low" = X; then
3284             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3285             rs) up='[A-Z]'
3286                 low='[a-z]'
3287                 ;;
3288             esac
3289         fi
3290         if test "X$up" = X -o "X$low" = X; then
3291             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3292             rs) up='A-Z'
3293                 low='a-z'
3294                 ;;
3295             esac
3296         fi
3297         if test "X$up" = X -o "X$low" = X; then
3298             case "`echo RS | od -x 2>/dev/null`" in
3299             *D9E2*|*d9e2*)
3300                 echo "Hey, this might be EBCDIC." >&4
3301                 if test "X$up" = X -o "X$low" = X; then
3302                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3303                     rs) up='[A-IJ-RS-Z]'
3304                         low='[a-ij-rs-z]'
3305                         ;;
3306                     esac
3307                 fi
3308                 if test "X$up" = X -o "X$low" = X; then
3309                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3310                     rs) up='A-IJ-RS-Z'
3311                         low='a-ij-rs-z'
3312                         ;;
3313                     esac
3314                 fi
3315                 ;;
3316             esac
3317         fi
3318 esac
3319 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3320 rs)
3321     echo "Using $up and $low to convert case." >&4
3322     ;;
3323 *)
3324     echo "I don't know how to translate letters from upper to lower case." >&4
3325     echo "Your tr is not acting any way I know of." >&4
3326     exit 1
3327     ;;
3328 esac
3329 : set up the translation script tr, must be called with ./tr of course
3330 cat >tr <<EOSC
3331 $startsh
3332 case "\$1\$2" in
3333 '[A-Z][a-z]') exec $tr '$up' '$low';;
3334 '[a-z][A-Z]') exec $tr '$low' '$up';;
3335 esac
3336 exec $tr "\$@"
3337 EOSC
3338 chmod +x tr
3339 $eunicefix tr
3340
3341 : Try to determine whether config.sh was made on this system
3342 case "$config_sh" in
3343 '')
3344 myuname=`$uname -a 2>/dev/null`
3345 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3346 # Downcase everything to avoid ambiguity.
3347 # Remove slashes and single quotes so we can use parts of this in
3348 # directory and file names.
3349 # Remove newlines so myuname is sane to use elsewhere.
3350 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3351 # because the A-Z/a-z are not consecutive.
3352 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3353         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3354 newmyuname="$myuname"
3355 dflt=n
3356 case "$knowitall" in
3357 '')
3358         if test -f ../config.sh; then
3359                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3360                         eval "`grep myuname= ../config.sh`"
3361                 fi
3362                 if test "X$myuname" = "X$newmyuname"; then
3363                         dflt=y
3364                 fi
3365         fi
3366         ;;
3367 *) dflt=y;;
3368 esac
3369
3370 : Get old answers from old config file if Configure was run on the
3371 : same system, otherwise use the hints.
3372 hint=default
3373 cd ..
3374 if test -f config.sh; then
3375         echo " "
3376         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3377         . UU/myread
3378         case "$ans" in
3379         n*|N*) echo "OK, I'll ignore it."
3380                 mv config.sh config.sh.old
3381                 myuname="$newmyuname"
3382                 ;;
3383         *)  echo "Fetching default answers from your old config.sh file..." >&4
3384                 tmp_n="$n"
3385                 tmp_c="$c"
3386                 tmp_sh="$sh"
3387                 . ./config.sh
3388                 cp config.sh UU
3389                 n="$tmp_n"
3390                 c="$tmp_c"
3391                 : Older versions did not always set $sh.  Catch re-use of such
3392                 : an old config.sh.
3393                 case "$sh" in
3394                 '') sh="$tmp_sh" ;;
3395                 esac
3396                 hint=previous
3397                 ;;
3398         esac
3399 fi
3400 . ./UU/checkcc
3401 if test ! -f config.sh; then
3402         $cat <<EOM
3403
3404 First time through, eh?  I have some defaults handy for some systems
3405 that need some extra help getting the Configure answers right:
3406
3407 EOM
3408         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3409         dflt=''
3410         : Half the following guesses are probably wrong... If you have better
3411         : tests or hints, please send them to https://github.com/Perl/perl5/issues
3412         : The metaconfig authors would also appreciate a copy...
3413         $test -f /irix && osname=irix
3414         $test -f /xenix && osname=sco_xenix
3415         $test -f /dynix && osname=dynix
3416         $test -f /dnix && osname=dnix
3417         $test -f /lynx.os && osname=lynxos
3418         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3419         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3420         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3421         $test -f /bin/mips && /bin/mips && osname=mips
3422         $test -d /usr/apollo/bin && osname=apollo
3423         $test -f /etc/saf/_sactab && osname=svr4
3424         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3425         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3426         $test -f /sys/utilities/MultiView && osname=amigaos
3427         if $test -d /MachTen -o -d /MachTen_Folder; then
3428                 osname=machten
3429                 if $test -x /sbin/version; then
3430                         osvers=`/sbin/version | $awk '{print $2}' |
3431                         $sed -e 's/[A-Za-z]$//'`
3432                 elif $test -x /usr/etc/version; then
3433                         osvers=`/usr/etc/version | $awk '{print $2}' |
3434                         $sed -e 's/[A-Za-z]$//'`
3435                 else
3436                         osvers="$2.$3"
3437                 fi
3438         fi
3439
3440         $test -f /sys/posix.dll &&
3441                 $test -f /usr/bin/what &&
3442                 set X `/usr/bin/what /sys/posix.dll` &&
3443                 $test "$3" = UWIN &&
3444                 osname=uwin &&
3445                 osvers="$5"
3446
3447         if $test -f $uname; then
3448                 set X $myuname
3449                 shift
3450
3451                 case "$5" in
3452                 fps*) osname=fps ;;
3453                 mips*)
3454                         case "$4" in
3455                         umips) osname=umips ;;
3456                         *) osname=mips ;;
3457                         esac;;
3458                 [23]100) osname=mips ;;
3459                 i386*)
3460                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3461                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3462                                 osname='sco'
3463                                 osvers=$tmp
3464                         elif $test -f /etc/kconfig; then
3465                                 osname=isc
3466                                 if test "$lns" = "$ln -s"; then
3467                                         osvers=4
3468                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3469                                         osvers=3
3470                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3471                                         osvers=2
3472                                 fi
3473                         fi
3474                         tmp=''
3475                         ;;
3476                 pc*)
3477                         if test -n "$DJGPP"; then
3478                                 osname=dos
3479                                 osvers=djgpp
3480                         fi
3481                         ;;
3482                 esac
3483
3484                 case "$1" in
3485                 aix) osname=aix
3486                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3487                         case "$tmp" in
3488                         # oslevel can fail with:
3489                         # oslevel: Unable to acquire lock.
3490                         *not\ found) osvers="$4"."$3" ;;
3491                         '<3240'|'<>3240') osvers=3.2.0 ;;
3492                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3493                         '=3250'|'>3250') osvers=3.2.5 ;;
3494                         *) osvers=$tmp;;
3495                         esac
3496                         ;;
3497                 bitrig) osname=bitrig
3498                         osvers="$3"
3499                         ;;
3500                 bsd386) osname=bsd386
3501                         osvers=`$uname -r`
3502                         ;;
3503                 cygwin*) osname=cygwin
3504                         osvers="$3"
3505                         ;;
3506                 *dc.osx) osname=dcosx
3507                         osvers="$3"
3508                         ;;
3509                 dnix) osname=dnix
3510                         osvers="$3"
3511                         ;;
3512                 domainos) osname=apollo
3513                         osvers="$3"
3514                         ;;
3515                 dgux)   osname=dgux
3516                         osvers="$3"
3517                         ;;
3518                 dragonfly) osname=dragonfly
3519                         case "$3" in
3520                             [0-9]*) osvers="$3" ;;
3521                             *) osvers="$2" ;;
3522                         esac
3523                         ;;
3524                 dynixptx*) osname=dynixptx
3525                         osvers=`echo "$4"|sed 's/^v//'`
3526                         ;;
3527                 freebsd) osname=freebsd
3528                         osvers="$3" ;;
3529                 genix)  osname=genix ;;
3530                 gnu)    osname=gnu
3531                         osvers="$3" ;;
3532                 hp*)    osname=hpux
3533                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3534                         ;;
3535                 irix*)  osname=irix
3536                         case "$3" in
3537                         4*) osvers=4 ;;
3538                         5*) osvers=5 ;;
3539                         *)      osvers="$3" ;;
3540                         esac
3541                         ;;
3542                 linux)  osname=linux
3543                         case "$3" in
3544                         *)      osvers="$3" ;;
3545                         esac
3546                         $test -f /system/lib/libandroid.so && osname=linux-android
3547                         ;;
3548                 MiNT)   osname=mint
3549                         ;;
3550                 minix)  osname=minix
3551                         osvers=`$uname -r`
3552                         ;;
3553                 netbsd*) osname=netbsd
3554                         osvers="$3"
3555                         ;;
3556                 news-os) osvers="$3"
3557                         case "$3" in
3558                         4*) osname=newsos4 ;;
3559                         *) osname=newsos ;;
3560                         esac
3561                         ;;
3562                 nonstop-ux) osname=nonstopux ;;
3563                 openbsd) osname=openbsd
3564                         osvers="$3"
3565                         ;;
3566                 os2)    osname=os2
3567                         osvers="$4"
3568                         ;;
3569                 POSIX-BC | posix-bc ) osname=posix-bc
3570                         osvers="$3"
3571                         ;;
3572                 powerux | power_ux | powermax_os | powermaxos | \
3573                 powerunix | power_unix) osname=powerux
3574                         osvers="$3"
3575                         ;;
3576                 qnx) osname=qnx
3577                         osvers="$4"
3578                         ;;
3579                 solaris) osname=solaris
3580                         case "$3" in
3581                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3582                         *)      osvers="$3" ;;
3583                         esac
3584                         ;;
3585                 sunos) osname=sunos
3586                         case "$3" in
3587                         5*) osname=solaris
3588                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3589                         *)      osvers="$3" ;;
3590                         esac
3591                         ;;
3592                 titanos) osname=titanos
3593                         case "$3" in
3594                         1*) osvers=1 ;;
3595                         2*) osvers=2 ;;
3596                         3*) osvers=3 ;;
3597                         4*) osvers=4 ;;
3598                         *)      osvers="$3" ;;
3599                         esac
3600                         ;;
3601                 ultrix) osname=ultrix
3602                         osvers="$3"
3603                         ;;
3604                 osf1|mls+)      case "$5" in
3605                                 alpha)
3606                                         osname=dec_osf
3607                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3608                                         case "$osvers" in
3609                                         [1-9].[0-9]*) ;;
3610                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3611                                         esac
3612                                         ;;
3613                         hp*)    osname=hp_osf1  ;;
3614                         mips)   osname=mips_osf1 ;;
3615                         esac
3616                         ;;
3617                 # UnixWare 7.1.2 is known as Open UNIX 8
3618                 openunix|unixware) osname=svr5
3619                         osvers="$4"
3620                         ;;
3621                 uts)    osname=uts
3622                         osvers="$3"
3623                         ;;
3624                 vos) osvers="$3"
3625                         ;;
3626                 $2) case "$osname" in
3627                         *isc*) ;;
3628                         *freebsd*) ;;
3629                         svr*)
3630                                 : svr4.x or possibly later
3631                                 case "svr$3" in
3632                                 ${osname}*)
3633                                         osname=svr$3
3634                                         osvers=$4
3635                                         ;;
3636                                 esac
3637                                 case "$osname" in
3638                                 svr4.0)
3639                                         : Check for ESIX
3640                                         if test -f /stand/boot ; then
3641                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3642                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3643                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3644                                                         if test -n "$isesix"; then
3645                                                                 osname=esix4
3646                                                         fi
3647                                                 fi
3648                                         fi
3649                                         ;;
3650                                 esac
3651                                 ;;
3652                         *)      if test -f /etc/systemid; then
3653                                         osname=sco
3654                                         set `echo $3 | $sed 's/\./ /g'` $4
3655                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3656                                                 osvers=$1.$2.$3
3657                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3658                                                 osvers=$1.$2
3659                                         elif $test -f $src/hints/sco_$1.sh; then
3660                                                 osvers=$1
3661                                         fi
3662                                 else
3663                                         case "$osname" in
3664                                         '') : Still unknown.  Probably a generic Sys V.
3665                                                 osname="sysv"
3666                                                 osvers="$3"
3667                                                 ;;
3668                                         esac
3669                                 fi
3670                                 ;;
3671                         esac
3672                         ;;
3673                 *)      case "$osname" in
3674                         '') : Still unknown.  Probably a generic BSD.
3675                                 osname="$1"
3676                                 osvers="$3"
3677                                 ;;
3678                         esac
3679                         ;;
3680                 esac
3681         else
3682                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3683                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3684                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3685                                 osname=news_os
3686                         fi
3687                         $rm -f UU/kernel.what
3688                 elif test -d c:/. -o -n "$is_os2" ; then
3689                         set X $myuname
3690                         osname=os2
3691                         osvers="$5"
3692                 fi
3693         fi
3694
3695         case "$targetarch" in
3696         '') ;;
3697         *)  hostarch=$osname
3698             case "$targetarch" in
3699                 nto*|*-nto-*)
3700                     # Will load qnx.sh, which should change osname to nto
3701                     osname=qnx
3702                     osvers=''
3703                     ;;
3704                 *linux-android*)
3705                     # Catch arm-linux-androideabi, mipsel-linux-android,
3706                     # and i686-linux-android
3707                     osname=linux-android
3708                     osvers=''
3709                     ;;
3710                 *linux*)
3711                     # Something like arm-linux-gnueabihf is really just
3712                     # plain linux.
3713                     osname=linux
3714                     osvers=''
3715                     ;;
3716                 *solaris*|*sunos*)
3717                     osname=solaris
3718                     # XXX perhaps we should just assume
3719                     # osvers to be 2, or maybe take the value
3720                     # from targetarch. Using $run before the
3721                     # hints are run is somewhat icky.
3722                     set X `$run $uname -a 2>/dev/null`
3723                     shift
3724                     case "$3" in
3725                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3726                         *)  osvers="$3" ;;
3727                     esac
3728                     ;;
3729                 *)
3730                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3731                     osvers=''
3732                 ;;
3733             esac
3734             ;;
3735         esac
3736
3737         : Now look for a hint file osname_osvers, unless one has been
3738         : specified already.
3739         case "$hintfile" in
3740         ''|' ')
3741                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3742                 : Also try without trailing minor version numbers.
3743                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3744                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3745                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3746                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3747                 case "$file" in
3748                 '') dflt=none ;;
3749                 *)  case "$osvers" in
3750                         '') dflt=$file
3751                                 ;;
3752                         *)  if $test -f $src/hints/$file.sh ; then
3753                                         dflt=$file
3754                                 elif $test -f $src/hints/$xfile.sh ; then
3755                                         dflt=$xfile
3756                                 elif $test -f $src/hints/$xxfile.sh ; then
3757                                         dflt=$xxfile
3758                                 elif $test -f $src/hints/$xxxfile.sh ; then
3759                                         dflt=$xxxfile
3760                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3761                                         dflt=$xxxxfile
3762                                 elif $test -f "$src/hints/${osname}.sh" ; then
3763                                         dflt="${osname}"
3764                                 else
3765                                         dflt=none
3766                                 fi
3767                                 ;;
3768                         esac
3769                         ;;
3770                 esac
3771                 if $test -f Policy.sh ; then
3772                         case "$dflt" in
3773                         *Policy*) ;;
3774                         none) dflt="Policy" ;;
3775                         *) dflt="Policy $dflt" ;;
3776                         esac
3777                 fi
3778                 ;;
3779         *)
3780                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3781                 ;;
3782         esac
3783
3784         if $test -f Policy.sh ; then
3785                 $cat <<EOM
3786
3787 There's also a Policy hint file available, which should make the
3788 site-specific (policy) questions easier to answer.
3789 EOM
3790
3791         fi
3792
3793         $cat <<EOM
3794
3795 You may give one or more space-separated answers, or "none" if appropriate.
3796 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3797 previous run of Configure, you may specify it as well as or instead of
3798 OS-specific hints.  If hints are provided for your OS, you should use them:
3799 although Perl can probably be built without hints on many platforms, using
3800 hints often improve performance and may enable features that Configure can't
3801 set up on its own. If there are no hints that match your OS, specify "none";
3802 DO NOT give a wrong version or a wrong OS.
3803
3804 EOM
3805
3806         rp="Which of these apply, if any?"
3807         . UU/myread
3808         tans=$ans
3809         for file in $tans; do
3810                 if $test X$file = XPolicy -a -f Policy.sh; then
3811                         . Policy.sh
3812                         $cat Policy.sh >> UU/config.sh
3813                 elif $test -f $src/hints/$file.sh; then
3814                         . $src/hints/$file.sh
3815                         $cat $src/hints/$file.sh >> UU/config.sh
3816                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3817                         : nothing
3818                 else
3819                         : Give one chance to correct a possible typo.
3820                         echo "$file.sh does not exist"
3821                         dflt=$file
3822                         rp="hint to use instead?"
3823                         . UU/myread
3824                         for file in $ans; do
3825                                 if $test -f "$src/hints/$file.sh"; then
3826                                         . $src/hints/$file.sh
3827                                         $cat $src/hints/$file.sh >> UU/config.sh
3828                                 elif $test X$ans = X -o X$ans = Xnone ; then
3829                                         : nothing
3830                                 else
3831                                         echo "$file.sh does not exist -- ignored."
3832                                 fi
3833                         done
3834                 fi
3835         done
3836
3837         hint=recommended
3838         : Remember our hint file for later.
3839         if $test -f "$src/hints/$file.sh" ; then
3840                 hintfile="$file"
3841         else
3842                 hintfile=''
3843         fi
3844 fi
3845 cd UU
3846 ;;
3847 *)
3848         echo " "
3849         echo "Fetching default answers from $config_sh..." >&4
3850         tmp_n="$n"
3851         tmp_c="$c"
3852         cd ..
3853         cp $config_sh config.sh 2>/dev/null
3854         chmod +w config.sh
3855         . ./config.sh
3856         cd UU
3857         cp ../config.sh .
3858         n="$tmp_n"
3859         c="$tmp_c"
3860         hint=previous
3861         ;;
3862 esac
3863 . ./optdef.sh
3864
3865 : Restore computed paths
3866 for file in $loclist $trylist; do
3867         eval $file="\$_$file"
3868 done
3869
3870 cat << EOM
3871
3872 Configure uses the operating system name and version to set some defaults.
3873 The default value is probably right if the name rings a bell. Otherwise,
3874 since spelling matters for me, either accept the default or answer "none"
3875 to leave it blank.
3876
3877 EOM
3878 case "$osname" in
3879         ''|' ')
3880                 case "$hintfile" in
3881                 ''|' '|none) dflt=none ;;
3882                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3883                 esac
3884                 ;;
3885         *) dflt="$osname" ;;
3886 esac
3887 rp="Operating system name?"
3888 . ./myread
3889 case "$ans" in
3890 none)  osname='' ;;
3891 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3892 esac
3893 echo " "
3894 case "$osvers" in
3895         ''|' ')
3896                 case "$hintfile" in
3897                 ''|' '|none) dflt=none ;;
3898                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3899                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3900                         case "$dflt" in
3901                         ''|' ') dflt=none ;;
3902                         esac
3903                         ;;
3904                 esac
3905                 ;;
3906         *) dflt="$osvers" ;;
3907 esac
3908 rp="Operating system version?"
3909 . ./myread
3910 case "$ans" in
3911 none)  osvers='' ;;
3912 *) osvers="$ans" ;;
3913 esac
3914
3915
3916 . ./posthint.sh
3917
3918 : who configured the system
3919 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3920 case "$cf_by" in
3921 "")
3922         cf_by=`(logname) 2>/dev/null`
3923         case "$cf_by" in
3924         "")
3925                 cf_by=`(whoami) 2>/dev/null`
3926                 case "$cf_by" in
3927                 "") cf_by=unknown ;;
3928                 esac ;;
3929         esac ;;
3930 esac
3931
3932 : decide how portable to be.  Allow command line overrides.
3933 case "$d_portable" in
3934 "$undef") ;;
3935 *)      d_portable="$define" ;;
3936 esac
3937
3938 : set up shell script to do ~ expansion
3939 cat >filexp <<EOSS
3940 $startsh
3941 : expand filename
3942 case "\$1" in
3943  \~/*|\~)
3944         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3945         ;;
3946  \~*)
3947         if $test -f /bin/csh; then
3948                 /bin/csh -f -c "glob \$1"
3949                 failed=\$?
3950                 echo ""
3951                 exit \$failed
3952         else
3953                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3954                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3955                 if $test ! -d "\$dir"; then
3956                         me=\`basename \$0\`
3957                         echo "\$me: can't locate home directory for: \$name" >&2
3958                         exit 1
3959                 fi
3960                 case "\$1" in
3961                 */*)
3962                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3963                         ;;
3964                 *)
3965                         echo \$dir
3966                         ;;
3967                 esac
3968         fi
3969         ;;
3970 *)
3971         echo \$1
3972         ;;
3973 esac
3974 EOSS
3975 chmod +x filexp
3976 $eunicefix filexp
3977
3978 : now set up to get a file name
3979 cat <<EOS >getfile
3980 $startsh
3981 EOS
3982 cat <<'EOSC' >>getfile
3983 tilde=''
3984 fullpath=''
3985 already=''
3986 skip=''
3987 none_ok=''
3988 exp_file=''
3989 nopath_ok=''
3990 orig_rp="$rp"
3991 orig_dflt="$dflt"
3992 case "$gfpth" in
3993 '') gfpth='.' ;;
3994 esac
3995
3996 case "$fn" in
3997 *\(*)
3998         : getfile will accept an answer from the comma-separated list
3999         : enclosed in parentheses even if it does not meet other criteria.
4000         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4001         fn=`echo $fn | sed 's/(.*)//'`
4002         ;;
4003 esac
4004
4005 case "$fn" in
4006 *:*)
4007         loc_file=`expr $fn : '.*:\(.*\)'`
4008         fn=`expr $fn : '\(.*\):.*'`
4009         ;;
4010 esac
4011
4012 case "$fn" in
4013 *~*) tilde=true;;
4014 esac
4015 case "$fn" in
4016 */*) fullpath=true;;
4017 esac
4018 case "$fn" in
4019 *+*) skip=true;;
4020 esac
4021 case "$fn" in
4022 *n*) none_ok=true;;
4023 esac
4024 case "$fn" in
4025 *e*) exp_file=true;;
4026 esac
4027 case "$fn" in
4028 *p*) nopath_ok=true;;
4029 esac
4030
4031 case "$fn" in
4032 *f*) type='File';;
4033 *d*) type='Directory';;
4034 *l*) type='Locate';;
4035 esac
4036
4037 what="$type"
4038 case "$what" in
4039 Locate) what='File';;
4040 esac
4041
4042 case "$exp_file" in
4043 '')
4044         case "$d_portable" in
4045         "$define") ;;
4046         *) exp_file=true;;
4047         esac
4048         ;;
4049 esac
4050
4051 cd ..
4052 while test "$type"; do
4053         redo=''
4054         rp="$orig_rp"
4055         dflt="$orig_dflt"
4056         case "$tilde" in
4057         true) rp="$rp (~name ok)";;
4058         esac
4059         . UU/myread
4060         if test -f UU/getfile.ok && \
4061                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4062         then
4063                 value="$ans"
4064                 ansexp="$ans"
4065                 break
4066         fi
4067         case "$ans" in
4068         none)
4069                 value=''
4070                 ansexp=''
4071                 case "$none_ok" in
4072                 true) type='';;
4073                 esac
4074                 ;;
4075         *)
4076                 case "$tilde" in
4077                 '') value="$ans"
4078                         ansexp="$ans";;
4079                 *)
4080                         value=`UU/filexp $ans`
4081                         case $? in
4082                         0)
4083                                 if test "$ans" != "$value"; then
4084                                         echo "(That expands to $value on this system.)"
4085                                 fi
4086                                 ;;
4087                         *) value="$ans";;
4088                         esac
4089                         ansexp="$value"
4090                         case "$exp_file" in
4091                         '') value="$ans";;
4092                         esac
4093                         ;;
4094                 esac
4095                 case "$fullpath" in
4096                 true)
4097                         case "$ansexp" in
4098                         /*) value="$ansexp" ;;
4099                         [a-zA-Z]:/*) value="$ansexp" ;;
4100                         *)
4101                                 redo=true
4102                                 case "$already" in
4103                                 true)
4104                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4105                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4106                                         ;;
4107                                 *)
4108                                 echo "Please give a full path name, starting with slash." >&4
4109                                         case "$tilde" in
4110                                         true)
4111                                 echo "Note that using ~name is ok provided it expands well." >&4
4112                                                 already=true
4113                                                 ;;
4114                                         esac
4115                                 esac
4116                                 ;;
4117                         esac
4118                         ;;
4119                 esac
4120                 case "$redo" in
4121                 '')
4122                         case "$type" in
4123                         File)
4124                                 for fp in $gfpth; do
4125                                         if test "X$fp" = X.; then
4126                                             pf="$ansexp"
4127                                         else    
4128                                             pf="$fp/$ansexp"
4129                                         fi
4130                                         if test -f "$pf"; then
4131                                                 type=''
4132                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4133                                         then
4134                                                 echo "($value is not a plain file, but that's ok.)"
4135                                                 type=''
4136                                         fi
4137                                         if test X"$type" = X; then
4138                                             value="$pf"
4139                                             break
4140                                         fi
4141                                 done
4142                                 ;;
4143                         Directory)
4144                                 for fp in $gfpth; do
4145                                         if test "X$fp" = X.; then
4146                                             dir="$ans"
4147                                             direxp="$ansexp"
4148                                         else    
4149                                             dir="$fp/$ansexp"
4150                                             direxp="$fp/$ansexp"
4151                                         fi
4152                                         if test -d "$direxp"; then
4153                                                 type=''
4154                                                 value="$dir"
4155                                                 break
4156                                         fi
4157                                 done
4158                                 ;;
4159                         Locate)
4160                                 if test -d "$ansexp"; then
4161                                         echo "(Looking for $loc_file in directory $value.)"
4162                                         value="$value/$loc_file"
4163                                         ansexp="$ansexp/$loc_file"
4164                                 fi
4165                                 if test -f "$ansexp"; then
4166                                         type=''
4167                                 fi
4168                                 case "$nopath_ok" in
4169                                 true)   case "$value" in
4170                                         */*) ;;
4171                                         *)      echo "Assuming $value will be in people's path."
4172                                                 type=''
4173                                                 ;;
4174                                         esac
4175                                         ;;
4176                                 esac
4177                                 ;;
4178                         esac
4179
4180                         case "$skip" in
4181                         true) type='';
4182                         esac
4183
4184                         case "$type" in
4185                         '') ;;
4186                         *)
4187                                 if test "$fastread" = yes; then
4188                                         dflt=y
4189                                 else
4190                                         dflt=n
4191                                 fi
4192                                 rp="$what $value doesn't exist.  Use that name anyway?"
4193                                 . UU/myread
4194                                 dflt=''
4195                                 case "$ans" in
4196                                 y*) type='';;
4197                                 *) echo " ";;
4198                                 esac
4199                                 ;;
4200                         esac
4201                         ;;
4202                 esac
4203                 ;;
4204         esac
4205 done
4206 cd UU
4207 ans="$value"
4208 rp="$orig_rp"
4209 dflt="$orig_dflt"
4210 rm -f getfile.ok
4211 test "X$gfpthkeep" != Xy && gfpth=""
4212 EOSC
4213
4214 : determine root of directory hierarchy where package will be installed.
4215 case "$prefix" in
4216 '')     dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4217         ;;
4218 *)      dflt="$prefix"
4219         ;;
4220 esac
4221 $cat <<EOM
4222
4223 By default, $package will be installed in $dflt/bin, manual pages
4224 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4225 installation directories. Typically this is something like /usr/local.
4226 If you wish to have binaries under /usr/bin but other parts of the
4227 installation under /usr/local, that's ok: you will be prompted
4228 separately for each of the installation directories, the prefix being
4229 only used to set the defaults.
4230
4231 EOM
4232 fn=d~
4233 rp='Installation prefix to use?'
4234 . ./getfile
4235 oldprefix=''
4236 case "$prefix" in
4237 '')     ;;
4238 *)      case "$ans" in
4239         "$prefix") ;;
4240         *) oldprefix="$prefix";;
4241         esac
4242         ;;
4243 esac
4244
4245 case "$ans" in
4246 *?/)    prefix=`echo "$ans" | sed 's/.$//'`
4247         ;;
4248 *)      prefix="$ans"
4249 esac
4250
4251 case "$ansexp" in
4252 *?/)    prefixexp=`echo "$ansexp" | sed 's/.$//'`
4253         ;;
4254 *)      prefixexp="$ansexp"
4255 esac
4256
4257 : allow them to override the AFS root
4258 case "$afsroot" in
4259 '')     afsroot=/afs ;;
4260 *)      afsroot=$afsroot ;;
4261 esac
4262
4263 : is AFS running?
4264 echo " "
4265 case "$afs" in
4266 $define|true)   afs=true ;;
4267 $undef|false)   afs=false ;;
4268 *)      if $test -d $afsroot; then
4269                 afs=true
4270         else
4271                 afs=false
4272         fi
4273         ;;
4274 esac
4275 if $afs; then
4276         echo "AFS may be running... I'll be extra cautious then..." >&4
4277 else
4278         echo "AFS does not seem to be running..." >&4
4279 fi
4280
4281 : determine installation prefix for where package is to be installed.
4282 if $afs; then
4283 $cat <<EOM
4284
4285 Since you are running AFS, I need to distinguish the directory in which
4286 files will reside from the directory in which they are installed (and from
4287 which they are presumably copied to the former directory by occult means).
4288
4289 EOM
4290         case "$installprefix" in
4291         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4292         *) dflt="$installprefix";;
4293         esac
4294 else
4295 $cat <<EOM
4296
4297 In some special cases, particularly when building $package for distribution,
4298 it is convenient to distinguish the directory in which files should be
4299 installed from the directory ($prefix) in which they will
4300 eventually reside.  For most users, these two directories are the same.
4301
4302 EOM
4303         case "$installprefix" in
4304         '') dflt=$prefix ;;
4305         *) dflt=$installprefix;;
4306         esac
4307 fi
4308 fn=d~
4309 rp='What installation prefix should I use for installing files?'
4310 . ./getfile
4311 installprefix="$ans"
4312 installprefixexp="$ansexp"
4313
4314 : Perform the prefixexp/installprefixexp correction if necessary
4315 cat <<EOS >installprefix
4316 $startsh
4317 EOS
4318 cat <<'EOSC' >>installprefix
4319 : Change installation prefix, if necessary.
4320 if $test X"$prefix" != X"$installprefix"; then
4321     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4322 else
4323     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4324 fi
4325 EOSC
4326 chmod +x installprefix
4327 $eunicefix installprefix
4328
4329 : Set variables such as privlib and privlibexp from the output of ./getfile
4330 : performing the prefixexp/installprefixexp correction if necessary.
4331 cat <<EOS >setprefixvar
4332 $startsh
4333 EOS
4334 cat <<'EOSC' >>setprefixvar
4335 eval "${prefixvar}=\"\$ans\""
4336 eval "${prefixvar}exp=\"\$ansexp\""
4337 . ./installprefix
4338 EOSC
4339 chmod +x setprefixvar
4340 $eunicefix setprefixvar
4341
4342 : set up the script used to warn in case of inconsistency
4343 cat <<EOS >whoa
4344 $startsh
4345 EOS
4346 cat <<'EOSC' >>whoa
4347 dflt=y
4348 case "$hint" in
4349     recommended)
4350         case "$hintfile" in
4351         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4352                 ;;
4353         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4354                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4355                 ;;
4356         esac
4357         ;;
4358     *)  echo " "
4359         echo "*** WHOA THERE!!! ***" >&4
4360         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4361         ;;
4362 esac
4363 rp="    Keep the $hint value?"
4364 . ./myread
4365 case "$ans" in
4366 y) td=$was; tu=$was;;
4367 esac
4368 EOSC
4369
4370 : function used to set '$1' to '$val'
4371 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4372 case "$val$was" in
4373 $define$undef) . ./whoa; eval "$var=\$td";;
4374 $undef$define) . ./whoa; eval "$var=\$tu";;
4375 *) eval "$var=$val";;
4376 esac'
4377
4378 : Do we want threads support and if so, what type
4379 case "$usethreads" in
4380 $define|true|[yY]*)     dflt='y';;
4381 *)     # Catch case where user specified ithreads but
4382        # forgot -Dusethreads (A.D. 4/2002)
4383        case "$useithreads" in
4384        *$define*)       dflt='y';;
4385        *)               dflt='n';;
4386        esac
4387        ;;
4388 esac
4389 cat <<EOM
4390
4391 Perl can be built to offer a form of threading support on some systems
4392 To do so, Configure can be run with -Dusethreads.
4393
4394 Note that Perl built with threading support runs slightly slower
4395 and uses slightly more memory than plain Perl.
4396
4397 If this doesn't make any sense to you, just accept the default '$dflt'.
4398 EOM
4399 rp='Build a threading Perl?'
4400 . ./myread
4401 case "$ans" in
4402 y|Y)    val="$define" ;;
4403 *)      val="$undef" ;;
4404 esac
4405 set usethreads
4406 eval $setvar
4407
4408 useithreads="$usethreads"
4409
4410 case "$d_oldpthreads" in
4411 '')     : Configure tests would be welcome here.  For now, assume undef.
4412         val="$undef" ;;
4413 *)      val="$d_oldpthreads" ;;
4414 esac
4415 set d_oldpthreads
4416 eval $setvar
4417
4418
4419 : Look for a hint-file generated 'call-back-unit'.  If the
4420 : user has specified that a threading perl is to be built,
4421 : we may need to set or change some other defaults.
4422 if $test -f usethreads.cbu; then
4423     echo "Your platform has some specific hints regarding threaded builds, using them..."
4424     . ./usethreads.cbu
4425 else
4426     case "$usethreads" in
4427         "$define"|true|[yY]*)
4428                 $cat <<EOM
4429 (Your platform does not have any specific hints for threaded builds.
4430  Assuming POSIX threads, then.)
4431 EOM
4432         ;;
4433     esac
4434 fi
4435
4436 : Check if multiplicity is required
4437 cat <<EOM
4438
4439 Perl can be built so that multiple Perl interpreters can coexist
4440 within the same Perl executable.
4441 EOM
4442
4443 case "$useithreads" in
4444 $define)
4445         cat <<EOM
4446 This multiple interpreter support is required for interpreter-based threads.
4447 EOM
4448         val="$define"
4449         ;;
4450 *)      case "$usemultiplicity" in
4451         $define|true|[yY]*)     dflt='y';;
4452         *) dflt='n';;
4453         esac
4454         echo " "
4455         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4456         rp='Build Perl for multiplicity?'
4457         . ./myread
4458         case "$ans" in
4459         y|Y)    val="$define" ;;
4460         *)      val="$undef" ;;
4461         esac
4462         ;;
4463 esac
4464 set usemultiplicity
4465 eval $setvar
4466
4467 : Check if morebits is requested
4468 case "$usemorebits" in
4469 "$define"|true|[yY]*)
4470         use64bitint="$define"
4471         uselongdouble="$define"
4472         usemorebits="$define"
4473         ;;
4474 *)      usemorebits="$undef"
4475         ;;
4476 esac
4477
4478 : Determine the C compiler to be used
4479 echo " "
4480 case "$cc" in
4481 '') dflt=cc;;
4482 *) dflt="$cc";;
4483 esac
4484 rp="Use which C compiler?"
4485 . ./myread
4486 cc="$ans"
4487
4488 : See whether they have no cc but they do have gcc
4489 . ./trygcc
4490 if $test -f cc.cbu; then
4491     . ./cc.cbu
4492 fi
4493 . ./checkcc
4494
4495 : make some quick guesses about what we are up against
4496 echo " "
4497 $echo $n "Hmm...  $c"
4498 echo exit 1 >bsd
4499 echo exit 1 >usg
4500 echo exit 1 >v7
4501 echo exit 1 >osf1
4502 echo exit 1 >eunice
4503 echo exit 1 >xenix
4504 echo exit 1 >venix
4505 echo exit 1 >os2
4506 d_bsd="$undef"
4507 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4508 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4509 then
4510         echo "Looks kind of like an OSF/1 system, but we'll see..."
4511         echo exit 0 >osf1
4512 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4513         xxx=`./loc addbib blurfl $pth`
4514         if $test -f $xxx; then
4515         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4516                 echo exit 0 >bsd
4517                 echo exit 0 >usg
4518         else
4519                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4520                         echo "Looks kind of like an extended USG system, but we'll see..."
4521                 else
4522                         echo "Looks kind of like a USG system, but we'll see..."
4523                 fi
4524                 echo exit 0 >usg
4525         fi
4526 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4527         echo "Looks kind of like a BSD system, but we'll see..."
4528         d_bsd="$define"
4529         echo exit 0 >bsd
4530 else
4531         echo "Looks kind of like a Version 7 system, but we'll see..."
4532         echo exit 0 >v7
4533 fi
4534 case "$eunicefix" in
4535 *unixtovms*)
4536         $cat <<'EOI'
4537 There is, however, a strange, musty smell in the air that reminds me of
4538 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4539 EOI
4540         echo exit 0 >eunice
4541         d_eunice="$define"
4542 : it so happens the Eunice I know will not run shell scripts in Unix format
4543         ;;
4544 *)
4545         echo " "
4546         echo "Congratulations.  You aren't running Eunice."
4547         d_eunice="$undef"
4548         ;;
4549 esac
4550 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4551 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4552 : semicolon as a patch separator
4553 case "$p_" in
4554 :) ;;
4555 *)
4556         $cat <<'EOI'
4557 I have the feeling something is not exactly right, however...don't tell me...
4558 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4559 (Or you may be running DOS with DJGPP.)
4560 EOI
4561         echo exit 0 >os2
4562         ;;
4563 esac
4564 if test -f /xenix; then
4565         echo "Actually, this looks more like a XENIX system..."
4566         echo exit 0 >xenix
4567         d_xenix="$define"
4568 else
4569         echo " "
4570         echo "It's not Xenix..."
4571         d_xenix="$undef"
4572 fi
4573 chmod +x xenix
4574 $eunicefix xenix
4575 if test -f /venix; then
4576         echo "Actually, this looks more like a VENIX system..."
4577         echo exit 0 >venix
4578 else
4579         echo " "
4580         if ./xenix; then
4581                 : null
4582         else
4583                 echo "Nor is it Venix..."
4584         fi
4585 fi
4586 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4587 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4588 $rm -f foo
4589
4590 : Check if we are using GNU gcc and what its version is
4591 echo " "
4592 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4593 $cat >try.c <<EOM
4594 #include <stdio.h>
4595 int main() {
4596 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4597 #ifdef __VERSION__
4598         printf("%s\n", __VERSION__);
4599 #else
4600         printf("%s\n", "1");
4601 #endif
4602 #endif
4603         return(0);
4604 }
4605 EOM
4606 if $cc -o try $ccflags $ldflags try.c; then
4607         gccversion=`$run ./try`
4608         case "$gccversion" in
4609         '') echo "You are not using GNU cc." ;;
4610         *)  echo "You are using GNU cc $gccversion."
4611             ccname=gcc
4612             ;;
4613         esac
4614 else
4615         echo " "
4616         echo "*** WHOA THERE!!! ***" >&4
4617         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4618         case "$knowitall" in
4619         '')
4620         echo "    You'd better start hunting for one and let me know about it." >&4
4621                 exit 1
4622                 ;;
4623         esac
4624 fi
4625 $rm -f try try.*
4626 case "$gccversion" in
4627 1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4628 esac
4629 case "$gccversion" in
4630 '') gccosandvers='' ;;
4631 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4632    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4633    gccshortvers=''
4634    case "$gccosandvers" in
4635    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4636    $osname$osvers) ;; # looking good
4637    $osname*) cat <<EOM >&4
4638
4639 *** WHOA THERE!!! ***
4640
4641     Your gcc has not been compiled for the exact release of
4642     your operating system ($gccosandvers versus $osname$osvers).
4643
4644     In general it is a good idea to keep gcc synchronized with
4645     the operating system because otherwise serious problems
4646     may ensue when trying to compile software, like Perl.
4647
4648     I'm trying to be optimistic here, though, and will continue.
4649     If later during the configuration and build icky compilation
4650     problems appear (headerfile conflicts being the most common
4651     manifestation), I suggest reinstalling the gcc to match
4652     your operating system release.
4653
4654 EOM
4655       ;;
4656    *) gccosandvers='' ;; # failed to parse, better be silent
4657    esac
4658    ;;
4659 esac
4660 case "$ccname" in
4661 '') ccname="$cc" ;;
4662 esac
4663
4664 # gcc 3.* complain about adding -Idirectories that they already know about,
4665 # so we will take those off from locincpth.
4666 case "$gccversion" in
4667 3.*)
4668     echo "int main(){}">try.c
4669     for incdir in $locincpth; do
4670        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4671              grep '^c[cp]p*[01]: warning: changing search order '`
4672        if test "X$warn" != X; then
4673            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4674        fi
4675     done
4676     $rm -f try try.*
4677 esac
4678
4679 # gcc 4.9 by default does some optimizations that break perl.
4680 # see ticket 121505.
4681 #
4682 # The -fwrapv disables those optimizations (and probably others,) so
4683 # for gcc 4.9 (and later, since the optimizations probably won't go
4684 # away), add -fwrapv unless the user requests -fno-wrapv, which
4685 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4686 # which turns the overflows -fwrapv ignores into runtime errors.
4687 case "$gccversion" in
4688 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4689     case "$ccflags" in
4690     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4691     *) ccflags="$ccflags -fwrapv" ;;
4692     esac
4693 esac
4694
4695 # Really old versions of gcc default to C89 and will error for this code.
4696 # See if the compiler (gcc or otherwise) needs a flag to compile C99 code
4697 # Initialisations in for loops seem to be the particular problem
4698 # (Does this syntax conflict with something else that was valid C89?)
4699 # We also add a declaration after a statement to detect whether the compiler
4700 # (or the user supplied -Accflags) consider such declarations to be errors.
4701 # This causes 'Configure with -Accflags="-Werror=declaration-after-statement"'
4702 # to fail hard and early.
4703 #
4704 # Annoyingly -std=c99 will cause gcc to tell glibc not to define prototypes for
4705 # syscall, drand48 etc when including <unistd.h>, which messes up our build.
4706 # I guess we *could* loop round trying -std=c99 first with checks both for the
4707 # prototype found and the code compiling (because -std=gnu99 might do other
4708 # things we don't want, particularly on non-GCC compilers) but
4709 # 1) We would need to check for the prototype first (without any flags)
4710 # 2) We would still end up with most Linux systems either being -std=gnu99
4711 #    or "" (no flag), and so both common options would not rigorously check our
4712 #    portability to other platforms.
4713 # So it doesn't seem worth the complexity and chance of different failure.
4714 $cat >try.c <<'EOCP'
4715 int main(int argc, char **argv) {
4716     argc = argc + 1;
4717     /* This is deliberately a declaration after a statement. */
4718     unsigned long long count = 0;
4719     for (char **p = argv; *p; ++p) {
4720         ++count;
4721     }
4722     return count == 1 ? 0 : argc;
4723 }
4724 EOCP
4725 c99_for=no
4726 for flag in '' '-std=gnu99' '-std=c99'; do
4727     if $cc -o try $flag $ccflags $ldflags try.c 2>/dev/null && ./try; then
4728         c99_for="$flag"
4729         break;
4730     fi
4731 done
4732 case "$c99_for" in
4733 '') echo "Your C compiler doesn't need any special flags to compile C99 code"
4734     ;;
4735 no) echo >&4 "Your C compiler doesn't seem to be able to compile C99 code"
4736     rp='Do you really want to continue?'
4737     dflt='n'
4738     . ./myread
4739     case "$ans" in
4740         [yY])   echo >&4 "Okay, continuing."    ;;
4741         *)      exit 1                          ;;
4742     esac
4743     ;;
4744 *)  echo "Your C compiler needs $c99_for to compile C99 code"
4745     ccflags="$c99_for $ccflags"
4746     ;;
4747 esac
4748 $rm -f try try.*
4749
4750 : What should the include directory be ?
4751 : Use sysroot if set, so findhdr looks in the right place.
4752 echo " "
4753 $echo $n "Hmm...  $c"
4754 dflt="$sysroot/usr/include"
4755 incpath=''
4756 mips_type=''
4757 if $test -f /bin/mips && /bin/mips; then
4758         echo "Looks like a MIPS system..."
4759         $cat >usr.c <<'EOCP'
4760 #ifdef SYSTYPE_BSD43
4761 /bsd43
4762 #endif
4763 EOCP
4764         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4765                 dflt='/bsd43/usr/include'
4766                 incpath='/bsd43'
4767                 mips_type='BSD 4.3'
4768         else
4769                 mips_type='System V'
4770         fi
4771         $rm -f usr.c usr.out
4772         echo "and you're compiling with the $mips_type compiler and libraries."
4773         xxx_prompt=y
4774         echo "exit 0" >mips
4775 else
4776         echo "Doesn't look like a MIPS system."
4777         xxx_prompt=n
4778         echo "exit 1" >mips
4779 fi
4780 chmod +x mips
4781 $eunicefix mips
4782 case "$usrinc" in
4783 '') ;;
4784 *) dflt="$usrinc";;
4785 esac
4786 case "$xxx_prompt" in
4787 y)      fn=d/
4788         echo " "
4789         rp='Where are the include files you want to use?'
4790         . ./getfile
4791         usrinc="$ans"
4792         ;;
4793 *)      usrinc="$dflt"
4794         ;;
4795 esac
4796
4797 : see how we invoke the C preprocessor
4798 echo " "
4799 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4800 cat <<'EOT' >testcpp.c
4801 #define ABC abc
4802 #define XYZ xyz
4803 ABC.XYZ
4804 EOT
4805 cd ..
4806 if test ! -f cppstdin; then
4807         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4808                 # AIX cc -E doesn't show the absolute headerfile
4809                 # locations but we'll cheat by using the -M flag.
4810                 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
4811         else
4812                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4813         fi
4814 else
4815         echo "Keeping your $hint cppstdin wrapper."
4816 fi
4817 chmod 755 cppstdin
4818 wrapper=`pwd`/cppstdin
4819 ok='false'
4820 cd UU
4821
4822 if $test "X$cppstdin" != "X" && \
4823         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4824         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4825 then
4826         echo "You used to use $cppstdin $cppminus so we'll use that again."
4827         case "$cpprun" in
4828         '') echo "But let's see if we can live without a wrapper..." ;;
4829         *)
4830                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4831                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4832                 then
4833                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4834                         ok='true'
4835                 else
4836                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4837                 fi
4838                 ;;
4839         esac
4840 else
4841         case "$cppstdin" in
4842         '') ;;
4843         *)
4844                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4845                 ;;
4846         esac
4847 fi
4848
4849 if $ok; then
4850         : nothing
4851 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4852         $cc -E <testcpp.c >testcpp.out 2>&1; \
4853         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4854         echo "Yup, it does."
4855         x_cpp="$cc $cppflags -E"
4856         x_minus='';
4857 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4858         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4859         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4860         echo "Yup, it does."
4861         x_cpp="$cc $cppflags -E"
4862         x_minus='-';
4863 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4864         $cc -P <testcpp.c >testcpp.out 2>&1; \
4865         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4866         echo "Yipee, that works!"
4867         x_cpp="$cc $cppflags -P"
4868         x_minus='';
4869 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4870         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4871         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4872         echo "At long last!"
4873         x_cpp="$cc $cppflags -P"
4874         x_minus='-';
4875 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4876         $cpp <testcpp.c >testcpp.out 2>&1; \
4877         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4878         echo "It works!"
4879         x_cpp="$cpp $cppflags"
4880         x_minus='';
4881 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4882         $cpp - <testcpp.c >testcpp.out 2>&1; \
4883         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4884         echo "Hooray, it works!  I was beginning to wonder."
4885         x_cpp="$cpp $cppflags"
4886         x_minus='-';
4887 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4888         $wrapper <testcpp.c >testcpp.out 2>&1; \
4889         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4890         x_cpp="$wrapper"
4891         x_minus=''
4892         echo "Eureka!"
4893 else
4894         dflt=''
4895         rp="No dice.  I can't find a C preprocessor.  Name one:"
4896         . ./myread
4897         x_cpp="$ans"
4898         x_minus=''
4899         $x_cpp <testcpp.c >testcpp.out 2>&1
4900         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4901                 echo "OK, that will do." >&4
4902         else
4903 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4904                 exit 1
4905         fi
4906 fi
4907
4908 case "$ok" in
4909 false)
4910         cppstdin="$x_cpp"
4911         cppminus="$x_minus"
4912         cpprun="$x_cpp"
4913         cpplast="$x_minus"
4914         set X $x_cpp
4915         shift
4916         case "$1" in
4917         "$cpp")
4918                 echo "Perhaps can we force $cc -E using a wrapper..."
4919                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4920                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4921                 then
4922                         echo "Yup, we can."
4923                         cppstdin="$wrapper"
4924                         cppminus='';
4925                 else
4926                         echo "Nope, we'll have to live without it..."
4927                 fi
4928                 ;;
4929         esac
4930         case "$cpprun" in
4931         "$wrapper")
4932                 cpprun=''
4933                 cpplast=''
4934                 ;;
4935         esac
4936         ;;
4937 esac
4938
4939 case "$cppstdin" in
4940 "$wrapper"|'cppstdin') ;;
4941 *) $rm -f $wrapper;;
4942 esac
4943 $rm -f testcpp.c testcpp.out
4944
4945 : Adjust cppfilter for path component separator
4946 case "$osname" in
4947 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4948 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4949 *)   cppfilter='' ;;
4950 esac
4951
4952 : Use gcc to determine libpth and incpth
4953 # If using gcc or clang, we can get better values for libpth, incpth
4954 # and usrinc directly from the compiler.
4955 # Note that ccname for clang is also gcc.
4956 case "$ccname" in
4957     gcc)
4958         realpath=`which realpath 2>/dev/null | sed 's/no realpath in.*//'`
4959         $echo 'extern int foo;' > try.c
4960         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4961         shift
4962         inclibpth=""
4963         if $test $# -gt 0; then
4964             for i in $*; do
4965                 case $realpath in
4966                     */realpath) i=`$realpath $i` ;;
4967                 esac
4968                 incpth="$incpth $i"
4969                 j="`$echo $i | $sed 's,/include[^/]*,/lib,'`"
4970                 if $test -d $j; then
4971                     inclibpth="$inclibpth $j"
4972                 fi
4973             done
4974             incpth="`$echo $incpth | $sed 's/^ //'`"
4975             for xxx in $inclibpth $loclibpth $plibpth $glibpth; do
4976                 if $test -d $xxx; then
4977                     case $realpath in
4978                         */realpath) xxx=`$realpath $xxx` ;;
4979                     esac
4980                     case " $libpth " in
4981                     *" $xxx "*) ;;
4982                     *) libpth="$libpth $xxx";;
4983                     esac
4984                 fi
4985             done
4986             libpth="`$echo $libpth | $sed 's/^ //'`"
4987         fi
4988         $rm -f try.c
4989         case "$usrinc" in
4990         '') for i in $incpth; do
4991                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4992                     usrinc="$i"
4993                     break
4994                 fi
4995             done
4996             ;;
4997         esac
4998
4999         case "$usecrosscompile" in
5000         $define|true|[yY]*)
5001             case "$incpth" in
5002                 '') echo "Incpth not defined." >&4; croak=y ;;
5003                 *)  echo "Using incpth '$incpth'." >&4 ;;
5004             esac
5005             case "$libpth" in
5006                 '') echo "Libpth not defined." >&4; croak=y ;;
5007                 *)  echo "Using libpth '$libpth'." >&4 ;;
5008             esac
5009             case "$usrinc" in
5010                 '') echo "Usrinc not defined." >&4; croak=y ;;
5011                 *)  echo "Using usrinc $usrinc." >&4 ;;
5012             esac
5013             case "$croak" in
5014                 y)
5015                 if test "X$sysroot" = X; then
5016                     echo "Cannot continue, aborting." >&4; exit 1
5017                 else
5018                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5019                 fi
5020                 ;;
5021             esac
5022             ;;
5023         esac
5024     ;;
5025 esac
5026
5027 : Default value for incpth is just usrinc
5028 case "$incpth" in
5029 '') incpth="$usrinc";;
5030 esac
5031
5032 : Set private lib path
5033 case "$plibpth" in
5034 '') if ./mips; then
5035         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5036     fi;;
5037 esac
5038 case "$libpth" in
5039 ' ') dlist='';;
5040 '') dlist="$loclibpth $plibpth $glibpth";;
5041 *) dlist="$libpth";;
5042 esac
5043
5044 : Now check and see which directories actually exist, avoiding duplicates
5045 for xxx in $dlist
5046 do
5047     if $test -d $xxx; then
5048                 case " $libpth " in
5049                 *" $xxx "*) ;;
5050                 *) libpth="$libpth $xxx";;
5051                 esac
5052     fi
5053 done
5054 $cat <<'EOM'
5055
5056 Some systems have incompatible or broken versions of libraries.  Among
5057 the directories listed in the question below, please remove any you
5058 know not to be holding relevant libraries, and add any that are needed.
5059 Say "none" for none.
5060
5061 EOM
5062
5063 if test "X$sysroot" != X; then
5064     $cat <<EOM
5065 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5066
5067 EOM
5068 fi
5069
5070 case "$libpth" in
5071 '') dflt='none';;
5072 *)
5073         set X $libpth
5074         shift
5075         dflt=${1+"$@"}
5076         ;;
5077 esac
5078 rp="Directories to use for library searches?"
5079 . ./myread
5080 case "$ans" in
5081 none) libpth=' ';;
5082 *) libpth="$ans";;
5083 esac
5084
5085 : compute shared library extension
5086 case "$so" in
5087 '')
5088         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5089                 dflt='sl'
5090         else
5091                 dflt='so'
5092         fi
5093         ;;
5094 *) dflt="$so";;
5095 esac
5096 $cat <<EOM
5097
5098 On some systems, shared libraries may be available.  Answer 'none' if
5099 you want to suppress searching of shared libraries for the remainder
5100 of this configuration.
5101
5102 EOM
5103 rp='What is the file extension used for shared libraries?'
5104 . ./myread
5105 so="$ans"
5106
5107 : Does target system insist that shared library basenames are unique
5108 $cat << EOM
5109
5110 Some dynamic loaders assume that the *basename* of shared library filenames
5111 are globally unique.  We'll default this to undef as we assume your system
5112 is not this weird. Set to defined if you're on one of them.
5113
5114 EOM
5115
5116 dflt='n'
5117 rp='Make shared library basenames unique?'
5118 . ./myread
5119 case "$ans" in
5120 y|Y) val="$define" ;;
5121 *)   val="$undef"  ;;
5122 esac
5123 set d_libname_unique
5124 eval $setvar
5125
5126 : Define several unixisms.
5127 : Hints files or command line option can be used to override them.
5128 : The convoluted testing is in case hints files set either the old
5129 : or the new name.
5130 case "$_exe" in
5131 '')     case "$exe_ext" in
5132         '')     ;;
5133         *)      _exe="$exe_ext" ;;
5134         esac
5135         ;;
5136 esac
5137 case "$_a" in
5138 '')     case "$lib_ext" in
5139     '') _a='.a';;
5140         *)      _a="$lib_ext" ;;
5141         esac
5142         ;;
5143 esac
5144 case "$_o" in
5145 '') case "$obj_ext" in
5146         '')     _o='.o';;
5147         *)      _o="$obj_ext";;
5148         esac
5149         ;;
5150 esac
5151 case "$p_" in
5152 '') case "$path_sep" in
5153         '')     p_=':';;
5154         *)      p_="$path_sep";;
5155         esac
5156         ;;
5157 esac
5158 exe_ext=$_exe
5159 lib_ext=$_a
5160 obj_ext=$_o
5161 path_sep=$p_
5162
5163 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5164
5165 : Which makefile gets called first.  This is used by make depend.
5166 case "$firstmakefile" in
5167 '') firstmakefile='makefile';;
5168 esac
5169
5170 : Check is we will use socks
5171 case "$usesocks" in
5172 $define|true|[yY]*)     dflt='y';;
5173 *) dflt='n';;
5174 esac
5175 cat <<EOM
5176
5177 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5178 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5179 to use the PerlIO abstraction layer, this will be implicitly selected.
5180
5181 If this doesn't make any sense to you, just accept the default '$dflt'.
5182 EOM
5183 rp='Build Perl for SOCKS?'
5184 . ./myread
5185 case "$ans" in
5186 y|Y)    val="$define" ;;
5187 *)      val="$undef" ;;
5188 esac
5189 set usesocks
5190 eval $setvar
5191
5192 : Check for uselongdouble support
5193 case "$ccflags" in
5194 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5195 esac
5196
5197 case "$uselongdouble" in
5198 $define|true|[yY]*)     dflt='y';;
5199 *) dflt='n';;
5200 esac
5201 cat <<EOM
5202
5203 Perl can be built to take advantage of long doubles which
5204 (if available) may give more accuracy and range for floating point numbers.
5205
5206 If this doesn't make any sense to you, just accept the default '$dflt'.
5207 EOM
5208 rp='Try to use long doubles if available?'
5209 . ./myread
5210 case "$ans" in
5211 y|Y)    val="$define"   ;;
5212 *)      val="$undef"    ;;
5213 esac
5214 set uselongdouble
5215 eval $setvar
5216
5217 case "$uselongdouble" in
5218 true|[yY]*) uselongdouble="$define" ;;
5219 esac
5220
5221 : Look for a hint-file generated 'call-back-unit'.  If the
5222 : user has specified that long doubles should be used,
5223 : we may need to set or change some other defaults.
5224 if $test -f uselongdouble.cbu; then
5225     echo "Your platform has some specific hints regarding long doubles, using them..."
5226     . ./uselongdouble.cbu
5227 else
5228     case "$uselongdouble" in
5229         $define)
5230                 $cat <<EOM
5231 (Your platform does not have any specific hints for long doubles.)
5232 EOM
5233         ;;
5234     esac
5235 fi
5236
5237 : Looking for optional libraries
5238 echo " "
5239 echo "Checking for optional libraries..." >&4
5240 case "$libs" in
5241 ' '|'') dflt='';;
5242 *) dflt="$libs";;
5243 esac
5244 case "$libswanted" in
5245 '') libswanted='c_s';;
5246 esac
5247 case "$usesocks" in
5248 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5249 esac
5250 case "$usecbacktrace" in
5251 "$define") libswanted="$libswanted bfd" ;;
5252 esac
5253 libsfound=''
5254 libsfiles=''
5255 libsdirs=''
5256 libspath=''
5257 for thisdir in $libpth $xlibpth; do
5258   test -d $thisdir && libspath="$libspath $thisdir"
5259 done
5260 for thislib in $libswanted; do
5261         for thisdir in $libspath; do
5262             xxx=''
5263             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5264                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5265                 $test -f "$xxx" && eval $libscheck
5266                 $test -f "$xxx" && libstyle=shared
5267                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5268                 $test -f "$xxx" && eval $libscheck
5269                 $test -f "$xxx" && libstyle=shared
5270             fi
5271             if test ! -f "$xxx"; then
5272                 xxx=$thisdir/lib$thislib.$so$_a
5273                 $test -f "$xxx" && eval $libscheck
5274                 $test -f "$xxx" && libstyle="import"
5275             fi
5276             if test ! -f "$xxx"; then
5277                 xxx=$thisdir/$thislib.$so$_a
5278                 $test -f "$xxx" && eval $libscheck
5279                 $test -f "$xxx" && libstyle="import"
5280             fi
5281             if test ! -f "$xxx"; then
5282                 xxx=$thisdir/lib$thislib.$so
5283                 $test -f "$xxx" && eval $libscheck
5284                 $test -f "$xxx" && libstyle=shared
5285             fi
5286             if test ! -f "$xxx"; then
5287                 xxx=$thisdir/lib$thislib$_a
5288                 $test -f "$xxx" && eval $libscheck
5289                 $test -f "$xxx" && libstyle=static
5290             fi
5291             if test ! -f "$xxx"; then
5292                 xxx=$thisdir/$thislib$_a
5293                 $test -f "$xxx" && eval $libscheck
5294                 $test -f "$xxx" && libstyle=static
5295             fi
5296             if test ! -f "$xxx"; then
5297                 xxx=$thisdir/lib${thislib}_s$_a
5298                 $test -f "$xxx" && eval $libscheck
5299                 $test -f "$xxx" && libstyle=static
5300                 $test -f "$xxx" && thislib=${thislib}_s
5301             fi
5302             if test ! -f "$xxx"; then
5303                 xxx=$thisdir/Slib$thislib$_a
5304                 $test -f "$xxx" && eval $libscheck
5305                 $test -f "$xxx" && libstyle=static
5306             fi
5307             if $test -f "$xxx"; then
5308                 case "$libstyle" in
5309                 shared) echo "Found -l$thislib (shared)." ;;
5310                 static) echo "Found -l$thislib." ;;
5311                 *)      echo "Found -l$thislib ($libstyle)." ;;
5312                 esac
5313                 case " $dflt " in
5314                 *"-l$thislib "*);;
5315                 *) dflt="$dflt -l$thislib"
5316                    libsfound="$libsfound $xxx"
5317                    yyy=`basename $xxx`
5318                    libsfiles="$libsfiles $yyy"
5319                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5320                    case " $libsdirs " in
5321                    *" $yyy "*) ;;
5322                    *) libsdirs="$libsdirs $yyy" ;;
5323                    esac
5324                    ;;
5325                 esac
5326                 break
5327             fi
5328         done
5329         if $test ! -f "$xxx"; then
5330             echo "No -l$thislib."
5331         fi
5332 done
5333 set X $dflt
5334 shift
5335 dflt="$*"
5336 case "$libs" in
5337 '') dflt="$dflt";;
5338 *) dflt="$libs";;
5339 esac
5340 case "$dflt" in
5341 ' '|'') dflt='none';;
5342 esac
5343
5344 $cat <<EOM
5345
5346 In order to compile $package on your machine, a number of libraries
5347 are usually needed.  Include any other special libraries here as well.
5348 Say "none" for none.  The default list is almost always right.
5349 EOM
5350
5351 echo " "
5352 rp="What libraries to use?"
5353 . ./myread
5354 case "$ans" in
5355 none) libs=' ';;
5356 *) libs="$ans";;
5357 esac
5358
5359 : determine optimization, if desired, or use for debug flag also
5360 case "$optimize" in
5361 ' '|$undef) dflt='none';;
5362 '') dflt='-O';;
5363 *) dflt="$optimize";;
5364 esac
5365 $cat <<EOH
5366
5367 By default, $package compiles with the -O flag to use the optimizer.
5368 Alternately, you might want to use the symbolic debugger, which uses
5369 the -g flag (on traditional Unix systems).  Either flag can be
5370 specified here.  To use neither flag, specify the word "none".
5371
5372 EOH
5373 rp="What optimizer/debugger flag should be used?"
5374 . ./myread
5375 optimize="$ans"
5376 case "$optimize" in
5377 'none') optimize=" ";;
5378 esac
5379
5380 : Check what DEBUGGING is required from the command line
5381 : -DEBUGGING      or -DDEBUGGING or
5382 : -DEBUGGING=both                       = -g + -DDEBUGGING
5383 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5384 : -DEBUGGING=none or -UDEBUGGING        =
5385 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5386 case "$EBUGGING" in
5387 '')     ;;
5388 *)      DEBUGGING=$EBUGGING ;;
5389 esac
5390
5391 case "$DEBUGGING" in
5392 -g|both|$define)
5393     case "$optimize" in
5394         *-g*) ;;
5395         *)    optimize="$optimize -g" ;;
5396     esac ;;
5397 none|$undef)
5398     case "$optimize" in
5399         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5400                 shift
5401                 optimize="$*"
5402                 ;;
5403     esac ;;
5404 esac
5405
5406 dflt=''
5407 case "$DEBUGGING" in
5408 both|$define) dflt='-DDEBUGGING'
5409 esac
5410
5411 : argument order is deliberate, as the flag will start with - which set could
5412 : think is an option
5413 checkccflag='check=$1; flag=$2; callback=$3;
5414 echo " ";
5415 echo "Checking if your compiler accepts $flag" >&4;
5416 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5417 echo "int main(void) { return 0; }" > gcctest.c;
5418 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5419     echo "Yes, it does." >&4;
5420     if $test -s gcctest.out ; then
5421         echo "But your platform does not like it:";
5422         cat gcctest.out;
5423     else
5424         case "$ccflags" in
5425         *$check*)
5426             echo "Leaving current flags $ccflags alone." >&4
5427             ;;
5428         *) dflt="$dflt $flag";
5429             eval $callback
5430             ;;
5431         esac
5432     fi
5433 else
5434     echo "Nope, it does not, but that is ok." >&4;
5435 fi
5436 '
5437
5438 : We will not override a previous value, but we might want to
5439 : augment a hint file
5440 case "$hint" in
5441 default|recommended)
5442         case "$gccversion" in
5443         1.*) dflt="$dflt -fpcc-struct-return" ;;
5444         esac
5445         case "$optimize:$DEBUGGING" in
5446         *-g*:old) dflt="$dflt -DDEBUGGING";;
5447         esac
5448         case "$gccversion" in
5449         2.*) if $test -d /etc/conf/kconfig.d &&
5450                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5451                 then
5452                         # Interactive Systems (ISC) POSIX mode.
5453                         dflt="$dflt -posix"
5454                 fi
5455                 ;;
5456         esac
5457         case "$gccversion" in
5458         1.*) ;;
5459         2.[0-8]*) ;;
5460         ?*)     set strict-aliasing -fno-strict-aliasing
5461                 eval $checkccflag
5462                 ;;
5463         esac
5464         # For gcc, adding -pipe speeds up compilations for some, but apparently
5465         # some assemblers can't read from stdin.  (It also slows down compilations
5466         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5467         case "$gccversion" in
5468         ?*)     set pipe -pipe
5469                 eval $checkccflag
5470                 ;;
5471         esac
5472
5473         # on x86_64 (at least) we require an extra library (libssp) in the
5474         # link command line. This library is not named, so I infer that it is
5475         # an implementation detail that may change. Hence the safest approach
5476         # is to add the flag to the flags passed to the compiler at link time,
5477         # as that way the compiler can do the right implementation dependant
5478         # thing. (NWC)
5479         case "$ccflags" in
5480         *-fno-stack-protector*)
5481             echo "Do not add -fstack-protector nor -fstack-protector-strong" 2>&1
5482             ;;
5483         *) case "$gccversion" in
5484            ?*)  set stack-protector-strong -fstack-protector-strong
5485                 eval $checkccflag
5486                 case "$dflt" in
5487                 *-fstack-protector-strong*) ;; # It got added.
5488                 *) # Try the plain/older -fstack-protector.
5489                    set stack-protector -fstack-protector
5490                    eval $checkccflag
5491                    ;;
5492                 esac
5493                 ;;
5494             esac
5495             ;;
5496         esac
5497 esac
5498
5499 case "$mips_type" in
5500 *BSD*|'') inclwanted="$locincpth $usrinc";;
5501 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5502 esac
5503 for thisincl in $inclwanted; do
5504         if $test -d $thisincl; then
5505                 if $test x$thisincl != x$usrinc; then
5506                         case "$dflt" in
5507                         *" -I$thisincl "*);;
5508                         *) dflt="$dflt -I$thisincl ";;
5509                         esac
5510                 fi
5511         fi
5512 done
5513
5514 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5515         xxx=true;
5516 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5517         xxx=true;
5518 else
5519         xxx=false;
5520 fi;
5521 if $xxx; then
5522         case "$dflt" in
5523         *$2*);;
5524         *) dflt="$dflt -D$2";;
5525         esac;
5526 fi'
5527
5528 set signal.h LANGUAGE_C; eval $inctest
5529
5530 case "$usesocks" in
5531 $define)
5532         ccflags="$ccflags -DSOCKS"
5533         ;;
5534 esac
5535
5536 case "$hint" in
5537 default|recommended) dflt="$ccflags $dflt" ;;
5538 *) dflt="$ccflags";;
5539 esac
5540
5541 case "$dflt" in
5542 ''|' ') dflt=none;;
5543 esac
5544
5545 $cat <<EOH
5546
5547 Your C compiler may want other flags.  For this question you should include
5548 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5549 but you should NOT include libraries or ld flags like -lwhatever.  If you
5550 want $package to honor its debug switch, you should include -DDEBUGGING here.
5551 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5552
5553 To use no flags, specify the word "none".
5554
5555 EOH
5556 set X $dflt
5557 shift
5558 dflt=${1+"$@"}
5559 rp="Any additional cc flags?"
5560 . ./myread
5561 case "$ans" in
5562 none) ccflags='';;
5563 *) ccflags="$ans";;
5564 esac
5565
5566 : the following weeds options from ccflags that are of no interest to cpp
5567 case "$cppflags" in
5568 '') cppflags="$ccflags" ;;
5569 *)  set X $ccflags; shift
5570     case " $cppflags " in
5571     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5572     *) cppflags="$cppflags $ccflags" ;;
5573     esac
5574     ;;
5575 esac
5576 case "$gccversion" in
5577 1.*) cppflags="$cppflags -D__GNUC__"
5578 esac
5579 case "$mips_type" in
5580 '');;
5581 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5582 esac
5583 case "$cppflags" in
5584 '');;
5585 *)
5586         echo " "
5587         echo "Let me guess what the preprocessor flags are..." >&4
5588         set X $cppflags
5589         shift
5590         cppflags=''
5591         $cat >cpp.c <<'EOM'
5592 #define BLURFL foo
5593
5594 BLURFL xx LFRULB
5595 EOM
5596         previous=''
5597         for flag in $*
5598         do
5599                 case "$flag" in
5600                 -*) ftry="$flag";;
5601                 *) ftry="$previous $flag";;
5602                 esac
5603                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5604                         >cpp1.out 2>/dev/null && \
5605                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5606                         >cpp2.out 2>/dev/null && \
5607                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5608                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5609                 then
5610                         cppflags="$cppflags $ftry"
5611                         previous=''
5612                 else
5613                         previous="$flag"
5614                 fi
5615         done
5616         set X $cppflags
5617         shift
5618         cppflags=${1+"$@"}
5619         case "$cppflags" in
5620         *-*)  echo "They appear to be: $cppflags";;
5621         esac
5622         $rm -f cpp.c cpp?.out
5623         ;;
5624 esac
5625
5626 : flags used in final linking phase
5627 case "$ldflags" in
5628 '') if ./venix; then
5629                 dflt='-i -z'
5630         else
5631                 dflt=''
5632         fi
5633         case "$ccflags" in
5634         *-posix*) dflt="$dflt -posix" ;;
5635         esac
5636         ;;
5637 *) dflt="$ldflags";;
5638 esac
5639 # See note above about -fstack-protector
5640 case "$ccflags" in
5641 *-fstack-protector-strong*)
5642         case "$dflt" in
5643         *-fstack-protector-strong*) ;; # Don't add it again
5644         *) dflt="$dflt -fstack-protector-strong" ;;
5645         esac
5646         ;;
5647 *-fstack-protector*)
5648         case "$dflt" in
5649         *-fstack-protector*) ;; # Don't add it again
5650         *) dflt="$dflt -fstack-protector" ;;
5651         esac
5652         ;;
5653 esac
5654
5655 : Try to guess additional flags to pick up local libraries.
5656 for thislibdir in $libpth; do
5657         case " $loclibpth " in
5658         *" $thislibdir "*)
5659                 case "$dflt " in
5660                 *"-L$thislibdir "*) ;;
5661                 *)  dflt="$dflt -L$thislibdir" ;;
5662                 esac
5663                 ;;
5664         esac
5665 done
5666
5667 case "$dflt" in
5668 '') dflt='none' ;;
5669 esac
5670
5671 $cat <<EOH
5672
5673 Your C linker may need flags.  For this question you should
5674 include -L/whatever and any other flags used by the C linker, but you
5675 should NOT include libraries like -lwhatever.
5676
5677 Make sure you include the appropriate -L/path flags if your C linker
5678 does not normally search all of the directories you specified above,
5679 namely
5680         $libpth
5681 To use no flags, specify the word "none".
5682
5683 EOH
5684
5685 rp="Any additional ld flags (NOT including libraries)?"
5686 . ./myread
5687 case "$ans" in
5688 none) ldflags='';;
5689 *) ldflags="$ans";;
5690 esac
5691 rmlist="$rmlist pdp11"
5692
5693 : coherency check
5694 echo " "
5695 echo "Checking your choice of C compiler and flags for coherency..." >&4
5696 $cat > try.c <<'EOF'
5697 #include <stdio.h>
5698 int main() { printf("Ok\n"); return(0); }
5699 EOF
5700 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5701 shift
5702 $cat >try.msg <<'EOM'
5703 I've tried to compile and run the following simple program:
5704
5705 EOM
5706 $cat try.c >> try.msg
5707
5708 $cat >> try.msg <<EOM
5709
5710 I used the command:
5711
5712         $*
5713         $run ./try
5714
5715 and I got the following output:
5716
5717 EOM
5718 dflt=y
5719 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5720         if $sh -c "$run ./try " >>try.msg 2>&1; then
5721                 xxx=`$run ./try`
5722                 case "$xxx" in
5723                 "Ok") dflt=n ;;
5724                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5725                 esac
5726         else
5727                 echo "The program compiled OK, but exited with status $?." >>try.msg
5728                 rp="You have a problem.  Shall I abort Configure"
5729                 dflt=y
5730         fi
5731 else
5732         echo "I can't compile the test program." >>try.msg
5733         rp="You have a BIG problem.  Shall I abort Configure"
5734         dflt=y
5735 fi
5736 case "$dflt" in
5737 y)
5738         $cat try.msg >&4
5739         case "$knowitall" in
5740         '')
5741                 echo "(The supplied flags or libraries might be incorrect.)"
5742                 ;;
5743         *) dflt=n;;
5744         esac
5745         echo " "
5746         . ./myread
5747         case "$ans" in
5748         n*|N*) ;;
5749         *)      echo "Ok.  Stopping Configure." >&4
5750                 exit 1
5751                 ;;
5752         esac
5753         ;;
5754 n) echo "OK, that should do.";;
5755 esac
5756 $rm_try gcctest gcctest.out
5757
5758 : define a shorthand compile call
5759 compile='
5760 mc_file=$1;
5761 shift;
5762 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5763 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4;
5764 exit 1;
5765 fi;
5766 esac;
5767 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5768 : define a shorthand compile call for compilations that should be ok.
5769 compile_ok='
5770 mc_file=$1;
5771 shift;
5772 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5773
5774 : stub, used only to satisfy other units
5775 i_stdlib='define'
5776
5777 : check for lengths of integral types
5778 echo " "
5779 case "$intsize" in
5780 '')
5781         echo "Checking to see how big your integers are..." >&4
5782         $cat >try.c <<EOCP
5783 #include <stdio.h>
5784 #$i_stdlib I_STDLIB
5785 #ifdef I_STDLIB
5786 #include <stdlib.h>
5787 #endif
5788 #include <stdio.h>
5789 int main()
5790 {
5791         printf("intsize=%d;\n", (int)sizeof(int));
5792         printf("longsize=%d;\n", (int)sizeof(long));
5793         printf("shortsize=%d;\n", (int)sizeof(short));
5794         exit(0);
5795 }
5796 EOCP
5797         set try
5798         if eval $compile_ok && $run ./try > /dev/null; then
5799                 eval `$run ./try`
5800                 echo "Your integers are $intsize bytes long."
5801                 echo "Your long integers are $longsize bytes long."
5802                 echo "Your short integers are $shortsize bytes long."
5803         else
5804                 $cat >&4 <<EOM
5805 !
5806 Help! I can't compile and run the intsize test program: please enlighten me!
5807 (This is probably a misconfiguration in your system or libraries, and
5808 you really ought to fix it.  Still, I'll try anyway.)
5809 !
5810 EOM
5811                 dflt=4
5812                 rp="What is the size of an integer (in bytes)?"
5813                 . ./myread
5814                 intsize="$ans"
5815                 dflt=$intsize
5816                 rp="What is the size of a long integer (in bytes)?"
5817                 . ./myread
5818                 longsize="$ans"
5819                 dflt=2
5820                 rp="What is the size of a short integer (in bytes)?"
5821                 . ./myread
5822                 shortsize="$ans"
5823         fi
5824         ;;
5825 esac
5826 $rm_try
5827
5828 : check for long long
5829 echo " "
5830 echo "Checking to see if you have long long..." >&4
5831 echo 'int main() { long long x = 7; return 0; }' > try.c
5832 set try
5833 if eval $compile; then
5834         val="$define"
5835         echo "You have long long."
5836 else
5837         val="$undef"
5838         echo "You do not have long long."
5839 fi
5840 $rm_try
5841 set d_longlong
5842 eval $setvar
5843
5844 : check for length of long long
5845 case "${d_longlong}${longlongsize}" in
5846 $define)
5847         echo " "
5848         echo "Checking to see how big your long longs are..." >&4
5849         $cat >try.c <<'EOCP'
5850 #include <stdio.h>
5851 int main()
5852 {
5853     printf("%d\n", (int)sizeof(long long));
5854     return(0);
5855 }
5856 EOCP
5857         set try
5858         if eval $compile_ok; then
5859                 longlongsize=`$run ./try`
5860                 echo "Your long longs are $longlongsize bytes long."
5861         else
5862                 dflt='8'
5863                 echo " "
5864                 echo "(I can't seem to compile the test program.  Guessing...)"
5865                 rp="What is the size of a long long (in bytes)?"
5866                 . ./myread
5867                 longlongsize="$ans"
5868         fi
5869         if $test "X$longsize" = "X$longlongsize"; then
5870                 echo "(That isn't any different from an ordinary long.)"
5871         fi
5872         ;;
5873 esac
5874 $rm_try
5875
5876 : determine filename position in cpp output
5877 echo " "
5878 echo "Computing filename position in cpp output for #include directives..." >&4
5879 case "$osname" in
5880 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5881 esac
5882 case "$fieldn" in
5883 '')
5884 case "$osname" in
5885 vos) testaccess=-e ;;
5886 *)   testaccess=-r ;;
5887 esac
5888 echo '#include <stdio.h>' > foo.c
5889 $cat >fieldn <<EOF
5890 $startsh
5891 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5892 $grep '^[       ]*#.*stdio\.h' | \
5893 while read cline; do
5894         pos=1
5895         set \$cline
5896         while $test \$# -gt 0; do
5897                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5898                         echo "\$pos"
5899                         exit 0
5900                 fi
5901                 shift
5902                 pos=\`expr \$pos + 1\`
5903         done
5904 done
5905 EOF
5906 chmod +x fieldn
5907 fieldn=`./fieldn`
5908 $rm -f foo.c fieldn
5909 ;;
5910 esac
5911 case $fieldn in
5912 '') pos='???';;
5913 1) pos=first;;
5914 2) pos=second;;
5915 3) pos=third;;
5916 *) pos="${fieldn}th";;
5917 esac
5918 echo "Your cpp writes the filename in the $pos field of the line."
5919
5920 : locate header file
5921 $cat >findhdr <<EOF
5922 $startsh
5923 wanted=\$1
5924 name=''
5925 for usrincdir in $incpth
5926 do
5927         if test -f \$usrincdir/\$wanted; then
5928                 echo "\$usrincdir/\$wanted"
5929                 exit 0
5930         fi
5931 done
5932 awkprg='{ print \$$fieldn }'
5933 echo "#include <\$wanted>" > foo\$\$.c
5934 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5935 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5936 while read cline; do
5937         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5938         case "\$name" in
5939         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5940         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5941         *) exit 2;;
5942         esac;
5943 done;
5944 #
5945 # status = 0: grep returned 0 lines, case statement not executed
5946 # status = 1: headerfile found
5947 # status = 2: while loop executed, no headerfile found
5948 #
5949 status=\$?
5950 $rm -f foo\$\$.c;
5951 if test \$status -eq 1; then
5952         exit 0;
5953 fi
5954 exit 1
5955 EOF
5956 chmod +x findhdr
5957
5958 : define an alternate in-header-list? function
5959 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5960 cont=true; xxf="echo \"<\$1> found.\" >&4";
5961 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5962 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5963 esac;
5964 case $# in 4) instead=instead;; *) instead="at last";; esac;
5965 while $test "$cont"; do
5966         xxx=`./findhdr $1`
5967         var=$2; eval "was=\$$2";
5968         if $test "$xxx" && $test -r "$xxx";
5969         then eval $xxf;
5970         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5971                 cont="";
5972         else eval $xxnf;
5973         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5974         set $yyy; shift; shift; yyy=$@;
5975         case $# in 0) cont="";;
5976         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5977                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5978         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5979                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5980         esac;
5981 done;
5982 while $test "$yyy";
5983 do set $yyy; var=$2; eval "was=\$$2";
5984         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5985         set $yyy; shift; shift; yyy=$@;
5986 done'
5987
5988 : see if inttypes.h is available
5989 : we want a real compile instead of Inhdr because some systems
5990 : have an inttypes.h which includes non-existent headers
5991 echo " "
5992 $cat >try.c <<EOCP
5993 #include <inttypes.h>
5994 int main() {
5995         static int32_t foo32 = 0x12345678;
5996 }
5997 EOCP
5998 set try
5999 if eval $compile; then
6000         echo "<inttypes.h> found." >&4
6001         val="$define"
6002 else
6003         echo "<inttypes.h> NOT found." >&4
6004         val="$undef"
6005 fi
6006 $rm_try
6007 set i_inttypes
6008 eval $setvar
6009
6010 : check for int64_t
6011 echo " "
6012 echo "Checking to see if you have int64_t..." >&4
6013 $cat >try.c <<EOCP
6014 #include <sys/types.h>
6015 #$i_inttypes I_INTTYPES
6016 #ifdef I_INTTYPES
6017 #include <inttypes.h>
6018 #endif
6019 int main() { int64_t x = 7; }
6020 EOCP
6021 set try
6022 if eval $compile; then
6023         val="$define"
6024         echo "You have int64_t."
6025 else
6026         val="$undef"
6027         echo "You do not have int64_t."
6028 fi
6029 $rm_try
6030 set d_int64_t
6031 eval $setvar
6032
6033 : Check if 64bit ints have a quad type
6034 echo " "
6035 echo "Checking which 64-bit integer type we could use..." >&4
6036
6037 case "$intsize" in
6038 8) val=int
6039    set quadtype
6040    eval $setvar
6041    val='"unsigned int"'
6042    set uquadtype
6043    eval $setvar
6044    quadkind=1
6045    ;;
6046 *) case "$longsize" in
6047    8) val=long
6048       set quadtype
6049       eval $setvar
6050       val='"unsigned long"'
6051       set uquadtype
6052       eval $setvar
6053       quadkind=2
6054       ;;
6055    *) case "$d_longlong:$longlongsize" in
6056       define:8)
6057         val='"long long"'
6058         set quadtype
6059         eval $setvar
6060         val='"unsigned long long"'
6061         set uquadtype
6062         eval $setvar
6063         quadkind=3
6064         ;;
6065       *) case "$d_int64_t" in
6066          define)
6067            val=int64_t
6068            set quadtype
6069            eval $setvar
6070            val=uint64_t
6071            set uquadtype
6072            eval $setvar
6073            quadkind=4
6074            ;;
6075          esac
6076          ;;
6077       esac
6078       ;;
6079    esac
6080    ;;
6081 esac
6082
6083 case "$quadtype" in
6084 '')     echo "Alas, no 64-bit integer types in sight." >&4
6085         d_quad="$undef"
6086         ;;
6087 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6088         d_quad="$define"
6089         ;;
6090 esac
6091
6092 : Do we want 64bit support
6093 case "$uselonglong" in
6094 "$define"|true|[yY]*)
6095         cat <<EOM >&4
6096
6097 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6098 EOM
6099         use64bitint="$define"
6100         ;;
6101 esac
6102 case "$use64bits" in
6103 "$define"|true|[yY]*)
6104         cat <<EOM >&4
6105
6106 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6107 EOM
6108         use64bitint="$define"
6109         ;;
6110 esac
6111 case "$use64bitints" in
6112 "$define"|true|[yY]*)
6113         cat <<EOM >&4
6114
6115 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6116 EOM
6117         use64bitint="$define"
6118         ;;
6119 esac
6120 case "$use64bitsint" in
6121 "$define"|true|[yY]*)
6122         cat <<EOM >&4
6123
6124 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6125 EOM
6126         use64bitint="$define"
6127         ;;
6128 esac
6129 case "$uselonglongs" in
6130 "$define"|true|[yY]*)
6131         cat <<EOM >&4
6132
6133 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6134 EOM
6135         use64bitint="$define"
6136         ;;
6137 esac
6138 case "$use64bitsall" in
6139 "$define"|true|[yY]*)
6140         cat <<EOM >&4
6141
6142 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6143 EOM
6144         use64bitall="$define"
6145         ;;
6146 esac
6147
6148 case "$ccflags" in
6149 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6150 esac
6151 case "$use64bitall" in
6152 "$define"|true|[yY]*) use64bitint="$define" ;;
6153 esac
6154
6155 case "$longsize" in
6156 8) cat <<EOM
6157
6158 You have natively 64-bit long integers.
6159 EOM
6160    val="$define"
6161    ;;
6162 *) case "$use64bitint" in
6163    "$define"|true|[yY]*) dflt='y';;
6164    *) dflt='n';;
6165    esac
6166    case "$d_quad" in
6167    "$define") ;;
6168    *) dflt='n' ;;
6169    esac
6170    cat <<EOM
6171
6172 Perl can be built to take advantage of 64-bit integer types
6173 on some systems.  To do so, Configure can be run with -Duse64bitint.
6174 Choosing this option will most probably introduce binary incompatibilities.
6175
6176 If this doesn't make any sense to you, just accept the default '$dflt'.
6177 (The default has been chosen based on your configuration.)
6178 EOM
6179    rp='Try to use 64-bit integers, if available?'
6180    . ./myread
6181    case "$ans" in
6182    [yY]*) val="$define" ;;
6183    *)     val="$undef"  ;;
6184    esac
6185    ;;
6186 esac
6187 set use64bitint
6188 eval $setvar
6189
6190 case "$use64bitall" in
6191 "$define"|true|[yY]*) dflt='y' ;;
6192 *) case "$longsize" in
6193    8) dflt='y' ;;
6194    *) dflt='n' ;;
6195    esac
6196    ;;
6197 esac
6198 cat <<EOM
6199
6200 You may also choose to try maximal 64-bitness.  It means using as much
6201 64-bitness as possible on the platform.  This in turn means even more
6202 binary incompatibilities.  On the other hand, your platform may not
6203 have any more 64-bitness available than what you already have chosen.
6204
6205 If this doesn't make any sense to you, just accept the default '$dflt'.
6206 (The default has been chosen based on your configuration.)
6207 EOM
6208 rp='Try to use maximal 64-bit support, if available?'
6209 . ./myread
6210 case "$ans" in
6211 [yY]*) val="$define" ;;
6212 *)     val="$undef"  ;;
6213 esac
6214 set use64bitall
6215 eval $setvar
6216 case "$use64bitall" in
6217 "$define")
6218         case "$use64bitint" in
6219         "$undef")
6220                 cat <<EOM
6221
6222 Since you have chosen a maximally 64-bit build, I'm also turning on
6223 the use of 64-bit integers.
6224 EOM
6225                 use64bitint="$define" ;;
6226         esac
6227         ;;
6228 esac
6229
6230 : Look for a hint-file generated 'call-back-unit'.  If the
6231 : user has specified that a 64-bit perl is to be built,
6232 : we may need to set or change some other defaults.
6233 if $test -f use64bitint.cbu; then
6234         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6235         . ./use64bitint.cbu
6236 fi
6237 case "$use64bitint" in
6238 "$define"|true|[yY]*)
6239         : This test was common to all the OpenBSD forks, and seems harmless for
6240         : other platforms:
6241         echo " "
6242         echo "Checking if your C library has broken 64-bit functions..." >&4
6243         cat >try.c <<EOCP
6244 #include <stdio.h>
6245 typedef $uquadtype myULL;
6246 int main (void)
6247 {
6248     struct {
6249         double d;
6250         myULL  u;
6251     } *p, test[] = {
6252         {4294967303.15, 4294967303ULL},
6253         {4294967294.2,  4294967294ULL},
6254         {4294967295.7,  4294967295ULL},
6255         {0.0, 0ULL}
6256     };
6257     for (p = test; p->u; p++) {
6258         myULL x = (myULL)p->d;
6259         if (x != p->u) {
6260             printf("buggy\n");
6261             return 0;
6262         }
6263     }
6264     printf("ok\n");
6265     return 0;
6266 }
6267 EOCP
6268         set try
6269         if eval $compile_ok; then
6270             libcquad=`$run ./try`
6271             echo "Your C library's 64-bit functions are $libcquad."
6272         else
6273             echo "(I can't seem to compile the test program.)"
6274             echo "Assuming that your C library's 64-bit functions are ok."
6275             libcquad="ok"
6276         fi
6277         $rm_try
6278
6279         case "$libcquad" in
6280             buggy*)
6281                 cat >&4 <<EOM
6282
6283 *** You have a C library with broken 64-bit functions.
6284 *** 64-bit support does not work reliably in this configuration.
6285 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6286 *** Cannot continue, aborting.
6287
6288 EOM
6289                 exit 1
6290                 ;;
6291         esac
6292         case "$longsize" in
6293         4) case "$archname64" in
6294            '') archname64=64int ;;
6295            esac
6296            ;;
6297         esac
6298         ;;
6299 esac
6300
6301 : Look for a hint-file generated 'call-back-unit'.  If the
6302 : user has specified that a maximally 64-bit perl is to be built,
6303 : we may need to set or change some other defaults.
6304 if $test -f use64bitall.cbu; then
6305         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6306         . ./use64bitall.cbu
6307 fi
6308 case "$use64bitall" in
6309 "$define"|true|[yY]*)
6310         case "$longsize" in
6311         4) case "$archname64" in
6312            ''|64int) archname64=64all ;;
6313            esac
6314            ;;
6315         esac
6316         ;;
6317 esac
6318
6319 case "$d_quad:$use64bitint" in
6320 $undef:$define)
6321         cat >&4 <<EOF
6322
6323 *** You have chosen to use 64-bit integers,
6324 *** but none can be found.
6325 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6326 *** Cannot continue, aborting.
6327
6328 EOF
6329         exit 1
6330         ;;
6331 esac
6332
6333 : Check if we are using the GNU C library
6334 echo " "
6335 echo "Checking for GNU C Library..." >&4
6336 cat >try.c <<'EOCP'
6337 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6338    alone are insufficient to distinguish different versions, such as
6339    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6340    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6341 */
6342 #include <stdio.h>
6343 int main(void)
6344 {
6345 #ifdef __GLIBC__
6346 #   ifdef __GLIBC_MINOR__
6347 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6348 #           include <gnu/libc-version.h>
6349             printf("%s\n",  gnu_get_libc_version());
6350 #       else
6351             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6352 #       endif
6353 #   else
6354         printf("%d\n",  __GLIBC__);
6355 #   endif
6356     return 0;
6357 #else
6358     return 1;
6359 #endif
6360 }
6361 EOCP
6362 set try
6363 if eval $compile_ok && $run ./try > glibc.ver; then
6364         val="$define"
6365         gnulibc_version=`$cat glibc.ver`
6366         echo "You are using the GNU C Library version $gnulibc_version"
6367 else
6368         val="$undef"
6369         gnulibc_version=''
6370         echo "You are not using the GNU C Library"
6371 fi
6372 $rm_try glibc.ver
6373 set d_gnulibc
6374 eval $setvar
6375
6376 : see if nm is to be used to determine whether a symbol is defined or not
6377 case "$usenm" in
6378 '')
6379         dflt=''
6380         case "$d_gnulibc" in
6381         "$define")
6382                 echo " "
6383                 echo "nm probably won't work on the GNU C Library." >&4
6384                 dflt=n
6385                 ;;
6386         esac
6387         case "$dflt" in
6388         '')
6389                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6390                         echo " "
6391                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6392                         echo "'nm' won't be sufficient on this system." >&4
6393                         dflt=n
6394                 fi
6395                 ;;
6396         esac
6397         case "$dflt" in
6398         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6399                 if $test $dflt -gt 20; then
6400                         dflt=y
6401                 else
6402                         dflt=n
6403                 fi
6404                 ;;
6405         esac
6406         ;;
6407 *)
6408         case "$usenm" in
6409         true|$define) dflt=y;;
6410         *) dflt=n;;
6411         esac
6412         ;;
6413 esac
6414 $cat <<EOM
6415
6416 I can use $nm to extract the symbols from your C libraries. This
6417 is a time consuming task which may generate huge output on the disk (up
6418 to 3 megabytes) but that should make the symbols extraction faster. The
6419 alternative is to skip the 'nm' extraction part and to compile a small
6420 test program instead to determine whether each symbol is present. If
6421 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6422 this may be the best solution.
6423
6424 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6425
6426 EOM
6427 rp="Shall I use $nm to extract C symbols from the libraries?"
6428 . ./myread
6429 case "$ans" in
6430 [Nn]*) usenm=false;;
6431 *) usenm=true;;
6432 esac
6433
6434 runnm=$usenm
6435 case "$reuseval" in
6436 true) runnm=false;;
6437 esac
6438
6439 : nm options which may be necessary
6440 case "$nm_opt" in
6441 '') if $test -f /mach_boot; then
6442                 nm_opt=''       # Mach
6443         elif $test -d /usr/ccs/lib; then
6444                 nm_opt='-p'     # Solaris (and SunOS?)
6445         elif $test -f /dgux; then
6446                 nm_opt='-p'     # DG-UX
6447         elif $test -f /lib64/rld; then
6448                 nm_opt='-p'     # 64-bit Irix
6449         else
6450                 nm_opt=''
6451         fi;;
6452 esac
6453
6454 : nm options which may be necessary for shared libraries but illegal
6455 : for archive libraries.  Thank you, Linux.
6456 case "$nm_so_opt" in
6457 '')     case "$myuname" in
6458         *linux*|gnu*)
6459                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6460                         nm_so_opt='--dynamic'
6461                 fi
6462                 ;;
6463         esac
6464         ;;
6465 esac
6466
6467 : Figure out where the libc is located
6468 case "$runnm" in
6469 true)
6470 : get list of predefined functions in a handy place
6471 echo " "
6472 case "$libc" in
6473 '') libc=unknown
6474         case "$libs" in
6475         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6476         esac
6477         ;;
6478 esac
6479 case "$libs" in
6480 '') ;;
6481 *)  for thislib in $libs; do
6482         case "$thislib" in
6483         -lc|-lc_s)
6484                 : Handle C library specially below.
6485                 ;;
6486         -l*)
6487                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6488                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6489                         :
6490                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6491                         :
6492                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6493                         :
6494                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6495                         :
6496                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6497                         :
6498                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6499                         :
6500                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6501                         :
6502                 else
6503                         try=''
6504                 fi
6505                 libnames="$libnames $try"
6506                 ;;
6507         *) libnames="$libnames $thislib" ;;
6508         esac
6509         done
6510         ;;
6511 esac
6512 xxx=normal
6513 case "$libc" in
6514 unknown)
6515         set /lib/libc.$so
6516         for xxx in $libpth; do
6517                 $test -r $1 || set $xxx/libc.$so
6518                 : The messy sed command sorts on library version numbers.
6519                 $test -r $1 || \
6520                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6521                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6522                                 h
6523                                 s/[0-9][0-9]*/0000&/g
6524                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6525                                 G
6526                                 s/\n/ /' | \
6527                          $sort | $sed -e 's/^.* //'`
6528                 eval set \$$#
6529         done
6530         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6531         $test -r $1 || set $sysroot/lib/libsys_s$_a
6532         ;;
6533 *)
6534         set blurfl
6535         ;;
6536 esac
6537 if $test -r "$1"; then
6538         echo "Your (shared) C library seems to be in $1."
6539         libc="$1"
6540 elif $test -r /lib/libc && $test -r /lib/clib; then
6541         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6542         xxx=apollo
6543         libc='/lib/clib /lib/libc'
6544         if $test -r /lib/syslib; then
6545                 echo "(Your math library is in /lib/syslib.)"
6546                 libc="$libc /lib/syslib"
6547         fi
6548 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6549         echo "Your C library seems to be in $libc, as you said before."
6550 elif $test -r $incpath/usr/lib/libc$_a; then
6551         libc=$incpath/usr/lib/libc$_a;
6552         echo "Your C library seems to be in $libc.  That's fine."
6553 elif $test -r /lib/libc$_a; then
6554         libc=/lib/libc$_a;
6555         echo "Your C library seems to be in $libc.  You're normal."
6556 else
6557         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6558                 :
6559         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6560                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6561         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6562                 :
6563         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6564                 :
6565         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6566                 :
6567         else
6568                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6569         fi
6570         if $test -r "$tans"; then
6571                 echo "Your C library seems to be in $tans, of all places."
6572                 libc=$tans
6573         else
6574                 libc='blurfl'
6575         fi
6576 fi
6577 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6578         dflt="$libc"
6579         cat <<EOM
6580
6581 If the guess above is wrong (which it might be if you're using a strange
6582 compiler, or your machine supports multiple models), you can override it here.
6583
6584 EOM
6585 else
6586         dflt=''
6587         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6588         cat >&4 <<EOM
6589 I can't seem to find your C library.  I've looked in the following places:
6590
6591 EOM
6592         $sed 's/^/      /' libpath
6593         cat <<EOM
6594
6595 None of these seems to contain your C library. I need to get its name...
6596
6597 EOM
6598 fi
6599 fn=f
6600 rp='Where is your C library?'
6601 . ./getfile
6602 libc="$ans"
6603
6604 echo " "
6605 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6606 set X `cat libnames`
6607 shift
6608 xxx=files
6609 case $# in 1) xxx=file; esac
6610 echo "Extracting names from the following $xxx for later perusal:" >&4
6611 echo " "
6612 $sed 's/^/      /' libnames >&4
6613 echo " "
6614 $echo $n "This may take a while...$c" >&4
6615
6616 for file in $*; do
6617         case $file in
6618         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6619         *) $nm $nm_opt $file 2>/dev/null;;
6620         esac
6621 done >libc.tmp
6622
6623 $echo $n ".$c"
6624 $grep fprintf libc.tmp > libc.ptf
6625 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6626 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6627 xxx='[ADTSIWi]'
6628 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6629         eval $xscan;\
6630         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6631                 eval $xrun
6632 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6633         eval $xscan;\
6634         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6635                 eval $xrun
6636 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6637         eval $xscan;\
6638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6639                 eval $xrun
6640 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //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 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6645         eval $xscan;\
6646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6647                 eval $xrun
6648 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6649         eval $xscan;\
6650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6651                 eval $xrun
6652 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6653                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6654         eval $xscan;\
6655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6656                 eval $xrun
6657 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6658         eval $xscan;\
6659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6660                 eval $xrun
6661 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6662         eval $xscan;\
6663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6664                 eval $xrun
6665 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6666         eval $xscan;\
6667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6668                 eval $xrun
6669 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6670         eval $xscan;\
6671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6672                 eval $xrun
6673 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6674         eval $xscan;\
6675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6676                 eval $xrun
6677 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6678         eval $xscan;\
6679         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6680                 eval $xrun
6681 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6682         eval $xscan;\
6683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6684                 eval $xrun
6685 else
6686         $nm -p $* 2>/dev/null >libc.tmp
6687         $grep fprintf libc.tmp > libc.ptf
6688         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6689                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6690         then
6691                 nm_opt='-p'
6692                 eval $xrun
6693         else
6694                 echo " "
6695                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6696                 com=''
6697                 if $ar t $libc > libc.tmp && \
6698                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6699                 then
6700                         for thisname in $libnames $libc; do
6701                                 $ar t $thisname >>libc.tmp
6702                         done
6703                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6704                         echo "Ok." >&4
6705                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6706                         for thisname in $libnames $libc; do
6707                                 $ar tv $thisname >>libc.tmp
6708                                 emximp -o tmp.imp $thisname \
6709                                     2>/dev/null && \
6710                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6711                                     < tmp.imp >>libc.tmp
6712                                 $rm -f tmp.imp
6713                         done
6714                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6715                         echo "Ok." >&4
6716                 else
6717                         echo "$ar didn't seem to work right." >&4
6718                         echo "Maybe this is a Cray...trying bld instead..." >&4
6719                         if  bld t $libc | \
6720                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6721                                 $test -s libc.list
6722                         then
6723                                 for thisname in $libnames; do
6724                                         bld t $libnames | \
6725                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6726                                         $ar t $thisname >>libc.tmp
6727                                 done
6728                                 echo "Ok." >&4
6729                         else
6730                                 echo "That didn't work either.  Giving up." >&4
6731                                 exit 1
6732                         fi
6733                 fi
6734         fi
6735 fi
6736 nm_extract="$com"
6737 case "$PASE" in
6738 define)
6739     echo " "
6740     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6741     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6742     ;;
6743 *)  if $test -f /lib/syscalls.exp; then
6744         echo " "
6745         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6746         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6747                 /lib/syscalls.exp >>libc.list
6748     fi
6749     ;;
6750 esac
6751 ;;
6752 esac
6753 $rm -f libnames libpath
6754
6755 : Check if we are using C++
6756 echo " "
6757 echo "Checking for C++..." >&4
6758 $cat >try.c <<'EOCP'
6759 #include <stdio.h>
6760 int main(void)
6761 {
6762 #ifdef __cplusplus
6763     return 0;
6764 #else
6765     return 1;
6766 #endif
6767 }
6768 EOCP
6769 set try
6770 if eval $compile_ok && $run ./try; then
6771         val="$define"
6772         echo "You are using a C++ compiler."
6773 else
6774         val="$undef"
6775         echo "You are not using a C++ compiler."
6776 fi
6777 $rm_try cplusplus$$
6778 set d_cplusplus
6779 eval $setvar
6780
6781 : is a C symbol defined?
6782 csym='tlook=$1;
6783 case "$3" in
6784 -v) tf=libc.tmp; tdc="";;
6785 -a) tf=libc.tmp; tdc="[]";;
6786 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6787 esac;
6788 case "$d_cplusplus" in
6789     $define)    extern_C="extern \"C\"" ;;
6790     *)          extern_C="extern"       ;;
6791 esac;
6792 tx=yes;
6793 case "$reuseval-$4" in
6794 true-) ;;
6795 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6796 esac;
6797 case "$tx" in
6798 yes)
6799         tval=false;
6800         if $test "$runnm" = true; then
6801                 if $contains $tlook $tf >/dev/null 2>&1; then
6802                         tval=true;
6803                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6804                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6805                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6806                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6807                         $rm_try;
6808                 fi;
6809         else
6810                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main(int argc, char **argv) { if(p() && p() != (void *)argv[0]) return(0); else return(1); }"> try.c;
6811                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6812                 $rm_try;
6813         fi;
6814         ;;
6815 *)
6816         case "$tval" in
6817         $define) tval=true;;
6818         *) tval=false;;
6819         esac;
6820         ;;
6821 esac;
6822 eval "$2=$tval"'
6823
6824 : define an is-in-libc? function
6825 inlibc='echo " "; td=$define; tu=$undef;
6826 sym=$1; var=$2; eval "was=\$$2";
6827 tx=yes;
6828 case "$reuseval$was" in
6829 true) ;;
6830 true*) tx=no;;
6831 esac;
6832 case "$tx" in
6833 yes)
6834         set $sym tres -f;
6835         eval $csym;
6836         case "$tres" in
6837         true)
6838                 echo "$sym() found." >&4;
6839                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6840         *)
6841                 echo "$sym() NOT found." >&4;
6842                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6843         esac;;
6844 *)
6845         case "$was" in
6846         $define) echo "$sym() found." >&4;;
6847         *) echo "$sym() NOT found." >&4;;
6848         esac;;
6849 esac'
6850
6851 : check for length of double
6852 echo " "
6853 case "$doublesize" in
6854 '')
6855         echo "Checking to see how big your double precision numbers are..." >&4
6856         $cat >try.c <<EOCP
6857 #include <stdio.h>
6858 #$i_stdlib I_STDLIB
6859 #ifdef I_STDLIB
6860 #include <stdlib.h>
6861 #endif
6862 #include <stdio.h>
6863 int main()
6864 {
6865     printf("%d\n", (int)sizeof(double));
6866     exit(0);
6867 }
6868 EOCP
6869         set try
6870         if eval $compile_ok; then
6871                 doublesize=`$run ./try`
6872                 echo "Your double is $doublesize bytes long."
6873         else
6874                 dflt='8'
6875                 echo "(I can't seem to compile the test program.  Guessing...)"
6876                 rp="What is the size of a double precision number (in bytes)?"
6877                 . ./myread
6878                 doublesize="$ans"
6879         fi
6880         ;;
6881 esac
6882 $rm_try
6883
6884 : check for long doubles
6885 echo " " >&4
6886 echo "Checking to see if you have long double..." >&4
6887 echo 'int main() { long double x = 7.0; }' > try.c
6888 set try
6889 if eval $compile; then
6890         val="$define"
6891         echo "You have long double." >&4
6892 else
6893         val="$undef"
6894         echo "You do not have long double." >&4
6895 fi
6896 $rm_try
6897 set d_longdbl
6898 eval $setvar
6899
6900 : see if ldexpl exists
6901 set ldexpl d_ldexpl
6902 eval $inlibc
6903
6904 : check for length of long double
6905 case "${d_longdbl}${longdblsize}" in
6906 $define)
6907         echo " " >&4
6908         echo "Checking to see how big your long doubles are..." >&4
6909         $cat >try.c <<'EOCP'
6910 #include <stdio.h>
6911 int main()
6912 {
6913         printf("%d\n", sizeof(long double));
6914 }
6915 EOCP
6916         set try
6917         set try
6918         if eval $compile; then
6919                 longdblsize=`$run ./try`
6920                 echo "Your long doubles are $longdblsize bytes long." >&4
6921         else
6922                 dflt='8'
6923                 echo " " >&4
6924                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6925                 rp="What is the size of a long double (in bytes)?"
6926                 . ./myread
6927                 longdblsize="$ans"
6928         fi
6929         if $test "X$doublesize" = "X$longdblsize"; then
6930                 echo "That isn't any different from an ordinary double." >&4
6931                 echo "I'll keep your setting anyway, but you may see some" >&4
6932                 echo "harmless compilation warnings." >&4
6933         fi
6934         ;;
6935 esac
6936 $rm_try
6937
6938 $echo "Checking the kind of long doubles you have..." >&4
6939 case "$d_longdbl" in
6940 define)
6941 $cat <<EOP >try.c
6942 #$i_stdlib I_STDLIB
6943 #define LONGDBLSIZE $longdblsize
6944 #define DOUBLESIZE $doublesize
6945 #include <float.h>
6946 #ifdef I_STDLIB
6947 #include <stdlib.h>
6948 #endif
6949 #include <stdio.h>
6950 static const long double d = -0.1L;
6951 int main() {
6952   unsigned const char* b = (unsigned const char*)(&d);
6953 #if DOUBLESIZE == LONGDBLSIZE
6954   printf("0\n"); /* if it floats like double */
6955   exit(0);
6956 #endif
6957 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6958   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6959     /* IEEE 754 128-bit little-endian */
6960     printf("1\n");
6961     exit(0);
6962   }
6963   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6964     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6965     printf("2\n");
6966     exit(0);
6967   }
6968 #endif
6969 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6970  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6971  * cannot be trusted. */
6972 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6973   if (b[0] == 0xCD && b[9] == 0xBF) {
6974     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6975      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6976      * Also known as "extended precision". */
6977     printf("3\n");
6978     exit(0);
6979   }
6980   if (b[0] == 0xBF && b[9] == 0xCD) {
6981     /* Is there ever big-endian 80-bit, really?
6982      *
6983      * The Motorola 68881 had another "extended precision" format:
6984      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6985      * for total of 96 bits of bytes.  The zero bits were unused.
6986      * See "M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL" for more details.
6987      * If it ever becomes relevant, this format should be allocated a
6988      * new doublekind code since it is quite different from the Intel x87.
6989      */
6990     printf("4\n");
6991     exit(0);
6992   }
6993 #endif
6994 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6995   /* software "double double", the 106 is 53+53.
6996    * but irix thinks it is 107. */
6997   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6998     /* double double 128-bit fully little-endian,
6999      * little-endian doubles in little-endian order,
7000      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7001     printf("5\n");
7002     exit(0);
7003   }
7004   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7005     /* double double 128-bit fully big-endian,
7006      * big-endian doubles in big-endian order,
7007      * e.g. PPC/Power and MIPS:
7008      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7009     printf("6\n");
7010     exit(0);
7011   }
7012   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7013     /* double double 128-bit mixed endian.
7014      * little-endian doubles in big-endian order,
7015      * e.g. ppc64el,
7016      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7017     printf("7\n");
7018     exit(0);
7019   }
7020   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7021     /* double double 128-bit mixed endian,
7022      * big-endian doubles in little-endian order,
7023      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7024     printf("8\n");
7025     exit(0);
7026   }
7027 #endif
7028 /* We are largely making this up because it may well be
7029  * that the VAX format H was never made available to C,
7030  * only to Fortran. */
7031 #if LONGDBLSIZE == 16 && defined(__vax__)
7032   if (b[0] == 0xFD && b[15] == 0x99) {
7033     /* VAX format H, PDP-11 mixed endian. */
7034     printf("9\n");
7035     exit(0);
7036   }
7037 #endif
7038   printf("-1\n"); /* unknown */
7039   exit(0);
7040 }
7041 EOP
7042 set try
7043 if eval $compile; then
7044     longdblkind=`$run ./try`
7045 else
7046     longdblkind=-1
7047 fi
7048 ;;
7049 *) longdblkind=0 ;;
7050 esac
7051 case "$longdblkind" in
7052 0) echo "Your long doubles are doubles." >&4 ;;
7053 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7054 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7055 3) echo "You have x86 80-bit little endian long doubles." >&4 ;;
7056 4) echo "You have x86 80-bit big endian long doubles." >&4 ;;
7057 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >&4 ;;
7058 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >&4 ;;
7059 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >&4 ;;
7060 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >&4 ;;
7061 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >&4 ;;
7062 *) echo "Cannot figure out your long double." >&4 ;;
7063 esac
7064 d_long_double_style_ieee=$undef
7065 d_long_double_style_ieee_std=$undef
7066 d_long_double_style_ieee_extended=$undef
7067 d_long_double_style_ieee_doubledouble=$undef
7068 d_long_double_style_vax=$undef
7069 case "$longdblkind" in
7070 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7071 esac
7072 case "$longdblkind" in
7073 1|2) d_long_double_style_ieee_std=$define ;;
7074 esac
7075 case "$longdblkind" in
7076 3|4) d_long_double_style_ieee_extended=$define ;;
7077 esac
7078 case "$longdblkind" in
7079 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7080 esac
7081 case "$longdblkind" in
7082 9) d_long_double_style_vax=$define ;;
7083 esac
7084 $rm_try
7085
7086 : get the patchlevel
7087 echo " "
7088 echo "Getting the current patchlevel..." >&4
7089 if $test -r $rsrc/patchlevel.h;then
7090         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
7091         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
7092         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
7093         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
7094         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
7095         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
7096         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
7097 else
7098         revision=0
7099         patchlevel=0
7100         subversion=0
7101         api_revision=0
7102         api_version=0
7103         api_subversion=0
7104         perl_patchlevel=0
7105         $echo "(You do not have patchlevel.h.  Eek.)"
7106 fi
7107 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
7108 version_patchlevel_string="version $patchlevel subversion $subversion"
7109 case "$perl_patchlevel" in
7110 0|'') ;;
7111 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
7112     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
7113     ;;
7114 esac
7115
7116 $echo "(You have $package $version_patchlevel_string.)"
7117
7118 case "$osname" in
7119 dos|vms)
7120         : XXX Should be a Configure test for double-dots in filenames.
7121         version=`echo $revision $patchlevel $subversion | \
7122                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
7123         api_versionstring=`echo $api_revision $api_version $api_subversion | \
7124                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
7125         ;;
7126 *)
7127         version=`echo $revision $patchlevel $subversion | \
7128                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
7129         api_versionstring=`echo $api_revision $api_version $api_subversion | \
7130                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
7131         ;;
7132 esac
7133 : Special case the 5.005_xx maintenance series, which used 5.005
7134 : without any subversion label as a subdirectory in $sitelib
7135 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
7136         api_versionstring='5.005'
7137 fi
7138
7139 : Check if quadmath is requested
7140 case "$usequadmath" in
7141 "$define"|true|[yY]*) usequadmath="$define" ;;
7142 *)                    usequadmath="$undef"  ;;
7143 esac
7144
7145 : Fail if both uselongdouble and usequadmath are requested
7146 case "$usequadmath:$uselongdouble" in
7147 define:define)
7148         $cat <<EOM >&4
7149
7150 *** You requested the use of the quadmath library and use
7151 *** of long doubles.
7152 ***
7153 *** Please select one or the other.
7154 EOM
7155         exit 1
7156         ;;
7157 esac
7158
7159 : determine the architecture name
7160 echo " "
7161 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7162         tarch=`arch`"-$osname"
7163 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7164         if uname -m > tmparch 2>&1 ; then
7165                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7166                         -e 's/$/'"-$osname/" tmparch`
7167         else
7168                 tarch="$osname"
7169         fi
7170         $rm -f tmparch
7171 else
7172         tarch="$osname"
7173 fi
7174 case "$myarchname" in
7175 ''|"$tarch") ;;
7176 *)
7177         echo "(Your architecture name used to be $myarchname.)"
7178         archname=''
7179         ;;
7180 esac
7181 case "$targetarch" in
7182 '') ;;
7183 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7184 esac
7185 myarchname="$tarch"
7186 case "$archname" in
7187 '') dflt="$tarch";;
7188 *) dflt="$archname";;
7189 esac
7190 rp='What is your architecture name'
7191 . ./myread
7192 archname="$ans"
7193
7194 : optionally add API version to the architecture for versioned archlibs
7195 case "$useversionedarchname" in
7196 $define|true|[yY]*) dflt='y';;
7197 *)                  dflt='n';;
7198 esac
7199 rp='Add the Perl API version to your archname?'
7200 . ./myread
7201 case "$ans" in
7202 y|Y)    useversionedarchname="$define" ;;
7203 *)      useversionedarchname="$undef" ;;
7204 esac
7205 case "$useversionedarchname" in
7206 $define)
7207         case "$archname" in
7208         *-$api_versionstring)
7209                 echo "...and architecture name already has -$api_versionstring" >&4
7210                 ;;
7211         *)
7212                 archname="$archname-$api_versionstring"
7213                 echo "...setting architecture name to $archname." >&4
7214                 ;;
7215         esac
7216         ;;
7217 esac
7218
7219 case "$usethreads" in
7220 $define)
7221         echo "Threads selected." >&4
7222         case "$archname" in
7223         *-thread*) echo "...and architecture name already has -thread." >&4
7224                 ;;
7225         *)      archname="$archname-thread"
7226                 echo "...setting architecture name to $archname." >&4
7227                 ;;
7228         esac
7229         ;;
7230 esac
7231 case "$usemultiplicity" in
7232 $define)
7233         echo "Multiplicity selected." >&4
7234         case "$archname" in
7235         *-multi*) echo "...and architecture name already has -multi." >&4
7236                 ;;
7237         *)      archname="$archname-multi"
7238                 echo "...setting architecture name to $archname." >&4
7239                 ;;
7240         esac
7241         ;;
7242 esac
7243 case "$use64bitint$use64bitall" in
7244 *"$define"*)
7245         case "$archname64" in
7246         '')
7247                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7248                 ;;
7249         *)
7250                 case "$use64bitint" in
7251                 "$define") echo "64 bit integers selected." >&4 ;;
7252                 esac
7253                 case "$use64bitall" in
7254                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7255                 esac
7256                 case "$archname" in
7257                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7258                         ;;
7259                 *)      archname="$archname-$archname64"
7260                         echo "...setting architecture name to $archname." >&4
7261                         ;;
7262                 esac
7263                 ;;
7264         esac
7265 esac
7266 case "$uselongdouble" in
7267 $define)
7268         echo "Long doubles selected." >&4
7269         case "$longdblsize" in
7270         $doublesize)
7271                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7272                 ;;
7273         *)
7274                 case "$archname" in
7275                 *-ld*) echo "...and architecture name already has -ld." >&4
7276                         ;;
7277                 *)      archname="$archname-ld"
7278                         echo "...setting architecture name to $archname." >&4
7279                         ;;
7280                 esac
7281                 ;;
7282         esac
7283         ;;
7284 esac
7285 case "$usequadmath" in
7286 $define)
7287         echo "quadmath selected." >&4
7288         case "$archname" in
7289         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7290                 ;;
7291         *)      archname="$archname-quadmath"
7292                 echo "...setting architecture name to $archname." >&4
7293                 ;;
7294         esac
7295         ;;
7296 esac
7297 if $test -f archname.cbu; then
7298         echo "Your platform has some specific hints for architecture name, using them..."
7299         . ./archname.cbu
7300 fi
7301
7302 : set the prefixit variable, to compute a suitable default value
7303 prefixit='case "$3" in
7304 ""|none)
7305         case "$oldprefix" in
7306         "") eval "$1=\"\$$2\"";;
7307         *)
7308                 case "$3" in
7309                 "") eval "$1=";;
7310                 none)
7311                         eval "tp=\"\$$2\"";
7312                         case "$tp" in
7313                         ""|" "|none) eval "$1=\"\$$2\"";;
7314                         *) eval "$1=";;
7315                         esac;;
7316                 esac;;
7317         esac;;
7318 *)
7319         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7320         case "$tp" in
7321         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7322         /*-$oldprefix/*|\~*-$oldprefix/*)
7323                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7324         *) eval "$1=\"\$$2\"";;
7325         esac;;
7326 esac'
7327
7328 : determine installation style
7329 : For now, try to deduce it from prefix unless it is already set.
7330 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7331 case "$installstyle" in
7332 '')     case "$prefix" in
7333                 *perl*) dflt='lib';;
7334                 *) dflt='lib/perl5' ;;
7335         esac
7336         ;;
7337 *)      dflt="$installstyle" ;;
7338 esac
7339 : Probably not worth prompting for this since we prompt for all
7340 : the directories individually, and the prompt would be too long and
7341 : confusing anyway.
7342 installstyle=$dflt
7343
7344 : determine where public executables go
7345 echo " "
7346 set dflt bin bin
7347 eval $prefixit
7348 fn=d~
7349 rp='Pathname where the public executables will reside?'
7350 . ./getfile
7351 if $test "X$ansexp" != "X$binexp"; then
7352         installbin=''
7353 fi
7354 prefixvar=bin
7355 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7356 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7357 :     this via initialinstalllocation
7358 . ./setprefixvar
7359
7360 case "$userelocatableinc" in
7361 $define|true|[yY]*)     dflt='y' ;;
7362 *)                      dflt='n' ;;
7363 esac
7364 cat <<EOM
7365
7366 Would you like to build Perl so that the installation is relocatable, so that
7367 library paths in @INC are determined relative to the path of the perl binary?
7368 This is not advised for system Perl installs, or if you need to run setid
7369 scripts or scripts under taint mode.
7370
7371 If this doesn't make any sense to you, just accept the default '$dflt'.
7372 EOM
7373 rp='Use relocatable @INC?'
7374 . ./myread
7375 case "$ans" in
7376 y|Y)    val="$define" ;;
7377 *)      val="$undef"  ;;
7378 esac
7379 set userelocatableinc
7380 eval $setvar
7381
7382 initialinstalllocation="$binexp"
7383 : Default prefix is now "up one level from where the binaries are"
7384 case "$userelocatableinc" in
7385 $define|true|[yY]*)
7386     bin=".../"
7387     binexp=".../"
7388     prefix=".../.."
7389     prefixexp=".../.."
7390     installprefixexp=".../.."
7391     ;;
7392 esac
7393
7394 : determine where private library files go
7395 : Usual default is /usr/local/lib/perl5/$version.
7396 : Also allow things like /opt/perl/lib/$version, since
7397 : /opt/perl/lib/perl5... would be redundant.
7398 : The default "style" setting is made in installstyle.U
7399 case "$installstyle" in
7400 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7401 *)       set dflt privlib lib/$version ;;
7402 esac
7403 eval $prefixit
7404 $cat <<EOM
7405
7406 There are some auxiliary files for $package that need to be put into a
7407 private library directory that is accessible by everyone.
7408
7409 EOM
7410 fn=$binexp
7411 fn=d~+
7412 rp='Pathname where the private library files will reside?'
7413 . ./getfile
7414 prefixvar=privlib
7415 . ./setprefixvar
7416
7417 : set the prefixup variable, to restore leading tilda escape
7418 prefixup='case "$prefixexp" in
7419 "$prefix") ;;
7420 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7421 esac'
7422
7423 : determine where public architecture dependent libraries go
7424 set archlib archlib
7425 eval $prefixit
7426 : privlib default is /usr/local/lib/$package/$version
7427 : archlib default is /usr/local/lib/$package/$version/$archname
7428 : privlib may have an optional trailing /share.
7429 tdflt=`echo $privlib | $sed 's,/share$,,'`
7430 tdflt=$tdflt/$archname
7431 case "$archlib" in
7432 '')     dflt=$tdflt
7433         ;;
7434 *)      dflt="$archlib"
7435     ;;
7436 esac
7437 $cat <<EOM
7438
7439 $spackage contains architecture-dependent library files.  If you are
7440 sharing libraries in a heterogeneous environment, you might store
7441 these files in a separate location.  Otherwise, you can just include
7442 them with the rest of the public library files.
7443
7444 EOM
7445 fn=$binexp
7446 fn=d+~
7447 rp='Where do you want to put the public architecture-dependent libraries?'
7448 . ./getfile
7449 prefixvar=archlib
7450 . ./setprefixvar
7451 if $test X"$archlib" = X"$privlib"; then
7452         d_archlib="$undef"
7453 else
7454         d_archlib="$define"
7455 fi
7456
7457 : see if setuid scripts can be secure
7458 $cat <<EOM
7459
7460 Some kernels have a bug that prevents setuid #! scripts from being
7461 secure.  Some sites have disabled setuid #! scripts because of this.
7462
7463 First let's decide if your kernel supports secure setuid #! scripts.
7464 (If setuid #! scripts would be secure but have been disabled anyway,
7465 don't say that they are secure if asked.)
7466
7467 EOM
7468
7469 val="$undef"
7470 if $test -d /dev/fd; then
7471         echo "#!$ls" >reflect
7472         chmod +x,u+s reflect
7473         ./reflect >flect 2>&1
7474         if $contains "/dev/fd" flect >/dev/null; then
7475                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7476                 val="$define"
7477         else
7478                 $cat <<EOM
7479 If you are not sure if they are secure, I can check but I'll need a
7480 username and password different from the one you are using right now.
7481 If you don't have such a username or don't want me to test, simply
7482 enter 'none'.
7483
7484 EOM
7485                 rp='Other username to test security of setuid scripts with?'
7486                 dflt='none'
7487                 . ./myread
7488                 case "$ans" in
7489                 n|none)
7490                         case "$d_suidsafe" in
7491                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7492                                 dflt=n;;
7493                         "$undef")
7494                                 echo "Well, the $hint value is *not* secure." >&4
7495                                 dflt=n;;
7496                         *)      echo "Well, the $hint value *is* secure." >&4
7497                                 dflt=y;;
7498                         esac
7499                         ;;
7500                 *)
7501                         $rm -f reflect flect
7502                         echo "#!$ls" >reflect
7503                         chmod +x,u+s reflect
7504                         echo >flect
7505                         chmod a+w flect
7506                         echo '"su" will (probably) prompt you for '"$ans's password."
7507                         su $ans -c './reflect >flect'
7508                         if $contains "/dev/fd" flect >/dev/null; then
7509                                 echo "Okay, it looks like setuid scripts are secure." >&4
7510                                 dflt=y
7511                         else
7512                                 echo "I don't think setuid scripts are secure." >&4
7513                                 dflt=n
7514                         fi
7515                         ;;
7516                 esac
7517                 rp='Does your kernel have *secure* setuid scripts?'
7518                 . ./myread
7519                 case "$ans" in
7520                 [yY]*)  val="$define";;
7521                 *)      val="$undef";;
7522                 esac
7523         fi
7524 else
7525         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7526         echo "(That's for file descriptors, not floppy disks.)"
7527         val="$undef"
7528 fi
7529 set d_suidsafe
7530 eval $setvar
7531
7532 $rm -f reflect flect
7533
7534 : now see if they want to do setuid emulation
7535 if $test $patchlevel -lt 11; then
7536 echo " "
7537 val="$undef"
7538 case "$d_suidsafe" in
7539 "$define")
7540         val="$undef"
7541         echo "No need to emulate SUID scripts since they are secure here." >&4
7542         ;;
7543 *)
7544         $cat <<EOM
7545 Some systems have disabled setuid scripts, especially systems where
7546 setuid scripts cannot be secure.  On systems where setuid scripts have
7547 been disabled, the setuid/setgid bits on scripts are currently
7548 useless.  It is possible for $package to detect those bits and emulate
7549 setuid/setgid in a secure fashion.  This emulation will only work if
7550 setuid scripts have been disabled in your kernel.
7551
7552 EOM
7553         case "$d_dosuid" in
7554         "$define") dflt=y ;;
7555         *) dflt=n ;;
7556         esac
7557         rp="Do you want to do setuid/setgid emulation?"
7558         . ./myread
7559         case "$ans" in
7560         [yY]*)  val="$define";;
7561         *)      val="$undef";;
7562         esac
7563         ;;
7564 esac
7565 set d_dosuid
7566 eval $setvar
7567 else
7568     case "$d_dosuid" in
7569         "$define")
7570         cat >&4 <<EOH
7571
7572 SUID emulation has been removed for 5.12
7573 Please re-run Configure without -Dd_dosuid
7574
7575 EOH
7576         exit 1;
7577         ;;
7578     esac
7579     d_dosuid=undef
7580 fi
7581
7582 : Find perl5.005 or later.
7583 echo "Looking for a previously installed perl5.005 or later... "
7584 case "$perl5" in
7585 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7586                 : Check if this perl is recent and can load a simple module
7587                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7588                         perl5=$tdir/perl
7589                         break;
7590                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7591                         perl5=$tdir/perl5
7592                         break;
7593                 fi
7594         done
7595         ;;
7596 *)      perl5="$perl5"
7597         ;;
7598 esac
7599 case "$perl5" in
7600 '')     echo "None found.  That's ok.";;
7601 *)      echo "Using $perl5." ;;
7602 esac
7603
7604 : Set the siteprefix variables
7605 $cat <<EOM
7606
7607 After $package is installed, you may wish to install various
7608 add-on modules and utilities.  Typically, these add-ons will
7609 be installed under $prefix with the rest
7610 of this package.  However, you may wish to install such add-ons
7611 elsewhere under a different prefix.
7612
7613 If you do not wish to put everything under a single prefix, that's
7614 ok.  You will be prompted for the individual locations; this siteprefix
7615 is only used to suggest the defaults.
7616
7617 The default should be fine for most people.
7618
7619 EOM
7620 fn=d~+
7621 rp='Installation prefix to use for add-on modules and utilities?'
7622 : XXX Here might be another good place for an installstyle setting.
7623 case "$siteprefix" in
7624 '') dflt=$prefix ;;
7625 *)  dflt=$siteprefix ;;
7626 esac
7627 . ./getfile
7628 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7629 oldsiteprefix=''
7630 case "$siteprefix" in
7631 '') ;;
7632 *)      case "$ans" in
7633         "$prefix") ;;
7634         *) oldsiteprefix="$prefix";;
7635         esac
7636         ;;
7637 esac
7638 siteprefix="$ans"
7639 siteprefixexp="$ansexp"
7640
7641 : determine where site specific libraries go.
7642 : Usual default is /usr/local/lib/perl5/site_perl/$version
7643 : The default "style" setting is made in installstyle.U
7644 : XXX No longer works with Prefixit stuff.
7645 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7646 case "$sitelib" in
7647 '') case "$installstyle" in
7648         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7649         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7650         esac
7651         ;;
7652 *)      dflt="$sitelib"
7653         ;;
7654 esac
7655 $cat <<EOM
7656
7657 The installation process will create a directory for
7658 site-specific extensions and modules.  Most users find it convenient
7659 to place all site-specific files in this directory rather than in the
7660 main distribution directory.
7661
7662 EOM
7663 fn=d~+
7664 rp='Pathname for the site-specific library files?'
7665 . ./getfile
7666 prefixvar=sitelib
7667 . ./setprefixvar
7668 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7669
7670 : Determine list of previous versions to include in @INC
7671 $cat > getverlist <<EOPL
7672 #!$perl5
7673 use strict;
7674 use warnings;
7675 use File::Basename;
7676 my \$api_versionstring = "$api_versionstring";
7677 my \$version = "$version";
7678 my \$stem = "$sitelib_stem";
7679 my \$archname = "$archname";
7680 EOPL
7681         $cat >> getverlist <<'EOPL'
7682 # The list found is stored twice for each entry: the original name, and
7683 # the binary broken down version into pack "s>s>s>", so sorting is easy
7684 # and unambiguous.  This will work for all versions that have a maximum
7685 # of three digit per group separate by '.'s or '_'s. Names are extended
7686 # with ".0.0" to ensure at least three elements for the pack.
7687 #                                   -- H.Merijn Brand (m)'06 23-10-2006
7688
7689 my @inc_version_list;
7690 my @candidates;
7691 # XXX Redo to do opendir/readdir?
7692 if (-d $stem) {
7693     chdir($stem);
7694     ;@candidates = map {
7695         [ $_, pack "s>s>s>", split m/[._]/, "$_.0.0" ] } glob("5.*");
7696     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7697 }
7698 else {
7699     ;@candidates = ();
7700 }
7701
7702 my ($pversion, $aversion, $vsn5005) = map {
7703     pack "s>s>s>", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7704 foreach my $d (@candidates) {
7705     if ($d->[1] lt $pversion) {
7706         if ($d->[1] ge $aversion) {
7707             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7708         }
7709         elsif ($d->[1] ge $vsn5005) {
7710             unshift(@inc_version_list, grep { -d } $d->[0]);
7711         }
7712     }
7713     else {
7714         # Skip newer version.  I.e. don't look in
7715         # 5.7.0 if we're installing 5.6.1.
7716     }
7717 }
7718
7719 if (@inc_version_list) {
7720     print join(' ', @inc_version_list);
7721 }
7722 else {
7723     # Blank space to preserve value for next Configure run.
7724     print " ";
7725 }
7726 EOPL
7727 chmod +x getverlist
7728 case "$inc_version_list" in
7729 '')     if test -x "$perl5$exe_ext"; then
7730                 dflt=`$perl5 getverlist`
7731         else
7732                 dflt='none'
7733         fi
7734         ;;
7735 $undef) dflt='none' ;;
7736 *)  eval dflt=\"$inc_version_list\" ;;
7737 esac
7738 case "$dflt" in
7739 ''|' ') dflt=none ;;
7740 esac
7741 case "$dflt" in
7742 5.005) dflt=none ;;
7743 esac
7744 $cat <<EOM
7745
7746 In order to ease the process of upgrading, this version of perl
7747 can be configured to use modules built and installed with earlier
7748 versions of perl that were installed under $prefix.  Specify here
7749 the list of earlier versions that this version of perl should check.
7750 If Configure detected no earlier versions of perl installed under
7751 $prefix, then the list will be empty.  Answer 'none' to tell perl
7752 to not search earlier versions.
7753
7754 The default should almost always be sensible, so if you're not sure,
7755 just accept the default.
7756 EOM
7757
7758 rp='List of earlier versions to include in @INC?'
7759 . ./myread
7760 case "$ans" in
7761 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7762 *) inc_version_list="$ans" ;;
7763 esac
7764 case "$inc_version_list" in
7765 ''|' ')
7766         inc_version_list_init='0'
7767         d_inc_version_list="$undef"
7768         ;;
7769 *)      inc_version_list_init=`echo $inc_version_list |
7770                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7771         d_inc_version_list="$define"
7772         ;;
7773 esac
7774 $rm -f getverlist
7775
7776 : check for length of pointer
7777 echo " "
7778 case "$ptrsize" in
7779 '')
7780         echo "Checking to see how big your pointers are..." >&4
7781         $cat >try.c <<EOCP
7782 #include <stdio.h>
7783 #$i_stdlib I_STDLIB
7784 #ifdef I_STDLIB
7785 #include <stdlib.h>
7786 #endif
7787 int main()
7788 {
7789     printf("%d\n", (int)sizeof(void *));
7790     exit(0);
7791 }
7792 EOCP
7793         set try
7794         if eval $compile_ok; then
7795                 ptrsize=`$run ./try`
7796                 echo "Your pointers are $ptrsize bytes long."
7797         else
7798                 dflt='4'
7799                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7800                 rp="What is the size of a pointer (in bytes)?"
7801                 . ./myread
7802                 ptrsize="$ans"
7803         fi
7804         ;;
7805 esac
7806 $rm_try
7807 case "$use64bitall" in
7808 "$define"|true|[yY]*)
7809         case "$ptrsize" in
7810         4)      cat <<EOM >&4
7811
7812 *** You have chosen a maximally 64-bit build,
7813 *** but your pointers are only 4 bytes wide.
7814 *** Please rerun Configure without -Duse64bitall.
7815 EOM
7816                 case "$d_quad" in
7817                 define)
7818                         cat <<EOM >&4
7819 *** Since you have quads, you could possibly try with -Duse64bitint.
7820 EOM
7821                         ;;
7822                 esac
7823                 cat <<EOM >&4
7824 *** Cannot continue, aborting.
7825
7826 EOM
7827
7828                 exit 1
7829                 ;;
7830         esac
7831         ;;
7832 esac
7833
7834 : determine whether to use malloc wrapping
7835 echo " "
7836 case "$usemallocwrap" in
7837 [yY]*|true|$define)     dflt='y' ;;
7838 [nN]*|false|$undef)     dflt='n' ;;
7839 *)      case "$usedevel" in
7840         [yY]*|true|$define)     dflt='y' ;;
7841         *) dflt='n' ;;
7842         esac
7843         ;;
7844 esac
7845 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7846 . ./myread
7847 usemallocwrap="$ans"
7848 case "$ans" in
7849 y*|true)
7850         usemallocwrap="$define" ;;
7851 *)
7852         usemallocwrap="$undef" ;;
7853 esac
7854
7855 : determine which malloc to compile in
7856 echo " "
7857 case "$usemymalloc" in
7858 [yY]*|true|$define)     dflt='y' ;;
7859 [nN]*|false|$undef)     dflt='n' ;;
7860 *)      case "$ptrsize" in
7861         4) dflt='y' ;;
7862         *) dflt='n' ;;
7863         esac
7864         if test "$useithreads" = "$define"; then dflt='n'; fi
7865         ;;
7866 esac
7867 rp="Do you wish to attempt to use the malloc that comes with $package?"
7868 . ./myread
7869 usemymalloc="$ans"
7870 case "$ans" in
7871 y*|true)
7872         usemymalloc='y'
7873         mallocsrc='malloc.c'
7874         mallocobj="malloc$_o"
7875         d_mymalloc="$define"
7876         case "$libs" in
7877         *-lmalloc*)
7878                 : Remove malloc from list of libraries to use
7879                 echo "Removing unneeded -lmalloc from library list" >&4
7880                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7881                 shift
7882                 libs="$*"
7883                 echo "libs = $libs" >&4
7884                 ;;
7885         esac
7886         ;;
7887 *)
7888         usemymalloc='n'
7889         mallocsrc=''
7890         mallocobj=''
7891         d_mymalloc="$undef"
7892         ;;
7893 esac
7894
7895 : compute the return types of malloc and free
7896 echo " "
7897 case "$malloctype" in
7898 '')
7899         malloctype='void *'
7900         ;;
7901 esac
7902 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7903
7904 case "$freetype" in
7905 '')
7906         freetype='void'
7907         ;;
7908 esac
7909 echo "Your system uses $freetype free(), it would seem." >&4
7910
7911 : determine where site specific architecture-dependent libraries go.
7912 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7913 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7914 : sitelib may have an optional trailing /share.
7915 case "$sitearch" in
7916 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7917         dflt="$dflt/$archname"
7918         ;;
7919 *)      dflt="$sitearch"
7920         ;;
7921 esac
7922 set sitearch sitearch none
7923 eval $prefixit
7924 $cat <<EOM
7925
7926 The installation process will also create a directory for
7927 architecture-dependent site-specific extensions and modules.
7928
7929 EOM
7930 fn=d~+
7931 rp='Pathname for the site-specific architecture-dependent library files?'
7932 . ./getfile
7933 prefixvar=sitearch
7934 . ./setprefixvar
7935 if $test X"$sitearch" = X"$sitelib"; then
7936         d_sitearch="$undef"
7937 else
7938         d_sitearch="$define"
7939 fi
7940
7941 : Set the vendorprefix variables
7942 $cat <<EOM
7943
7944 The installation process will also create a directory for
7945 vendor-supplied add-ons.  Vendors who supply perl with their system
7946 may find it convenient to place all vendor-supplied files in this
7947 directory rather than in the main distribution directory.  This will
7948 ease upgrades between binary-compatible maintenance versions of perl.
7949
7950 Of course you may also use these directories in whatever way you see
7951 fit.  For example, you might use them to access modules shared over a
7952 company-wide network.
7953
7954 The default answer should be fine for most people.
7955 This causes further questions about vendor add-ons to be skipped
7956 and no vendor-specific directories will be configured for perl.
7957
7958 EOM
7959 rp='Do you want to configure vendor-specific add-on directories?'
7960 case "$usevendorprefix" in
7961 define|true|[yY]*) dflt=y ;;
7962 *)      : User may have set vendorprefix directly on Configure command line.
7963         case "$vendorprefix" in
7964         ''|' ') dflt=n ;;
7965         *)      dflt=y ;;
7966         esac
7967         ;;
7968 esac
7969 . ./myread
7970 case "$ans" in
7971 [yY]*)  fn=d~+
7972         rp='Installation prefix to use for vendor-supplied add-ons?'
7973         case "$vendorprefix" in
7974         '') dflt="$prefix" ;;
7975         *)  dflt=$vendorprefix ;;
7976         esac
7977         . ./getfile
7978         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7979         oldvendorprefix=''
7980         case "$vendorprefix" in
7981         '') ;;
7982         *)      case "$ans" in
7983                 "$prefix") ;;
7984                 *) oldvendorprefix="$prefix";;
7985                 esac
7986                 ;;
7987         esac
7988         usevendorprefix="$define"
7989         vendorprefix="$ans"
7990         vendorprefixexp="$ansexp"
7991         ;;
7992 *)      usevendorprefix="$undef"
7993         vendorprefix=''
7994         vendorprefixexp=''
7995         ;;
7996 esac
7997
7998 : Set the vendorlib variables
7999 case "$vendorprefix" in
8000 '')     d_vendorlib="$undef"
8001         vendorlib=''
8002         vendorlibexp=''
8003         ;;
8004 *)      d_vendorlib="$define"
8005         : determine where vendor-supplied modules go.
8006         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8007         case "$vendorlib" in
8008         '')
8009                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8010                 case "$installstyle" in
8011                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8012                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8013                 esac
8014                 ;;
8015         *)      dflt="$vendorlib"
8016                 ;;
8017         esac
8018         fn=d~+
8019         rp='Pathname for the vendor-supplied library files?'
8020         . ./getfile
8021         vendorlib="$ans"
8022         vendorlibexp="$ansexp"
8023         ;;
8024 esac
8025 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8026 prefixvar=vendorlib
8027 . ./installprefix
8028
8029 : Set the vendorarch variables
8030 case "$vendorprefix" in
8031 '')     d_vendorarch="$undef"
8032         vendorarch=''
8033         vendorarchexp=''
8034         ;;
8035 *)      d_vendorarch="$define"
8036         : determine where vendor-supplied architecture-dependent libraries go.
8037         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8038         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8039         : vendorlib may have an optional trailing /share.
8040         case "$vendorarch" in
8041         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8042                 dflt="$dflt/$archname"
8043                 ;;
8044         *)      dflt="$vendorarch" ;;
8045         esac
8046         fn=d~+
8047         rp='Pathname for vendor-supplied architecture-dependent files?'
8048         . ./getfile
8049         vendorarch="$ans"
8050         vendorarchexp="$ansexp"
8051         ;;
8052 esac
8053 prefixvar=vendorarch
8054 . ./installprefix
8055 if $test X"$vendorarch" = X"$vendorlib"; then
8056         d_vendorarch="$undef"
8057 else
8058         d_vendorarch="$define"
8059 fi
8060
8061 : Final catch-all directories to search
8062 $cat <<EOM
8063
8064 Lastly, you can have perl look in other directories for extensions and
8065 modules in addition to those already specified.
8066 These directories will be searched after
8067         $sitearch
8068         $sitelib
8069 EOM
8070 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8071 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8072 echo ' '
8073 case "$otherlibdirs" in
8074 ''|' ') dflt='none' ;;
8075 *)      dflt="$otherlibdirs" ;;
8076 esac
8077 $cat <<EOM
8078 Enter a colon-separated set of extra paths to include in perl's @INC
8079 search path, or enter 'none' for no extra paths.
8080
8081 EOM
8082
8083 rp='Colon-separated list of additional directories for perl to search?'
8084 . ./myread
8085 case "$ans" in
8086 ' '|''|none)    otherlibdirs=' ' ;;
8087 *)      otherlibdirs="$ans" ;;
8088 esac
8089 case "$otherlibdirs" in
8090 ' ') val=$undef ;;
8091 *)      val=$define ;;
8092 esac
8093 set d_perl_otherlibdirs
8094 eval $setvar
8095
8096 : DTrace support
8097 dflt_dtrace='/usr/sbin/dtrace'
8098 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8099
8100 cat <<EOM
8101
8102 Perl can be built to support DTrace on platforms that support it.
8103 DTrace is a diagnosis and performance analysis tool from Sun.
8104
8105 If this doesn't make any sense to you, just accept the default.
8106 EOM
8107
8108 while $test 1 ; do
8109         case "$usedtrace" in
8110         $define|true|[yY]*)
8111                 dflt='y'
8112                 ;;
8113         $undef|false|[nN]*)
8114                 dflt='n'
8115                 dflt_dtrace=""
8116                 ;;
8117         ?*)
8118                 dflt='y'
8119                 dflt_dtrace=$usedtrace
8120                 ;;
8121         *)
8122                 dflt='n'
8123                 ;;
8124         esac
8125
8126         rp='Support DTrace if available?'
8127         . ./myread
8128         case "$ans" in
8129         y|Y)    val="$define" ;;
8130         *)      val="$undef" ;;
8131         esac
8132         set usedtrace
8133         eval $setvar
8134
8135         test "X$usedtrace" != "X$define" && break
8136
8137         echo " "
8138         rp='Where is the dtrace executable?'
8139         dflt=$dflt_dtrace
8140         . ./getfile
8141         val="$ans"
8142         set dtrace
8143         eval $setvar
8144
8145         if $test -f $dtrace
8146         then
8147                 if $dtrace -h -s ../perldtrace.d \
8148                         -o perldtrace.tmp >/dev/null 2>&1 \
8149                         && rm -f perldtrace.tmp
8150                 then
8151                         echo " "
8152                         echo "Good: your $dtrace knows about the -h flag."
8153                 else
8154                         cat >&2 <<EOM
8155
8156 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8157 ***
8158 *** Your installed dtrace doesn't support the -h switch to compile a D
8159 *** program into a C header. Can't continue.
8160
8161 EOM
8162                         exit 1
8163                 fi
8164                 break;
8165         fi
8166
8167         case "$fastread" in
8168         yes)
8169                 cat >&2 <<EOM
8170
8171 *** $me:  Fatal Error:  $dtrace not found.
8172 *** Can't continue.
8173
8174 EOM
8175                 exit 1
8176                 ;;
8177         *)
8178                 echo "*** $dtrace was not found."
8179                 echo " "
8180                 ;;
8181         esac
8182 done
8183
8184 : See if we want extra modules installed
8185 echo " "
8186 case "$extras" in
8187 '') dflt='n';;
8188 *) dflt='y';;
8189 esac
8190 cat <<EOM
8191 Perl can be built with extra modules or bundles of modules which
8192 will be fetched from the CPAN and installed alongside Perl.
8193
8194 Notice that you will need access to the CPAN; either via the Internet,
8195 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8196 be asked later to configure the CPAN.pm module which will in turn do
8197 the installation of the rest of the extra modules or bundles.)
8198
8199 Notice also that if the modules require any external software such as
8200 libraries and headers (the libz library and the zlib.h header for the
8201 Compress::Zlib module, for example) you MUST have any such software
8202 already installed, this configuration process will NOT install such
8203 things for you.
8204
8205 If this doesn't make any sense to you, just accept the default '$dflt'.
8206 EOM
8207 rp='Install any extra modules (y or n)?'
8208 . ./myread
8209 case "$ans" in
8210 y|Y)
8211         cat <<EOM
8212
8213 Please list any extra modules or bundles to be installed from CPAN,
8214 with spaces between the names.  The names can be in any format the
8215 'install' command of CPAN.pm will understand.  (Answer 'none',
8216 without the quotes, to install no extra modules or bundles.)
8217 EOM
8218         rp='Extras?'
8219         dflt="$extras"
8220         . ./myread
8221         extras="$ans"
8222 esac
8223 case "$extras" in
8224 ''|'none')
8225         val=''
8226         $rm -f ../extras.lst
8227         ;;
8228 *)      echo "(Saving the list of extras for later...)"
8229         echo "$extras" > ../extras.lst
8230         val="'$extras'"
8231         ;;
8232 esac
8233 set extras
8234 eval $setvar
8235 echo " "
8236
8237 : determine where html pages for programs go
8238 set html1dir html1dir none
8239 eval $prefixit
8240 $cat <<EOM
8241
8242 If you wish to install html files for programs in $spackage, indicate
8243 the appropriate directory here.  To skip installing html files,
8244 answer "none".
8245 EOM
8246 case "$html1dir" in
8247 ''|none|$undef|' ') dflt=none ;;
8248 *) dflt=$html1dir ;;
8249 esac
8250 fn=dn+~
8251 rp="Directory for the main $spackage html pages?"
8252 . ./getfile
8253 prefixvar=html1dir
8254 . ./setprefixvar
8255 : Use ' ' for none so value is preserved next time through Configure
8256 $test X"$html1dir" = "X" && html1dir=' '
8257
8258 : determine where html pages for libraries and modules go
8259 set html3dir html3dir none
8260 eval $prefixit
8261 $cat <<EOM
8262
8263 If you wish to install html files for modules associated with $spackage,
8264 indicate the appropriate directory here.  To skip installing html files,
8265 answer "none".
8266 EOM
8267 : There is no obvious default.  If they have specified html1dir, then
8268 : try to key off that, possibly changing .../html1 into .../html3.
8269 case "$html3dir" in
8270 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8271 *) dflt=$html3dir ;;
8272 esac
8273 fn=dn+~
8274 rp="Directory for the $spackage module html pages?"
8275 . ./getfile
8276 prefixvar=html3dir
8277 . ./setprefixvar
8278 : Use ' ' for none so value is preserved next time through Configure
8279 $test X"$html3dir" = "X" && html3dir=' '
8280
8281 : determine whether to install perl also as /usr/bin/perl
8282
8283 echo " "
8284 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8285         $cat <<EOM
8286 Many scripts expect perl to be installed as /usr/bin/perl.
8287
8288 If you want to, I can install the perl you are about to compile
8289 as /usr/bin/perl (in addition to $bin/perl).
8290 EOM
8291         if test -f /usr/bin/perl; then
8292             $cat <<EOM
8293
8294 However, please note that because you already have a /usr/bin/perl,
8295 overwriting that with a new Perl would very probably cause problems.
8296 Therefore I'm assuming you don't want to do that (unless you insist).
8297
8298 EOM
8299             case "$installusrbinperl" in
8300             "$define"|[yY]*)    dflt='y';;
8301             *)                  dflt='n';;
8302             esac
8303         else
8304             $cat <<EOM
8305
8306 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8307
8308 EOM
8309             case "$installusrbinperl" in
8310             "$undef"|[nN]*)     dflt='n';;
8311             *)                  dflt='y';;
8312             esac
8313         fi
8314         rp="Do you want to install perl as /usr/bin/perl?"
8315         . ./myread
8316         case "$ans" in
8317         [yY]*)  val="$define";;
8318         *)      val="$undef" ;;
8319         esac
8320 else
8321         val="$undef"
8322 fi
8323 set installusrbinperl
8324 eval $setvar
8325
8326 : see if dlopen exists
8327 xxx_runnm="$runnm"
8328 xxx_ccflags="$ccflags"
8329 runnm=false
8330 : with g++ one needs -shared to get is-in-libc to work for dlopen
8331 case "$gccversion" in
8332 '')     ;;
8333 *Clang*)        ;;
8334 *)      case "$d_cplusplus" in
8335         "$define") ccflags="$ccflags -shared" ;;
8336         esac
8337         ;;
8338 esac
8339 set dlopen d_dlopen
8340 eval $inlibc
8341 runnm="$xxx_runnm"
8342 ccflags="$xxx_ccflags"
8343
8344 : see if this is a unistd.h system
8345 set unistd.h i_unistd
8346 eval $inhdr
8347
8348 : determine which dynamic loading, if any, to compile in
8349 echo " "
8350 dldir="ext/DynaLoader"
8351 case "$usedl" in
8352     $define|y|true)
8353         dflt='y'
8354         usedl="$define"
8355         ;;
8356     $undef|n|false)
8357         dflt='n'
8358         usedl="$undef"
8359         ;;
8360     *)
8361         dflt='n'
8362         case "$d_dlopen" in
8363             $define) dflt='y' ;;
8364         esac
8365         : Does a dl_xxx.xs file exist for this operating system
8366         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8367         ;;
8368 esac
8369 rp="Do you wish to use dynamic loading?"
8370 . ./myread
8371 usedl="$ans"
8372 bin_ELF="$undef"
8373 case "$ans" in
8374     y*) usedl="$define"
8375         case "$dlsrc" in
8376             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8377                     dflt="$dldir/dl_${osname}.xs"
8378                 elif $test "$d_dlopen" = "$define" ; then
8379                     dflt="$dldir/dl_dlopen.xs"
8380                 else
8381                     dflt=''
8382                 fi
8383                 ;;
8384             *)  dflt="$dldir/$dlsrc"
8385                 ;;
8386         esac
8387         echo "The following dynamic loading files are available:"
8388         : Can not go over to $dldir because getfile has path hard-coded in.
8389         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8390         rp="Source file to use for dynamic loading"
8391         fn="fne"
8392         gfpth="$src"
8393         . ./getfile
8394         usedl="$define"
8395         : emulate basename
8396         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8397
8398         $cat << EOM
8399
8400 Some systems may require passing special flags to $cc -c to
8401 compile modules that will be used to create a shared library.
8402 To use no flags, say "none".
8403
8404 EOM
8405         case "$cccdlflags" in
8406             '') case "$gccversion" in
8407                 '') case "$osname" in
8408                         hpux)   dflt='+z' ;;
8409                         irix*)  dflt='-KPIC' ;;
8410                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8411                         sunos)  dflt='-pic' ;;
8412                         *)      dflt='none' ;;
8413                     esac
8414                     ;;
8415                 *)  case "$osname" in
8416                         darwin) dflt='none' ;;
8417                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8418                         *)      dflt='-fpic' ;;
8419                     esac ;;
8420                 esac ;;
8421             ' ') dflt='none' ;;
8422             *)   dflt="$cccdlflags" ;;
8423         esac
8424
8425         case "$dflt" in
8426             none) dflt='' ;;
8427         esac
8428
8429         # If -Dsysroot was specified, now's the time to add it
8430         # to cccdlflags
8431         if test "X$sysroot" != X; then
8432             case "$gccversion" in
8433                 '') ;;
8434                 *)  case "$dflt" in
8435                         *sysroot*) ;;
8436                         'undef'|*)
8437                             dflt="$dflt --sysroot=$sysroot" ;;
8438                     esac
8439                     ;;
8440             esac
8441         fi
8442
8443         case "$dflt" in
8444             '') dflt='none';;
8445         esac
8446
8447         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8448         . ./myread
8449         case "$ans" in
8450             none) cccdlflags=' ' ;;
8451             *)    cccdlflags="$ans" ;;
8452         esac
8453
8454         cat << EOM
8455
8456 Some systems use ld to create libraries that can be dynamically loaded,
8457 while other systems (such as those using ELF) use $cc.
8458
8459 EOM
8460
8461 : Determine if this is ELF
8462         $cat >try.c <<EOM
8463 /* Test for whether ELF binaries are produced */
8464 #include <fcntl.h>
8465 #$i_stdlib I_STDLIB
8466 #ifdef I_STDLIB
8467 #include <stdlib.h>
8468 #endif
8469 #$i_unistd I_UNISTD
8470 #ifdef I_UNISTD
8471 #include <unistd.h>
8472 #endif
8473 int main() {
8474     char b[4];
8475     int i = open("a.out",O_RDONLY);
8476     if(i == -1)
8477         exit(1); /* fail */
8478     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8479         exit(0); /* succeed (yes, it is ELF) */
8480     exit(1); /* fail */
8481 }
8482 EOM
8483         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8484             bin_ELF="$define"
8485         fi
8486         $rm_try
8487
8488         case "$ld" in
8489             '') if $test $bin_ELF = "$define"; then
8490                     cat <<EOM
8491 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8492 EOM
8493                     dflt="$cc"
8494                 else
8495                     echo "I'll use ld to build dynamic libraries."
8496                     dflt='ld'
8497                 fi
8498                 ;;
8499             *)  dflt="$ld"
8500                 ;;
8501         esac
8502
8503         rp="What command should be used to create dynamic libraries?"
8504         . ./myread
8505         ld="$ans"
8506
8507         cat << EOM
8508
8509 Some systems may require passing special flags to $ld to create a
8510 library that can be dynamically loaded.  If your ld flags include
8511 -L/other/path options to locate libraries outside your loader's normal
8512 search path, you may need to specify those -L options here as well.  To
8513 use no flags, say "none".
8514
8515 EOM
8516         case "$lddlflags" in
8517             '') case "$osname" in
8518                     haiku) dflt='-shared' ;;
8519                     hpux) dflt='-b';
8520                           case "$gccversion" in
8521                               '') dflt="$dflt +vnocompatwarnings" ;;
8522                           esac
8523                           ;;
8524                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8525                     solaris) # See [perl #66604].
8526                             # On Solaris 11, gcc -m64 on amd64
8527                             # appears not to understand -G.  gcc versions at
8528                             # least as old as 3.4.3 support -shared, so just
8529                             # use that with Solaris 11 and later, but keep
8530                             # the old behavior for older Solaris versions.
8531                             case "$gccversion" in
8532                                 '') dflt='-G' ;;
8533                                 *)  case "$osvers" in
8534                                         2.?|2.10) dflt='-G' ;;
8535                                         *) dflt='-shared' ;;
8536                                     esac
8537                                     ;;
8538                             esac
8539                             ;;
8540                     sunos) dflt='-assert nodefinitions' ;;
8541                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8542                     *)     dflt='none' ;;
8543                 esac
8544                 ;;
8545             *) dflt="$lddlflags" ;;
8546         esac
8547
8548         : Only do this for gcc, since, for example, qcc has no concept
8549         : of --sysroot.
8550         if $test "X$sysroot" != X; then
8551             case "$gccversion" in
8552                 '') ;;
8553                 *)  dflt="$dflt --sysroot=$sysroot" ;;
8554             esac
8555         fi
8556
8557         : Try to guess additional flags to pick up local libraries.
8558         : Be careful not to append to a plain 'none'
8559         case "$dflt" in
8560             none) dflt='' ;;
8561         esac
8562         for thisflag in $ldflags; do
8563             case "$thisflag" in
8564                 -L*|-R*|-Wl,-R*)
8565                     case " $dflt " in
8566                         *" $thisflag "*) ;;
8567                         *) dflt="$dflt $thisflag" ;;
8568                     esac
8569                     ;;
8570             esac
8571         done
8572
8573         case "$dflt" in
8574             ''|' ') dflt='none' ;;
8575         esac
8576
8577         case "$ldflags" in
8578             *-fstack-protector-strong*)
8579                 case "$dflt" in
8580                     *-fstack-protector-strong*) ;; # Don't add it again
8581                     *) dflt="$dflt -fstack-protector-strong" ;;
8582                 esac
8583                 ;;
8584             *-fstack-protector*)
8585                 case "$dflt" in
8586                     *-fstack-protector*) ;; # Don't add it again
8587                     *) dflt="$dflt -fstack-protector" ;;
8588                 esac
8589                 ;;
8590         esac
8591
8592         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8593         . ./myread
8594         case "$ans" in
8595             none) lddlflags=' ' ;;
8596             *) lddlflags="$ans" ;;
8597         esac
8598
8599         cat <<EOM
8600
8601 Some systems may require passing special flags to $cc to indicate that
8602 the resulting executable will use dynamic linking.  To use no flags,
8603 say "none".
8604
8605 EOM
8606         case "$ccdlflags" in
8607             '') case "$osname" in
8608                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8609                     sunos)             dflt='none'   ;;
8610                     *)                 dflt='none'   ;;
8611                 esac ;;
8612             ' ') dflt='none' ;;
8613             *)   dflt="$ccdlflags" ;;
8614         esac
8615         rp="Any special flags to pass to $cc to use dynamic linking?"
8616         . ./myread
8617         case "$ans" in
8618             none) ccdlflags=' ' ;;
8619             *)    ccdlflags="$ans" ;;
8620         esac
8621         ;;
8622
8623     *)  usedl="$undef"
8624         ld='ld'
8625         dlsrc='dl_none.xs'
8626         lddlflags=''
8627         ccdlflags=''
8628         ;;
8629 esac
8630
8631 ld_can_script="$undef"
8632 case "$bin_ELF$usedl" in
8633     $define$define)
8634         # Abuse try.h and a.out names for neat cleanup
8635         $cat >try.c <<EOM
8636 void foo() {}
8637 void bar() {}
8638 EOM
8639         $cat >try.h <<EOM
8640 LIBTEST_42 {
8641  global:
8642   foo;
8643  local: *;
8644  };
8645 EOM
8646         if $cc $cccdlflags $ccdlflags $ccflags \
8647                $ldflags $lddlflags -o a.out try.c \
8648                -Wl,--version-script=try.h >/dev/null 2>&1 \
8649            &&  $test -s a.out ; then
8650             echo "ld supports scripting" >&4
8651             ld_can_script="$define"
8652         else
8653             echo "ld does not support scripting" >&4
8654         fi
8655         $rm_try
8656         ;;
8657 esac
8658
8659 : Do we want a shared libperl?
8660 also=''
8661 case "$usedl" in
8662 $undef)
8663         # No dynamic loading being used, so don't bother even to prompt.
8664         useshrplib='false'
8665         ;;
8666 *)      case "$useshrplib" in
8667         '')     case "$osname" in
8668                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8669                         dflt=y
8670                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8671                         ;;
8672                 *)      dflt=n
8673                         ;;
8674                 esac
8675                 ;;
8676         $define|true|[Yy]*)
8677                 dflt=y
8678                 ;;
8679         *)      dflt=n
8680                 ;;
8681         esac
8682         $cat << EOM
8683
8684 The perl executable is normally obtained by linking perlmain.c with
8685 libperl${_a}, any static extensions (usually just DynaLoader), and
8686 any other libraries needed on this system (such as -lm, etc.).  Since
8687 your system supports dynamic loading, it is probably possible to build
8688 a shared libperl.$so.  If you will have more than one executable linked
8689 to libperl.$so, this will significantly reduce the size of each
8690 executable, but it may have a noticeable effect on performance.  The
8691 default is probably sensible for your system.
8692 $also
8693
8694 EOM
8695         rp="Build a shared libperl.$so (y/n)"
8696         . ./myread
8697         case "$ans" in
8698         true|$define|[Yy]*)
8699                 useshrplib='true'  ;;
8700         *)      useshrplib='false' ;;
8701         esac
8702         ;;
8703 esac
8704
8705 case "$useshrplib" in
8706 true)
8707         case "$userelocatableinc" in
8708         true|define)
8709                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8710                 echo "See INSTALL for an explanation why that won't work." >&4
8711                 exit 4
8712                 ;;
8713         esac
8714         case "$libperl" in
8715         '')
8716                 # Figure out a good name for libperl.so.  Since it gets stored in
8717                 # a version-specific architecture-dependent library, the version
8718                 # number isn't really that important, except for making cc/ld happy.
8719                 #
8720                 # A name such as libperl.so.10.1
8721                 majmin="libperl.$so.$patchlevel.$subversion"
8722                 # A name such as libperl.so.100
8723                 majonly=`echo $patchlevel $subversion |
8724                         $awk '{printf "%d%02d", $1, $2}'`
8725                 majonly=libperl.$so.$majonly
8726                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8727                 # rely on figuring it out from the naming of libc.
8728                 case "${osname}${osvers}" in
8729                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8730                         dflt=libperl.$so
8731                         ;;
8732                 cygwin*) # ld links now against the dll directly
8733                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8734                         majonly=`echo $patchlevel $subversion |
8735                                 $awk '{printf "%03d%03d", $1, $2}'`
8736                         majonly=cygperl5.$majonly.$so
8737                         dflt=$majmin
8738                         ;;
8739                 *)      # Try to guess based on whether libc has major.minor.
8740                         case "$libc" in
8741                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8742                         *libc.$so.[0-9]*) dflt=$majonly ;;
8743                         *)      dflt=libperl.$so ;;
8744                         esac
8745                         ;;
8746                 esac
8747                 ;;
8748         *)      dflt=$libperl
8749                 ;;
8750         esac
8751         cat << EOM
8752
8753 I need to select a good name for the shared libperl.  If your system uses
8754 library names with major and minor numbers, then you might want something
8755 like $majmin.  Alternatively, if your system uses a single version
8756 number for shared libraries, then you might want to use $majonly.
8757 Or, your system might be quite happy with a simple libperl.$so.
8758
8759 Since the shared libperl will get installed into a version-specific
8760 architecture-dependent directory, the version number of the shared perl
8761 library probably isn't important, so the default should be o.k.
8762
8763 EOM
8764         rp='What name do you want to give to the shared libperl?'
8765         . ./myread
8766         libperl=$ans
8767         echo "Ok, I'll use $libperl"
8768         ;;
8769 *)
8770         libperl="libperl${_a}"
8771         ;;
8772 esac
8773
8774 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8775 case "$shrpdir" in
8776 '') ;;
8777 *)      $cat >&4 <<EOM
8778 WARNING:  Use of the shrpdir variable for the installation location of
8779 the shared $libperl is not supported.  It was never documented and
8780 will not work in this version.  Let me (https://github.com/Perl/perl5/issues)
8781 know of any problems this may cause.
8782
8783 EOM
8784         case "$shrpdir" in
8785         "$archlibexp/CORE")
8786                 $cat >&4 <<EOM
8787 But your current setting of $shrpdir is
8788 the default anyway, so it's harmless.
8789 EOM
8790                 ;;
8791         *)
8792                 $cat >&4 <<EOM
8793 Further, your current attempted setting of $shrpdir
8794 conflicts with the value of $archlibexp/CORE
8795 that installperl will use.
8796 EOM
8797                 ;;
8798         esac
8799         ;;
8800 esac
8801
8802 # How will the perl executable find the installed shared $libperl?
8803 # Add $xxx to ccdlflags.
8804 # If we can't figure out a command-line option, use $shrpenv to
8805 # set env LD_RUN_PATH.  The main perl makefile uses this.
8806 shrpdir=$archlibexp/CORE
8807 xxx=''
8808 tmp_shrpenv=''
8809 if "$useshrplib"; then
8810     case "$osname" in
8811         aix)
8812                 # We'll set it in Makefile.SH...
8813                 ;;
8814         solaris)
8815                 xxx="-R $shrpdir"
8816                 ;;
8817         freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8818                 xxx="-Wl,-R$shrpdir"
8819                 ;;
8820         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8821                 xxx="-Wl,-rpath,$shrpdir"
8822                 ;;
8823         hpux*)
8824                 # hpux doesn't like the default, either.
8825                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8826                 ;;
8827         cygwin)
8828                 # cygwin needs only ldlibpth
8829                 ;;
8830         *)
8831                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8832                 ;;
8833         esac
8834         case "$xxx" in
8835         '') ;;
8836         *)
8837                 # Only add $xxx if it isn't already in ccdlflags.
8838                 case " $ccdlflags " in
8839                 *" $xxx "*)     ;;
8840                 *)      ccdlflags="$ccdlflags $xxx"
8841                         cat <<EOM >&4
8842
8843 Adding $xxx to the flags
8844 passed to $ld so that the perl executable will find the
8845 installed shared $libperl.
8846
8847 EOM
8848                         ;;
8849                 esac
8850                 ;;
8851         esac
8852 fi
8853 # Fix ccdlflags in AIX for building external extensions.
8854 # (For building Perl itself bare -bE:perl.exp is needed,
8855 #  Makefile.SH takes care of this.)
8856 case "$osname" in
8857 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8858 esac
8859 # Respect a hint or command-line value.
8860 case "$shrpenv" in
8861 '') shrpenv="$tmp_shrpenv" ;;
8862 esac
8863 case "$ldlibpthname" in
8864 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8865 none)   ldlibpthname='' ;;
8866 esac
8867
8868 : determine where manual pages are on this system
8869 echo " "
8870 case "$sysman" in
8871 '')
8872         syspath='/usr/share/man/man1 /usr/man/man1'
8873         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8874         syspath="$syspath /usr/man/u_man/man1"
8875         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8876         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8877         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8878         sysman=`./loc . /usr/man/man1 $syspath`
8879         ;;
8880 esac
8881 if $test -d "$sysman"; then
8882         echo "System manual is in $sysman." >&4
8883 else
8884         echo "Could not find manual pages in source form." >&4
8885 fi
8886
8887 : determine where manual pages go
8888 set man1dir man1dir none
8889 eval $prefixit
8890 $cat <<EOM
8891
8892 $spackage has manual pages available in source form.
8893 EOM
8894 case "$nroff" in
8895 nroff)
8896         echo "However, you don't have nroff, so they're probably useless to you."
8897         case "$man1dir" in
8898         '') man1dir="none";;
8899         esac;;
8900 esac
8901 echo "If you don't want the manual sources installed, answer 'none'."
8902 case "$man1dir" in
8903 ' ') dflt=none
8904         ;;
8905 '')
8906         lookpath="$prefixexp/share/man/man1"
8907         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8908         lookpath="$lookpath $prefixexp/man/p_man/man1"
8909         lookpath="$lookpath $prefixexp/man/u_man/man1"
8910         lookpath="$lookpath $prefixexp/man/man.1"
8911         case "$sysman" in
8912         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8913         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8914         esac
8915         set dflt
8916         eval $prefixup
8917         ;;
8918 *)  dflt="$man1dir"
8919         ;;
8920 esac
8921 echo " "
8922 fn=dn+~
8923 rp="Where do the main $spackage manual pages (source) go?"
8924 . ./getfile
8925 if $test "X$man1direxp" != "X$ansexp"; then
8926         installman1dir=''
8927 fi
8928 prefixvar=man1dir
8929 . ./setprefixvar
8930
8931 case "$man1dir" in
8932 '')     man1dir=' '
8933         installman1dir='';;
8934 esac
8935
8936 : What suffix to use on installed man pages
8937
8938 case "$man1dir" in
8939 ' ')
8940         man1ext='0'
8941         ;;
8942 *)
8943         rp="What suffix should be used for the main $spackage man pages?"
8944         case "$man1ext" in
8945         '')     case "$man1dir" in
8946                 *1)  dflt=1 ;;
8947                 *1p) dflt=1p ;;
8948                 *1pm) dflt=1pm ;;
8949                 *l) dflt=l;;
8950                 *n) dflt=n;;
8951                 *o) dflt=o;;
8952                 *p) dflt=p;;
8953                 *C) dflt=C;;
8954                 *L) dflt=L;;
8955                 *L1) dflt=L1;;
8956                 *) dflt=1;;
8957                 esac
8958                 ;;
8959         *)      dflt="$man1ext";;
8960         esac
8961         . ./myread
8962         man1ext="$ans"
8963         ;;
8964 esac
8965
8966 : see if we can have long filenames
8967 echo " "
8968 first=123456789abcdef
8969 $rm -f $first
8970 if (echo hi >$first) 2>/dev/null; then
8971         if $test -f 123456789abcde; then
8972                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8973                 val="$undef"
8974         else
8975                 echo 'You can have filenames longer than 14 characters.'>&4
8976                 val="$define"
8977         fi
8978 else
8979         $cat <<'EOM'
8980 You can't have filenames longer than 14 chars.
8981 You can't even think about them!
8982 EOM
8983         val="$undef"
8984 fi
8985 set d_flexfnam
8986 eval $setvar
8987 $rm -rf 123456789abcde*
8988
8989 : determine where library module manual pages go
8990 set man3dir man3dir none
8991 eval $prefixit
8992 $cat <<EOM
8993
8994 $spackage has manual pages for many of the library modules.
8995 EOM
8996
8997 case "$nroff" in
8998 nroff)
8999         $cat <<'EOM'
9000 However, you don't have nroff, so they're probably useless to you.
9001 EOM
9002         case "$man3dir" in
9003         '') man3dir="none";;
9004         esac;;
9005 esac
9006
9007 case "$d_flexfnam" in
9008 undef)
9009         $cat <<'EOM'
9010 However, your system can't handle the long file names like File::Basename.3.
9011 EOM
9012         case "$man3dir" in
9013         '') man3dir="none";;
9014         esac;;
9015 esac
9016
9017 echo "If you don't want the manual sources installed, answer 'none'."
9018 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9019 case "$man3dir" in
9020 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9021         if $test -d "$privlib/man/man3"; then
9022                 cat <<EOM >&4
9023
9024 WARNING:  Previous versions of perl installed man3 pages into
9025 $privlib/man/man3.  This version will suggest a
9026 new default of $dflt.
9027 EOM
9028                 tdflt=$dflt
9029                 dflt='n'
9030                 rp='Do you wish to preserve the old behavior?(y/n)'
9031                 . ./myread
9032                 case "$ans" in
9033                 y*) dflt="$privlib/man/man3" ;;
9034                 *)  dflt=$tdflt ;;
9035                 esac
9036     fi
9037         ;;
9038 *)      dflt="$man3dir" ;;
9039 esac
9040 case "$dflt" in
9041 ' ') dflt=none ;;
9042 esac
9043 echo " "
9044 fn=dn+~
9045 rp="Where do the $package library man pages (source) go?"
9046 . ./getfile
9047 prefixvar=man3dir
9048 . ./setprefixvar
9049
9050 case "$man3dir" in
9051 '')     man3dir=' '
9052         installman3dir='';;
9053 esac
9054
9055 : What suffix to use on installed man pages
9056 case "$man3dir" in
9057 ' ')
9058         man3ext='0'
9059         ;;
9060 *)
9061         rp="What suffix should be used for the $package library man pages?"
9062         case "$man3ext" in
9063         '')     case "$man3dir" in
9064                 *3)  dflt=3 ;;
9065                 *3p) dflt=3p ;;
9066                 *3pm) dflt=3pm ;;
9067                 *l) dflt=l;;
9068                 *n) dflt=n;;
9069                 *o) dflt=o;;
9070                 *p) dflt=p;;
9071                 *C) dflt=C;;
9072                 *L) dflt=L;;
9073                 *L3) dflt=L3;;
9074                 *) dflt=3;;
9075                 esac
9076                 ;;
9077         *)      dflt="$man3ext";;
9078         esac
9079         . ./myread
9080         man3ext="$ans"
9081         ;;
9082 esac
9083
9084 : see if we have to deal with yellow pages, now NIS.
9085 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9086         case "$hostcat" in
9087         nidump*) ;;
9088         *)
9089                 case "$hostcat" in
9090                 *ypcat*) dflt=y;;
9091                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9092                                 dflt=y
9093                         else
9094                                 dflt=n
9095                         fi;;
9096                 *) dflt=n;;
9097                 esac
9098                 echo " "
9099                 rp='Are you getting the hosts file via yellow pages?'
9100                 . ./myread
9101                 case "$ans" in
9102                 y*) hostcat='ypcat hosts';;
9103                 *) hostcat='cat /etc/hosts';;
9104                 esac
9105                 ;;
9106         esac
9107 fi
9108 case "$hostcat" in
9109 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9110 esac
9111 case "$groupcat" in
9112 '') test -f /etc/group && groupcat='cat /etc/group';;
9113 esac
9114 case "$passcat" in
9115 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9116 esac
9117
9118 : now get the host name
9119 echo " "
9120 echo "Figuring out host name..." >&4
9121 case "$myhostname" in
9122 '') cont=true
9123         echo 'Maybe "hostname" will work...'
9124         if tans=`sh -c hostname 2>&1` ; then
9125                 myhostname=$tans
9126                 phostname=hostname
9127                 cont=''
9128         fi
9129         ;;
9130 *) cont='';;
9131 esac
9132 if $test "$cont"; then
9133         if ./xenix; then
9134                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9135                 if tans=`cat /etc/systemid 2>&1` ; then
9136                         myhostname=$tans
9137                         phostname='cat /etc/systemid'
9138                         echo "Whadyaknow.  Xenix always was a bit strange..."
9139                         cont=''
9140                 fi
9141         elif $test -r /etc/systemid; then
9142                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9143         fi
9144 fi
9145 if $test "$cont"; then
9146         echo 'No, maybe "uuname -l" will work...'
9147         if tans=`sh -c 'uuname -l' 2>&1` ; then
9148                 myhostname=$tans
9149                 phostname='uuname -l'
9150         else
9151                 echo 'Strange.  Maybe "uname -n" will work...'
9152                 if tans=`sh -c 'uname -n' 2>&1` ; then
9153                         myhostname=$tans
9154                         phostname='uname -n'
9155                 else
9156                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9157                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9158                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9159                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9160                         else
9161                                 case "$myhostname" in
9162                                 '') echo "Does this machine have an identity crisis or something?"
9163                                         phostname='';;
9164                                 *)
9165                                         echo "Well, you said $myhostname before..."
9166                                         phostname='echo $myhostname';;
9167                                 esac
9168                         fi
9169                 fi
9170         fi
9171 fi
9172 case "$myhostname" in
9173 '') myhostname=noname ;;
9174 esac
9175 : you do not want to know about this
9176 set $myhostname
9177 myhostname=$1
9178
9179 : verify guess
9180 if $test "$myhostname" ; then
9181         dflt=y
9182         rp='Your host name appears to be "'$myhostname'".'" Right?"
9183         . ./myread
9184         case "$ans" in
9185         y*) ;;
9186         *) myhostname='';;
9187         esac
9188 fi
9189
9190 : bad guess or no guess
9191 while $test "X$myhostname" = X ; do
9192         dflt=''
9193         rp="Please type the (one word) name of your host:"
9194         . ./myread
9195         myhostname="$ans"
9196 done
9197
9198 : translate upper to lower if necessary
9199 case "$myhostname" in
9200 *[A-Z]*)
9201         echo "(Normalizing case in your host name)"
9202         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9203         ;;
9204 esac
9205
9206 case "$myhostname" in
9207 *.*)
9208         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9209         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9210         echo "(Trimming domain name from host name--host name is now $myhostname)"
9211         ;;
9212 *) case "$mydomain" in
9213         '')
9214                 {
9215                         test "X$hostcat" = "Xypcat hosts" &&
9216                         ypmatch "$myhostname" hosts 2>/dev/null |\
9217                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9218                         $test -s hosts
9219                 } || {
9220                         test "X$hostcat" != "X" &&
9221                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9222                                         /[       ]$myhostname[  . ]/p" > hosts
9223                 }
9224                 tmp_re="[       . ]"
9225                 if $test -f hosts; then
9226                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9227                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9228                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9229                                 hosts | $sort | $uniq | \
9230                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9231                         case `$echo X$dflt` in
9232                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9233                                 dflt=.
9234                                 ;;
9235                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9236                                 ;;
9237                         esac
9238                 else
9239                         echo "(I cannot locate a hosts database anywhere)"
9240                         dflt=.
9241                 fi
9242                 case "$dflt" in
9243                 .)
9244                         tans=`./loc resolv.conf X /etc /usr/etc`
9245                         if $test -f "$tans"; then
9246                                 echo "(Attempting domain name extraction from $tans)"
9247                                 dflt=.`$sed -n -e 's/   / /g' \
9248                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9249                                   -e 1q 2>/dev/null`
9250                                 case "$dflt" in
9251                                 .) dflt=.`$sed -n -e 's/        / /g' \
9252                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9253                                      -e 1q 2>/dev/null`
9254                                         ;;
9255                                 esac
9256                         fi
9257                         ;;
9258                 esac
9259                 case "$dflt" in
9260                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9261                         dflt=.`sh -c domainname 2>/dev/null`
9262                         case "$dflt" in
9263                         '') dflt='.';;
9264                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9265                         esac
9266                         ;;
9267                 esac
9268                 case "$dflt$osname" in
9269                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9270                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9271                         ;;
9272                 esac
9273                 case "$dflt" in
9274                 .) echo "(Lost all hope -- silly guess then)"
9275                         dflt='.nonet'
9276                         ;;
9277                 esac
9278                 $rm -f hosts
9279                 ;;
9280         *) dflt="$mydomain";;
9281         esac;;
9282 esac
9283 echo " "
9284 rp="What is your domain name?"
9285 . ./myread
9286 tans="$ans"
9287 case "$ans" in
9288 '') ;;
9289 .*) ;;
9290 *) tans=".$tans";;
9291 esac
9292 mydomain="$tans"
9293
9294 : translate upper to lower if necessary
9295 case "$mydomain" in
9296 *[A-Z]*)
9297         echo "(Normalizing case in your domain name)"
9298         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9299         ;;
9300 esac
9301
9302 : a little sanity check here
9303 case "$phostname" in
9304 '') ;;
9305 *)
9306         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9307         $myhostname$mydomain|$myhostname) ;;
9308         *)
9309                 case "$phostname" in
9310                 sed*)
9311                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9312                         ;;
9313                 *)
9314                         echo "(That doesn't agree with your $phostname command, by the way.)"
9315                         ;;
9316                 esac
9317         ;;
9318         esac
9319         ;;
9320 esac
9321
9322 : determine the e-mail address of the user who is running us
9323 $cat <<EOM
9324
9325 I need to get your e-mail address in Internet format if possible, i.e.
9326 something like [email protected]. Please answer accurately since I have
9327 no easy means to double check it. The default value provided below
9328 is most probably close to reality but may not be valid from outside
9329 your organization...
9330
9331 EOM
9332 cont=x
9333 while test "$cont"; do
9334         case "$MAILDOMAIN" in
9335         '')
9336                 if $test -s /etc/mailname; then
9337                         maildomain=`$cat /etc/mailname`
9338                 else
9339                         maildomain="$myhostname$mydomain"
9340                 fi
9341                 ;;
9342         *)  maildomain="$MAILDOMAIN";;
9343         esac
9344         case "$cf_email" in
9345         '') dflt="$cf_by@$maildomain";;
9346         *)  dflt="$cf_email";;
9347         esac
9348         rp='What is your e-mail address?'
9349         . ./myread
9350         cf_email="$ans"
9351         case "$cf_email" in
9352         *@*.*) cont='' ;;
9353         *)
9354                 rp='Address does not look like an Internet one.  Use it anyway?'
9355                 case "$fastread" in
9356                 yes) dflt=y ;;
9357                 *) dflt=n ;;
9358                 esac
9359                 . ./myread
9360                 case "$ans" in
9361                 y*) cont='' ;;
9362                 *) echo " " ;;
9363                 esac
9364                 ;;
9365         esac
9366 done
9367
9368 : Ask e-mail of administrator
9369 $cat <<EOM
9370
9371 If you or somebody else will be maintaining perl at your site, please
9372 fill in the correct e-mail address here so that they may be contacted
9373 if necessary. You may enter "none" for no administrator.
9374
9375 EOM
9376 case "$perladmin" in
9377 '') dflt="$cf_email";;
9378 *) dflt="$perladmin";;
9379 esac
9380 rp='Perl administrator e-mail address'
9381 . ./myread
9382 perladmin="$ans"
9383
9384 : determine whether to use a version number suffix for installed binaries
9385 echo " "
9386 $cat <<EOM
9387 Do you want to use a version number suffix for installed binaries? This
9388 will install 'perl$version' instead of 'perl', and likewise for other
9389 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9390 to be installed side-by-side. Unless you are a developer, you probably
9391 do *not* want to do this.
9392 EOM
9393 case "$versiononly" in
9394 "$define"|[Yy]*|true) dflt='y' ;;
9395 *) dflt='n';
9396 esac
9397 rp="Do you want to use a version number suffix for installed binaries?"
9398 . ./myread
9399 case "$ans" in
9400 [yY]*)  val="$define";;
9401 *)      val="$undef" ;;
9402 esac
9403 set versiononly
9404 eval $setvar
9405
9406 case "$versiononly" in
9407 "$define") inc_version_list=''
9408            inc_version_list_init=0
9409            ;;
9410 esac
9411
9412 : figure out how to guarantee perl startup
9413 : XXX Note that this currently takes advantage of the bug that binexp ignores
9414 :     the Configure -Dinstallprefix setting, which in turn means that under
9415 :     relocatable @INC, initialinstalllocation is what binexp started as.
9416 case "$startperl" in
9417 '')
9418         case "$sharpbang" in
9419         *!)
9420                 $cat <<EOH
9421
9422 I can use the #! construct to start perl on your system. This will
9423 make startup of perl scripts faster, but may cause problems if you
9424 want to share those scripts and perl is not in a standard place
9425 ($initialinstalllocation/perl) on all your platforms. The alternative
9426 is to force a shell by starting the script with a single ':' character.
9427
9428 EOH
9429                 case "$versiononly" in
9430                 "$define")      dflt="$initialinstalllocation/perl$version";;
9431                 *)              dflt="$initialinstalllocation/perl";;
9432                 esac
9433                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9434                 . ./myread
9435                 case "$ans" in
9436                 none)   startperl=": # use perl";;
9437                 *)      startperl="#!$ans"
9438                         if $test 30 -lt `echo "$ans" | wc -c`; then
9439                                 $cat >&4 <<EOM
9440
9441 WARNING:  Some systems limit the #! command to 32 characters.
9442 If you experience difficulty running Perl scripts with #!, try
9443 installing Perl in a directory with a shorter pathname.
9444
9445 EOM
9446                         fi ;;
9447                 esac
9448                 ;;
9449         *) startperl=": # use perl"
9450                 ;;
9451         esac
9452         ;;
9453 esac
9454 echo "I'll use $startperl to start perl scripts."
9455
9456 : figure best path for perl in scripts
9457 case "$perlpath" in
9458 '')
9459         case "$versiononly" in
9460         "$define")      perlpath="$initialinstalllocation/perl$version";;
9461         *)              perlpath="$initialinstalllocation/perl";;
9462         esac
9463         case "$startperl" in
9464         *!*) ;;
9465         *)
9466                 $cat <<EOH
9467
9468 I will use the "eval 'exec'" idiom to start Perl on your system.
9469 I can use the full path of your Perl binary for this purpose, but
9470 doing so may cause problems if you want to share those scripts and
9471 Perl is not always in a standard place ($initialinstalllocation/perl).
9472
9473 EOH
9474                 dflt="$initialinstalllocation/perl"
9475                 rp="What path shall I use in \"eval 'exec'\"?"
9476                 . ./myread
9477                 perlpath="$ans"
9478                 ;;
9479         esac
9480         ;;
9481 esac
9482 case "$startperl" in
9483 *!*)    ;;
9484 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9485 esac
9486
9487 : determine where public executable scripts go
9488 set scriptdir scriptdir
9489 eval $prefixit
9490 case "$scriptdir" in
9491 '')
9492         dflt="$bin"
9493         : guess some guesses
9494         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9495         $test -d /usr/share/bin     && dflt=/usr/share/bin
9496         $test -d /usr/local/script  && dflt=/usr/local/script
9497         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9498         $test -d $prefixexp/script  && dflt=$prefixexp/script
9499         set dflt
9500         eval $prefixup
9501         ;;
9502 *)  dflt="$scriptdir"
9503         ;;
9504 esac
9505 $cat <<EOM
9506
9507 Some installations have a separate directory just for executable scripts so
9508 that they can mount it across multiple architectures but keep the scripts in
9509 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9510 Or you might just lump your scripts in with all your other executables.
9511
9512 EOM
9513 fn=d~
9514 rp='Where do you keep publicly executable scripts?'
9515 . ./getfile
9516 if $test "X$ansexp" != "X$scriptdirexp"; then
9517         installscript=''
9518 fi
9519 installscriptdir=''
9520 prefixvar=scriptdir
9521 . ./setprefixvar
9522 : A little fix up for an irregularly named variable.
9523 installscript="$installscriptdir"
9524
9525 : determine where add-on public executables go
9526 case "$sitebin" in
9527 '')     dflt=$siteprefix/bin ;;
9528 *)      dflt=$sitebin ;;
9529 esac
9530 fn=d~
9531 rp='Pathname where the add-on public executables should be installed?'
9532 . ./getfile
9533 prefixvar=sitebin
9534 . ./setprefixvar
9535
9536 : determine where add-on html pages go
9537 : There is no standard location, so try to copy the previously-selected
9538 : directory structure for the core html pages.
9539 case "$sitehtml1dir" in
9540 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9541 *)     dflt=$sitehtml1dir ;;
9542 esac
9543 case "$dflt" in
9544 ''|' ') dflt=none ;;
9545 esac
9546 fn=dn+~
9547 rp='Pathname where the site-specific html pages should be installed?'
9548 . ./getfile
9549 prefixvar=sitehtml1dir
9550 . ./setprefixvar
9551
9552 : determine where add-on library html pages go
9553 : There is no standard location, so try to copy the previously-selected
9554 : directory structure for the core html pages.
9555 case "$sitehtml3dir" in
9556 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9557 *)     dflt=$sitehtml3dir ;;
9558 esac
9559 case "$dflt" in
9560 ''|' ') dflt=none ;;
9561 esac
9562 fn=dn+~
9563 rp='Pathname where the site-specific library html pages should be installed?'
9564 . ./getfile
9565 prefixvar=sitehtml3dir
9566 . ./setprefixvar
9567
9568 : determine where add-on manual pages go
9569 case "$siteman1dir" in
9570 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9571 *)      dflt=$siteman1dir ;;
9572 esac
9573 case "$dflt" in
9574 ''|' ') dflt=none ;;
9575 esac
9576 fn=dn+~
9577 rp='Pathname where the site-specific manual pages should be installed?'
9578 . ./getfile
9579 prefixvar=siteman1dir
9580 . ./setprefixvar
9581
9582 : determine where add-on library man pages go
9583 case "$siteman3dir" in
9584 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9585 *)      dflt=$siteman3dir ;;
9586 esac
9587 case "$dflt" in
9588 ''|' ') dflt=none ;;
9589 esac
9590 fn=dn+~
9591 rp='Pathname where the site-specific library manual pages should be installed?'
9592 . ./getfile
9593 prefixvar=siteman3dir
9594 . ./setprefixvar
9595
9596 : determine where add-on public executable scripts go
9597 case "$sitescript" in
9598 '')     dflt=$siteprefix/script
9599         $test -d $dflt || dflt=$sitebin ;;
9600 *)  dflt="$sitescript" ;;
9601 esac
9602 fn=d~+
9603 rp='Pathname where add-on public executable scripts should be installed?'
9604 . ./getfile
9605 prefixvar=sitescript
9606 . ./setprefixvar
9607
9608 : see if backtrace exists
9609 set backtrace d_backtrace
9610 eval $inlibc
9611
9612 : Check if C backtrace is actually supported.
9613 case "$usecbacktrace" in
9614   "") usecbacktrace=$undef ;;
9615   [yY]*|true|$define)
9616     case "$d_backtrace" in
9617       [yY]*|true|$define)
9618         ;;
9619       *)
9620         echo "This system does not support backtrace" >&4
9621         usecbacktrace=$undef
9622         ;;
9623       esac
9624     ;;
9625   esac
9626
9627 : Check if faststdio is requested and available
9628 case "$usefaststdio" in
9629 $define|true|[yY]*|'')
9630         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9631         case "$xversion" in
9632         [68])   dflt='y' ;;
9633         *)      dflt='n' ;;
9634         esac
9635         ;;
9636 *) dflt='n';;
9637 esac
9638 cat <<EOM
9639
9640 Perl can be built to use 'fast stdio', which means using the stdio
9641 library but also directly manipulating the stdio buffers to enable
9642 faster I/O.  Using stdio is better for backward compatibility (especially
9643 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9644 interface has been preferred instead of stdio.
9645
9646 If this doesn't make any sense to you, just accept the default '$dflt'.
9647 EOM
9648 rp='Use the "fast stdio" if available?'
9649 . ./myread
9650 case "$ans" in
9651 y|Y)    val="$define" ;;
9652 *)      val="$undef" ;;
9653 esac
9654 set usefaststdio
9655 eval $setvar
9656
9657 : define an is-a-typedef? function
9658 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9659 case "$inclist" in
9660 "") inclist="sys/types.h";;
9661 esac;
9662 eval "varval=\$$var";
9663 case "$varval" in
9664 "")
9665         $rm -f temp.c;
9666         for inc in $inclist; do
9667                 echo "#include <$inc>" >>temp.c;
9668         done;
9669         echo "#ifdef $type" >> temp.c;
9670         echo "printf(\"We have $type\");" >> temp.c;
9671         echo "#endif" >> temp.c;
9672         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9673         if $contains $type temp.E >/dev/null 2>&1; then
9674                 eval "$var=\$type";
9675         else
9676                 eval "$var=\$def";
9677         fi;
9678         $rm -f temp.?;;
9679 *) eval "$var=\$varval";;
9680 esac'
9681
9682 : define an is-a-typedef? function that prompts if the type is not available.
9683 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9684 case "$inclist" in
9685 "") inclist="sys/types.h";;
9686 esac;
9687 eval "varval=\$$var";
9688 case "$varval" in
9689 "")
9690         $rm -f temp.c;
9691         for inc in $inclist; do
9692                 echo "#include <$inc>" >>temp.c;
9693         done;
9694         echo "#ifdef $type" >> temp.c;
9695         echo "printf(\"We have $type\");" >> temp.c;
9696         echo "#endif" >> temp.c;
9697         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9698         echo " " ;
9699         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9700         if $contains $type temp.E >/dev/null 2>&1; then
9701                 echo "$type found." >&4;
9702                 eval "$var=\$type";
9703         else
9704                 echo "$type NOT found." >&4;
9705                 dflt="$def";
9706                 . ./myread ;
9707                 eval "$var=\$ans";
9708         fi;
9709         $rm -f temp.?;;
9710 *) eval "$var=\$varval";;
9711 esac'
9712
9713 : see what type lseek is declared as in the kernel
9714 rp="What is the type used for lseek's offset on this system?"
9715 set off_t lseektype long stdio.h sys/types.h
9716 eval $typedef_ask
9717
9718 echo " "
9719 echo "Checking to see how big your file offsets are..." >&4
9720 $cat >try.c <<EOCP
9721 #include <sys/types.h>
9722 #include <stdio.h>
9723 int main()
9724 {
9725     printf("%d\n", (int)sizeof($lseektype));
9726     return(0);
9727 }
9728 EOCP
9729 set try
9730 if eval $compile_ok; then
9731         lseeksize=`$run ./try`
9732         echo "Your file offsets are $lseeksize bytes long."
9733 else
9734         dflt=$longsize
9735         echo " "
9736         echo "(I can't seem to compile the test program.  Guessing...)"
9737         rp="What is the size of your file offsets (in bytes)?"
9738         . ./myread
9739         lseeksize="$ans"
9740 fi
9741 $rm_try
9742
9743 : see what type file positions are declared as in the library
9744 rp="What is the type for file position used by fsetpos()?"
9745 set fpos_t fpostype long stdio.h sys/types.h
9746 eval $typedef_ask
9747
9748 : Check size for Fpos_t
9749 echo " "
9750 case "$fpostype" in
9751 *_t) zzz="$fpostype"    ;;
9752 *)   zzz="fpos_t"       ;;
9753 esac
9754 echo "Checking the size of $zzz..." >&4
9755 cat > try.c <<EOCP
9756 #include <sys/types.h>
9757 #include <stdio.h>
9758 #$i_stdlib I_STDLIB
9759 #ifdef I_STDLIB
9760 #include <stdlib.h>
9761 #endif
9762 int main() {
9763     printf("%d\n", (int)sizeof($fpostype));
9764     exit(0);
9765 }
9766 EOCP
9767 set try
9768 if eval $compile_ok; then
9769         yyy=`$run ./try`
9770         case "$yyy" in
9771         '')     fpossize=4
9772                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9773                 ;;
9774         *)      fpossize=$yyy
9775                 echo "Your $zzz is $fpossize bytes long."
9776                 ;;
9777         esac
9778 else
9779         dflt="$longsize"
9780         echo " " >&4
9781         echo "(I can't compile the test program.  Guessing...)" >&4
9782         rp="What is the size of your file positions (in bytes)?"
9783         . ./myread
9784         fpossize="$ans"
9785 fi
9786
9787 : Check for large file support
9788 # Backward compatibility (uselfs is deprecated).
9789 case "$uselfs" in
9790 "$define"|true|[yY]*)
9791         cat <<EOM >&4
9792
9793 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9794 EOM
9795         uselargefiles="$define"
9796         ;;
9797 esac
9798
9799 case "$lseeksize:$fpossize" in
9800 8:8) cat <<EOM
9801
9802 You can have files larger than 2 gigabytes.
9803 EOM
9804    val="$define" ;;
9805 *)    case "$uselargefiles" in
9806    "$undef"|false|[nN]*) dflt='n' ;;
9807    *)   dflt='y' ;;
9808    esac
9809    cat <<EOM
9810
9811 Perl can be built to understand large files (files larger than 2 gigabytes)
9812 on some systems.  To do so, Configure can be run with -Duselargefiles.
9813
9814 If this doesn't make any sense to you, just accept the default '$dflt'.
9815 EOM
9816    rp='Try to understand large files, if available?'
9817    . ./myread
9818    case "$ans" in
9819    y|Y) val="$define" ;;
9820    *)   val="$undef"  ;;
9821    esac
9822    ;;
9823 esac
9824 set uselargefiles
9825 eval $setvar
9826 : Look for a hint-file generated 'call-back-unit'.  If the
9827 : user has specified that a large files perl is to be built,
9828 : we may need to set or change some other defaults.
9829 if $test -f uselargefiles.cbu; then
9830         echo "Your platform has some specific hints regarding large file builds, using them..."
9831         . ./uselargefiles.cbu
9832 fi
9833 case "$uselargefiles" in
9834 "$define")
9835         if $test -f uselargefiles.cbu; then
9836                 echo " "
9837                 echo "Rechecking to see how big your file offsets are..." >&4
9838                 $cat >try.c <<EOCP
9839 #include <sys/types.h>
9840 #include <stdio.h>
9841 int main()
9842 {
9843     printf("%d\n", (int)sizeof($lseektype));
9844     return(0);
9845 }
9846 EOCP
9847                 set try
9848                 if eval $compile_ok; then
9849                         lseeksize=`$run ./try`
9850                         $echo "Your file offsets are now $lseeksize bytes long."
9851                 else
9852                         dflt="$lseeksize"
9853                         echo " "
9854                         echo "(I can't seem to compile the test program.  Guessing...)"
9855                         rp="What is the size of your file offsets (in bytes)?"
9856                         . ./myread
9857                         lseeksize="$ans"
9858                 fi
9859                 case "$fpostype" in
9860                 *_t) zzz="$fpostype"    ;;
9861                 *)   zzz="fpos_t"       ;;
9862                 esac
9863                 $echo $n "Rechecking the size of $zzz...$c" >&4
9864                 $cat > try.c <<EOCP
9865 #include <sys/types.h>
9866 #include <stdio.h>
9867 #$i_stdlib I_STDLIB
9868 #ifdef I_STDLIB
9869 #include <stdlib.h>
9870 #endif
9871 int main() {
9872     printf("%d\n", (int)sizeof($fpostype));
9873     return(0);
9874 }
9875 EOCP
9876                 set try
9877                 if eval $compile_ok; then
9878                         yyy=`$run ./try`
9879                         dflt="$lseeksize"
9880                         case "$yyy" in
9881                         '')     echo " "
9882                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9883                                 ;;
9884                         *)      fpossize=$yyy
9885                                 echo " $fpossize bytes." >&4
9886                                 ;;
9887                         esac
9888                 else
9889                         dflt="$fpossize"
9890                         echo " "
9891                         echo "(I can't compile the test program.  Guessing...)" >&4
9892                         rp="What is the size of your file positions (in bytes)?"
9893                         . ./myread
9894                         fpossize="$ans"
9895                 fi
9896                 $rm_try
9897         fi
9898         ;;
9899 esac
9900
9901 : Check if we want perlio
9902 useperlio="$define"
9903
9904 : Set the vendorbin variables
9905 case "$vendorprefix" in
9906 '')     d_vendorbin="$undef"
9907         vendorbin=''
9908         vendorbinexp=''
9909         ;;
9910 *)      d_vendorbin="$define"
9911         : determine where vendor-supplied executables go.
9912         case "$vendorbin" in
9913         '') dflt=$vendorprefix/bin ;;
9914         *)      dflt="$vendorbin" ;;
9915         esac
9916         fn=d~+
9917         rp='Pathname for the vendor-supplied executables directory?'
9918         . ./getfile
9919         vendorbin="$ans"
9920         vendorbinexp="$ansexp"
9921         ;;
9922 esac
9923 prefixvar=vendorbin
9924 . ./installprefix
9925
9926 : Set the vendorhtml1dir variables
9927 case "$vendorprefix" in
9928 '')     vendorhtml1dir=''
9929         vendorhtml1direxp=''
9930         ;;
9931 *)      : determine where vendor-supplied html pages go.
9932         : There is no standard location, so try to copy the previously-selected
9933         : directory structure for the core html pages.
9934         : XXX Better default suggestions would be welcome.
9935         case "$vendorhtml1dir" in
9936         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9937         *)      dflt=$vendorhtml1dir ;;
9938         esac
9939         case "$dflt" in
9940         ''|' ') dflt=none ;;
9941         esac
9942         fn=dn+~
9943         rp='Pathname for the vendor-supplied html pages?'
9944         . ./getfile
9945         vendorhtml1dir="$ans"
9946         vendorhtml1direxp="$ansexp"
9947         ;;
9948 esac
9949 : Use ' ' for none so value is preserved next time through Configure
9950 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9951 prefixvar=vendorhtml1dir
9952 . ./installprefix
9953
9954 : Set the vendorhtml3dir variables
9955 case "$vendorprefix" in
9956 '')     vendorhtml3dir=''
9957         vendorhtml3direxp=''
9958         ;;
9959 *)      : determine where vendor-supplied module html pages go.
9960         : There is no standard location, so try to copy the previously-selected
9961         : directory structure for the core html pages.
9962         : XXX Better default suggestions would be welcome.
9963         case "$vendorhtml3dir" in
9964         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9965         *)      dflt=$vendorhtml3dir ;;
9966         esac
9967         case "$dflt" in
9968         ''|' ') dflt=none ;;
9969         esac
9970         fn=dn+~
9971         rp='Pathname for the vendor-supplied html pages?'
9972         . ./getfile
9973         vendorhtml3dir="$ans"
9974         vendorhtml3direxp="$ansexp"
9975         ;;
9976 esac
9977 : Use ' ' for none so value is preserved next time through Configure
9978 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9979 prefixvar=vendorhtml3dir
9980 . ./installprefix
9981
9982 : Set the vendorman1dir variables
9983 case "$vendorprefix" in
9984 '')     vendorman1dir=''
9985         vendorman1direxp=''
9986         ;;
9987 *)      : determine where vendor-supplied manual pages go.
9988         case "$vendorman1dir" in
9989         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9990         *)      dflt=$vendorman1dir ;;
9991         esac
9992         case "$dflt" in
9993         ''|' ') dflt=none ;;
9994         esac
9995         fn=nd~+
9996         rp='Pathname for the vendor-supplied manual section 1 pages?'
9997         . ./getfile
9998         vendorman1dir="$ans"
9999         vendorman1direxp="$ansexp"
10000         ;;
10001 esac
10002 : Use ' ' for none so value is preserved next time through Configure
10003 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10004 prefixvar=vendorman1dir
10005 . ./installprefix
10006
10007 : Set the vendorman3dir variables
10008 case "$vendorprefix" in
10009 '')     vendorman3dir=''
10010         vendorman3direxp=''
10011         ;;
10012 *)      : determine where vendor-supplied module manual pages go.
10013         case "$vendorman3dir" in
10014         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10015         *)      dflt=$vendorman3dir ;;
10016         esac
10017         case "$dflt" in
10018         ''|' ') dflt=none ;;
10019         esac
10020         fn=nd~+
10021         rp='Pathname for the vendor-supplied manual section 3 pages?'
10022         . ./getfile
10023         vendorman3dir="$ans"
10024         vendorman3direxp="$ansexp"
10025         ;;
10026 esac
10027 : Use ' ' for none so value is preserved next time through Configure
10028 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10029 prefixvar=vendorman3dir
10030 . ./installprefix
10031
10032 : Set the vendorscript variables
10033 case "$vendorprefix" in
10034 '')     d_vendorscript="$undef"
10035         vendorscript=''
10036         vendorscriptexp=''
10037         ;;
10038 *)      d_vendorscript="$define"
10039         : determine where vendor-supplied scripts go.
10040         case "$vendorscript" in
10041         '')     dflt=$vendorprefix/script
10042                 $test -d $dflt || dflt=$vendorbin ;;
10043         *)  dflt="$vendorscript" ;;
10044         esac
10045         $cat <<EOM
10046
10047 The installation process will create a directory for
10048 vendor-supplied scripts.
10049
10050 EOM
10051         fn=d~+
10052         rp='Pathname for the vendor-supplied scripts directory?'
10053         . ./getfile
10054         vendorscript="$ans"
10055         vendorscriptexp="$ansexp"
10056         ;;
10057 esac
10058 prefixvar=vendorscript
10059 . ./installprefix
10060
10061 : see if qgcvt exists
10062 set qgcvt d_qgcvt
10063 eval $inlibc
10064
10065 : Check what kind of doubles your system has
10066 $echo "Checking the kind of doubles you have..." >&4
10067 $cat >try.c <<EOP
10068 #$i_stdlib I_STDLIB
10069 #define DOUBLESIZE $doublesize
10070 #ifdef I_STDLIB
10071 #include <stdlib.h>
10072 #endif
10073 #include <stdio.h>
10074 static const double d = -0.1;
10075 int main() {
10076   unsigned const char* b = (unsigned const char*)(&d);
10077 #if DOUBLESIZE == 4
10078   if (b[0] == 0xCD && b[3] == 0xBD) {
10079     /* IEEE 754 32-bit little-endian */
10080     printf("1\n");
10081     exit(0);
10082   }
10083   if (b[0] == 0xBD && b[3] == 0xCD) {
10084     /* IEEE 754 32-bit big-endian */
10085     printf("2\n");
10086     exit(0);
10087   }
10088   if (b[0] == 0xCC && b[3] == 0xCC) {
10089     /* VAX format F, 32-bit PDP-style mixed endian. */
10090     printf("9\n");
10091     exit(0);
10092   }
10093   if (b[0] == 0xC0 && b[3] == 0x9A) {
10094     /* IBM single 32-bit */
10095     printf("12\n");
10096     exit(0);
10097   }
10098 #endif
10099 #if DOUBLESIZE == 8
10100   if (b[0] == 0x9A && b[7] == 0xBF) {
10101     /* IEEE 754 64-bit little-endian */
10102     printf("3\n");
10103     exit(0);
10104   }
10105   if (b[0] == 0xBF && b[7] == 0x9A) {
10106     /* IEEE 754 64-bit big-endian */
10107     printf("4\n");
10108     exit(0);
10109   }
10110   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10111    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10112     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10113     * 99 99 b9 bf 9a 99 99 99 */
10114     printf("7\n");
10115     exit(0);
10116   }
10117   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10118    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10119     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10120     * 99 99 99 9a bf b9 99 99 */
10121     printf("8\n");
10122     exit(0);
10123   }
10124   if (b[0] == 0xCC && b[7] == 0xCC) {
10125    /* VAX format D, 64-bit PDP-style mixed endian. */
10126     printf("10\n");
10127     exit(0);
10128   }
10129   if (b[0] == 0xD9 && b[7] == 0x99) {
10130    /* VAX format G, 64-bit PDP-style mixed endian. */
10131     printf("11\n");
10132     exit(0);
10133   }
10134   if (b[0] == 0xC0 && b[7] == 0x9A) {
10135     /* IBM double 64-bit */
10136     printf("13\n");
10137     exit(0);
10138   }
10139   if (b[0] == 0xBF && b[7] == 0xCD) {
10140     /* CRAY single 64-bit */
10141     printf("14\n");
10142     exit(0);
10143   }
10144 #endif
10145 #if DOUBLESIZE == 16
10146   if (b[0] == 0x9A && b[15] == 0xBF) {
10147     /* IEEE 754 128-bit little-endian */
10148     printf("5\n");
10149     exit(0);
10150   }
10151   if (b[0] == 0xBF && b[15] == 0x9A) {
10152     /* IEEE 754 128-bit big-endian */
10153     printf("6\n");
10154     exit(0);
10155   }
10156 #endif
10157   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10158    * Whether those environments can still build Perl is debatable. */
10159   printf("-1\n"); /* unknown */
10160   exit(0);
10161 }
10162 EOP
10163 set try
10164 if eval $compile; then
10165     doublekind=`$run ./try`
10166 else
10167     doublekind=-1
10168 fi
10169 case "$doublekind" in
10170 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10171 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10172 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10173 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10174 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10175 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10176 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10177 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10178 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10179 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10180 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10181 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10182 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10183 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10184 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10185 esac
10186 d_double_style_ieee=$undef
10187 d_double_style_vax=$undef
10188 d_double_style_ibm=$undef
10189 d_double_style_cray=$undef
10190 case "$doublekind" in
10191 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10192 9|10|11) d_double_style_vax=$define ;;
10193 12|13) d_double_style_ibm=$define ;;
10194 14) d_double_style_cray=$define ;;
10195 esac
10196 case "$d_double_style_ieee" in
10197 $define)
10198     d_double_has_inf=$define
10199     d_double_has_nan=$define
10200     d_double_has_negative_zero=$define
10201     d_double_has_subnormals=$define
10202     ;;
10203 *)
10204     d_double_has_inf=$undef
10205     d_double_has_nan=$undef
10206     d_double_has_negative_zero=$undef
10207     d_double_has_subnormals=$undef
10208     ;;
10209 esac
10210 $rm_try
10211
10212 : Check print/scan long double stuff
10213 echo " "
10214
10215 if $test X"$d_longdbl" = X"$define"; then
10216
10217 echo "Checking how to print long doubles..." >&4
10218
10219 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10220         $cat >try.c <<'EOCP'
10221 #include <sys/types.h>
10222 #include <stdio.h>
10223 int main() {
10224   double d = 123.456;
10225   printf("%.3f\n", d);
10226 }
10227 EOCP
10228         set try
10229         if eval $compile; then
10230                 yyy=`$run ./try`
10231                 case "$yyy" in
10232                 123.456)
10233                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10234                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10235                         echo "We will use %f."
10236                         ;;
10237                 esac
10238         fi
10239 fi
10240
10241 if $test X"$sPRIfldbl" = X; then
10242         $cat >try.c <<'EOCP'
10243 #include <sys/types.h>
10244 #include <stdio.h>
10245 int main() {
10246   long double d = 123.456;
10247   printf("%.3Lf\n", d);
10248 }
10249 EOCP
10250         set try
10251         if eval $compile; then
10252                 yyy=`$run ./try`
10253                 case "$yyy" in
10254                 123.456)
10255                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10256                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10257                         echo "We will use %Lf."
10258                         ;;
10259                 esac
10260         fi
10261 fi
10262
10263 if $test X"$sPRIfldbl" = X; then
10264         $cat >try.c <<'EOCP'
10265 #include <sys/types.h>
10266 #include <stdio.h>
10267 int main() {
10268   long double d = 123.456;
10269   printf("%.3llf\n", d);
10270 }
10271 EOCP
10272         set try
10273         if eval $compile; then
10274                 yyy=`$run ./try`
10275                 case "$yyy" in
10276                 123.456)
10277                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10278                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10279                         echo "We will use %llf."
10280                         ;;
10281                 esac
10282         fi
10283 fi
10284
10285 if $test X"$sPRIfldbl" = X; then
10286         $cat >try.c <<'EOCP'
10287 #include <sys/types.h>
10288 #include <stdio.h>
10289 int main() {
10290   long double d = 123.456;
10291   printf("%.3lf\n", d);
10292 }
10293 EOCP
10294         set try
10295         if eval $compile; then
10296                 yyy=`$run ./try`
10297                 case "$yyy" in
10298                 123.456)
10299                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10300                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10301                         echo "We will use %lf."
10302                         ;;
10303                 esac
10304         fi
10305 fi
10306
10307 if $test X"$sPRIfldbl" = X; then
10308         echo "Cannot figure out how to print long doubles." >&4
10309 else
10310         sSCNfldbl=$sPRIfldbl    # expect consistency
10311 fi
10312
10313 $rm_try
10314
10315 fi # d_longdbl
10316
10317 case "$sPRIfldbl" in
10318 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10319         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10320         d_SCNfldbl="$undef";
10321         ;;
10322 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10323         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10324         d_SCNfldbl="$define";
10325         ;;
10326 esac
10327
10328 : Before committing on uselongdouble, see whether that looks sane.
10329 if $test "$uselongdouble" = "$define"; then
10330     message=""
10331     echo " "
10332     echo "Checking if your long double math functions work right..." >&4
10333     $cat > try.c <<EOF
10334 #include <math.h>
10335 #include <stdio.h>
10336 int main() {
10337   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10338 }
10339 EOF
10340     case "$osname:$gccversion" in
10341     aix:)       saveccflags="$ccflags"
10342                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10343     esac
10344     set try
10345     if eval $compile_ok; then
10346       yyy=`$run ./try`
10347     fi
10348     case "$yyy" in
10349     3) echo "Your long double math functions are working correctly." >&4 ;;
10350     *) echo "Your long double math functions are broken, not using long doubles." >&4
10351        uselongdouble=$undef
10352        ;;
10353     esac
10354     $rm_try
10355     case "$osname:$gccversion" in
10356     aix:)       ccflags="$saveccflags" ;; # restore
10357     esac
10358 fi
10359
10360 : Check how to convert floats to strings.
10361
10362 if test "X$d_Gconvert" = X; then
10363
10364 echo " "
10365 echo "Checking for an efficient way to convert floats to strings."
10366 echo " " > try.c
10367 case "$uselongdouble" in
10368 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10369 esac
10370 case "$d_longdbl" in
10371 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10372 esac
10373 case "$d_PRIgldbl" in
10374 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10375 esac
10376 $cat >>try.c <<EOP
10377 #ifdef TRY_gconvert
10378 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10379 const char *myname = "gconvert";
10380 #endif
10381 #ifdef TRY_gcvt
10382 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10383 const char *myname = "gcvt";
10384 #endif
10385 #ifdef TRY_qgcvt
10386 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10387 const char *myname = "qgcvt";
10388 #define DOUBLETYPE long double
10389 #endif
10390 #ifdef TRY_sprintf
10391 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10392 #ifdef HAS_PRIgldbl
10393 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10394 #else
10395 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10396 #endif
10397 #else
10398 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10399 #endif
10400 const char *myname = "sprintf";
10401 #endif
10402
10403 #ifndef DOUBLETYPE
10404 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10405 #define DOUBLETYPE long double
10406 #else
10407 #define DOUBLETYPE double
10408 #endif
10409 #endif
10410
10411 #include <stdio.h>
10412
10413 #$i_stdlib I_STDLIB
10414 #ifdef I_STDLIB
10415 #include <stdlib.h>
10416 #endif
10417 #include <string.h>
10418
10419 void checkit(const char *expect, char *got)
10420 {
10421     if (strcmp(expect, got)) {
10422                 printf("%s oddity:  Expected %s, got %s\n",
10423                         myname, expect, got);
10424                 exit(1);
10425         }
10426 }
10427
10428 void lencheck(int expect, int got)
10429 {
10430     if (expect != got) {
10431                 printf("%s length mismatch:  Expected %d, got %d\n",
10432                         myname, expect, got);
10433                 exit(1);
10434         }
10435 }
10436
10437 int main()
10438 {
10439         char buf[64];
10440         buf[63] = '\0';
10441
10442         /* This must be 1st test on (which?) platform */
10443         /* Alan Burlison <[email protected]> */
10444         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10445         checkit("0.1", buf);
10446
10447         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10448         checkit("0.01", buf);
10449
10450         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10451         checkit("0.001", buf);
10452
10453         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10454         checkit("0.0001", buf);
10455
10456         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10457         if (strlen(buf) > 5)
10458             checkit("9e-005", buf); /* for Microsoft ?? */
10459         else
10460             checkit("9e-05", buf);
10461
10462         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10463         checkit("1", buf);
10464
10465         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10466         checkit("1.1", buf);
10467
10468         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10469         checkit("1.01", buf);
10470
10471         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10472         checkit("1.001", buf);
10473
10474         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10475         checkit("1.0001", buf);
10476
10477         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10478         checkit("1.00001", buf);
10479
10480         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10481         checkit("1.000001", buf);
10482
10483         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10484         checkit("0", buf);
10485
10486         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10487         checkit("-1", buf);
10488
10489         /* Some Linux gcvt's give 1.e+5 here. */
10490         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10491         checkit("100000", buf);
10492
10493         /* Some Linux gcvt's give -1.e+5 here. */
10494         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10495         checkit("-100000", buf);
10496
10497         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10498         checkit("123.456", buf);
10499
10500         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10501         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10502         /* 34 should be enough to scare even long double
10503          * places into using the e notation. */
10504         if (strlen(buf) > 5)
10505             checkit("1e+034", buf); /* for Microsoft */
10506         else
10507             checkit("1e+34", buf);
10508
10509         /* Test for an Ubuntu/Debian bug in gcvt and qgcvt. See:        *
10510          * https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1899553 */
10511
10512         Gconvert((DOUBLETYPE)0.4, 53, 0, buf);
10513         lencheck(55, (int)strlen(buf));
10514
10515         /* For Perl, if you add additional tests here, also add them to
10516          * t/base/num.t for benefit of platforms not using Configure or
10517          * overriding d_Gconvert */
10518
10519         exit(0);
10520 }
10521 EOP
10522 : first add preferred functions to our list
10523 xxx_list=""
10524 for xxx_convert in $gconvert_preference; do
10525     case $xxx_convert in
10526     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10527     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10528     esac
10529 done
10530 : then add any others
10531 for xxx_convert in gconvert gcvt sprintf; do
10532     case "$xxx_list" in
10533     *$xxx_convert*) ;;
10534     *) xxx_list="$xxx_list $xxx_convert" ;;
10535     esac
10536 done
10537
10538 case "$d_longdbl$uselongdouble" in
10539 "$define$define")
10540     : again, add preferred functions to our list first
10541     xxx_ld_list=""
10542     for xxx_convert in $gconvert_ld_preference; do
10543         case $xxx_convert in
10544         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10545         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10546         esac
10547     done
10548     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10549     for xxx_convert in qgcvt sprintf $xxx_list; do
10550         case "$xxx_ld_list" in
10551         $xxx_convert*|*" $xxx_convert"*) ;;
10552         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10553         esac
10554     done
10555     : if sprintf cannot do long doubles, move it to the end
10556     if test "$d_PRIgldbl" != "$define"; then
10557         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10558     fi
10559     : if no qgcvt, remove it
10560     if test "$d_qgcvt" != "$define"; then
10561         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10562     fi
10563     : use the ld_list
10564     xxx_list="$xxx_ld_list"
10565     ;;
10566 esac
10567
10568 for xxx_convert in $xxx_list; do
10569         echo "Trying $xxx_convert..."
10570         $rm -f try try$_o core
10571         set try -DTRY_$xxx_convert
10572         if eval $compile; then
10573                 echo "$xxx_convert() found." >&4
10574                 if $run ./try; then
10575                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10576                         break;
10577                 else
10578                         echo "...But $xxx_convert didn't work as I expected."
10579                         xxx_convert=''
10580                 fi
10581         else
10582                 echo "$xxx_convert NOT found." >&4
10583                 xxx_convert=''
10584         fi
10585 done
10586
10587 if test X$xxx_convert = X; then
10588     echo "*** WHOA THERE!!! ***" >&4
10589     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10590     xxx_convert=sprintf
10591 fi
10592
10593 case "$xxx_convert" in
10594 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10595 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10596 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10597 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10598    "$define$define$define")
10599       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10600    "$define$define$undef")
10601       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10602    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10603    esac
10604    ;;
10605 esac
10606
10607 fi
10608 $rm_try
10609
10610 : see if _fwalk exists
10611 set fwalk d__fwalk
10612 eval $inlibc
10613
10614 : see if accept4 exists
10615 set accept4 d_accept4
10616 eval $inlibc
10617
10618 : Initialize h_fcntl
10619 h_fcntl=false
10620
10621 : Initialize h_sysfile
10622 h_sysfile=false
10623
10624 : access call always available on UNIX
10625 set access d_access
10626 eval $inlibc
10627
10628 : locate the flags for 'access()'
10629 case "$d_access" in
10630 "$define")
10631         echo " "
10632         $cat >access.c <<EOCP
10633 #include <sys/types.h>
10634 #ifdef I_FCNTL
10635 #include <fcntl.h>
10636 #endif
10637 #ifdef I_SYS_FILE
10638 #include <sys/file.h>
10639 #endif
10640 #ifdef I_UNISTD
10641 #include <unistd.h>
10642 #endif
10643 #$i_stdlib I_STDLIB
10644 #ifdef I_STDLIB
10645 #include <stdlib.h>
10646 #endif
10647 int main() {
10648         exit(R_OK);
10649 }
10650 EOCP
10651         : check sys/file.h first, no particular reason here
10652         if $test `./findhdr sys/file.h` && \
10653                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10654                 h_sysfile=true;
10655                 echo "<sys/file.h> defines the *_OK access constants." >&4
10656         elif $test `./findhdr fcntl.h` && \
10657                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10658                 h_fcntl=true;
10659                 echo "<fcntl.h> defines the *_OK access constants." >&4
10660         elif $test `./findhdr unistd.h` && \
10661                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10662                 echo "<unistd.h> defines the *_OK access constants." >&4
10663         else
10664                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10665         fi
10666         ;;
10667 esac
10668 $rm -f access*
10669
10670 : see if accessx exists
10671 set accessx d_accessx
10672 eval $inlibc
10673
10674 : see if acosh exists
10675 set acosh d_acosh
10676 eval $inlibc
10677
10678 : see if aintl exists
10679 set aintl d_aintl
10680 eval $inlibc
10681
10682 : see if alarm exists
10683 set alarm d_alarm
10684 eval $inlibc
10685
10686 : see if 64bit time functions exists
10687
10688 set ctime64 d_ctime64
10689 eval $inlibc
10690
10691 set localtime64 d_localtime64
10692 eval $inlibc
10693
10694 set gmtime64 d_gmtime64
10695 eval $inlibc
10696
10697 set mktime64 d_mktime64
10698 eval $inlibc
10699
10700 set difftime64 d_difftime64
10701 eval $inlibc
10702
10703 set asctime64 d_asctime64
10704 eval $inlibc
10705
10706 : see if POSIX threads are available
10707 set pthread.h i_pthread
10708 eval $inhdr
10709
10710 : define a function to check prototypes
10711 $cat > protochk <<EOSH
10712 $startsh
10713 cc="$cc"
10714 optimize="$optimize"
10715 ccflags="$ccflags"
10716 define="$define"
10717 rm_try="$rm_try"
10718 usethreads=$usethreads
10719 i_pthread=$i_pthread
10720 pthread_h_first=$pthread_h_first
10721 EOSH
10722
10723 $cat >> protochk <<'EOSH'
10724
10725 $rm_try
10726 foo="$1"
10727 shift
10728 while test $# -ge 2; do
10729         case "$1" in
10730                 $define) echo "#include <$2>" >> try.c ;;
10731                 literal) echo "$2" >> try.c ;;
10732         esac
10733     # Extra magic for the benefit of systems that need pthread.h
10734     # to be included early to correctly detect threadsafe functions.
10735     # Such functions must guarantee themselves, though, that the usethreads
10736     # and i_pthread have been defined, before calling protochk.
10737     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10738         echo "#include <pthread.h>" >> try.c
10739         pthread_h_done=yes
10740     fi
10741     shift 2
10742 done
10743 cat >> try.c <<'EOCP'
10744 #define _(args) args
10745 EOCP
10746 echo "$foo" >> try.c
10747 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10748 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10749 status=$?
10750 $rm_try
10751 exit $status
10752 EOSH
10753 chmod +x protochk
10754 $eunicefix protochk
10755
10756 : Define hasproto macro for Configure internal use
10757 hasproto='varname=$1; func=$2; shift; shift;
10758 while $test $# -ge 2; do
10759         case "$1" in
10760         $define) echo "#include <$2>";;
10761         literal) echo "$2" ;;
10762         esac ;
10763     shift 2;
10764 done > try.c;
10765 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10766 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10767         echo "$func() prototype found.";
10768         val="$define";
10769 else
10770         echo "$func() prototype NOT found.";
10771         val="$undef";
10772 fi;
10773 set $varname;
10774 eval $setvar;
10775 $rm_try tryout.c'
10776
10777 : see if sys/types.h has to be included
10778 set sys/types.h i_systypes
10779 eval $inhdr
10780
10781 : see if sys/select.h has to be included
10782 set sys/select.h i_sysselct
10783 eval $inhdr
10784
10785 : Define hasfield macro for Configure internal use
10786 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10787 while $test $# -ge 2; do
10788         case "$1" in
10789         $define) echo "#include <$2>";;
10790         esac ;
10791     shift 2;
10792 done > try.c;
10793 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10794 set try;
10795 if eval $compile; then
10796         val="$define";
10797 else
10798         val="$undef";
10799 fi;
10800 set $varname;
10801 eval $setvar;
10802 $rm_try'
10803
10804 : see if we should include sys/time.h
10805 echo " "
10806 i_time='define'
10807 if test "X$timeincl" = X; then
10808         echo "Testing to see if we should include <sys/time.h>." >&4
10809         $echo $n "I'm now running the test program...$c"
10810         $cat >try.c <<EOCP
10811 #include <sys/types.h>
10812 #include <time.h>
10813 #ifdef I_SYSTIME
10814 #ifdef SYSTIMEKERNEL
10815 #define KERNEL
10816 #endif
10817 #include <sys/time.h>
10818 #endif
10819 #ifdef I_SYSSELECT
10820 #include <sys/select.h>
10821 #endif
10822 #$i_stdlib I_STDLIB
10823 #ifdef I_STDLIB
10824 #include <stdlib.h>
10825 #endif
10826 int main()
10827 {
10828         struct tm foo;
10829 #ifdef S_TIMEVAL
10830         struct timeval bar;
10831 #endif
10832 #ifdef S_TIMEZONE
10833         struct timezone tzp;
10834 #endif
10835         if (foo.tm_sec == foo.tm_sec)
10836                 exit(0);
10837 #ifdef S_TIMEVAL
10838         if (bar.tv_sec == bar.tv_sec)
10839                 exit(0);
10840 #endif
10841         exit(1);
10842 }
10843 EOCP
10844         flags=''
10845         for s_timezone in '-DS_TIMEZONE' ''; do
10846         sysselect=''
10847         for s_timeval in '-DS_TIMEVAL' ''; do
10848         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10849         for i_systime in '-DI_SYSTIME' ''; do
10850                 case "$flags" in
10851                 '') $echo $n ".$c"
10852                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10853                         if eval $compile; then
10854                                 set X $i_systime $i_systimek $sysselect $s_timeval
10855                                 shift
10856                                 flags="$*"
10857                                 echo " "
10858                                 $echo $n "Succeeded with $flags$c"
10859                         fi
10860                         ;;
10861                 esac
10862         done
10863         done
10864         done
10865         done
10866         timeincl=''
10867         echo " "
10868         case "$flags" in
10869         *SYSTIMEKERNEL*) i_systimek="$define"
10870                 timeincl=`./findhdr sys/time.h`
10871                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10872         *) i_systimek="$undef";;
10873         esac
10874         case "$flags" in
10875         *I_SYSTIME*) i_systime="$define"
10876                 timeincl=`./findhdr sys/time.h`" $timeincl"
10877                 echo "We'll include <sys/time.h>." >&4;;
10878         *) i_systime="$undef";;
10879         esac
10880         $rm_try
10881 fi
10882 : see if struct tm knows about tm_zone
10883 case "$i_systime$i_time" in
10884 *$define*)
10885         echo " "
10886         echo "Checking to see if your struct tm has tm_zone field..." >&4
10887         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10888         eval $hasfield
10889         ;;
10890 *)      val="$undef"
10891         set d_tm_tm_zone
10892         eval $setvar
10893         ;;
10894 esac
10895 case "$d_tm_tm_zone" in
10896 "$define")      echo "Yes, it does."   ;;
10897 *)              echo "No, it doesn't." ;;
10898 esac
10899 : see if struct tm knows about tm_gmtoff
10900 case "$i_systime$i_time" in
10901 *$define*)
10902         echo " "
10903         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10904         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10905         eval $hasfield
10906         ;;
10907 *)      val="$undef"
10908         set d_tm_tm_gmtoff
10909         eval $setvar
10910         ;;
10911 esac
10912 case "$d_tm_tm_gmtoff" in
10913 "$define")      echo "Yes, it does."   ;;
10914 *)              echo "No, it doesn't." ;;
10915 esac
10916
10917 : see if asctime_r exists
10918 set asctime_r d_asctime_r
10919 eval $inlibc
10920 case "$d_asctime_r" in
10921 "$define")
10922         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10923         case "$d_asctime_r_proto:$usethreads" in
10924         ":define")      d_asctime_r_proto=define
10925                 set d_asctime_r_proto asctime_r $hdrs
10926                 eval $hasproto ;;
10927         *)      ;;
10928         esac
10929         case "$d_asctime_r_proto" in
10930         define)
10931         case "$asctime_r_proto" in
10932         ''|0) try='char* asctime_r(const struct tm*, char*);'
10933         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10934         esac
10935         case "$asctime_r_proto" in
10936         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10937         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10938         esac
10939         case "$asctime_r_proto" in
10940         ''|0) try='int asctime_r(const struct tm*, char*);'
10941         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10942         esac
10943         case "$asctime_r_proto" in
10944         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10945         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10946         esac
10947         case "$asctime_r_proto" in
10948         ''|0)   d_asctime_r=undef
10949                 asctime_r_proto=0
10950                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10951         * )     case "$asctime_r_proto" in
10952                 REENTRANT_PROTO*) ;;
10953                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10954                 esac
10955                 echo "Prototype: $try" ;;
10956         esac
10957         ;;
10958         *)      case "$usethreads" in
10959                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10960                 esac
10961                 d_asctime_r=undef
10962                 asctime_r_proto=0
10963                 ;;
10964         esac
10965         ;;
10966 *)      asctime_r_proto=0
10967         ;;
10968 esac
10969
10970 : see if asinh exists
10971 set asinh d_asinh
10972 eval $inlibc
10973
10974 : see if atanh exists
10975 set atanh d_atanh
10976 eval $inlibc
10977
10978 : see if atolf exists
10979 set atolf d_atolf
10980 eval $inlibc
10981
10982 : see if atoll exists
10983 set atoll d_atoll
10984 eval $inlibc
10985
10986 : See if a file contains compiler warnings
10987 case "$osname" in
10988   'aix')
10989         cat >compiler_warning <<EOSS
10990 # Sample for aix ('.5' indicates the column number in the line):
10991 #    "op.h", line 203.5: 1506-159 (E) Bit field type specified for op_type
10992 # Since the word 'warning' isn't present, use a fairly rigorous match of what
10993 # warning messages look like
10994 #            "    o        p        .  h   ", line    203      .   5        :   1506     -    159      (  E  )
10995 $grep -E "^\\"[A-Za-z][A-Za-z0-9_]*\.[ch]\\", line [1-9][0-9]*[.][1-9][0-9]*: [1-9][0-9]*-[1-9][0-9]* \([EW][)] " "\$1"
10996 EOSS
10997         compiler_warning=./compiler_warning
10998         chmod +x $compiler_warning
10999     ;;
11000      # Maybe a colon after the 'warning' would be appropriate
11001   *) compiler_warning="$contains -i warning"
11002     ;;
11003 esac
11004
11005 : Look for GCC-style attribute format
11006 case "$d_attribute_format" in
11007 '')
11008 echo " "
11009 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11010 $cat >attrib.c <<'EOCP'
11011 #include <stdio.h>
11012 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11013 EOCP
11014 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11015         if $compiler_warning attrib.out >/dev/null 2>&1; then
11016                 echo "Your C compiler doesn't support __attribute__((format))."
11017                 val="$undef"
11018         else
11019                 echo "Your C compiler supports __attribute__((format))."
11020                 val="$define"
11021         fi
11022 else
11023         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11024         val="$undef"
11025 fi
11026 ;;
11027 *) val="$d_attribute_format" ;;
11028 esac
11029 set d_attribute_format
11030 eval $setvar
11031 $rm -f attrib*
11032
11033 : Look for GCC-style attribute format with null format allowed
11034 case "$d_printf_format_null" in
11035 '') case "$d_attribute_format" in
11036     $define)
11037         echo " "
11038         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11039 $cat >attrib.c <<EOCP
11040 #include <stdio.h>
11041 #$i_stdlib I_STDLIB
11042 #ifdef I_STDLIB
11043 #include <stdlib.h>
11044 #endif
11045 #$i_inttypes I_INTTYPES
11046 #ifdef I_INTTYPES
11047 #include <inttypes.h>
11048 #endif
11049 #ifndef INTPTR_MAX
11050 #define intptr_t int
11051 #endif
11052 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11053 int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11054 int main () { exit(null_printf(NULL)); }
11055 EOCP
11056         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11057             : run the executable in case it produces a run-time warning
11058             if $run ./attrib >>attrib.out 2>&1; then
11059                 if $compiler_warning attrib.out >/dev/null 2>&1; then
11060                     echo "Your C compiler doesn't allow __printf__ format to be null."
11061                     val="$undef"
11062                 else
11063                     echo "Your C compiler allows __printf__ format to be null."
11064                     val="$define"
11065                 fi
11066             else
11067             echo "Your C compiler executable failed with __printf__ format null."
11068             val="$undef"
11069         fi
11070     else
11071         echo "Your C compiler fails with __printf__ format null."
11072         val="$undef"
11073     fi
11074     ;;
11075     *)  val="$undef" ;;
11076     esac
11077 ;;
11078 *)  val="$d_printf_format_null" ;;
11079 esac
11080 set d_printf_format_null
11081 eval $setvar
11082 $rm -f attrib*
11083
11084 : Look for GCC-style attribute malloc
11085 case "$d_attribute_malloc" in
11086 '')
11087 echo " "
11088 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11089 $cat >attrib.c <<'EOCP'
11090 #include <stdio.h>
11091 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11092 EOCP
11093 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11094         if $compiler_warning attrib.out >/dev/null 2>&1; then
11095                 echo "Your C compiler doesn't support __attribute__((malloc))."
11096                 val="$undef"
11097         else
11098                 echo "Your C compiler supports __attribute__((malloc))."
11099                 val="$define"
11100         fi
11101 else
11102         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11103         val="$undef"
11104 fi
11105 ;;
11106 *) val="$d_attribute_malloc" ;;
11107 esac
11108 set d_attribute_malloc
11109 eval $setvar
11110 $rm -f attrib*
11111
11112 : Look for GCC-style attribute nonnull
11113 case "$d_attribute_nonnull" in
11114 '')
11115 echo " "
11116 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11117 $cat >attrib.c <<'EOCP'
11118 #include <stdio.h>
11119 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11120 EOCP
11121 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11122         if $compiler_warning attrib.out >/dev/null 2>&1; then
11123                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11124                 val="$undef"
11125         else
11126                 echo "Your C compiler supports __attribute__((nonnull))."
11127                 val="$define"
11128         fi
11129 else
11130         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11131         val="$undef"
11132 fi
11133 ;;
11134 *) val="$d_attribute_nonnull" ;;
11135 esac
11136 set d_attribute_nonnull
11137 eval $setvar
11138 $rm -f attrib*
11139
11140 : Look for GCC-style attribute noreturn
11141 case "$d_attribute_noreturn" in
11142 '')
11143 echo " "
11144 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11145 $cat >attrib.c <<'EOCP'
11146 #include <stdio.h>
11147 void fall_over_dead( void ) __attribute__((noreturn));
11148 EOCP
11149 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11150         if $compiler_warning attrib.out >/dev/null 2>&1; then
11151                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11152                 val="$undef"
11153         else
11154                 echo "Your C compiler supports __attribute__((noreturn))."
11155                 val="$define"
11156         fi
11157 else
11158         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11159         val="$undef"
11160 fi
11161 ;;
11162 *) val="$d_attribute_noreturn" ;;
11163 esac
11164 set d_attribute_noreturn
11165 eval $setvar
11166 $rm -f attrib*
11167
11168 : Look for GCC-style attribute pure
11169 case "$d_attribute_pure" in
11170 '')
11171 echo " "
11172 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11173 $cat >attrib.c <<'EOCP'
11174 #include <stdio.h>
11175 int square( int n ) __attribute__((pure));
11176 EOCP
11177 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11178         if $compiler_warning attrib.out >/dev/null 2>&1; then
11179                 echo "Your C compiler doesn't support __attribute__((pure))."
11180                 val="$undef"
11181         else
11182                 echo "Your C compiler supports __attribute__((pure))."
11183                 val="$define"
11184         fi
11185 else
11186         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11187         val="$undef"
11188 fi
11189 ;;
11190 *) val="$d_attribute_pure" ;;
11191 esac
11192 set d_attribute_pure
11193 eval $setvar
11194 $rm -f attrib*
11195
11196 : Look for GCC-style attribute unused
11197 case "$d_attribute_unused" in
11198 '')
11199 echo " "
11200 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11201 $cat >attrib.c <<'EOCP'
11202 #include <stdio.h>
11203 int do_something( int dummy __attribute__((unused)), int n );
11204 EOCP
11205 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11206         if $compiler_warning attrib.out >/dev/null 2>&1; then
11207                 echo "Your C compiler doesn't support __attribute__((unused))."
11208                 val="$undef"
11209         else
11210                 echo "Your C compiler supports __attribute__((unused))."
11211                 val="$define"
11212         fi
11213 else
11214         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11215         val="$undef"
11216 fi
11217 ;;
11218 *) val="$d_attribute_unused" ;;
11219 esac
11220 set d_attribute_unused
11221 eval $setvar
11222 $rm -f attrib*
11223
11224 : Look for GCC-style attribute deprecated
11225 case "$d_attribute_deprecated" in
11226 '')
11227 echo " "
11228 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11229 $cat >attrib.c <<'EOCP'
11230 #include <stdio.h>
11231 int I_am_deprecated(void) __attribute__((deprecated));
11232 EOCP
11233 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11234         if $compiler_warning attrib.out >/dev/null 2>&1; then
11235                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11236                 val="$undef"
11237         else
11238                 echo "Your C compiler supports __attribute__((deprecated))."
11239                 val="$define"
11240         fi
11241 else
11242         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11243         val="$undef"
11244 fi
11245 ;;
11246 *) val="$d_attribute_deprecated" ;;
11247 esac
11248 set d_attribute_deprecated
11249 eval $setvar
11250 $rm -f attrib*
11251
11252 : Look for GCC-style attribute warn_unused_result
11253 case "$d_attribute_warn_unused_result" in
11254 '')
11255 echo " "
11256 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11257 $cat >attrib.c <<'EOCP'
11258 #include <stdio.h>
11259 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11260 EOCP
11261 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11262         if $compiler_warning attrib.out >/dev/null 2>&1; then
11263                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11264                 val="$undef"
11265         else
11266                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11267                 val="$define"
11268         fi
11269 else
11270         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11271         val="$undef"
11272 fi
11273 ;;
11274 *) val="$d_attribute_warn_unused_result" ;;
11275 esac
11276 set d_attribute_warn_unused_result
11277 eval $setvar
11278 $rm -f attrib*
11279
11280 : Look for GCC-style attribute always_inline
11281 case "$d_attribute_always_inline" in
11282 '')
11283 echo " "
11284 echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
11285 $cat >attrib.c <<'EOCP'
11286 #include <stdio.h>
11287 static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
11288 EOCP
11289 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11290         if $compiler_warning attrib.out >/dev/null 2>&1; then
11291                 echo "Your C compiler doesn't support __attribute__((always_inline))."
11292                 val="$undef"
11293         else
11294                 echo "Your C compiler supports __attribute__((always_inline))."
11295                 val="$define"
11296         fi
11297 else
11298         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11299         val="$undef"
11300 fi
11301 ;;
11302 *) val="$d_attribute_always_inline" ;;
11303 esac
11304 set d_attribute_always_inline
11305 eval $setvar
11306 $rm -f attrib*
11307
11308 : Look for GCC-style attribute visibility
11309 case "$d_attribute_visibility" in
11310 '')
11311 echo " "
11312 echo "Checking whether your compiler can handle __attribute__((visibility)) ..." >&4
11313 $cat >attrib.c <<'EOCP'
11314 #include <stdio.h>
11315 __attribute__((visibility("hidden"))) int I_will_be_hidden(void);
11316 EOCP
11317 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11318         if $compiler_warning attrib.out >/dev/null 2>&1; then
11319                 echo "Your C compiler doesn't support __attribute__((visibility))."
11320                 val="$undef"
11321         else
11322                 echo "Your C compiler supports __attribute__((visibility))."
11323                 val="$define"
11324         fi
11325 else
11326         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11327         val="$undef"
11328 fi
11329 ;;
11330 *) val="$d_attribute_visibility" ;;
11331 esac
11332 set d_attribute_visibility
11333 eval $setvar
11334 $rm -f attrib*
11335
11336 : see if getpgrp exists
11337 set getpgrp d_getpgrp
11338 eval $inlibc
11339
11340 case "$d_getpgrp" in
11341 "$define")
11342         echo " "
11343         echo "Checking to see which flavor of getpgrp is in use..."
11344         $cat >try.c <<EOP
11345 #include <stdio.h>
11346 #$i_unistd I_UNISTD
11347 #include <sys/types.h>
11348 #ifdef I_UNISTD
11349 #  include <unistd.h>
11350 #endif
11351 #$i_stdlib I_STDLIB
11352 #ifdef I_STDLIB
11353 #include <stdlib.h>
11354 #endif
11355 int main()
11356 {
11357         if (getuid() == 0) {
11358                 printf("(I see you are running Configure as super-user...)\n");
11359                 setuid(1);
11360         }
11361 #ifdef TRY_BSD_PGRP
11362         if (getpgrp(1) == 0)
11363                 exit(0);
11364 #else
11365         if (getpgrp() > 0)
11366                 exit(0);
11367 #endif
11368         exit(1);
11369 }
11370 EOP
11371         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11372                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11373                 val="$define"
11374         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11375                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11376                 val="$undef"
11377         else
11378                 echo "I can't seem to compile and run the test program."
11379                 if ./usg; then
11380                         xxx="a USG one, i.e. you use getpgrp()."
11381                 else
11382                         # SVR4 systems can appear rather BSD-ish.
11383                         case "$i_unistd" in
11384                         $undef)
11385                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11386                                 val="$define"
11387                                 ;;
11388                         $define)
11389                                 xxx="probably a USG one, i.e. you use getpgrp()."
11390                                 val="$undef"
11391                                 ;;
11392                         esac
11393                 fi
11394                 echo "Assuming your getpgrp is $xxx" >&4
11395         fi
11396         ;;
11397 *) val="$undef";;
11398 esac
11399 set d_bsdgetpgrp
11400 eval $setvar
11401 $rm_try
11402
11403 : see if setpgrp exists
11404 set setpgrp d_setpgrp
11405 eval $inlibc
11406
11407 case "$d_setpgrp" in
11408 "$define")
11409         echo " "
11410         echo "Checking to see which flavor of setpgrp is in use..."
11411         $cat >try.c <<EOP
11412 #include <stdio.h>
11413 #$i_unistd I_UNISTD
11414 #include <sys/types.h>
11415 #ifdef I_UNISTD
11416 #  include <unistd.h>
11417 #endif
11418 #$i_stdlib I_STDLIB
11419 #ifdef I_STDLIB
11420 #include <stdlib.h>
11421 #endif
11422 int main()
11423 {
11424         if (getuid() == 0) {
11425                 printf("(I see you are running Configure as super-user...)\n");
11426                 setuid(1);
11427         }
11428 #ifdef TRY_BSD_PGRP
11429         if (-1 == setpgrp(1, 1))
11430                 exit(0);
11431 #else
11432         if (setpgrp() != -1)
11433                 exit(0);
11434 #endif
11435         exit(1);
11436 }
11437 EOP
11438         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11439                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11440                 val="$define"
11441         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11442                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11443                 val="$undef"
11444         else
11445                 echo "(I can't seem to compile and run the test program.)"
11446                 if ./usg; then
11447                         xxx="a USG one, i.e. you use setpgrp()."
11448                 else
11449                         # SVR4 systems can appear rather BSD-ish.
11450                         case "$i_unistd" in
11451                         $undef)
11452                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11453                                 val="$define"
11454                                 ;;
11455                         $define)
11456                                 xxx="probably a USG one, i.e. you use setpgrp()."
11457                                 val="$undef"
11458                                 ;;
11459                         esac
11460                 fi
11461                 echo "Assuming your setpgrp is $xxx" >&4
11462         fi
11463         ;;
11464 *) val="$undef";;
11465 esac
11466 set d_bsdsetpgrp
11467 eval $setvar
11468 $rm_try
11469
11470 : Look for GCC-style __builtin_add_overflow
11471 case "$d_builtin_add_overflow" in
11472 '')
11473     echo " "
11474     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11475     $cat >try.c <<'EOCP'
11476 int main(void) {
11477     const unsigned int uint_max = ~0u;
11478     int target_int = 0;
11479     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11480         return 1;
11481     }
11482     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11483         return 1;
11484     }
11485     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11486         return 1;
11487     }
11488     return 0;
11489 }
11490 EOCP
11491     set try
11492     if eval $compile && $run ./try; then
11493         echo "Your C compiler supports __builtin_add_overflow."
11494         val="$define"
11495     else
11496         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11497         val="$undef"
11498     fi
11499     ;;
11500 *) val="$d_builtin_add_overflow" ;;
11501 esac
11502
11503 set d_builtin_add_overflow
11504 eval $setvar
11505 $rm_try
11506
11507 : Look for GCC-style __builtin_sub_overflow
11508 case "$d_builtin_sub_overflow" in
11509 '')
11510     echo " "
11511     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11512     $cat >try.c <<'EOCP'
11513 int main(void) {
11514     const unsigned int uint_max = ~0u;
11515     int target_int = 0;
11516     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11517         return 1;
11518     }
11519     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11520         return 1;
11521     }
11522     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11523         return 1;
11524     }
11525     return 0;
11526 }
11527 EOCP
11528     set try
11529     if eval $compile && $run ./try; then
11530         echo "Your C compiler supports __builtin_sub_overflow."
11531         val="$define"
11532     else
11533         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11534         val="$undef"
11535     fi
11536     ;;
11537 *) val="$d_builtin_sub_overflow" ;;
11538 esac
11539
11540 set d_builtin_sub_overflow
11541 eval $setvar
11542 $rm_try
11543
11544 : Look for GCC-style __builtin_mul_overflow
11545 case "$d_builtin_mul_overflow" in
11546 '')
11547     echo " "
11548     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11549     $cat >try.c <<'EOCP'
11550 int main(void) {
11551     const unsigned int uint_max = ~0u;
11552     int target_int = 0;
11553     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11554         return 1;
11555     }
11556     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11557         return 1;
11558     }
11559     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11560         return 1;
11561     }
11562     return 0;
11563 }
11564 EOCP
11565     set try
11566     if eval $compile && $run ./try; then
11567         echo "Your C compiler supports __builtin_mul_overflow."
11568         val="$define"
11569     else
11570         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11571         val="$undef"
11572     fi
11573     ;;
11574 *) val="$d_builtin_mul_overflow" ;;
11575 esac
11576
11577 set d_builtin_mul_overflow
11578 eval $setvar
11579 $rm_try
11580
11581 : Look for GCC-style __builtin_choose_expr
11582 case "$d_builtin_choose_expr" in
11583 '')
11584     echo " "
11585     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11586     $cat >try.c <<'EOCP'
11587 #include <assert.h>
11588 #include <stdlib.h>
11589 #include <stdio.h>
11590
11591 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11592
11593 int main(void) {
11594     assert( SYRINX(1) == 2112 );
11595     assert( SYRINX(1) != 5150 );
11596     assert( SYRINX(0) == 5150 );
11597     assert( SYRINX(0) != 2112 );
11598     puts( "All good!" );
11599     exit(0);
11600 }
11601
11602 EOCP
11603     set try
11604     if eval $compile && $run ./try; then
11605         echo "Your C compiler supports __builtin_choose_expr."
11606         val="$define"
11607     else
11608         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11609         val="$undef"
11610     fi
11611 ;;
11612 *) val="$d_builtin_choose_expr" ;;
11613 esac
11614
11615 set d_builtin_choose_expr
11616 eval $setvar
11617 $rm_try
11618
11619 : Look for GCC-style __builtin_expect
11620 case "$d_builtin_expect" in
11621 '')
11622     echo " "
11623     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11624     $cat >try.c <<'EOCP'
11625 int main(void) {
11626     int n = 50;
11627     if ( __builtin_expect(n, 0) ) n = 1;
11628     /* Remember shell exit code truth is 0, C truth is non-zero */
11629     return !(n == 1);
11630 }
11631 EOCP
11632     set try
11633     if eval $compile && $run ./try; then
11634         echo "Your C compiler supports __builtin_expect."
11635         val="$define"
11636     else
11637         echo "Your C compiler doesn't seem to understand __builtin_expect."
11638         val="$undef"
11639     fi
11640     ;;
11641 *) val="$d_builtin_expect" ;;
11642 esac
11643
11644 set d_builtin_expect
11645 eval $setvar
11646 $rm_try
11647
11648 : see if the Compiler supports C99 variadic macros
11649 echo "Checking for C99 variadic macros." >&4
11650 $cat >try.c <<EOCP
11651 #include <stdio.h>
11652 #include <stdarg.h>
11653
11654 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11655
11656 int main() {
11657   char buf[20];
11658   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11659   puts(buf);
11660   return 0;
11661 }
11662 EOCP
11663 set try
11664 if eval $compile && $run ./try 2>&1 >/dev/null; then
11665     case "`$run ./try`" in
11666         "123 456 789")
11667         echo "You have C99 variadic macros." >&4
11668         d_c99_variadic_macros="$define"
11669         ;;
11670         *)
11671         echo "You don't have functional C99 variadic macros." >&4
11672         d_c99_variadic_macros="$undef"
11673         ;;
11674     esac
11675 else
11676     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11677     d_c99_variadic_macros="$undef"
11678 fi
11679 $rm_try
11680
11681 : see if signal is declared as pointer to function returning int or void
11682 echo " "
11683 xxx=`./findhdr signal.h`
11684 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11685 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11686         echo "You have int (*signal())() instead of void." >&4
11687         val="$undef"
11688 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11689         echo "You have void (*signal())()." >&4
11690         val="$define"
11691 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11692         echo "You have int (*signal())() instead of void." >&4
11693         val="$undef"
11694 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11695         echo "You have void (*signal())()." >&4
11696         val="$define"
11697 else
11698         case "$d_voidsig" in
11699         '')
11700         echo "I can't determine whether signal handler returns void or int..." >&4
11701                 dflt=void
11702                 rp="What type does your signal handler return?"
11703                 . ./myread
11704                 case "$ans" in
11705                 v*) val="$define";;
11706                 *) val="$undef";;
11707                 esac;;
11708         "$define")
11709                 echo "As you already told me, signal handler returns void." >&4
11710                 val="$define"
11711                 ;;
11712         *)      echo "As you already told me, signal handler returns int." >&4
11713                 val="$undef"
11714                 ;;
11715         esac
11716 fi
11717 set d_voidsig
11718 eval $setvar
11719 case "$d_voidsig" in
11720 "$define") signal_t="void";;
11721 *) signal_t="int";;
11722 esac
11723 $rm -f $$.tmp
11724
11725 : check for ability to cast large floats to 32-bit ints.
11726 echo " "
11727 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11728 if $test "$intsize" -ge 4; then
11729         xxx=int
11730 else
11731         xxx=long
11732 fi
11733 $cat >try.c <<EOCP
11734 #include <stdio.h>
11735 #$i_stdlib I_STDLIB
11736 #ifdef I_STDLIB
11737 #include <stdlib.h>
11738 #endif
11739 #include <sys/types.h>
11740 #include <signal.h>
11741 $signal_t blech(int s) { exit(3); }
11742 int main()
11743 {
11744         $xxx i32;
11745         double f, g;
11746         int result = 0;
11747         char str[16];
11748         signal(SIGFPE, blech);
11749
11750         /* Don't let compiler optimize the test away.  Store the number
11751            in a writable string for gcc to pass to sscanf under HP-UX.
11752         */
11753         sprintf(str, "2147483647");
11754         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11755         g = 10 * f;
11756         i32  = ($xxx) g;
11757
11758         /* x86 processors will probably give 0x8000 0000, which is a
11759            sign change.  We don't want that.  We want to mimic SPARC
11760            behavior here, which is to preserve the sign and give
11761            back 0x7fff ffff.
11762         */
11763         if (i32 != ($xxx) f)
11764                 result |= 1;
11765         exit(result);
11766 }
11767 EOCP
11768 set try
11769 if eval $compile_ok; then
11770         $run ./try 2>/dev/null
11771         yyy=$?
11772 else
11773         echo "(I can't seem to compile the test program--assuming it can't)"
11774         yyy=1
11775 fi
11776 case "$yyy" in
11777 0)      val="$define"
11778         echo "Yup, it can."
11779         ;;
11780 *)      val="$undef"
11781         echo "Nope, it can't."
11782         ;;
11783 esac
11784 set d_casti32
11785 eval $setvar
11786 $rm_try
11787
11788 : check for ability to cast negative floats to unsigned
11789 echo " "
11790 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11791 $cat >try.c <<EOCP
11792 #include <stdio.h>
11793 #$i_stdlib I_STDLIB
11794 #ifdef I_STDLIB
11795 #include <stdlib.h>
11796 #endif
11797 #include <sys/types.h>
11798 #include <signal.h>
11799 $signal_t blech(int s) { exit(7); }
11800 $signal_t blech_in_list(int s) { exit(4); }
11801 unsigned long dummy_long(unsigned long p) { return p; }
11802 unsigned int dummy_int(unsigned int p) { return p; }
11803 unsigned short dummy_short(unsigned short p) { return p; }
11804 int main()
11805 {
11806         double f;
11807         unsigned long along;
11808         unsigned int aint;
11809         unsigned short ashort;
11810         int result = 0;
11811         char str[16];
11812
11813         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11814            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11815            optimized the whole file away
11816         */
11817         /* Store the number in a writable string for gcc to pass to
11818            sscanf under HP-UX.
11819         */
11820         sprintf(str, "-123");
11821         sscanf(str, "%lf", &f);  /* f = -123.; */
11822
11823         signal(SIGFPE, blech);
11824         along = (unsigned long)f;
11825         aint = (unsigned int)f;
11826         ashort = (unsigned short)f;
11827         if (along != (unsigned long)-123)
11828                 result |= 1;
11829         if (aint != (unsigned int)-123)
11830                 result |= 1;
11831         if (ashort != (unsigned short)-123)
11832                 result |= 1;
11833         sprintf(str, "1073741824.");
11834         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11835         f = f + f;
11836         along = 0;
11837         along = (unsigned long)f;
11838         if (along != 0x80000000)
11839                 result |= 2;
11840         f -= 1.;
11841         along = 0;
11842         along = (unsigned long)f;
11843         if (along != 0x7fffffff)
11844                 result |= 1;
11845         f += 2.;
11846         along = 0;
11847         along = (unsigned long)f;
11848         if (along != 0x80000001)
11849                 result |= 2;
11850         if (result)
11851                 exit(result);
11852         signal(SIGFPE, blech_in_list);
11853         sprintf(str, "123.");
11854         sscanf(str, "%lf", &f);  /* f = 123.; */
11855         along = dummy_long((unsigned long)f);
11856         aint = dummy_int((unsigned int)f);
11857         ashort = dummy_short((unsigned short)f);
11858         if (along != (unsigned long)123)
11859                 result |= 4;
11860         if (aint != (unsigned int)123)
11861                 result |= 4;
11862         if (ashort != (unsigned short)123)
11863                 result |= 4;
11864         exit(result);
11865
11866 }
11867 EOCP
11868 set try
11869 if eval $compile_ok; then
11870         $run ./try 2>/dev/null
11871         castflags=$?
11872 else
11873         echo "(I can't seem to compile the test program--assuming it can't)"
11874         castflags=7
11875 fi
11876 case "$castflags" in
11877 0)      val="$define"
11878         echo "Yup, it can."
11879         ;;
11880 *)      val="$undef"
11881         echo "Nope, it can't."
11882         ;;
11883 esac
11884 set d_castneg
11885 eval $setvar
11886 $rm_try
11887
11888 : see if cbrt exists
11889 set cbrt d_cbrt
11890 eval $inlibc
11891
11892 : see if chown exists
11893 set chown d_chown
11894 eval $inlibc
11895
11896 : see if chroot exists
11897 set chroot d_chroot
11898 eval $inlibc
11899
11900 : see if chsize exists
11901 set chsize d_chsize
11902 eval $inlibc
11903
11904 : see if class exists
11905 set class d_class
11906 eval $inlibc
11907
11908 : see if clearenv exists
11909 set clearenv d_clearenv
11910 eval $inlibc
11911
11912 : Define hasstruct macro for Configure internal use
11913 hasstruct='varname=$1; struct=$2; shift; shift;
11914 while $test $# -ge 2; do
11915         case "$1" in
11916         $define) echo "#include <$2>";;
11917         esac ;
11918     shift 2;
11919 done > try.c;
11920 echo "int main () { struct $struct foo; }" >> try.c;
11921 set try;
11922 if eval $compile; then
11923         val="$define";
11924 else
11925         val="$undef";
11926 fi;
11927 set $varname;
11928 eval $setvar;
11929 $rm_try'
11930
11931 : see whether socket exists
11932 socketlib=''
11933 sockethdr=''
11934 echo " "
11935 $echo $n "Hmm... $c" >&4
11936 if set socket val -f d_socket; eval $csym; $val; then
11937     echo "Looks like you have Berkeley networking support." >&4
11938     d_socket="$define"
11939     if set setsockopt val -f; eval $csym; $val; then
11940         d_oldsock="$undef"
11941     else
11942         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11943         d_oldsock="$define"
11944     fi
11945 else
11946     if $contains socklib libc.list >/dev/null 2>&1; then
11947         echo "Looks like you have Berkeley networking support." >&4
11948         d_socket="$define"
11949         : we will have to assume that it supports the 4.2 BSD interface
11950         d_oldsock="$undef"
11951     else
11952         echo "You don't have Berkeley networking in libc$_a..." >&4
11953         if test "X$d_socket" = "X$define"; then
11954             echo "...but you seem to believe that you have sockets." >&4
11955         else
11956             for net in net socket
11957             do
11958                 if test -f $sysroot/usr/lib/lib$net$_a; then
11959                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11960                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11961                     if $contains socket libc.list >/dev/null 2>&1; then
11962                         d_socket="$define"
11963                         socketlib="-l$net"
11964                         case "$net" in
11965                         net)
11966                             echo "...but the Wollongong group seems to have hacked it in." >&4
11967                             sockethdr="-I$sysroot/usr/netinclude"
11968                             ;;
11969                         esac
11970                         echo "Found Berkeley sockets interface in lib$net." >&4
11971                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11972                             d_oldsock="$undef"
11973                         else
11974                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11975                             d_oldsock="$define"
11976                         fi
11977                         break
11978                     fi
11979                 fi
11980             done
11981             if test "X$d_socket" != "X$define"; then
11982                echo "or anywhere else I see." >&4
11983                d_socket="$undef"
11984                d_oldsock="$undef"
11985             fi
11986         fi
11987     fi
11988 fi
11989
11990 : see if socketpair exists
11991 set socketpair d_sockpair
11992 eval $inlibc
11993
11994
11995 echo "Checking the availability sa_len in the sock struct ..." >&4
11996 $cat >try.c <<EOF
11997 #include <sys/types.h>
11998 #include <sys/socket.h>
11999 int main() {
12000 struct sockaddr sa;
12001 return (sa.sa_len);
12002 }
12003 EOF
12004 val="$undef"
12005 set try; if eval $compile; then
12006     val="$define"
12007 fi
12008 set d_sockaddr_sa_len; eval $setvar
12009 $rm_try
12010
12011 echo "Checking the availability struct sockaddr_in6 ..." >&4
12012 $cat >try.c <<EOF
12013 #include <sys/types.h>
12014 #include <sys/socket.h>
12015 #include <netinet/in.h>
12016 int main() {
12017 struct sockaddr_in6 sin6;
12018 return (sin6.sin6_family);
12019 }
12020 EOF
12021 val="$undef"
12022 set try; if eval $compile; then
12023     val="$define"
12024 fi
12025 set d_sockaddr_in6; eval $setvar
12026 $rm_try
12027
12028 echo "Checking the availability struct sockaddr_storage ..." >&4
12029 $cat >try.c <<EOF
12030 #include <sys/types.h>
12031 #include <sys/socket.h>
12032 #include <netinet/in.h>
12033 int main() {
12034 struct sockaddr_storage sastor;
12035 return (sastor.ss_family);
12036 }
12037 EOF
12038 val="$undef"
12039 set try; if eval $compile; then
12040     val="$define"
12041 fi
12042 set d_sockaddr_storage; eval $setvar
12043 $rm_try
12044
12045 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12046 $cat >try.c <<EOF
12047 #include <sys/types.h>
12048 #include <sys/socket.h>
12049 #include <netinet/in.h>
12050 int main() {
12051 struct sockaddr_in6 sin6;
12052 return (sin6.sin6_scope_id);
12053 }
12054 EOF
12055 val="$undef"
12056 set try; if eval $compile; then
12057     val="$define"
12058 fi
12059 set d_sin6_scope_id; eval $setvar
12060 $rm_try
12061
12062 echo "Checking the availability struct ip_mreq ..." >&4
12063 $cat >try.c <<EOF
12064 #include <sys/types.h>
12065 #include <sys/socket.h>
12066 #include <netinet/in.h>
12067 int main() {
12068 struct ip_mreq mreq;
12069 return (mreq.imr_multiaddr.s_addr);
12070 }
12071 EOF
12072 val="$undef"
12073 set try; if eval $compile; then
12074        val="$define"
12075 fi
12076 set d_ip_mreq; eval $setvar
12077 $rm_try
12078
12079 echo "Checking the availability struct ip_mreq_source ..." >&4
12080 $cat >try.c <<EOF
12081 #include <sys/types.h>
12082 #include <sys/socket.h>
12083 #include <netinet/in.h>
12084 int main() {
12085 struct ip_mreq_source mreq;
12086 return (mreq.imr_multiaddr.s_addr);
12087 }
12088 EOF
12089 val="$undef"
12090 set try; if eval $compile; then
12091        val="$define"
12092 fi
12093 set d_ip_mreq_source; eval $setvar
12094 $rm_try
12095
12096 echo "Checking the availability struct ipv6_mreq ..." >&4
12097 $cat >try.c <<EOF
12098 #include <sys/types.h>
12099 #include <sys/socket.h>
12100 #include <netinet/in.h>
12101 int main() {
12102 struct ipv6_mreq mreq;
12103 return (mreq.ipv6mr_interface);
12104 }
12105 EOF
12106 val="$undef"
12107 set try; if eval $compile; then
12108     val="$define"
12109 fi
12110 set d_ipv6_mreq; eval $setvar
12111 $rm_try
12112
12113 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12114 $cat >try.c <<EOF
12115 #include <sys/types.h>
12116 #include <sys/socket.h>
12117 #include <netinet/in.h>
12118 int main() {
12119 struct ipv6_mreq_source mreq;
12120 return (mreq.imr_multiaddr.s_addr);
12121 }
12122 EOF
12123 val="$undef"
12124 set try; if eval $compile; then
12125        val="$define"
12126 fi
12127 set d_ipv6_mreq_source; eval $setvar
12128 $rm_try
12129
12130 echo "Checking the availability of certain socket constants..." >&4
12131 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12132     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12133     $cat >try.c <<EOF
12134 #include <sys/types.h>
12135 #include <sys/socket.h>
12136 int main() {
12137     int i = $ENUM;
12138 }
12139 EOF
12140     val="$undef"
12141     set try; if eval $compile; then
12142         val="$define"
12143     fi
12144     set d_${enum}; eval $setvar
12145     $rm_try
12146 done
12147
12148 : see if this is a sys/uio.h system
12149 set sys/uio.h i_sysuio
12150 eval $inhdr
12151
12152 : Check for cmsghdr support
12153 echo " "
12154 echo "Checking to see if your system supports struct cmsghdr..." >&4
12155 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12156 eval $hasstruct
12157 case "$d_cmsghdr_s" in
12158 "$define")      echo "Yes, it does."   ;;
12159 *)              echo "No, it doesn't." ;;
12160 esac
12161
12162 : see if copysign exists
12163 set copysign d_copysign
12164 eval $inlibc
12165
12166 : see if copysignl exists
12167 set copysignl d_copysignl
12168 eval $inlibc
12169
12170 : see if crypt exists
12171 echo " "
12172 set crypt d_crypt
12173 eval $inlibc
12174 case "$d_crypt" in
12175 $define) cryptlib='' ;;
12176 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12177                 echo 'crypt() found.' >&4
12178                 val="$define"
12179                 cryptlib=''
12180         else
12181                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12182                 if $test -z "$cryptlib"; then
12183                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12184                 else
12185                         cryptlib=-lcrypt
12186                 fi
12187                 if $test -z "$cryptlib"; then
12188                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12189                 else
12190                         cryptlib=-lcrypt
12191                 fi
12192                 if $test -z "$cryptlib"; then
12193                         cryptlib=`./loc libcrypt$_a "" $libpth`
12194                 else
12195                         cryptlib=-lcrypt
12196                 fi
12197                 if $test -z "$cryptlib"; then
12198                         echo 'crypt() NOT found.' >&4
12199                         val="$undef"
12200                 else
12201                         val="$define"
12202                 fi
12203         fi
12204         set d_crypt
12205         eval $setvar
12206         ;;
12207 esac
12208
12209 : see if this is a crypt.h system
12210 set crypt.h i_crypt
12211 eval $inhdr
12212
12213 : see if crypt_r exists
12214 set crypt_r d_crypt_r
12215 eval $inlibc
12216 case "$d_crypt_r" in
12217 "$define")
12218         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12219         case "$d_crypt_r_proto:$usethreads" in
12220         ":define")      d_crypt_r_proto=define
12221                 set d_crypt_r_proto crypt_r $hdrs
12222                 eval $hasproto ;;
12223         *)      ;;
12224         esac
12225         case "$d_crypt_r_proto" in
12226         define)
12227         case "$crypt_r_proto" in
12228         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12229         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12230         esac
12231         case "$crypt_r_proto" in
12232         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12233         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12234         esac
12235         case "$crypt_r_proto" in
12236         ''|0)   d_crypt_r=undef
12237                 crypt_r_proto=0
12238                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12239         * )     case "$crypt_r_proto" in
12240                 REENTRANT_PROTO*) ;;
12241                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12242                 esac
12243                 echo "Prototype: $try" ;;
12244         esac
12245         ;;
12246         *)      case "$usethreads" in
12247                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12248                 esac
12249                 d_crypt_r=undef
12250                 crypt_r_proto=0
12251                 ;;
12252         esac
12253         ;;
12254 *)      crypt_r_proto=0
12255         ;;
12256 esac
12257
12258 : get csh whereabouts
12259 case "$csh" in
12260 'csh') val="$undef" ;;
12261 *) val="$define" ;;
12262 esac
12263 set d_csh
12264 eval $setvar
12265 : Respect a hint or command line value for full_csh.
12266 case "$full_csh" in
12267 '') full_csh=$csh ;;
12268 esac
12269
12270 : see if ctermid exists
12271 set ctermid d_ctermid
12272 eval $inlibc
12273
12274 : see if ctermid_r exists
12275 set ctermid_r d_ctermid_r
12276 eval $inlibc
12277 case "$d_ctermid_r" in
12278 "$define")
12279         hdrs="$i_systypes sys/types.h define stdio.h "
12280         case "$d_ctermid_r_proto:$usethreads" in
12281         ":define")      d_ctermid_r_proto=define
12282                 set d_ctermid_r_proto ctermid_r $hdrs
12283                 eval $hasproto ;;
12284         *)      ;;
12285         esac
12286         case "$d_ctermid_r_proto" in
12287         define)
12288         case "$ctermid_r_proto" in
12289         ''|0) try='char* ctermid_r(char*);'
12290         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12291         esac
12292         case "$ctermid_r_proto" in
12293         ''|0)   d_ctermid_r=undef
12294                 ctermid_r_proto=0
12295                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12296         * )     case "$ctermid_r_proto" in
12297                 REENTRANT_PROTO*) ;;
12298                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12299                 esac
12300                 echo "Prototype: $try" ;;
12301         esac
12302         ;;
12303         *)      case "$usethreads" in
12304                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12305                 esac
12306                 d_ctermid_r=undef
12307                 ctermid_r_proto=0
12308                 ;;
12309         esac
12310         ;;
12311 *)      ctermid_r_proto=0
12312         ;;
12313 esac
12314
12315 : see if ctime_r exists
12316 set ctime_r d_ctime_r
12317 eval $inlibc
12318 case "$d_ctime_r" in
12319 "$define")
12320         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12321         case "$d_ctime_r_proto:$usethreads" in
12322         ":define")      d_ctime_r_proto=define
12323                 set d_ctime_r_proto ctime_r $hdrs
12324                 eval $hasproto ;;
12325         *)      ;;
12326         esac
12327         case "$d_ctime_r_proto" in
12328         define)
12329         case "$ctime_r_proto" in
12330         ''|0) try='char* ctime_r(const time_t*, char*);'
12331         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12332         esac
12333         case "$ctime_r_proto" in
12334         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12335         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12336         esac
12337         case "$ctime_r_proto" in
12338         ''|0) try='int ctime_r(const time_t*, char*);'
12339         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12340         esac
12341         case "$ctime_r_proto" in
12342         ''|0) try='int ctime_r(const time_t*, char*, int);'
12343         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12344         esac
12345         case "$ctime_r_proto" in
12346         ''|0)   d_ctime_r=undef
12347                 ctime_r_proto=0
12348                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12349         * )     case "$ctime_r_proto" in
12350                 REENTRANT_PROTO*) ;;
12351                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12352                 esac
12353                 echo "Prototype: $try" ;;
12354         esac
12355         ;;
12356         *)      case "$usethreads" in
12357                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12358                 esac
12359                 d_ctime_r=undef
12360                 ctime_r_proto=0
12361                 ;;
12362         esac
12363         ;;
12364 *)      ctime_r_proto=0
12365         ;;
12366 esac
12367
12368 : see if cuserid exists
12369 set cuserid d_cuserid
12370 eval $inlibc
12371
12372 : see if dbm.h is available
12373 : see if dbmclose exists
12374 set dbmclose d_dbmclose
12375 eval $inlibc
12376
12377 case "$d_dbmclose" in
12378 $define)
12379         set dbm.h i_dbm
12380         eval $inhdr
12381         case "$i_dbm" in
12382         $define)
12383                 val="$undef"
12384                 set i_rpcsvcdbm
12385                 eval $setvar
12386                 ;;
12387         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12388                 eval $inhdr
12389                 ;;
12390         esac
12391         ;;
12392 *)      echo "We won't be including <dbm.h>"
12393         val="$undef"
12394         set i_dbm
12395         eval $setvar
12396         val="$undef"
12397         set i_rpcsvcdbm
12398         eval $setvar
12399         ;;
12400 esac
12401
12402 : see if prototype for dbminit is available
12403 echo " "
12404 set d_dbminitproto dbminit $i_dbm dbm.h
12405 eval $hasproto
12406
12407 : see if difftime exists
12408 set difftime d_difftime
12409 eval $inlibc
12410
12411 : see if this is a dirent system
12412 echo " "
12413 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12414         val="$define"
12415         echo "<dirent.h> found." >&4
12416 else
12417         val="$undef"
12418         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12419                 echo "<sys/dir.h> found." >&4
12420                 echo " "
12421         else
12422                 xinc=`./findhdr sys/ndir.h`
12423         fi
12424         echo "<dirent.h> NOT found." >&4
12425 fi
12426 set i_dirent
12427 eval $setvar
12428
12429 : Look for type of directory structure.
12430 echo " "
12431 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12432
12433 case "$direntrytype" in
12434 ''|' ')
12435         case "$i_dirent" in
12436         $define) guess1='struct dirent' ;;
12437         *) guess1='struct direct'  ;;
12438         esac
12439         ;;
12440 *)      guess1="$direntrytype"
12441         ;;
12442 esac
12443
12444 case "$guess1" in
12445 'struct dirent') guess2='struct direct' ;;
12446 *) guess2='struct dirent' ;;
12447 esac
12448
12449 if $contains "$guess1" try.c >/dev/null 2>&1; then
12450         direntrytype="$guess1"
12451         echo "Your directory entries are $direntrytype." >&4
12452 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12453         direntrytype="$guess2"
12454         echo "Your directory entries seem to be $direntrytype." >&4
12455 else
12456         echo "I don't recognize your system's directory entries." >&4
12457         rp="What type is used for directory entries on this system?"
12458         dflt="$guess1"
12459         . ./myread
12460         direntrytype="$ans"
12461 fi
12462 $rm_try
12463
12464 : see if the directory entry stores field length
12465 echo " "
12466 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12467 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12468         echo "Good, your directory entry keeps length information in d_namlen." >&4
12469         val="$define"
12470 else
12471         echo "Your directory entry does not know about the d_namlen field." >&4
12472         val="$undef"
12473 fi
12474 set d_dirnamlen
12475 eval $setvar
12476 $rm_try
12477
12478 : Look for DIR.dd_fd
12479 case "$i_dirent" in
12480 "$define")
12481     echo "Checking to see if DIR has a dd_fd member variable" >&4
12482     $cat >try.c <<EOCP
12483 #$i_stdlib I_STDLIB
12484 #ifdef I_STDLIB
12485 #include <stdlib.h>
12486 #endif
12487 #include <dirent.h>
12488
12489 int main() {
12490     DIR dir;
12491     dir.dd_fd = 1;
12492     return 0;
12493 }
12494 EOCP
12495     val=$undef
12496     set try
12497     if eval $compile; then
12498         echo "Yes, it does."
12499         val="$define"
12500     else
12501         echo "No, it does not."
12502         val="$undef"
12503     fi
12504     ;;
12505 *)
12506     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12507     val="$undef"
12508     ;;
12509 esac
12510 set d_dir_dd_fd
12511 eval $setvar
12512 $rm_try
12513
12514 : see if this is an sysdir system
12515 set sys/dir.h i_sysdir
12516 eval $inhdr
12517
12518 : see if this is an sysndir system
12519 set sys/ndir.h i_sysndir
12520 eval $inhdr
12521
12522 : Look for dirfd
12523 echo " "
12524 $cat >dirfd.c <<EOM
12525 #include <stdio.h>
12526 #$i_stdlib I_STDLIB
12527 #ifdef I_STDLIB
12528 #include <stdlib.h>
12529 #endif
12530 #$i_dirent I_DIRENT             /**/
12531 #$i_sysdir I_SYS_DIR            /**/
12532 #$i_sysndir I_SYS_NDIR          /**/
12533 #$i_systypes I_SYS_TYPES        /**/
12534 #if defined(I_SYS_TYPES)
12535 #include <sys/types.h>
12536 #endif
12537 #if defined(I_DIRENT)
12538 #include <dirent.h>
12539 #else
12540 #ifdef I_SYS_NDIR
12541 #include <sys/ndir.h>
12542 #else
12543 #ifdef I_SYS_DIR
12544 #include <sys/dir.h>
12545 #endif
12546 #endif
12547 #endif
12548 int main() {
12549         DIR *dirp = opendir(".");
12550         if (dirfd(dirp) >= 0)
12551                 exit(0);
12552         else
12553                 exit(1);
12554 }
12555 EOM
12556 val=$undef
12557 set dirfd
12558 if eval $compile; then
12559         val="$define"
12560 fi
12561 case "$val" in
12562 $define)        echo "dirfd() found." >&4       ;;
12563 *)              echo "dirfd() NOT found." >&4   ;;
12564 esac
12565 set d_dirfd
12566 eval $setvar
12567 $rm -f dirfd*
12568
12569 : see if dladdr exists
12570 set dladdr d_dladdr
12571 eval $inlibc
12572
12573 : see if dlerror exists
12574 xxx_runnm="$runnm"
12575 runnm=false
12576 set dlerror d_dlerror
12577 eval $inlibc
12578 runnm="$xxx_runnm"
12579
12580 : see if dlfcn is available
12581 set dlfcn.h i_dlfcn
12582 eval $inhdr
12583
12584 : Check what extension to use for shared libs
12585 case "$usedl" in
12586 $define|y|true)
12587         $cat << EOM
12588
12589 On a few systems, the dynamically loaded modules that perl generates and uses
12590 will need a different extension than shared libs. The default will probably
12591 be appropriate.
12592
12593 EOM
12594         case "$dlext" in
12595         '')     dflt="$so" ;;
12596         *)      dflt="$dlext" ;;
12597         esac
12598         rp='What is the extension of dynamically loaded modules'
12599         . ./myread
12600         dlext="$ans"
12601         ;;
12602 *)
12603         dlext="none"
12604         ;;
12605 esac
12606
12607 : Check if dlsym need a leading underscore
12608 echo " "
12609 val="$undef"
12610
12611 case "$dlsrc" in
12612 dl_dlopen.xs)
12613         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12614         $cat >dyna.c <<'EOM'
12615 void fred (void) { }
12616 EOM
12617
12618 $cat >fred.c<<EOM
12619
12620 #include <stdio.h>
12621 #$i_stdlib I_STDLIB
12622 #ifdef I_STDLIB
12623 #include <stdlib.h>
12624 #endif
12625 #$i_dlfcn I_DLFCN
12626 #ifdef I_DLFCN
12627 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12628 #else
12629 #include <sys/types.h>
12630 #include <nlist.h>
12631 #include <link.h>
12632 #endif
12633
12634 extern void fred(void) ;
12635
12636 int main()
12637 {
12638     void * handle ;
12639     void * symbol ;
12640 #ifndef RTLD_LAZY
12641     int mode = 1 ;
12642 #else
12643     int mode = RTLD_LAZY ;
12644 #endif
12645     handle = dlopen("./dyna.$dlext", mode) ;
12646     if (handle == NULL) {
12647         printf ("1\n") ;
12648         fflush (stdout) ;
12649         exit(0);
12650     }
12651     symbol = dlsym(handle, "fred") ;
12652     if (symbol == NULL) {
12653         /* try putting a leading underscore */
12654         symbol = dlsym(handle, "_fred") ;
12655         if (symbol == NULL) {
12656             printf ("2\n") ;
12657             fflush (stdout) ;
12658             exit(0);
12659         }
12660         printf ("3\n") ;
12661     }
12662     else
12663         printf ("4\n") ;
12664     fflush (stdout) ;
12665     exit(0);
12666 }
12667 EOM
12668         : Call the object file tmp-dyna.o in case dlext=o.
12669         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12670                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12671                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12672                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12673                 xxx=`$run ./fred`
12674                 case $xxx in
12675                 1)      echo "Test program failed using dlopen." >&4
12676                         echo "Perhaps you should not use dynamic loading." >&4;;
12677                 2)      echo "Test program failed using dlsym." >&4
12678                         echo "Perhaps you should not use dynamic loading." >&4;;
12679                 3)      echo "dlsym needs a leading underscore" >&4
12680                         val="$define" ;;
12681                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12682                 esac
12683         else
12684                 echo "I can't compile and run the test program." >&4
12685                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12686         fi
12687         ;;
12688 esac
12689
12690 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12691
12692 set d_dlsymun
12693 eval $setvar
12694
12695 : see if drand48_r exists
12696 set drand48_r d_drand48_r
12697 eval $inlibc
12698 case "$d_drand48_r" in
12699 "$define")
12700         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12701         case "$d_drand48_r_proto:$usethreads" in
12702         ":define")      d_drand48_r_proto=define
12703                 set d_drand48_r_proto drand48_r $hdrs
12704                 eval $hasproto ;;
12705         *)      ;;
12706         esac
12707         case "$d_drand48_r_proto" in
12708         define)
12709         case "$drand48_r_proto" in
12710         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12711         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12712         esac
12713         case "$drand48_r_proto" in
12714         ''|0)   d_drand48_r=undef
12715                 drand48_r_proto=0
12716                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12717         * )     case "$drand48_r_proto" in
12718                 REENTRANT_PROTO*) ;;
12719                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12720                 esac
12721                 echo "Prototype: $try" ;;
12722         esac
12723         ;;
12724         *)      case "$usethreads" in
12725                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12726                 esac
12727                 d_drand48_r=undef
12728                 drand48_r_proto=0
12729                 ;;
12730         esac
12731         ;;
12732 *)      drand48_r_proto=0
12733         ;;
12734 esac
12735
12736 : see if prototype for drand48 is available
12737 echo " "
12738 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12739 eval $hasproto
12740
12741 : see if dup2 exists
12742 set dup2 d_dup2
12743 eval $inlibc
12744
12745 : see if dup3 exists
12746 set dup3 d_dup3
12747 eval $inlibc
12748
12749 : see if localeconv_l exists
12750 set localeconv_l d_localeconv_l
12751 eval $inlibc
12752
12753 : see if this is an xlocale.h system
12754 set xlocale.h i_xlocale
12755 eval $inhdr
12756
12757 : see if newlocale exists
12758 set newlocale d_newlocale
12759 eval $inlibc
12760
12761 : see if freelocale exists
12762 set freelocale d_freelocale
12763 eval $inlibc
12764
12765 : see if uselocale exists
12766 set uselocale d_uselocale
12767 eval $inlibc
12768
12769 : see if duplocale exists
12770 set duplocale d_duplocale
12771 eval $inlibc
12772
12773 : see if querylocale exists
12774 set querylocale d_querylocale
12775 eval $inlibc
12776
12777 : if we have xlocale.h, check whether it is needed
12778 case "$i_xlocale$d_newlocale$xlocale_needed" in
12779 "$define$define")
12780         echo "Checking if xlocale.h is needed..." >&4
12781         $cat >try.c <<EOF
12782 #include <locale.h>
12783 #include <stdio.h>
12784 #ifdef TRY_XLOCALE
12785 #include <xlocale.h>
12786 #endif
12787 #$d_localeconv_l HAVE_LOCALECONV_L
12788
12789 #ifdef HAVE_LOCALECONV_L
12790 struct lconv *(*lcptr)(locale_t) = localeconv_l;
12791 #endif
12792
12793 int main(void) {
12794   locale_t lc = newlocale(LC_ALL_MASK, "C", (locale_t)0);
12795
12796 #ifdef HAVE_LOCALECONV_L
12797   /* FreeBSD hides only localeconv_l() in xlocale.h */
12798   struct lconv *lcbuf = localeconv_l(lc);
12799   printf("decimal: %s\n", lcbuf->decimal_point);
12800 #endif
12801
12802   freelocale(lc);
12803   return 0;
12804 }
12805 EOF
12806         set try
12807         if eval $compile && $run ./try > /dev/null 2>&1 ; then
12808                 echo "xlocale.h isn't needed" >&4
12809                 xlocale_needed=$undef
12810         else
12811                 set try -DTRY_XLOCALE
12812                 if eval $compile && $run ./try > /dev/null 2>&1 ; then
12813                         xlocale_needed=$define
12814                         echo "xlocale.h is needed" >&4
12815                 else
12816                         echo "I can't build my test either way" >&4
12817                         xlocale_needed=$undef
12818                 fi
12819         fi
12820         $rm_try
12821         ;;
12822 *) xlocale_needed=$undef ;;
12823 esac
12824
12825 : see if eaccess exists
12826 set eaccess d_eaccess
12827 eval $inlibc
12828
12829 : see if endgrent exists
12830 set endgrent d_endgrent
12831 eval $inlibc
12832
12833 : see if this is an grp system
12834 set grp.h i_grp
12835 eval $inhdr
12836
12837 case "$i_grp" in
12838 $define)
12839         xxx=`./findhdr grp.h`
12840         $cppstdin $cppflags $cppminus < $xxx >$$.h
12841
12842         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12843                 val="$define"
12844         else
12845                 val="$undef"
12846         fi
12847         set d_grpasswd
12848         eval $setvar
12849
12850         $rm -f $$.h
12851         ;;
12852 *)
12853         val="$undef";
12854         set d_grpasswd; eval $setvar
12855         ;;
12856 esac
12857
12858 : see if endgrent_r exists
12859 set endgrent_r d_endgrent_r
12860 eval $inlibc
12861 case "$d_endgrent_r" in
12862 "$define")
12863         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12864         case "$d_endgrent_r_proto:$usethreads" in
12865         ":define")      d_endgrent_r_proto=define
12866                 set d_endgrent_r_proto endgrent_r $hdrs
12867                 eval $hasproto ;;
12868         *)      ;;
12869         esac
12870         case "$d_endgrent_r_proto" in
12871         define)
12872         case "$endgrent_r_proto" in
12873         ''|0) try='int endgrent_r(FILE**);'
12874         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12875         esac
12876         case "$endgrent_r_proto" in
12877         ''|0) try='void endgrent_r(FILE**);'
12878         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12879         esac
12880         case "$endgrent_r_proto" in
12881         ''|0)   d_endgrent_r=undef
12882                 endgrent_r_proto=0
12883                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12884         * )     case "$endgrent_r_proto" in
12885                 REENTRANT_PROTO*) ;;
12886                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12887                 esac
12888                 echo "Prototype: $try" ;;
12889         esac
12890         ;;
12891         *)      case "$usethreads" in
12892                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12893                 esac
12894                 d_endgrent_r=undef
12895                 endgrent_r_proto=0
12896                 ;;
12897         esac
12898         ;;
12899 *)      endgrent_r_proto=0
12900         ;;
12901 esac
12902
12903 : see if endhostent exists
12904 set endhostent d_endhent
12905 eval $inlibc
12906
12907 : see if this is a netdb.h system
12908 set netdb.h i_netdb
12909 eval $inhdr
12910
12911 : see if endhostent_r exists
12912 set endhostent_r d_endhostent_r
12913 eval $inlibc
12914 case "$d_endhostent_r" in
12915 "$define")
12916         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12917         case "$d_endhostent_r_proto:$usethreads" in
12918         ":define")      d_endhostent_r_proto=define
12919                 set d_endhostent_r_proto endhostent_r $hdrs
12920                 eval $hasproto ;;
12921         *)      ;;
12922         esac
12923         case "$d_endhostent_r_proto" in
12924         define)
12925         case "$endhostent_r_proto" in
12926         ''|0) try='int endhostent_r(struct hostent_data*);'
12927         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12928         esac
12929         case "$endhostent_r_proto" in
12930         ''|0) try='void endhostent_r(struct hostent_data*);'
12931         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12932         esac
12933         case "$endhostent_r_proto" in
12934         ''|0)   d_endhostent_r=undef
12935                 endhostent_r_proto=0
12936                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12937         * )     case "$endhostent_r_proto" in
12938                 REENTRANT_PROTO*) ;;
12939                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12940                 esac
12941                 echo "Prototype: $try" ;;
12942         esac
12943         ;;
12944         *)      case "$usethreads" in
12945                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12946                 esac
12947                 d_endhostent_r=undef
12948                 endhostent_r_proto=0
12949                 ;;
12950         esac
12951         ;;
12952 *)      endhostent_r_proto=0
12953         ;;
12954 esac
12955
12956 : see if endnetent exists
12957 set endnetent d_endnent
12958 eval $inlibc
12959
12960 : see if endnetent_r exists
12961 set endnetent_r d_endnetent_r
12962 eval $inlibc
12963 case "$d_endnetent_r" in
12964 "$define")
12965         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12966         case "$d_endnetent_r_proto:$usethreads" in
12967         ":define")      d_endnetent_r_proto=define
12968                 set d_endnetent_r_proto endnetent_r $hdrs
12969                 eval $hasproto ;;
12970         *)      ;;
12971         esac
12972         case "$d_endnetent_r_proto" in
12973         define)
12974         case "$endnetent_r_proto" in
12975         ''|0) try='int endnetent_r(struct netent_data*);'
12976         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12977         esac
12978         case "$endnetent_r_proto" in
12979         ''|0) try='void endnetent_r(struct netent_data*);'
12980         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12981         esac
12982         case "$endnetent_r_proto" in
12983         ''|0)   d_endnetent_r=undef
12984                 endnetent_r_proto=0
12985                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12986         * )     case "$endnetent_r_proto" in
12987                 REENTRANT_PROTO*) ;;
12988                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12989                 esac
12990                 echo "Prototype: $try" ;;
12991         esac
12992         ;;
12993         *)      case "$usethreads" in
12994                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12995                 esac
12996                 d_endnetent_r=undef
12997                 endnetent_r_proto=0
12998                 ;;
12999         esac
13000         ;;
13001 *)      endnetent_r_proto=0
13002         ;;
13003 esac
13004
13005 : see if endprotoent exists
13006 set endprotoent d_endpent
13007 eval $inlibc
13008
13009 : see if endprotoent_r exists
13010 set endprotoent_r d_endprotoent_r
13011 eval $inlibc
13012 case "$d_endprotoent_r" in
13013 "$define")
13014         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13015         case "$d_endprotoent_r_proto:$usethreads" in
13016         ":define")      d_endprotoent_r_proto=define
13017                 set d_endprotoent_r_proto endprotoent_r $hdrs
13018                 eval $hasproto ;;
13019         *)      ;;
13020         esac
13021         case "$d_endprotoent_r_proto" in
13022         define)
13023         case "$endprotoent_r_proto" in
13024         ''|0) try='int endprotoent_r(struct protoent_data*);'
13025         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13026         esac
13027         case "$endprotoent_r_proto" in
13028         ''|0) try='void endprotoent_r(struct protoent_data*);'
13029         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13030         esac
13031         case "$endprotoent_r_proto" in
13032         ''|0)   d_endprotoent_r=undef
13033                 endprotoent_r_proto=0
13034                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13035         * )     case "$endprotoent_r_proto" in
13036                 REENTRANT_PROTO*) ;;
13037                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13038                 esac
13039                 echo "Prototype: $try" ;;
13040         esac
13041         ;;
13042         *)      case "$usethreads" in
13043                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13044                 esac
13045                 d_endprotoent_r=undef
13046                 endprotoent_r_proto=0
13047                 ;;
13048         esac
13049         ;;
13050 *)      endprotoent_r_proto=0
13051         ;;
13052 esac
13053
13054 : see if endpwent exists
13055 set endpwent d_endpwent
13056 eval $inlibc
13057
13058 : see if this is a pwd.h system
13059 set pwd.h i_pwd
13060 eval $inhdr
13061
13062 case "$i_pwd" in
13063 $define)
13064         xxx=`./findhdr pwd.h`
13065         $cppstdin $cppflags $cppminus < $xxx >$$.h
13066
13067         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13068                 val="$define"
13069         else
13070                 val="$undef"
13071         fi
13072         set d_pwquota
13073         eval $setvar
13074
13075         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13076                 val="$define"
13077         else
13078                 val="$undef"
13079         fi
13080         set d_pwage
13081         eval $setvar
13082
13083         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13084                 val="$define"
13085         else
13086                 val="$undef"
13087         fi
13088         set d_pwchange
13089         eval $setvar
13090
13091         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13092                 val="$define"
13093         else
13094                 val="$undef"
13095         fi
13096         set d_pwclass
13097         eval $setvar
13098
13099         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13100                 val="$define"
13101         else
13102                 val="$undef"
13103         fi
13104         set d_pwexpire
13105         eval $setvar
13106
13107         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13108                 val="$define"
13109         else
13110                 val="$undef"
13111         fi
13112         set d_pwcomment
13113         eval $setvar
13114
13115         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13116                 val="$define"
13117         else
13118                 val="$undef"
13119         fi
13120         set d_pwgecos
13121         eval $setvar
13122
13123         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13124                 val="$define"
13125         else
13126                 val="$undef"
13127         fi
13128         set d_pwpasswd
13129         eval $setvar
13130
13131         $rm -f $$.h
13132         ;;
13133 *)
13134         val="$undef";
13135         set d_pwquota; eval $setvar
13136         set d_pwage; eval $setvar
13137         set d_pwchange; eval $setvar
13138         set d_pwclass; eval $setvar
13139         set d_pwexpire; eval $setvar
13140         set d_pwcomment; eval $setvar
13141         set d_pwgecos; eval $setvar
13142         set d_pwpasswd; eval $setvar
13143         ;;
13144 esac
13145
13146 : see if endpwent_r exists
13147 set endpwent_r d_endpwent_r
13148 eval $inlibc
13149 case "$d_endpwent_r" in
13150 "$define")
13151         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13152         case "$d_endpwent_r_proto:$usethreads" in
13153         ":define")      d_endpwent_r_proto=define
13154                 set d_endpwent_r_proto endpwent_r $hdrs
13155                 eval $hasproto ;;
13156         *)      ;;
13157         esac
13158         case "$d_endpwent_r_proto" in
13159         define)
13160         case "$endpwent_r_proto" in
13161         ''|0) try='int endpwent_r(FILE**);'
13162         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13163         esac
13164         case "$endpwent_r_proto" in
13165         ''|0) try='void endpwent_r(FILE**);'
13166         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13167         esac
13168         case "$endpwent_r_proto" in
13169         ''|0)   d_endpwent_r=undef
13170                 endpwent_r_proto=0
13171                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13172         * )     case "$endpwent_r_proto" in
13173                 REENTRANT_PROTO*) ;;
13174                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13175                 esac
13176                 echo "Prototype: $try" ;;
13177         esac
13178         ;;
13179         *)      case "$usethreads" in
13180                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13181                 esac
13182                 d_endpwent_r=undef
13183                 endpwent_r_proto=0
13184                 ;;
13185         esac
13186         ;;
13187 *)      endpwent_r_proto=0
13188         ;;
13189 esac
13190
13191 : see if endservent exists
13192 set endservent d_endsent
13193 eval $inlibc
13194
13195 : see if endservent_r exists
13196 set endservent_r d_endservent_r
13197 eval $inlibc
13198 case "$d_endservent_r" in
13199 "$define")
13200         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13201         case "$d_endservent_r_proto:$usethreads" in
13202         ":define")      d_endservent_r_proto=define
13203                 set d_endservent_r_proto endservent_r $hdrs
13204                 eval $hasproto ;;
13205         *)      ;;
13206         esac
13207         case "$d_endservent_r_proto" in
13208         define)
13209         case "$endservent_r_proto" in
13210         ''|0) try='int endservent_r(struct servent_data*);'
13211         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13212         esac
13213         case "$endservent_r_proto" in
13214         ''|0) try='void endservent_r(struct servent_data*);'
13215         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13216         esac
13217         case "$endservent_r_proto" in
13218         ''|0)   d_endservent_r=undef
13219                 endservent_r_proto=0
13220                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13221         * )     case "$endservent_r_proto" in
13222                 REENTRANT_PROTO*) ;;
13223                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13224                 esac
13225                 echo "Prototype: $try" ;;
13226         esac
13227         ;;
13228         *)      case "$usethreads" in
13229                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13230                 esac
13231                 d_endservent_r=undef
13232                 endservent_r_proto=0
13233                 ;;
13234         esac
13235         ;;
13236 *)      endservent_r_proto=0
13237         ;;
13238 esac
13239
13240 : Locate the flags for 'open()'
13241 echo " "
13242 $cat >try.c <<EOCP
13243 #include <sys/types.h>
13244 #ifdef I_FCNTL
13245 #include <fcntl.h>
13246 #endif
13247 #ifdef I_SYS_FILE
13248 #include <sys/file.h>
13249 #endif
13250 #$i_stdlib I_STDLIB
13251 #ifdef I_STDLIB
13252 #include <stdlib.h>
13253 #endif
13254 int main() {
13255         if(O_RDONLY);
13256 #ifdef O_TRUNC
13257         exit(0);
13258 #else
13259         exit(1);
13260 #endif
13261 }
13262 EOCP
13263 : check sys/file.h first to get FREAD on Sun
13264 if $test `./findhdr sys/file.h` && \
13265                 set try -DI_SYS_FILE && eval $compile; then
13266         h_sysfile=true;
13267         echo "<sys/file.h> defines the O_* constants..." >&4
13268         if $run ./try; then
13269                 echo "and you have the 3 argument form of open()." >&4
13270                 val="$define"
13271         else
13272                 echo "but not the 3 argument form of open().  Oh, well." >&4
13273                 val="$undef"
13274         fi
13275 elif $test `./findhdr fcntl.h` && \
13276                 set try -DI_FCNTL && eval $compile; then
13277         h_fcntl=true;
13278         echo "<fcntl.h> defines the O_* constants..." >&4
13279         if $run ./try; then
13280                 echo "and you have the 3 argument form of open()." >&4
13281                 val="$define"
13282         else
13283                 echo "but not the 3 argument form of open().  Oh, well." >&4
13284                 val="$undef"
13285         fi
13286 else
13287         val="$undef"
13288         echo "I can't find the O_* constant definitions!  You got problems." >&4
13289 fi
13290 set d_open3
13291 eval $setvar
13292 $rm_try
13293
13294 : see if this is a sys/file.h system
13295 val=''
13296 set sys/file.h val
13297 eval $inhdr
13298
13299 : do we need to include sys/file.h ?
13300 case "$val" in
13301 "$define")
13302         echo " "
13303         if $h_sysfile; then
13304                 val="$define"
13305                 echo "We'll be including <sys/file.h>." >&4
13306         else
13307                 val="$undef"
13308                 echo "We won't be including <sys/file.h>." >&4
13309         fi
13310         ;;
13311 *)
13312         h_sysfile=false
13313         ;;
13314 esac
13315 set i_sysfile
13316 eval $setvar
13317
13318 : see if fcntl.h is there
13319 val=''
13320 set fcntl.h val
13321 eval $inhdr
13322
13323 : see if we can include fcntl.h
13324 case "$val" in
13325 "$define")
13326         echo " "
13327         if $h_fcntl; then
13328                 val="$define"
13329                 echo "We'll be including <fcntl.h>." >&4
13330         else
13331                 val="$undef"
13332                 if $h_sysfile; then
13333         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13334                 else
13335                         echo "We won't be including <fcntl.h>." >&4
13336                 fi
13337         fi
13338         ;;
13339 *)
13340         h_fcntl=false
13341         val="$undef"
13342         ;;
13343 esac
13344 set i_fcntl
13345 eval $setvar
13346
13347 : see if fork exists
13348 set fork d_fork
13349 eval $inlibc
13350
13351 : see if pipe exists
13352 set pipe d_pipe
13353 eval $inlibc
13354
13355 : check for non-blocking I/O stuff
13356 case "$h_sysfile" in
13357 true) echo "#include <sys/file.h>" > head.c;;
13358 *)
13359        case "$h_fcntl" in
13360        true) echo "#include <fcntl.h>" > head.c;;
13361        *) echo "#include <sys/fcntl.h>" > head.c;;
13362        esac
13363        ;;
13364 esac
13365 echo " "
13366 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13367 case "$o_nonblock" in
13368 '')
13369         $cat head.c > try.c
13370         $cat >>try.c <<EOCP
13371 #include <stdio.h>
13372 #$i_stdlib I_STDLIB
13373 #ifdef I_STDLIB
13374 #include <stdlib.h>
13375 #endif
13376 #$i_fcntl I_FCNTL
13377 #ifdef I_FCNTL
13378 #include <fcntl.h>
13379 #endif
13380 int main() {
13381 #ifdef O_NONBLOCK
13382         printf("O_NONBLOCK\n");
13383         exit(0);
13384 #endif
13385 #ifdef O_NDELAY
13386         printf("O_NDELAY\n");
13387         exit(0);
13388 #endif
13389 #ifdef FNDELAY
13390         printf("FNDELAY\n");
13391         exit(0);
13392 #endif
13393         exit(0);
13394 }
13395 EOCP
13396         set try
13397         if eval $compile_ok; then
13398                 o_nonblock=`$run ./try`
13399                 case "$o_nonblock" in
13400                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13401                 *) echo "Seems like we can use $o_nonblock.";;
13402                 esac
13403         else
13404                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13405         fi
13406         ;;
13407 *) echo "Using $hint value $o_nonblock.";;
13408 esac
13409 $rm_try
13410
13411 echo " "
13412 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13413 case "$eagain" in
13414 '')
13415         case "$d_fork:$d_pipe:$d_alarm" in
13416         define:define:define)
13417         $cat head.c > try.c
13418         $cat >>try.c <<EOCP
13419 #include <errno.h>
13420 #include <sys/types.h>
13421 #include <signal.h>
13422 #include <stdio.h>
13423 #$i_stdlib I_STDLIB
13424 #ifdef I_STDLIB
13425 #include <stdlib.h>
13426 #endif
13427 #$i_fcntl I_FCNTL
13428 #ifdef I_FCNTL
13429 #include <fcntl.h>
13430 #endif
13431 #define MY_O_NONBLOCK $o_nonblock
13432 #ifndef errno  /* XXX need better Configure test */
13433 extern int errno;
13434 #endif
13435 #$i_unistd I_UNISTD
13436 #ifdef I_UNISTD
13437 #include <unistd.h>
13438 #endif
13439 #include <string.h>
13440 $signal_t blech(int x) { exit(3); }
13441 EOCP
13442         $cat >> try.c <<'EOCP'
13443 int main()
13444 {
13445         int pd[2];
13446         int pu[2];
13447         char buf[1];
13448         char string[100];
13449         int ret;
13450
13451         ret = pipe(pd); /* Down: child -> parent */
13452         if (ret != 0)
13453                 exit(3);
13454         ret = pipe(pu); /* Up: parent -> child */
13455         if (ret != 0)
13456                 exit(3);
13457         if (0 != fork()) {
13458                 close(pd[1]);   /* Parent reads from pd[0] */
13459                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13460 #ifdef F_SETFL
13461                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13462                         exit(1);
13463 #else
13464                 exit(4);
13465 #endif
13466                 signal(SIGALRM, blech);
13467                 alarm(5);
13468                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13469                         exit(2);
13470                 sprintf(string, "%d\n", ret);
13471                 ret = write(2, string, strlen(string));
13472                 if (ret != strlen(string))
13473                         exit(3);
13474                 alarm(0);
13475 #ifdef EAGAIN
13476                 if (errno == EAGAIN) {
13477                         printf("EAGAIN\n");
13478                         goto ok;
13479                 }
13480 #endif
13481 #ifdef EWOULDBLOCK
13482                 if (errno == EWOULDBLOCK)
13483                         printf("EWOULDBLOCK\n");
13484 #endif
13485         ok:
13486                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13487                 if (ret != 1)
13488                         exit(3);
13489                 sleep(2);                               /* Give it time to close our pipe */
13490                 alarm(5);
13491                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13492                 alarm(0);
13493                 sprintf(string, "%d\n", ret);
13494                 ret = write(4, string, strlen(string));
13495                 if (ret != strlen(string))
13496                         exit(3);
13497                 exit(0);
13498         }
13499
13500         close(pd[0]);                   /* We write to pd[1] */
13501         close(pu[1]);                   /* We read from pu[0] */
13502         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13503         if (ret != 1)
13504                 exit(3);
13505         close(pd[1]);                   /* Pipe pd is now fully closed! */
13506         exit(0);                                /* Bye bye, thank you for playing! */
13507 }
13508 EOCP
13509         set try
13510         if eval $compile_ok; then
13511                 echo "$startsh" >mtry
13512                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13513                 chmod +x mtry
13514                 $run ./mtry >/dev/null 2>&1
13515                 case $? in
13516                 0) eagain=`$cat try.out`;;
13517                 1) echo "Could not perform non-blocking setting!";;
13518                 2) echo "I did a successful read() for something that was not there!";;
13519                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13520                 4) echo "Could not find F_SETFL!";;
13521                 *) echo "Something terribly wrong happened during testing.";;
13522                 esac
13523                 rd_nodata=`$cat try.ret`
13524                 echo "A read() system call with no data present returns $rd_nodata."
13525                 case "$rd_nodata" in
13526                 0|-1) ;;
13527                 *)
13528                         echo "(That's peculiar, fixing that to be -1.)"
13529                         rd_nodata=-1
13530                         ;;
13531                 esac
13532                 case "$eagain" in
13533                 '')
13534                         echo "Forcing errno EAGAIN on read() with no data available."
13535                         eagain=EAGAIN
13536                         ;;
13537                 *)
13538                         echo "Your read() sets errno to $eagain when no data is available."
13539                         ;;
13540                 esac
13541                 status=`$cat try.err`
13542                 case "$status" in
13543                 0) echo "And it correctly returns 0 to signal EOF.";;
13544                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13545                 *) echo "However, your read() returns '$status' on EOF??";;
13546                 esac
13547                 val="$define"
13548                 if test "$status" = "$rd_nodata"; then
13549                         echo "WARNING: you can't distinguish between EOF and no data!"
13550                         val="$undef"
13551                 fi
13552         else
13553                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13554                 eagain=EAGAIN
13555         fi
13556         ;;
13557         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13558                 eagain=EAGAIN
13559                 val="$define"
13560                 ;;
13561         esac
13562         set d_eofnblk
13563         eval $setvar
13564         ;;
13565 *)
13566         echo "Using $hint value $eagain."
13567         echo "Your read() returns $rd_nodata when no data is present."
13568         case "$d_eofnblk" in
13569         "$define") echo "And you can see EOF because read() returns 0.";;
13570         "$undef") echo "But you can't see EOF status from read() returned value.";;
13571         *)
13572                 echo "(Assuming you can't see EOF status from read anyway.)"
13573                 d_eofnblk=$undef
13574                 ;;
13575         esac
13576         ;;
13577 esac
13578 $rm_try head.c mtry
13579
13580 : see if erf exists
13581 set erf d_erf
13582 eval $inlibc
13583
13584 : see if erfc exists
13585 set erfc d_erfc
13586 eval $inlibc
13587
13588 : see if exp2 exists
13589 set exp2 d_exp2
13590 eval $inlibc
13591
13592 : see if expm1 exists
13593 set expm1 d_expm1
13594 eval $inlibc
13595
13596 : see if _ptr and _cnt from stdio act std
13597 echo " "
13598
13599 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13600         echo "(Looks like you have stdio.h from BSD.)"
13601         case "$stdio_ptr" in
13602         '') stdio_ptr='((fp)->_p)'
13603                 ptr_lval=$define
13604                 ;;
13605         *)      ptr_lval=$d_stdio_ptr_lval;;
13606         esac
13607         case "$stdio_cnt" in
13608         '') stdio_cnt='((fp)->_r)'
13609                 cnt_lval=$define
13610                 ;;
13611         *)      cnt_lval=$d_stdio_cnt_lval;;
13612         esac
13613         case "$stdio_base" in
13614         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13615         esac
13616         case "$stdio_bufsiz" in
13617         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13618         esac
13619 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13620         echo "(Looks like you have stdio.h from Linux.)"
13621         case "$stdio_ptr" in
13622         '') stdio_ptr='((fp)->_IO_read_ptr)'
13623                 ptr_lval=$define
13624                 ;;
13625         *)      ptr_lval=$d_stdio_ptr_lval;;
13626         esac
13627         case "$stdio_cnt" in
13628         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13629                 cnt_lval=$undef
13630                 ;;
13631         *)      cnt_lval=$d_stdio_cnt_lval;;
13632         esac
13633         case "$stdio_base" in
13634         '') stdio_base='((fp)->_IO_read_base)';;
13635         esac
13636         case "$stdio_bufsiz" in
13637         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13638         esac
13639 else
13640         case "$stdio_ptr" in
13641         '') stdio_ptr='((fp)->_ptr)'
13642                 ptr_lval=$define
13643                 ;;
13644         *)      ptr_lval=$d_stdio_ptr_lval;;
13645         esac
13646         case "$stdio_cnt" in
13647         '') stdio_cnt='((fp)->_cnt)'
13648                 cnt_lval=$define
13649                 ;;
13650         *)      cnt_lval=$d_stdio_cnt_lval;;
13651         esac
13652         case "$stdio_base" in
13653         '') stdio_base='((fp)->_base)';;
13654         esac
13655         case "$stdio_bufsiz" in
13656         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13657         esac
13658 fi
13659
13660 : test whether _ptr and _cnt really work
13661 echo "Checking how std your stdio is..." >&4
13662 $cat >try.c <<EOP
13663 #include <stdio.h>
13664 #$i_stdlib I_STDLIB
13665 #ifdef I_STDLIB
13666 #include <stdlib.h>
13667 #endif
13668 #include <string.h>
13669 #define FILE_ptr(fp)    $stdio_ptr
13670 #define FILE_cnt(fp)    $stdio_cnt
13671 int main() {
13672         FILE *fp = fopen("try.c", "r");
13673         char c = getc(fp);
13674         if (
13675                 18 <= FILE_cnt(fp) &&
13676                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13677         )
13678                 exit(0);
13679         exit(1);
13680 }
13681 EOP
13682 val="$undef"
13683 set try
13684 if eval $compile && $to try.c; then
13685         if $run ./try; then
13686                 echo "Your stdio acts pretty std."
13687                 val="$define"
13688         else
13689                 echo "Your stdio isn't very std."
13690         fi
13691 else
13692         echo "Your stdio doesn't appear very std."
13693 fi
13694 $rm_try
13695
13696 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13697 # direct buffer manipulation no longer works.  The Configure tests
13698 # should be changed to correctly detect this, but until then,
13699 # the following check should at least let perl compile and run.
13700 # (This quick fix should be updated before 5.8.1.)
13701 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13702 # A. Dougherty, June 3, 2002.
13703 case "$d_gnulibc" in
13704 $define)
13705         case "$gnulibc_version" in
13706         2.[01]*)  ;;
13707         2.2) ;;
13708         2.2.[0-9]) ;;
13709         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13710                 val="$undef"
13711                 ;;
13712         esac
13713         ;;
13714 esac
13715 set d_stdstdio
13716 eval $setvar
13717
13718 : Can _ptr be used as an lvalue?
13719 case "$d_stdstdio$ptr_lval" in
13720 $define$define) val=$define ;;
13721 *) val=$undef ;;
13722 esac
13723 set d_stdio_ptr_lval
13724 eval $setvar
13725
13726 : Can _cnt be used as an lvalue?
13727 case "$d_stdstdio$cnt_lval" in
13728 $define$define) val=$define ;;
13729 *) val=$undef ;;
13730 esac
13731 set d_stdio_cnt_lval
13732 eval $setvar
13733
13734
13735 : test whether setting _ptr sets _cnt as a side effect
13736 d_stdio_ptr_lval_sets_cnt="$undef"
13737 d_stdio_ptr_lval_nochange_cnt="$undef"
13738 case "$d_stdio_ptr_lval$d_stdstdio" in
13739 $define$define)
13740         echo "Checking to see what happens if we set the stdio ptr..." >&4
13741 $cat >try.c <<EOP
13742 #include <stdio.h>
13743 /* Can we scream? */
13744 /* Eat dust sed :-) */
13745 /* In the buffer space, no one can hear you scream. */
13746 #$i_stdlib I_STDLIB
13747 #ifdef I_STDLIB
13748 #include <stdlib.h>
13749 #endif
13750 #define FILE_ptr(fp)    $stdio_ptr
13751 #define FILE_cnt(fp)    $stdio_cnt
13752 #include <sys/types.h>
13753 int main() {
13754         FILE *fp = fopen("try.c", "r");
13755         int c;
13756         char *ptr;
13757         size_t cnt;
13758         if (!fp) {
13759             puts("Fail even to read");
13760             exit(1);
13761         }
13762         c = getc(fp); /* Read away the first # */
13763         if (c == EOF) {
13764             puts("Fail even to read");
13765             exit(1);
13766         }
13767         if (!(
13768                 18 <= FILE_cnt(fp) &&
13769                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13770         )) {
13771                 puts("Fail even to read");
13772                 exit (1);
13773         }
13774         ptr = (char*) FILE_ptr(fp);
13775         cnt = (size_t)FILE_cnt(fp);
13776
13777         FILE_ptr(fp) += 42;
13778
13779         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13780                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13781                 exit (1);
13782         }
13783         if (FILE_cnt(fp) <= 20) {
13784                 printf ("Fail (<20 chars to test)");
13785                 exit (1);
13786         }
13787         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13788                 puts("Fail compare");
13789                 exit (1);
13790         }
13791         if (cnt == FILE_cnt(fp)) {
13792                 puts("Pass_unchanged");
13793                 exit (0);
13794         }
13795         if (FILE_cnt(fp) == (cnt - 42)) {
13796                 puts("Pass_changed");
13797                 exit (0);
13798         }
13799         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13800         return 1;
13801
13802 }
13803 EOP
13804         set try
13805         if eval $compile && $to try.c; then
13806                 case `$run ./try` in
13807                 Pass_changed)
13808                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13809                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13810                 Pass_unchanged)
13811                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13812                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13813                 Fail*)
13814                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13815                 *)
13816                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13817         esac
13818         else
13819                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13820         fi
13821         $rm_try
13822         ;;
13823 esac
13824
13825 : see if _base is also standard
13826 val="$undef"
13827 case "$d_stdstdio" in
13828 $define)
13829         $cat >try.c <<EOP
13830 #include <stdio.h>
13831 #$i_stdlib I_STDLIB
13832 #ifdef I_STDLIB
13833 #include <stdlib.h>
13834 #endif
13835 #define FILE_base(fp)   $stdio_base
13836 #define FILE_bufsiz(fp) $stdio_bufsiz
13837 int main() {
13838         FILE *fp = fopen("try.c", "r");
13839         char c = getc(fp);
13840         if (
13841                 19 <= FILE_bufsiz(fp) &&
13842                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13843         )
13844                 exit(0);
13845         exit(1);
13846 }
13847 EOP
13848         set try
13849         if eval $compile && $to try.c; then
13850                 if $run ./try; then
13851                         echo "And its _base field acts std."
13852                         val="$define"
13853                 else
13854                         echo "But its _base field isn't std."
13855                 fi
13856         else
13857                 echo "However, it seems to be lacking the _base field."
13858         fi
13859         $rm_try
13860         ;;
13861 esac
13862 set d_stdiobase
13863 eval $setvar
13864
13865 : see if fast_stdio exists
13866 val="$undef"
13867 case "$d_stdstdio:$d_stdio_ptr_lval" in
13868 "$define:$define")
13869         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13870         *$define*)
13871                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >&4
13872                 val="$define"
13873                 ;;
13874         esac
13875         ;;
13876 esac
13877 set d_faststdio
13878 eval $setvar
13879
13880 : see if fchdir exists
13881 set fchdir d_fchdir
13882 eval $inlibc
13883
13884 : see if fchmod exists
13885 set fchmod d_fchmod
13886 eval $inlibc
13887
13888 : check for openat, unlinkat, renameat, linkat, fchmodat
13889 set openat d_openat
13890 eval $inlibc
13891
13892 set unlinkat d_unlinkat
13893 eval $inlibc
13894
13895 set renameat d_renameat
13896 eval $inlibc
13897
13898 set linkat d_linkat
13899 eval $inlibc
13900
13901 set fchmodat d_fchmodat
13902 eval $inlibc
13903
13904 : see if fchown exists
13905 set fchown d_fchown
13906 eval $inlibc
13907
13908 : see if this is an fcntl system
13909 set fcntl d_fcntl
13910 eval $inlibc
13911
13912 : See if fcntl-based locking works.
13913 echo " "
13914 $cat >try.c <<EOCP
13915 #$i_stdlib I_STDLIB
13916 #ifdef I_STDLIB
13917 #include <stdlib.h>
13918 #endif
13919 #include <unistd.h>
13920 #include <fcntl.h>
13921 #include <signal.h>
13922 $signal_t blech(int x) { exit(3); }
13923 int main() {
13924 #if defined(F_SETLK) && defined(F_SETLKW)
13925      struct flock flock;
13926      int retval, fd;
13927      fd = open("try.c", O_RDONLY);
13928      flock.l_type = F_RDLCK;
13929      flock.l_whence = SEEK_SET;
13930      flock.l_start = flock.l_len = 0;
13931      signal(SIGALRM, blech);
13932      alarm(10);
13933      retval = fcntl(fd, F_SETLK, &flock);
13934      close(fd);
13935      (retval < 0 ? exit(2) : exit(0));
13936 #else
13937      exit(2);
13938 #endif
13939 }
13940 EOCP
13941 echo "Checking if fcntl-based file locking works... "
13942 case "$d_fcntl" in
13943 "$define")
13944         set try
13945         if eval $compile_ok; then
13946                 if $run ./try; then
13947                         echo "Yes, it seems to work."
13948                         val="$define"
13949                 else
13950                         echo "Nope, it didn't work."
13951                         val="$undef"
13952                         case "$?" in
13953                         3) $cat >&4 <<EOM
13954 ***
13955 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13956 *** This is (almost) impossible.
13957 *** If your NFS lock daemons are not feeling well, something like
13958 *** this may happen, please investigate.  Cannot continue, aborting.
13959 ***
13960 EOM
13961                                 exit 1
13962                                 ;;
13963                         esac
13964                 fi
13965         else
13966                 echo "I'm unable to compile the test program, so I'll assume not."
13967                 val="$undef"
13968         fi
13969         ;;
13970 *) val="$undef";
13971         echo "Nope, since you don't even have fcntl()."
13972         ;;
13973 esac
13974 set d_fcntl_can_lock
13975 eval $setvar
13976 $rm_try
13977
13978 : check for fd_set items
13979 $cat <<EOM
13980
13981 Checking to see how well your C compiler handles fd_set and friends ...
13982 EOM
13983 $cat >try.c <<EOCP
13984 #$i_stdlib I_STDLIB
13985 #ifdef I_STDLIB
13986 #include <stdlib.h>
13987 #endif
13988 #$i_systime I_SYS_TIME
13989 #$i_sysselct I_SYS_SELECT
13990 #$d_socket HAS_SOCKET
13991 #include <sys/types.h>
13992 #ifdef HAS_SOCKET
13993 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13994 #endif
13995 #ifdef I_SYS_TIME
13996 #include <sys/time.h>
13997 #endif
13998 #ifdef I_SYS_SELECT
13999 #include <sys/select.h>
14000 #endif
14001 int main() {
14002         fd_set fds;
14003
14004 #ifdef TRYBITS
14005         if(fds.fds_bits);
14006 #endif
14007
14008 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
14009         exit(0);
14010 #else
14011         exit(1);
14012 #endif
14013 }
14014 EOCP
14015 set try -DTRYBITS
14016 if eval $compile; then
14017         d_fds_bits="$define"
14018         d_fd_set="$define"
14019         echo "Well, your system knows about the normal fd_set typedef..." >&4
14020         if $run ./try; then
14021                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14022                 d_fd_macros="$define"
14023         else
14024                 $cat >&4 <<'EOM'
14025 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
14026 EOM
14027                 d_fd_macros="$undef"
14028         fi
14029 else
14030         $cat <<'EOM'
14031 Hmm, your compiler has some difficulty with fd_set.  Checking further...
14032 EOM
14033         set try
14034         if eval $compile; then
14035                 d_fds_bits="$undef"
14036                 d_fd_set="$define"
14037                 echo "Well, your system has some sort of fd_set available..." >&4
14038                 if $run ./try; then
14039                         echo "and you have the normal fd_set macros." >&4
14040                         d_fd_macros="$define"
14041                 else
14042                         $cat <<'EOM'
14043 but not the normal fd_set macros!  Gross!  More work for me...
14044 EOM
14045                         d_fd_macros="$undef"
14046                 fi
14047         else
14048         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14049                 d_fd_set="$undef"
14050                 d_fds_bits="$undef"
14051                 d_fd_macros="$undef"
14052         fi
14053 fi
14054 $rm_try
14055
14056 : see if fdclose exists
14057 set fdclose d_fdclose
14058 eval $inlibc
14059
14060 : see if fdim exists
14061 set fdim d_fdim
14062 eval $inlibc
14063
14064 : see if fegetround exists
14065 set fegetround d_fegetround
14066 eval $inlibc
14067
14068 : see if ffs exists
14069 set ffs d_ffs
14070 eval $inlibc
14071 : see if ffsl exists
14072 set ffsl d_ffsl
14073 eval $inlibc
14074
14075 : see if fgetpos exists
14076 set fgetpos d_fgetpos
14077 eval $inlibc
14078
14079 : see if finite exists
14080 set finite d_finite
14081 eval $inlibc
14082
14083 : see if finitel exists
14084 set finitel d_finitel
14085 eval $inlibc
14086
14087 : see if flock exists
14088 set flock d_flock
14089 eval $inlibc
14090
14091 : see if prototype for flock is available
14092 echo " "
14093 set d_flockproto flock $i_sysfile sys/file.h
14094 eval $hasproto
14095
14096 : see if fma exists
14097 set fma d_fma
14098 eval $inlibc
14099
14100 : see if fmax exists
14101 set fmax d_fmax
14102 eval $inlibc
14103
14104 : see if fmin exists
14105 set fmin d_fmin
14106 eval $inlibc
14107
14108 : see if fp_class exists
14109 set fp_class d_fp_class
14110 eval $inlibc
14111
14112 : check for fpclassify
14113 echo "Checking to see if you have fpclassify..." >&4
14114 $cat >try.c <<EOCP
14115 #include <math.h>
14116 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14117 EOCP
14118 set try
14119 if eval $compile; then
14120         val="$define"
14121         echo "You have fpclassify."
14122 else
14123         val="$undef"
14124         echo "You do not have fpclassify."
14125 fi
14126 $rm_try
14127 set d_fpclassify
14128 eval $setvar
14129
14130 : see if fp_classify exists
14131 set fp_classify d_fp_classify
14132 eval $inlibc
14133
14134 : see if fp_classl exists
14135 set fp_classl d_fp_classl
14136 eval $inlibc
14137
14138 : see if pathconf exists
14139 set pathconf d_pathconf
14140 eval $inlibc
14141
14142 : see if fpathconf exists
14143 set fpathconf d_fpathconf
14144 eval $inlibc
14145
14146 : see if fpclass exists
14147 set fpclass d_fpclass
14148 eval $inlibc
14149
14150 : see if fpclassl exists
14151 set fpclassl d_fpclassl
14152 eval $inlibc
14153
14154 : see if fpgetround exists
14155 set fpgetround d_fpgetround
14156 eval $inlibc
14157
14158 : check for fpos64_t
14159 echo " "
14160 echo "Checking to see if you have fpos64_t..." >&4
14161 $cat >try.c <<EOCP
14162 #include <stdio.h>
14163 int main() { fpos64_t x = 7; }
14164 EOCP
14165 set try
14166 if eval $compile; then
14167         val="$define"
14168         echo "You have fpos64_t."
14169 else
14170         val="$undef"
14171         echo "You do not have fpos64_t."
14172         case "$fpossize" in
14173         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14174         esac
14175 fi
14176 $rm_try
14177 set d_fpos64_t
14178 eval $setvar
14179
14180 : see if frexpl exists
14181 set frexpl d_frexpl
14182 eval $inlibc
14183
14184 : see if this is a sys/param system
14185 set sys/param.h i_sysparam
14186 eval $inhdr
14187
14188 : see if this is a sys/mount.h system
14189 set sys/mount.h i_sysmount
14190 eval $inhdr
14191
14192 : Check for fs_data_s
14193 echo " "
14194 echo "Checking to see if your system supports struct fs_data..." >&4
14195 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14196 eval $hasstruct
14197 case "$d_fs_data_s" in
14198 "$define")      echo "Yes, it does."   ;;
14199 *)              echo "No, it doesn't." ;;
14200 esac
14201
14202 : see if fseeko exists
14203 set fseeko d_fseeko
14204 eval $inlibc
14205 case "$longsize" in
14206 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14207 esac
14208
14209 : see if fsetpos exists
14210 set fsetpos d_fsetpos
14211 eval $inlibc
14212
14213 : see if fstatfs exists
14214 set fstatfs d_fstatfs
14215 eval $inlibc
14216
14217 : see if statvfs exists
14218 set statvfs d_statvfs
14219 eval $inlibc
14220
14221 : see if fstatvfs exists
14222 set fstatvfs d_fstatvfs
14223 eval $inlibc
14224
14225 : see if fsync exists
14226 set fsync d_fsync
14227 eval $inlibc
14228
14229 : see if ftello exists
14230 set ftello d_ftello
14231 eval $inlibc
14232 case "$longsize" in
14233 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14234 esac
14235
14236 : check for a working futimes
14237 d_futimes="$undef"
14238 echo " "
14239 echo "Checking if you have a working futimes()" >&4
14240 $cat >try.c <<EOCP
14241 #include <stdio.h>
14242 #include <stdlib.h>
14243 #include <sys/time.h>
14244 #include <errno.h>
14245 #include <fcntl.h>
14246 #include <stdlib.h>
14247
14248 int main ()
14249 {
14250     int fd, rv;
14251     fd = open ("try.c", O_RDWR);
14252     if (-1 == fd) exit (1);
14253     rv = futimes (fd, NULL);
14254     exit (rv == -1 ? errno : 0);
14255 }
14256 EOCP
14257 set try
14258 if eval $compile; then
14259     `$run ./try`
14260     rc=$?
14261     case "$rc" in
14262         0)  echo "Yes, you have" >&4
14263             d_futimes="$define"
14264             ;;
14265         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14266             ;;
14267     esac
14268 else
14269     echo "No, it does not (probably harmless)" >&4
14270 fi
14271 $rm_try
14272
14273 : look for gai_strerror
14274 echo " "
14275 $cat >try.c <<'EOCP'
14276 #include <sys/types.h>
14277 #include <sys/socket.h>
14278 #include <netdb.h>
14279 int main ()
14280 {
14281     return (gai_strerror (0) ? 0 : 1);
14282     }
14283 EOCP
14284 set try
14285 val="$undef"
14286 if eval $compile; then
14287     `$run ./try`
14288     case "$?" in
14289         0)  echo "A working gai_strerror() found." >&4
14290             val="$define" ;;
14291         *)  echo "gai_strerror() found, but it doesn't work" >&4
14292             ;;
14293         esac
14294 else
14295     echo "gai_strerror() NOT found." >&4
14296     fi
14297 set d_gai_strerror
14298 eval $setvar
14299 $rm_try
14300
14301 : see if ndbm.h is available
14302 set ndbm.h i_ndbm
14303 eval $inhdr
14304 : Compatibility location for RedHat 7.1
14305 set gdbm/ndbm.h i_gdbmndbm
14306 eval $inhdr
14307 : Compatibility location for Debian 4.0
14308 set gdbm-ndbm.h i_gdbm_ndbm
14309 eval $inhdr
14310
14311 val="$undef"
14312 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14313         : see if dbm_open exists
14314         set dbm_open d_dbm_open
14315         eval $inlibc
14316         case "$d_dbm_open" in
14317         $undef)
14318                 i_ndbm="$undef"
14319                 i_gdbmndbm="$undef"
14320                 i_gdbm_ndbm="$undef"
14321                 echo "We won't be including <ndbm.h>"
14322                 val="$undef"
14323                 ;;
14324         *) val="$define"
14325            ;;
14326         esac
14327 fi
14328 set d_ndbm
14329 eval $setvar
14330
14331 ndbm_hdr_protochk='name=$1; hdr=$2;
14332 eval "ihdr=\$""i_$name";
14333 val="$undef";
14334 if $test "$ihdr" = "$define"; then
14335         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14336         case "$d_cplusplus" in
14337         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14338         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14339         esac;
14340         case "$val" in
14341         $define) $echo "Your <$hdr> seems to have prototypes";;
14342         *) $echo "Your <$hdr> does not seem to have prototypes";;
14343         esac;
14344 fi;
14345 set "d_${name}_h_uses_prototypes";
14346 eval $setvar'
14347
14348 set ndbm ndbm.h
14349 eval $ndbm_hdr_protochk
14350 set gdbmndbm gdbm/ndbm.h
14351 eval $ndbm_hdr_protochk
14352 set gdbm_ndbm gdbm-ndbm.h
14353 eval $ndbm_hdr_protochk
14354
14355 : see if getaddrinfo exists
14356 set getaddrinfo d_getaddrinfo
14357 eval $inlibc
14358
14359 : see if getcwd exists
14360 set getcwd d_getcwd
14361 eval $inlibc
14362
14363 : check for getenv behavior
14364 case "$d_getenv_preserves_other_thread" in
14365 '')
14366 $echo "Checking to see if getenv() preserves a different thread's results" >&4
14367 $cat >try.c <<EOCP
14368 #$i_stdlib I_STDLIB
14369 #ifdef I_STDLIB
14370 #  include <stdlib.h>
14371 #endif
14372 #include <stdio.h>
14373 #include <string.h>
14374 #$i_pthread I_PTHREAD
14375 #ifdef I_PTHREAD
14376 #  include <pthread.h>
14377 #endif
14378
14379 void *
14380 thread_start(void * arg)
14381 {
14382     return (void *) getenv("HOME");
14383 }
14384
14385 int main() {
14386     char * main_buffer;
14387     char save_main_buffer[1000];
14388     pthread_t subthread;
14389     pthread_attr_t attr;
14390
14391     main_buffer = getenv("PATH");
14392
14393     /* If too large for our generous allowance, return we couldn't figure it
14394      * out. */
14395     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
14396         exit(2);
14397     }
14398
14399     strcpy(save_main_buffer, main_buffer);
14400
14401     if (pthread_attr_init(&attr) != 0) {
14402         exit(2);
14403     }
14404
14405     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
14406         exit(2);
14407     }
14408
14409     if (pthread_join(subthread, NULL) != 0) {
14410         exit(2);
14411     }
14412
14413     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
14414 }
14415 EOCP
14416 val=
14417 set try
14418 if eval $compile_ok; then
14419     $run ./try
14420     rc=$?
14421     case "$rc" in
14422         0) echo "getenv() didn't destroy another thread's buffer" >&4
14423            val=$define
14424            ;;
14425         1) echo "getenv() does destroy another thread's buffer" >&4
14426            val=$undef
14427            ;;
14428         *) echo "Couldn't determine if getenv() destroys another thread's return value (code=$rc); assuming it does" >&4
14429            val=$undef
14430            ;;
14431     esac
14432 else
14433     echo "(I can't seem to compile the test program.)" >&4
14434     echo "Assuming that your C library's getenv destroys another thread's return value." >&4
14435     val=$undef
14436 fi
14437 set d_getenv_preserves_other_thread
14438 eval $setvar
14439 $rm_try
14440 ;;
14441 esac
14442
14443 : see if getespwnam exists
14444 set getespwnam d_getespwnam
14445 eval $inlibc
14446
14447 : see if getfsstat exists
14448 set getfsstat d_getfsstat
14449 eval $inlibc
14450
14451 : see if getgrent exists
14452 set getgrent d_getgrent
14453 eval $inlibc
14454
14455 : see if getgrent_r exists
14456 set getgrent_r d_getgrent_r
14457 eval $inlibc
14458 case "$d_getgrent_r" in
14459 "$define")
14460         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14461         case "$d_getgrent_r_proto:$usethreads" in
14462         ":define")      d_getgrent_r_proto=define
14463                 set d_getgrent_r_proto getgrent_r $hdrs
14464                 eval $hasproto ;;
14465         *)      ;;
14466         esac
14467         case "$d_getgrent_r_proto" in
14468         define)
14469         case "$getgrent_r_proto" in
14470         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14471         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14472         esac
14473         case "$getgrent_r_proto" in
14474         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14475         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14476         esac
14477         case "$getgrent_r_proto" in
14478         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14479         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14480         esac
14481         case "$getgrent_r_proto" in
14482         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14483         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14484         esac
14485         case "$getgrent_r_proto" in
14486         ''|0) try='int getgrent_r(struct group*, char*, int);'
14487         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14488         esac
14489         case "$getgrent_r_proto" in
14490         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14491         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14492         esac
14493         case "$getgrent_r_proto" in
14494         ''|0)   d_getgrent_r=undef
14495                 getgrent_r_proto=0
14496                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14497         * )     case "$getgrent_r_proto" in
14498                 REENTRANT_PROTO*) ;;
14499                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14500                 esac
14501                 echo "Prototype: $try" ;;
14502         esac
14503         ;;
14504         *)      case "$usethreads" in
14505                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14506                 esac
14507                 d_getgrent_r=undef
14508                 getgrent_r_proto=0
14509                 ;;
14510         esac
14511         ;;
14512 *)      getgrent_r_proto=0
14513         ;;
14514 esac
14515
14516 : see if getgrgid_r exists
14517 set getgrgid_r d_getgrgid_r
14518 eval $inlibc
14519 case "$d_getgrgid_r" in
14520 "$define")
14521         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14522         case "$d_getgrgid_r_proto:$usethreads" in
14523         ":define")      d_getgrgid_r_proto=define
14524                 set d_getgrgid_r_proto getgrgid_r $hdrs
14525                 eval $hasproto ;;
14526         *)      ;;
14527         esac
14528         case "$d_getgrgid_r_proto" in
14529         define)
14530         case "$getgrgid_r_proto" in
14531         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14532         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14533         esac
14534         case "$getgrgid_r_proto" in
14535         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14536         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14537         esac
14538         case "$getgrgid_r_proto" in
14539         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14540         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14541         esac
14542         case "$getgrgid_r_proto" in
14543         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14544         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14545         esac
14546         case "$getgrgid_r_proto" in
14547         ''|0)   d_getgrgid_r=undef
14548                 getgrgid_r_proto=0
14549                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14550         * )     case "$getgrgid_r_proto" in
14551                 REENTRANT_PROTO*) ;;
14552                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14553                 esac
14554                 echo "Prototype: $try" ;;
14555         esac
14556         ;;
14557         *)      case "$usethreads" in
14558                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14559                 esac
14560                 d_getgrgid_r=undef
14561                 getgrgid_r_proto=0
14562                 ;;
14563         esac
14564         ;;
14565 *)      getgrgid_r_proto=0
14566         ;;
14567 esac
14568
14569 : see if getgrnam_r exists
14570 set getgrnam_r d_getgrnam_r
14571 eval $inlibc
14572 case "$d_getgrnam_r" in
14573 "$define")
14574         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14575         case "$d_getgrnam_r_proto:$usethreads" in
14576         ":define")      d_getgrnam_r_proto=define
14577                 set d_getgrnam_r_proto getgrnam_r $hdrs
14578                 eval $hasproto ;;
14579         *)      ;;
14580         esac
14581         case "$d_getgrnam_r_proto" in
14582         define)
14583         case "$getgrnam_r_proto" in
14584         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14585         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14586         esac
14587         case "$getgrnam_r_proto" in
14588         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14589         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14590         esac
14591         case "$getgrnam_r_proto" in
14592         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14593         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14594         esac
14595         case "$getgrnam_r_proto" in
14596         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14597         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14598         esac
14599         case "$getgrnam_r_proto" in
14600         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14601         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14602         esac
14603         case "$getgrnam_r_proto" in
14604         ''|0)   d_getgrnam_r=undef
14605                 getgrnam_r_proto=0
14606                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14607         * )     case "$getgrnam_r_proto" in
14608                 REENTRANT_PROTO*) ;;
14609                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14610                 esac
14611                 echo "Prototype: $try" ;;
14612         esac
14613         ;;
14614         *)      case "$usethreads" in
14615                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14616                 esac
14617                 d_getgrnam_r=undef
14618                 getgrnam_r_proto=0
14619                 ;;
14620         esac
14621         ;;
14622 *)      getgrnam_r_proto=0
14623         ;;
14624 esac
14625
14626 : see if gethostbyaddr exists
14627 set gethostbyaddr d_gethbyaddr
14628 eval $inlibc
14629
14630 : see if gethostbyname exists
14631 set gethostbyname d_gethbyname
14632 eval $inlibc
14633
14634 : see if gethostent exists
14635 set gethostent d_gethent
14636 eval $inlibc
14637
14638 : see how we will look up host name
14639 echo " "
14640 call=''
14641 if set gethostname val -f d_gethname; eval $csym; $val; then
14642         echo 'gethostname() found.' >&4
14643         d_gethname="$define"
14644         call=gethostname
14645 fi
14646 if set uname val -f d_uname; eval $csym; $val; then
14647         if ./xenix; then
14648                 $cat <<'EOM'
14649 uname() was found, but you're running xenix, and older versions of xenix
14650 have a broken uname(). If you don't really know whether your xenix is old
14651 enough to have a broken system call, use the default answer.
14652
14653 EOM
14654                 dflt=y
14655                 case "$d_uname" in
14656                 "$define") dflt=n;;
14657                 esac
14658                 rp='Is your uname() broken?'
14659                 . ./myread
14660                 case "$ans" in
14661                 n*) d_uname="$define"; call=uname;;
14662                 esac
14663         else
14664                 echo 'uname() found.' >&4
14665                 d_uname="$define"
14666                 case "$call" in
14667                 '') call=uname ;;
14668                 esac
14669         fi
14670 fi
14671 case "$d_gethname" in
14672 '') d_gethname="$undef";;
14673 esac
14674 case "$d_uname" in
14675 '') d_uname="$undef";;
14676 esac
14677 case "$d_uname$d_gethname" in
14678 *define*)
14679         dflt=n
14680         cat <<EOM
14681
14682 Every now and then someone has a $call() that lies about the hostname
14683 but can't be fixed for political or economic reasons.  If you wish, I can
14684 pretend $call() isn't there and maybe compute hostname at run-time
14685 thanks to the '$phostname' command.
14686
14687 EOM
14688         rp="Shall I ignore $call() from now on?"
14689         . ./myread
14690         case "$ans" in
14691         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14692         esac;;
14693 esac
14694 case "$phostname" in
14695 '') aphostname='';;
14696 *) case "$aphostname" in
14697         /*) ;;
14698         *) set X $phostname
14699                 shift
14700                 file=$1
14701                 shift
14702                 file=`./loc $file $file $pth`
14703                 aphostname=`echo $file $*`
14704                 ;;
14705         esac
14706         ;;
14707 esac
14708 case "$d_uname$d_gethname" in
14709 *define*) ;;
14710 *)
14711         case "$phostname" in
14712         '')
14713                 echo "There will be no way for $package to get your hostname." >&4;;
14714         *)
14715         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14716                 ;;
14717         esac;;
14718 esac
14719 case "$d_phostname" in
14720 '') d_phostname="$undef";;
14721 esac
14722
14723 : see if gethostbyaddr_r exists
14724 set gethostbyaddr_r d_gethostbyaddr_r
14725 eval $inlibc
14726 case "$d_gethostbyaddr_r" in
14727 "$define")
14728         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14729         case "$d_gethostbyaddr_r_proto:$usethreads" in
14730         ":define")      d_gethostbyaddr_r_proto=define
14731                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14732                 eval $hasproto ;;
14733         *)      ;;
14734         esac
14735         case "$d_gethostbyaddr_r_proto" in
14736         define)
14737         case "$gethostbyaddr_r_proto" in
14738         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14739         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14740         esac
14741         case "$gethostbyaddr_r_proto" in
14742         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14743         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14744         esac
14745         case "$gethostbyaddr_r_proto" in
14746         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14747         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14748         esac
14749         case "$gethostbyaddr_r_proto" in
14750         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14751         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14752         esac
14753         case "$gethostbyaddr_r_proto" in
14754         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14755         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14756         esac
14757         case "$gethostbyaddr_r_proto" in
14758         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14759         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14760         esac
14761         case "$gethostbyaddr_r_proto" in
14762         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14763         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14764         esac
14765         case "$gethostbyaddr_r_proto" in
14766         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14767         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14768         esac
14769         case "$gethostbyaddr_r_proto" in
14770         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14771         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14772         esac
14773         case "$gethostbyaddr_r_proto" in
14774         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14775         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14776         esac
14777         case "$gethostbyaddr_r_proto" in
14778         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14779         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14780         esac
14781         case "$gethostbyaddr_r_proto" in
14782         ''|0)   d_gethostbyaddr_r=undef
14783                 gethostbyaddr_r_proto=0
14784                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14785         * )     case "$gethostbyaddr_r_proto" in
14786                 REENTRANT_PROTO*) ;;
14787                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14788                 esac
14789                 echo "Prototype: $try" ;;
14790         esac
14791         ;;
14792         *)      case "$usethreads" in
14793                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14794                 esac
14795                 d_gethostbyaddr_r=undef
14796                 gethostbyaddr_r_proto=0
14797                 ;;
14798         esac
14799         ;;
14800 *)      gethostbyaddr_r_proto=0
14801         ;;
14802 esac
14803
14804 : see if gethostbyname_r exists
14805 set gethostbyname_r d_gethostbyname_r
14806 eval $inlibc
14807 case "$d_gethostbyname_r" in
14808 "$define")
14809         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14810         case "$d_gethostbyname_r_proto:$usethreads" in
14811         ":define")      d_gethostbyname_r_proto=define
14812                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14813                 eval $hasproto ;;
14814         *)      ;;
14815         esac
14816         case "$d_gethostbyname_r_proto" in
14817         define)
14818         case "$gethostbyname_r_proto" in
14819         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14820         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14821         esac
14822         case "$gethostbyname_r_proto" in
14823         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14824         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14825         esac
14826         case "$gethostbyname_r_proto" in
14827         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14828         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14829         esac
14830         case "$gethostbyname_r_proto" in
14831         ''|0)   d_gethostbyname_r=undef
14832                 gethostbyname_r_proto=0
14833                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14834         * )     case "$gethostbyname_r_proto" in
14835                 REENTRANT_PROTO*) ;;
14836                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14837                 esac
14838                 echo "Prototype: $try" ;;
14839         esac
14840         ;;
14841         *)      case "$usethreads" in
14842                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14843                 esac
14844                 d_gethostbyname_r=undef
14845                 gethostbyname_r_proto=0
14846                 ;;
14847         esac
14848         ;;
14849 *)      gethostbyname_r_proto=0
14850         ;;
14851 esac
14852
14853 : see if gethostent_r exists
14854 set gethostent_r d_gethostent_r
14855 eval $inlibc
14856 case "$d_gethostent_r" in
14857 "$define")
14858         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14859         case "$d_gethostent_r_proto:$usethreads" in
14860         ":define")      d_gethostent_r_proto=define
14861                 set d_gethostent_r_proto gethostent_r $hdrs
14862                 eval $hasproto ;;
14863         *)      ;;
14864         esac
14865         case "$d_gethostent_r_proto" in
14866         define)
14867         case "$gethostent_r_proto" in
14868         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14869         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14870         esac
14871         case "$gethostent_r_proto" in
14872         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14873         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14874         esac
14875         case "$gethostent_r_proto" in
14876         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14877         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14878         esac
14879         case "$gethostent_r_proto" in
14880         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14881         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14882         esac
14883         case "$gethostent_r_proto" in
14884         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14885         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14886         esac
14887         case "$gethostent_r_proto" in
14888         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14889         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14890         esac
14891         case "$gethostent_r_proto" in
14892         ''|0)   d_gethostent_r=undef
14893                 gethostent_r_proto=0
14894                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14895         * )     case "$gethostent_r_proto" in
14896                 REENTRANT_PROTO*) ;;
14897                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14898                 esac
14899                 echo "Prototype: $try" ;;
14900         esac
14901         ;;
14902         *)      case "$usethreads" in
14903                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14904                 esac
14905                 d_gethostent_r=undef
14906                 gethostent_r_proto=0
14907                 ;;
14908         esac
14909         ;;
14910 *)      gethostent_r_proto=0
14911         ;;
14912 esac
14913
14914 : see if prototypes for various gethostxxx netdb.h functions are available
14915 echo " "
14916 set d_gethostprotos gethostent $i_netdb netdb.h
14917 eval $hasproto
14918
14919 : see if getitimer exists
14920 set getitimer d_getitimer
14921 eval $inlibc
14922
14923 : see if getlogin exists
14924 set getlogin d_getlogin
14925 eval $inlibc
14926
14927 : see if getlogin_r exists
14928 set getlogin_r d_getlogin_r
14929 eval $inlibc
14930 case "$d_getlogin_r" in
14931 "$define")
14932         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14933         case "$d_getlogin_r_proto:$usethreads" in
14934         ":define")      d_getlogin_r_proto=define
14935                 set d_getlogin_r_proto getlogin_r $hdrs
14936                 eval $hasproto ;;
14937         *)      ;;
14938         esac
14939         case "$d_getlogin_r_proto" in
14940         define)
14941         case "$getlogin_r_proto" in
14942         ''|0) try='int getlogin_r(char*, size_t);'
14943         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14944         esac
14945         case "$getlogin_r_proto" in
14946         ''|0) try='int getlogin_r(char*, int);'
14947         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14948         esac
14949         case "$getlogin_r_proto" in
14950         ''|0) try='char* getlogin_r(char*, size_t);'
14951         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14952         esac
14953         case "$getlogin_r_proto" in
14954         ''|0) try='char* getlogin_r(char*, int);'
14955         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14956         esac
14957         case "$getlogin_r_proto" in
14958         ''|0)   d_getlogin_r=undef
14959                 getlogin_r_proto=0
14960                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14961         * )     case "$getlogin_r_proto" in
14962                 REENTRANT_PROTO*) ;;
14963                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14964                 esac
14965                 echo "Prototype: $try" ;;
14966         esac
14967         ;;
14968         *)      case "$usethreads" in
14969                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14970                 esac
14971                 d_getlogin_r=undef
14972                 getlogin_r_proto=0
14973                 ;;
14974         esac
14975         ;;
14976 *)      getlogin_r_proto=0
14977         ;;
14978 esac
14979
14980 : see if getmnt exists
14981 set getmnt d_getmnt
14982 eval $inlibc
14983
14984 : see if getmntent exists
14985 set getmntent d_getmntent
14986 eval $inlibc
14987
14988 : see if getnameinfo exists
14989 set getnameinfo d_getnameinfo
14990 eval $inlibc
14991
14992 : see if getnetbyaddr exists
14993 set getnetbyaddr d_getnbyaddr
14994 eval $inlibc
14995
14996 : see if getnetbyname exists
14997 set getnetbyname d_getnbyname
14998 eval $inlibc
14999
15000 : see if getnetent exists
15001 set getnetent d_getnent
15002 eval $inlibc
15003
15004 : see if getnetbyaddr_r exists
15005 set getnetbyaddr_r d_getnetbyaddr_r
15006 eval $inlibc
15007 case "$d_getnetbyaddr_r" in
15008 "$define")
15009         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15010         case "$d_getnetbyaddr_r_proto:$usethreads" in
15011         ":define")      d_getnetbyaddr_r_proto=define
15012                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
15013                 eval $hasproto ;;
15014         *)      ;;
15015         esac
15016         case "$d_getnetbyaddr_r_proto" in
15017         define)
15018         case "$getnetbyaddr_r_proto" in
15019         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
15020         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
15021         esac
15022         case "$getnetbyaddr_r_proto" in
15023         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
15024         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
15025         esac
15026         case "$getnetbyaddr_r_proto" in
15027         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
15028         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
15029         esac
15030         case "$getnetbyaddr_r_proto" in
15031         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
15032         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
15033         esac
15034         case "$getnetbyaddr_r_proto" in
15035         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
15036         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
15037         esac
15038         case "$getnetbyaddr_r_proto" in
15039         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
15040         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
15041         esac
15042         case "$getnetbyaddr_r_proto" in
15043         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
15044         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
15045         esac
15046         case "$getnetbyaddr_r_proto" in
15047         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
15048         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
15049         esac
15050         case "$getnetbyaddr_r_proto" in
15051         ''|0)   d_getnetbyaddr_r=undef
15052                 getnetbyaddr_r_proto=0
15053                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
15054         * )     case "$getnetbyaddr_r_proto" in
15055                 REENTRANT_PROTO*) ;;
15056                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
15057                 esac
15058                 echo "Prototype: $try" ;;
15059         esac
15060         ;;
15061         *)      case "$usethreads" in
15062                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
15063                 esac
15064                 d_getnetbyaddr_r=undef
15065                 getnetbyaddr_r_proto=0
15066                 ;;
15067         esac
15068         ;;
15069 *)      getnetbyaddr_r_proto=0
15070         ;;
15071 esac
15072
15073 : see if getnetbyname_r exists
15074 set getnetbyname_r d_getnetbyname_r
15075 eval $inlibc
15076 case "$d_getnetbyname_r" in
15077 "$define")
15078         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15079         case "$d_getnetbyname_r_proto:$usethreads" in
15080         ":define")      d_getnetbyname_r_proto=define
15081                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
15082                 eval $hasproto ;;
15083         *)      ;;
15084         esac
15085         case "$d_getnetbyname_r_proto" in
15086         define)
15087         case "$getnetbyname_r_proto" in
15088         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
15089         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
15090         esac
15091         case "$getnetbyname_r_proto" in
15092         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
15093         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
15094         esac
15095         case "$getnetbyname_r_proto" in
15096         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
15097         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
15098         esac
15099         case "$getnetbyname_r_proto" in
15100         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
15101         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
15102         esac
15103         case "$getnetbyname_r_proto" in
15104         ''|0)   d_getnetbyname_r=undef
15105                 getnetbyname_r_proto=0
15106                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
15107         * )     case "$getnetbyname_r_proto" in
15108                 REENTRANT_PROTO*) ;;
15109                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
15110                 esac
15111                 echo "Prototype: $try" ;;
15112         esac
15113         ;;
15114         *)      case "$usethreads" in
15115                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
15116                 esac
15117                 d_getnetbyname_r=undef
15118                 getnetbyname_r_proto=0
15119                 ;;
15120         esac
15121         ;;
15122 *)      getnetbyname_r_proto=0
15123         ;;
15124 esac
15125
15126 : see if getnetent_r exists
15127 set getnetent_r d_getnetent_r
15128 eval $inlibc
15129 case "$d_getnetent_r" in
15130 "$define")
15131         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15132         case "$d_getnetent_r_proto:$usethreads" in
15133         ":define")      d_getnetent_r_proto=define
15134                 set d_getnetent_r_proto getnetent_r $hdrs
15135                 eval $hasproto ;;
15136         *)      ;;
15137         esac
15138         case "$d_getnetent_r_proto" in
15139         define)
15140         case "$getnetent_r_proto" in
15141         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15142         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15143         esac
15144         case "$getnetent_r_proto" in
15145         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15146         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15147         esac
15148         case "$getnetent_r_proto" in
15149         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15150         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15151         esac
15152         case "$getnetent_r_proto" in
15153         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15154         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15155         esac
15156         case "$getnetent_r_proto" in
15157         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15158         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15159         esac
15160         case "$getnetent_r_proto" in
15161         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15162         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15163         esac
15164         case "$getnetent_r_proto" in
15165         ''|0)   d_getnetent_r=undef
15166                 getnetent_r_proto=0
15167                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15168         * )     case "$getnetent_r_proto" in
15169                 REENTRANT_PROTO*) ;;
15170                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15171                 esac
15172                 echo "Prototype: $try" ;;
15173         esac
15174         ;;
15175         *)      case "$usethreads" in
15176                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15177                 esac
15178                 d_getnetent_r=undef
15179                 getnetent_r_proto=0
15180                 ;;
15181         esac
15182         ;;
15183 *)      getnetent_r_proto=0
15184         ;;
15185 esac
15186
15187 : see if prototypes for various getnetxxx netdb.h functions are available
15188 echo " "
15189 set d_getnetprotos getnetent $i_netdb netdb.h
15190 eval $hasproto
15191
15192 : see if getpagesize exists
15193 set getpagesize d_getpagsz
15194 eval $inlibc
15195
15196 : Optional checks for getprotobyname and getprotobynumber
15197
15198 : see if getprotobyname exists
15199 set getprotobyname d_getpbyname
15200 eval $inlibc
15201
15202 : see if getprotobynumber exists
15203 set getprotobynumber d_getpbynumber
15204 eval $inlibc
15205
15206 : see if getprotoent exists
15207 set getprotoent d_getpent
15208 eval $inlibc
15209
15210 : see if getpgid exists
15211 set getpgid d_getpgid
15212 eval $inlibc
15213
15214 : see if getpgrp2 exists
15215 set getpgrp2 d_getpgrp2
15216 eval $inlibc
15217
15218 : see if getppid exists
15219 set getppid d_getppid
15220 eval $inlibc
15221
15222 : see if getpriority exists
15223 set getpriority d_getprior
15224 eval $inlibc
15225
15226 : see if getprotobyname_r exists
15227 set getprotobyname_r d_getprotobyname_r
15228 eval $inlibc
15229 case "$d_getprotobyname_r" in
15230 "$define")
15231         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15232         case "$d_getprotobyname_r_proto:$usethreads" in
15233         ":define")      d_getprotobyname_r_proto=define
15234                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15235                 eval $hasproto ;;
15236         *)      ;;
15237         esac
15238         case "$d_getprotobyname_r_proto" in
15239         define)
15240         case "$getprotobyname_r_proto" in
15241         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15242         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15243         esac
15244         case "$getprotobyname_r_proto" in
15245         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15246         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15247         esac
15248         case "$getprotobyname_r_proto" in
15249         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15250         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15251         esac
15252         case "$getprotobyname_r_proto" in
15253         ''|0)   d_getprotobyname_r=undef
15254                 getprotobyname_r_proto=0
15255                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15256         * )     case "$getprotobyname_r_proto" in
15257                 REENTRANT_PROTO*) ;;
15258                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15259                 esac
15260                 echo "Prototype: $try" ;;
15261         esac
15262         ;;
15263         *)      case "$usethreads" in
15264                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15265                 esac
15266                 d_getprotobyname_r=undef
15267                 getprotobyname_r_proto=0
15268                 ;;
15269         esac
15270         ;;
15271 *)      getprotobyname_r_proto=0
15272         ;;
15273 esac
15274
15275 : see if getprotobynumber_r exists
15276 set getprotobynumber_r d_getprotobynumber_r
15277 eval $inlibc
15278 case "$d_getprotobynumber_r" in
15279 "$define")
15280         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15281         case "$d_getprotobynumber_r_proto:$usethreads" in
15282         ":define")      d_getprotobynumber_r_proto=define
15283                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15284                 eval $hasproto ;;
15285         *)      ;;
15286         esac
15287         case "$d_getprotobynumber_r_proto" in
15288         define)
15289         case "$getprotobynumber_r_proto" in
15290         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15291         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15292         esac
15293         case "$getprotobynumber_r_proto" in
15294         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15295         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15296         esac
15297         case "$getprotobynumber_r_proto" in
15298         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15299         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15300         esac
15301         case "$getprotobynumber_r_proto" in
15302         ''|0)   d_getprotobynumber_r=undef
15303                 getprotobynumber_r_proto=0
15304                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15305         * )     case "$getprotobynumber_r_proto" in
15306                 REENTRANT_PROTO*) ;;
15307                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15308                 esac
15309                 echo "Prototype: $try" ;;
15310         esac
15311         ;;
15312         *)      case "$usethreads" in
15313                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15314                 esac
15315                 d_getprotobynumber_r=undef
15316                 getprotobynumber_r_proto=0
15317                 ;;
15318         esac
15319         ;;
15320 *)      getprotobynumber_r_proto=0
15321         ;;
15322 esac
15323
15324 : see if getprotoent_r exists
15325 set getprotoent_r d_getprotoent_r
15326 eval $inlibc
15327 case "$d_getprotoent_r" in
15328 "$define")
15329         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15330         case "$d_getprotoent_r_proto:$usethreads" in
15331         ":define")      d_getprotoent_r_proto=define
15332                 set d_getprotoent_r_proto getprotoent_r $hdrs
15333                 eval $hasproto ;;
15334         *)      ;;
15335         esac
15336         case "$d_getprotoent_r_proto" in
15337         define)
15338         case "$getprotoent_r_proto" in
15339         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15340         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15341         esac
15342         case "$getprotoent_r_proto" in
15343         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15344         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15345         esac
15346         case "$getprotoent_r_proto" in
15347         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15348         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15349         esac
15350         case "$getprotoent_r_proto" in
15351         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15352         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15353         esac
15354         case "$getprotoent_r_proto" in
15355         ''|0)   d_getprotoent_r=undef
15356                 getprotoent_r_proto=0
15357                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15358         * )     case "$getprotoent_r_proto" in
15359                 REENTRANT_PROTO*) ;;
15360                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15361                 esac
15362                 echo "Prototype: $try" ;;
15363         esac
15364         ;;
15365         *)      case "$usethreads" in
15366                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15367                 esac
15368                 d_getprotoent_r=undef
15369                 getprotoent_r_proto=0
15370                 ;;
15371         esac
15372         ;;
15373 *)      getprotoent_r_proto=0
15374         ;;
15375 esac
15376
15377 : see if prototypes for various getprotoxxx netdb.h functions are available
15378 echo " "
15379 set d_getprotoprotos getprotoent $i_netdb netdb.h
15380 eval $hasproto
15381
15382 : see if getprpwnam exists
15383 set getprpwnam d_getprpwnam
15384 eval $inlibc
15385
15386 : see if getpwent exists
15387 set getpwent d_getpwent
15388 eval $inlibc
15389
15390 : see if getpwent_r exists
15391 set getpwent_r d_getpwent_r
15392 eval $inlibc
15393 case "$d_getpwent_r" in
15394 "$define")
15395         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15396         case "$d_getpwent_r_proto:$usethreads" in
15397         ":define")      d_getpwent_r_proto=define
15398                 set d_getpwent_r_proto getpwent_r $hdrs
15399                 eval $hasproto ;;
15400         *)      ;;
15401         esac
15402         case "$d_getpwent_r_proto" in
15403         define)
15404         case "$getpwent_r_proto" in
15405         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15406         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15407         esac
15408         case "$getpwent_r_proto" in
15409         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15410         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15411         esac
15412         case "$getpwent_r_proto" in
15413         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15414         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15415         esac
15416         case "$getpwent_r_proto" in
15417         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15418         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15419         esac
15420         case "$getpwent_r_proto" in
15421         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15422         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15423         esac
15424         case "$getpwent_r_proto" in
15425         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15426         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15427         esac
15428         case "$getpwent_r_proto" in
15429         ''|0)   d_getpwent_r=undef
15430                 getpwent_r_proto=0
15431                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15432         * )     case "$getpwent_r_proto" in
15433                 REENTRANT_PROTO*) ;;
15434                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15435                 esac
15436                 echo "Prototype: $try" ;;
15437         esac
15438         ;;
15439         *)      case "$usethreads" in
15440                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15441                 esac
15442                 d_getpwent_r=undef
15443                 getpwent_r_proto=0
15444                 ;;
15445         esac
15446         ;;
15447 *)      getpwent_r_proto=0
15448         ;;
15449 esac
15450
15451 : see if getpwnam_r exists
15452 set getpwnam_r d_getpwnam_r
15453 eval $inlibc
15454 case "$d_getpwnam_r" in
15455 "$define")
15456         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15457         case "$d_getpwnam_r_proto:$usethreads" in
15458         ":define")      d_getpwnam_r_proto=define
15459                 set d_getpwnam_r_proto getpwnam_r $hdrs
15460                 eval $hasproto ;;
15461         *)      ;;
15462         esac
15463         case "$d_getpwnam_r_proto" in
15464         define)
15465         case "$getpwnam_r_proto" in
15466         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15467         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15468         esac
15469         case "$getpwnam_r_proto" in
15470         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15471         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15472         esac
15473         case "$getpwnam_r_proto" in
15474         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15475         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15476         esac
15477         case "$getpwnam_r_proto" in
15478         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15479         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15480         esac
15481         case "$getpwnam_r_proto" in
15482         ''|0)   d_getpwnam_r=undef
15483                 getpwnam_r_proto=0
15484                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15485         * )     case "$getpwnam_r_proto" in
15486                 REENTRANT_PROTO*) ;;
15487                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15488                 esac
15489                 echo "Prototype: $try" ;;
15490         esac
15491         ;;
15492         *)      case "$usethreads" in
15493                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15494                 esac
15495                 d_getpwnam_r=undef
15496                 getpwnam_r_proto=0
15497                 ;;
15498         esac
15499         ;;
15500 *)      getpwnam_r_proto=0
15501         ;;
15502 esac
15503
15504 : see if getpwuid_r exists
15505 set getpwuid_r d_getpwuid_r
15506 eval $inlibc
15507 case "$d_getpwuid_r" in
15508 "$define")
15509         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15510         case "$d_getpwuid_r_proto:$usethreads" in
15511         ":define")      d_getpwuid_r_proto=define
15512                 set d_getpwuid_r_proto getpwuid_r $hdrs
15513                 eval $hasproto ;;
15514         *)      ;;
15515         esac
15516         case "$d_getpwuid_r_proto" in
15517         define)
15518         case "$getpwuid_r_proto" in
15519         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15520         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15521         esac
15522         case "$getpwuid_r_proto" in
15523         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15524         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15525         esac
15526         case "$getpwuid_r_proto" in
15527         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15528         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15529         esac
15530         case "$getpwuid_r_proto" in
15531         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15532         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15533         esac
15534         case "$getpwuid_r_proto" in
15535         ''|0)   d_getpwuid_r=undef
15536                 getpwuid_r_proto=0
15537                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15538         * )     case "$getpwuid_r_proto" in
15539                 REENTRANT_PROTO*) ;;
15540                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15541                 esac
15542                 echo "Prototype: $try" ;;
15543         esac
15544         ;;
15545         *)      case "$usethreads" in
15546                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15547                 esac
15548                 d_getpwuid_r=undef
15549                 getpwuid_r_proto=0
15550                 ;;
15551         esac
15552         ;;
15553 *)      getpwuid_r_proto=0
15554         ;;
15555 esac
15556
15557 : Optional checks for getsbyname and getsbyport
15558
15559 : see if getservbyname exists
15560 set getservbyname d_getsbyname
15561 eval $inlibc
15562
15563 : see if getservbyport exists
15564 set getservbyport d_getsbyport
15565 eval $inlibc
15566
15567 : see if getservent exists
15568 set getservent d_getsent
15569 eval $inlibc
15570
15571 : see if getservbyname_r exists
15572 set getservbyname_r d_getservbyname_r
15573 eval $inlibc
15574 case "$d_getservbyname_r" in
15575 "$define")
15576         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15577         case "$d_getservbyname_r_proto:$usethreads" in
15578         ":define")      d_getservbyname_r_proto=define
15579                 set d_getservbyname_r_proto getservbyname_r $hdrs
15580                 eval $hasproto ;;
15581         *)      ;;
15582         esac
15583         case "$d_getservbyname_r_proto" in
15584         define)
15585         case "$getservbyname_r_proto" in
15586         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15587         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15588         esac
15589         case "$getservbyname_r_proto" in
15590         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15591         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15592         esac
15593         case "$getservbyname_r_proto" in
15594         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15595         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15596         esac
15597         case "$getservbyname_r_proto" in
15598         ''|0)   d_getservbyname_r=undef
15599                 getservbyname_r_proto=0
15600                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15601         * )     case "$getservbyname_r_proto" in
15602                 REENTRANT_PROTO*) ;;
15603                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15604                 esac
15605                 echo "Prototype: $try" ;;
15606         esac
15607         ;;
15608         *)      case "$usethreads" in
15609                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15610                 esac
15611                 d_getservbyname_r=undef
15612                 getservbyname_r_proto=0
15613                 ;;
15614         esac
15615         ;;
15616 *)      getservbyname_r_proto=0
15617         ;;
15618 esac
15619
15620 : see if getservbyport_r exists
15621 set getservbyport_r d_getservbyport_r
15622 eval $inlibc
15623 case "$d_getservbyport_r" in
15624 "$define")
15625         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15626         case "$d_getservbyport_r_proto:$usethreads" in
15627         ":define")      d_getservbyport_r_proto=define
15628                 set d_getservbyport_r_proto getservbyport_r $hdrs
15629                 eval $hasproto ;;
15630         *)      ;;
15631         esac
15632         case "$d_getservbyport_r_proto" in
15633         define)
15634         case "$getservbyport_r_proto" in
15635         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15636         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15637         esac
15638         case "$getservbyport_r_proto" in
15639         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15640         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15641         esac
15642         case "$getservbyport_r_proto" in
15643         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15644         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15645         esac
15646         case "$getservbyport_r_proto" in
15647         ''|0)   d_getservbyport_r=undef
15648                 getservbyport_r_proto=0
15649                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15650         * )     case "$getservbyport_r_proto" in
15651                 REENTRANT_PROTO*) ;;
15652                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15653                 esac
15654                 echo "Prototype: $try" ;;
15655         esac
15656         ;;
15657         *)      case "$usethreads" in
15658                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15659                 esac
15660                 d_getservbyport_r=undef
15661                 getservbyport_r_proto=0
15662                 ;;
15663         esac
15664         ;;
15665 *)      getservbyport_r_proto=0
15666         ;;
15667 esac
15668
15669 : see if getservent_r exists
15670 set getservent_r d_getservent_r
15671 eval $inlibc
15672 case "$d_getservent_r" in
15673 "$define")
15674         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15675         case "$d_getservent_r_proto:$usethreads" in
15676         ":define")      d_getservent_r_proto=define
15677                 set d_getservent_r_proto getservent_r $hdrs
15678                 eval $hasproto ;;
15679         *)      ;;
15680         esac
15681         case "$d_getservent_r_proto" in
15682         define)
15683         case "$getservent_r_proto" in
15684         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15685         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15686         esac
15687         case "$getservent_r_proto" in
15688         ''|0) try='int getservent_r(struct servent*, char*, int);'
15689         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15690         esac
15691         case "$getservent_r_proto" in
15692         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15693         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15694         esac
15695         case "$getservent_r_proto" in
15696         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15697         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15698         esac
15699         case "$getservent_r_proto" in
15700         ''|0)   d_getservent_r=undef
15701                 getservent_r_proto=0
15702                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15703         * )     case "$getservent_r_proto" in
15704                 REENTRANT_PROTO*) ;;
15705                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15706                 esac
15707                 echo "Prototype: $try" ;;
15708         esac
15709         ;;
15710         *)      case "$usethreads" in
15711                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15712                 esac
15713                 d_getservent_r=undef
15714                 getservent_r_proto=0
15715                 ;;
15716         esac
15717         ;;
15718 *)      getservent_r_proto=0
15719         ;;
15720 esac
15721
15722 : see if prototypes for various getservxxx netdb.h functions are available
15723 echo " "
15724 set d_getservprotos getservent $i_netdb netdb.h
15725 eval $hasproto
15726
15727 : see if getspnam exists
15728 set getspnam d_getspnam
15729 eval $inlibc
15730
15731 : see if this is a shadow.h system
15732 set shadow.h i_shadow
15733 eval $inhdr
15734
15735 : see if getspnam_r exists
15736 set getspnam_r d_getspnam_r
15737 eval $inlibc
15738 case "$d_getspnam_r" in
15739 "$define")
15740         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15741         case "$d_getspnam_r_proto:$usethreads" in
15742         ":define")      d_getspnam_r_proto=define
15743                 set d_getspnam_r_proto getspnam_r $hdrs
15744                 eval $hasproto ;;
15745         *)      ;;
15746         esac
15747         case "$d_getspnam_r_proto" in
15748         define)
15749         case "$getspnam_r_proto" in
15750         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15751         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15752         esac
15753         case "$getspnam_r_proto" in
15754         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15755         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15756         esac
15757         case "$getspnam_r_proto" in
15758         ''|0)   d_getspnam_r=undef
15759                 getspnam_r_proto=0
15760                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15761         * )     case "$getspnam_r_proto" in
15762                 REENTRANT_PROTO*) ;;
15763                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15764                 esac
15765                 echo "Prototype: $try" ;;
15766         esac
15767         ;;
15768         *)      case "$usethreads" in
15769                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15770                 esac
15771                 d_getspnam_r=undef
15772                 getspnam_r_proto=0
15773                 ;;
15774         esac
15775         ;;
15776 *)      getspnam_r_proto=0
15777         ;;
15778 esac
15779
15780 : see if gettimeofday or ftime exists
15781 set gettimeofday d_gettimeod
15782 eval $inlibc
15783 case "$d_gettimeod" in
15784 "$undef")
15785         set ftime d_ftime 
15786         eval $inlibc
15787         ;;
15788 *)
15789         val="$undef"; set d_ftime; eval $setvar
15790         ;;
15791 esac
15792 case "$d_gettimeod$d_ftime" in
15793 "$undef$undef")
15794         echo " "
15795         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15796         ;;
15797 esac
15798
15799 : see if gmtime_r exists
15800 set gmtime_r d_gmtime_r
15801 eval $inlibc
15802 case "$d_gmtime_r" in
15803 "$define")
15804         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15805         case "$d_gmtime_r_proto:$usethreads" in
15806         ":define")      d_gmtime_r_proto=define
15807                 set d_gmtime_r_proto gmtime_r $hdrs
15808                 eval $hasproto ;;
15809         *)      ;;
15810         esac
15811         case "$d_gmtime_r_proto" in
15812         define)
15813         case "$gmtime_r_proto" in
15814         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15815         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15816         esac
15817         case "$gmtime_r_proto" in
15818         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15819         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15820         esac
15821         case "$gmtime_r_proto" in
15822         ''|0)   d_gmtime_r=undef
15823                 gmtime_r_proto=0
15824                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15825         * )     case "$gmtime_r_proto" in
15826                 REENTRANT_PROTO*) ;;
15827                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15828                 esac
15829                 echo "Prototype: $try" ;;
15830         esac
15831         ;;
15832         *)      case "$usethreads" in
15833                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15834                 esac
15835                 d_gmtime_r=undef
15836                 gmtime_r_proto=0
15837                 ;;
15838         esac
15839         ;;
15840 *)      gmtime_r_proto=0
15841         ;;
15842 esac
15843
15844 : see if hasmntopt exists
15845 set hasmntopt d_hasmntopt
15846 eval $inlibc
15847
15848 : see if this is a netinet/in.h or sys/in.h system
15849 set netinet/in.h i_niin sys/in.h i_sysin
15850 eval $inhdr
15851
15852 : see if arpa/inet.h has to be included
15853 set arpa/inet.h i_arpainet
15854 eval $inhdr
15855
15856 : see if htonl --and friends-- exists
15857 val=''
15858 set htonl val
15859 eval $inlibc
15860
15861 : Maybe they are macros.
15862 case "$val" in
15863 $undef)
15864         $cat >htonl.c <<EOM
15865 #include <stdio.h>
15866 #include <sys/types.h>
15867 #$i_niin I_NETINET_IN
15868 #$i_sysin I_SYS_IN
15869 #$i_arpainet I_ARPA_INET
15870 #ifdef I_NETINET_IN
15871 #include <netinet/in.h>
15872 #endif
15873 #ifdef I_SYS_IN
15874 #include <sys/in.h>
15875 #endif
15876 #ifdef I_ARPA_INET
15877 #include <arpa/inet.h>
15878 #endif
15879 #ifdef htonl
15880 printf("Defined as a macro.");
15881 #endif
15882 EOM
15883         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15884         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15885                 val="$define"
15886                 echo "But it seems to be defined as a macro." >&4
15887         fi
15888         $rm -f htonl.?
15889         ;;
15890 esac
15891 set d_htonl
15892 eval $setvar
15893
15894 : see if hypot exists
15895 set hypot d_hypot
15896 eval $inlibc
15897
15898 : see if ilogb exists
15899 set ilogb d_ilogb
15900 eval $inlibc
15901
15902 : see if ilogbl exists
15903 set ilogbl d_ilogbl
15904 eval $inlibc
15905
15906 : check whether inet_aton exists
15907 set inet_aton d_inetaton
15908 eval $inlibc
15909
15910 : see if inet_ntop exists
15911 set inet_ntop d_inetntop
15912 eval $inlibc
15913
15914 : see if inet_pton exists
15915 set inet_pton d_inetpton
15916 eval $inlibc
15917
15918 : Look for isascii
15919 echo " "
15920 $cat >isascii.c <<EOCP
15921 #include <stdio.h>
15922 #include <ctype.h>
15923 #$i_stdlib I_STDLIB
15924 #ifdef I_STDLIB
15925 #include <stdlib.h>
15926 #endif
15927 int main() {
15928         int c = 'A';
15929         if (isascii(c))
15930                 exit(0);
15931         else
15932                 exit(1);
15933 }
15934 EOCP
15935 set isascii
15936 if eval $compile; then
15937         echo "isascii() found." >&4
15938         val="$define"
15939 else
15940         echo "isascii() NOT found." >&4
15941         val="$undef"
15942 fi
15943 set d_isascii
15944 eval $setvar
15945 $rm -f isascii*
15946
15947 : Look for isblank
15948 echo " "
15949 $cat >isblank.c <<'EOCP'
15950 #include <stdio.h>
15951 #include <ctype.h>
15952 int main() {
15953         int c = ' ';
15954         if (isblank(c))
15955                 return 0 ;
15956         else
15957                 return 1 ;
15958 }
15959 EOCP
15960 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15961         echo "isblank() found." >&4
15962         val="$define"
15963 else
15964         echo "isblank() NOT found." >&4
15965         val="$undef"
15966 fi
15967 set d_isblank
15968 eval $setvar
15969 $rm -f isblank*
15970
15971 : check for isfinite
15972 echo "Checking to see if you have isfinite..." >&4
15973 $cat >try.c <<EOCP
15974 #include <math.h>
15975 int main() { return isfinite(0.0); }
15976 EOCP
15977 set try
15978 if eval $compile; then
15979         val="$define"
15980         echo "You have isfinite."
15981 else
15982         val="$undef"
15983         echo "You do not have isfinite."
15984 fi
15985 $rm_try
15986 set d_isfinite
15987 eval $setvar
15988
15989 : see if isfinitel exists
15990 set isfinitel d_isfinitel
15991 eval $inlibc
15992
15993 : check for isinf
15994 echo "Checking to see if you have isinf..." >&4
15995 $cat >try.c <<EOCP
15996 #include <math.h>
15997 int main() { return isinf(0.0); }
15998 EOCP
15999 set try
16000 if eval $compile; then
16001         val="$define"
16002         echo "You have isinf."
16003 else
16004         val="$undef"
16005         echo "You do not have isinf."
16006 fi
16007 $rm_try
16008 set d_isinf
16009 eval $setvar
16010
16011 : see if isinfl exists
16012 set isinfl d_isinfl
16013 eval $inlibc
16014
16015 : check for isless
16016 echo "Checking to see if you have isless..." >&4
16017 $cat >try.c <<EOCP
16018 #include <math.h>
16019 int main() { return isless(2.0, 1.0); }
16020 EOCP
16021 set try
16022 if eval $compile; then
16023         val="$define"
16024         echo "You have isless."
16025 else
16026         val="$undef"
16027         echo "You do not have isless."
16028 fi
16029 $rm_try
16030 set d_isless
16031 eval $setvar
16032
16033 : check for isnan
16034 echo "Checking to see if you have isnan..." >&4
16035 $cat >try.c <<EOCP
16036 #include <math.h>
16037 int main() { return isnan(0.0); }
16038 EOCP
16039 set try
16040 if eval $compile; then
16041         val="$define"
16042         echo "You have isnan."
16043 else
16044         val="$undef"
16045         echo "You do not have isnan."
16046 fi
16047 $rm_try
16048 set d_isnan
16049 eval $setvar
16050
16051 : see if isnanl exists
16052 set isnanl d_isnanl
16053 eval $inlibc
16054
16055 : check for isnormal
16056 echo "Checking to see if you have isnormal..." >&4
16057 $cat >try.c <<EOCP
16058 #include <math.h>
16059 int main() { return isnormal(0.0); }
16060 EOCP
16061 set try
16062 if eval $compile; then
16063         val="$define"
16064         echo "You have isnormal."
16065 else
16066         val="$undef"
16067         echo "You do not have isnormal."
16068 fi
16069 $rm_try
16070 set d_isnormal
16071 eval $setvar
16072
16073 : see if j0 exists
16074 set j0 d_j0
16075 eval $inlibc
16076
16077 : see if j0l exists
16078 set j0l d_j0l
16079 eval $inlibc
16080
16081 : see if killpg exists
16082 set killpg d_killpg
16083 eval $inlibc
16084
16085 : see if localeconv exists
16086 set localeconv d_locconv
16087 eval $inlibc
16088
16089 : see if libc has the POSIX.1-2008 currency locale rules
16090 case "$d_locconv:$d_lc_monetary_2008" in
16091 $define:)
16092         $cat >try.c <<EOCP
16093 #include <locale.h>
16094 int main() {
16095         struct lconv *lc = localeconv();
16096         char int_p_cs_precedes = lc->int_p_cs_precedes;
16097         return 0;
16098 }
16099 EOCP
16100         set try
16101         if eval $compile; then
16102                 d_lc_monetary_2008="$define"
16103         else
16104                 d_lc_monetary_2008="$undef"
16105         fi;
16106         $rm_try
16107         ;;
16108 *)      d_lc_monetary_2008="$undef"
16109         ;;
16110 esac
16111
16112 : see if lchown exists
16113 echo " "
16114 $cat > try.c <<EOCP
16115 #include <pwd.h>
16116 #include <stdio.h>
16117 #include <stdlib.h>
16118 #$i_unistd      I_UNISTD
16119 #ifdef I_UNISTD
16120 #  include <unistd.h>
16121 #endif
16122 int main(int argc, char *argv[])
16123 {
16124    if (lchown("./try.c", -1, getgid()) == -1) {
16125        exit(EXIT_FAILURE);
16126    }
16127    exit(EXIT_SUCCESS);
16128 }
16129 EOCP
16130 set try
16131 if eval $compile && ./try; then
16132     $echo "lchown() found." >&4
16133     val="$define"
16134 else
16135     $echo "lchown() NOT found." >&4
16136     val="$undef"
16137 fi
16138 set d_lchown
16139 eval $setvar
16140 $rm_try
16141
16142 : See if number of significant digits in a double precision number is known
16143 echo " "
16144 $cat >ldbl_dig.c <<EOM
16145 #include <limits.h>
16146 #include <float.h>
16147 #ifdef LDBL_DIG
16148 printf("Contains LDBL_DIG");
16149 #endif
16150 EOM
16151 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16152 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16153         echo "LDBL_DIG found." >&4
16154         val="$define"
16155 else
16156         echo "LDBL_DIG NOT found." >&4
16157         val="$undef"
16158 fi
16159 $rm -f ldbl_dig.?
16160 set d_ldbl_dig
16161 eval $setvar
16162
16163 : see if lgamma exists
16164 set lgamma d_lgamma
16165 eval $inlibc
16166
16167 : see if lgamma_r exists
16168 set lgamma_r d_lgamma_r
16169 eval $inlibc
16170
16171 : check to see if math.h defines _LIB_VERSION
16172 d_libm_lib_version="$undef"
16173 echo " "
16174 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16175 $cat >try.c <<EOCP
16176 #include <unistd.h>
16177 #include <math.h>
16178 #include <stdio.h>
16179 int main (int argc, char *argv[])
16180 {
16181     printf ("%d\n", _LIB_VERSION);
16182     return (0);
16183     } /* main */
16184 EOCP
16185 set try
16186 if eval $compile; then
16187     foo=`$run ./try`
16188     echo "Yes, it does ($foo)" >&4
16189     d_libm_lib_version="$define"
16190 else
16191     echo "No, it does not (probably harmless)" >&4
16192     fi
16193 $rm_try
16194
16195 : see if link exists
16196 set link d_link
16197 eval $inlibc
16198
16199 : see if llrint exists
16200 set llrint d_llrint
16201 eval $inlibc
16202
16203 : see if llrintl exists
16204 set llrintl d_llrintl
16205 eval $inlibc
16206
16207 : see if llround exists
16208 set llround d_llround
16209 eval $inlibc
16210
16211 : see if llroundl exists
16212 set llroundl d_llroundl
16213 eval $inlibc
16214
16215 : see if malloc/malloc.h has to be included
16216 set malloc/malloc.h i_mallocmalloc
16217 eval $inhdr
16218
16219 : see if this is a malloc.h system
16220 : we want a real compile instead of Inhdr because some systems have a
16221 : malloc.h that just gives a compile error saying to use stdlib.h instead
16222 echo " "
16223 $cat >try.c <<EOCP
16224 #include <stdlib.h>
16225 #include <malloc.h>
16226 #$i_mallocmalloc I_MALLOCMALLOC
16227 #ifdef I_MALLOCMALLOC
16228 # include <malloc/malloc.h>
16229 #endif
16230
16231 int main () { return 0; }
16232 EOCP
16233 set try
16234 if eval $compile; then
16235     echo "<malloc.h> found." >&4
16236     val="$define"
16237 else
16238     echo "<malloc.h> NOT found." >&4
16239     val="$undef"
16240 fi
16241 $rm_try
16242 set i_malloc
16243 eval $setvar
16244
16245 : see if localtime_r exists
16246 set localtime_r d_localtime_r
16247 eval $inlibc
16248 case "$d_localtime_r" in
16249 "$define")
16250         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16251         case "$d_localtime_r_proto:$usethreads" in
16252         ":define")      d_localtime_r_proto=define
16253                 set d_localtime_r_proto localtime_r $hdrs
16254                 eval $hasproto ;;
16255         *)      ;;
16256         esac
16257         case "$d_localtime_r_proto" in
16258         define)
16259         case "$localtime_r_proto" in
16260         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16261         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16262         esac
16263         case "$localtime_r_proto" in
16264         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16265         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16266         esac
16267         case "$localtime_r_proto" in
16268         ''|0)   d_localtime_r=undef
16269                 localtime_r_proto=0
16270                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16271         * )     case "$localtime_r_proto" in
16272                 REENTRANT_PROTO*) ;;
16273                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16274                 esac
16275                 echo "Prototype: $try" ;;
16276         esac
16277         ;;
16278         *)      case "$usethreads" in
16279                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16280                 esac
16281                 d_localtime_r=undef
16282                 localtime_r_proto=0
16283                 ;;
16284         esac
16285         ;;
16286 *)      localtime_r_proto=0
16287         ;;
16288 esac
16289
16290 : see if localtime_r calls tzset
16291 case "$localtime_r_proto" in
16292 REENTRANT_PROTO*)
16293         $cat >try.c <<EOCP
16294 /*  Does our libc's localtime_r call tzset ?
16295  *  return 0 if so, 1 otherwise.
16296  */
16297 #$i_systypes    I_SYS_TYPES
16298 #$i_unistd      I_UNISTD
16299 #$i_time        I_TIME
16300 #$i_stdlib      I_STDLIB
16301 #$i_malloc      I_MALLOC
16302 #ifdef I_SYS_TYPES
16303 #  include <sys/types.h>
16304 #endif
16305 #ifdef I_UNISTD
16306 #  include <unistd.h>
16307 #endif
16308 #ifdef I_TIME
16309 #  include <time.h>
16310 #endif
16311 #ifdef I_STDLIB
16312 #include <stdlib.h>
16313 #endif
16314 #include <string.h>
16315 #ifdef I_MALLOC
16316 #  include <malloc.h>
16317 #endif
16318 int main()
16319 {
16320     int result = 0;
16321     time_t t = time(0L);
16322     char w_tz[]="TZ" "=GMT+5",
16323          e_tz[]="TZ" "=GMT-5",
16324         *tz_e = (char*)malloc(16),
16325         *tz_w = (char*)malloc(16);
16326     struct tm tm_e, tm_w;
16327     memset(&tm_e,'\0',sizeof(struct tm));
16328     memset(&tm_w,'\0',sizeof(struct tm));
16329     strcpy(tz_e,e_tz);
16330     strcpy(tz_w,w_tz);
16331
16332     putenv(tz_e);
16333     localtime_r(&t, &tm_e);
16334
16335     putenv(tz_w);
16336     localtime_r(&t, &tm_w);
16337
16338     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16339         result = 1;
16340
16341     free(tz_e);free(tz_w);
16342     return result;
16343 }
16344 EOCP
16345         set try
16346         if eval $compile; then
16347             if $run ./try; then
16348                 d_localtime_r_needs_tzset=undef;
16349             else
16350                 d_localtime_r_needs_tzset=define;
16351             fi;
16352         else
16353             d_localtime_r_needs_tzset=undef;
16354         fi;
16355      ;;
16356   *)
16357      d_localtime_r_needs_tzset=undef;
16358      ;;
16359 esac
16360 $rm_try
16361
16362 : see if lockf exists
16363 set lockf d_lockf
16364 eval $inlibc
16365
16366 : see if log1p exists
16367 set log1p d_log1p
16368 eval $inlibc
16369
16370 : see if log2 exists
16371 set log2 d_log2
16372 eval $inlibc
16373
16374 : see if logb exists
16375 set logb d_logb
16376 eval $inlibc
16377
16378 : see if lrint exists
16379 set lrint d_lrint
16380 eval $inlibc
16381
16382 : see if lrintl exists
16383 set lrintl d_lrintl
16384 eval $inlibc
16385
16386 : see if lround exists
16387 set lround d_lround
16388 eval $inlibc
16389
16390 : see if lroundl exists
16391 set lroundl d_lroundl
16392 eval $inlibc
16393
16394 : see if prototype for lseek is available
16395 echo " "
16396 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16397 eval $hasproto
16398
16399 : see if lstat exists
16400 set lstat d_lstat
16401 eval $inlibc
16402
16403 : see if madvise exists
16404 set madvise d_madvise
16405 eval $inlibc
16406
16407 : see if malloc_size exists
16408 set malloc_size d_malloc_size
16409 eval $inlibc
16410
16411 : see if malloc_size_good exists
16412 set malloc_good_size d_malloc_good_size
16413 eval $inlibc
16414
16415 : see if malloc_usable_size exists
16416 set malloc_usable_size d_malloc_usable_size
16417 eval $inlibc
16418
16419 : see if mblen exists
16420 set mblen d_mblen
16421 eval $inlibc
16422
16423 : see if mbrlen exists
16424 set mbrlen d_mbrlen
16425 eval $inlibc
16426
16427 : see if mbrtowc exists
16428 set mbrtowc d_mbrtowc
16429 eval $inlibc
16430
16431 : see if mbstowcs exists
16432 set mbstowcs d_mbstowcs
16433 eval $inlibc
16434
16435 : see if mbtowc exists
16436 set mbtowc d_mbtowc
16437 eval $inlibc
16438
16439 : see if memmem exists
16440 : We need both a prototype in string.h and the symbol in libc.
16441 echo " "
16442 d_memmem_proto=''
16443 xx1="#$d_gnulibc HAS_GNULIBC"
16444 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16445 xx3='#   define _GNU_SOURCE'
16446 xx4='#endif'
16447 set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16448 eval $hasproto
16449 case "$d_memmem_proto" in
16450     define) # see if memmem exists
16451         set memmem d_memmem
16452         eval $inlibc
16453         ;;
16454     *)  val=$undef
16455         set d_memmem
16456         eval $setvar
16457         ;;
16458 esac
16459
16460 : see if memrchr exists
16461 : We need both a prototype in string.h and the symbol in libc.
16462 echo " "
16463 d_memrchr_proto=''
16464 xx1="#$d_gnulibc HAS_GNULIBC"
16465 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16466 xx3='#   define _GNU_SOURCE'
16467 xx4='#endif'
16468 set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16469 eval $hasproto
16470 case "$d_memrchr_proto" in
16471     define) # see if memrchr exists
16472         set memrchr d_memrchr
16473         eval $inlibc
16474         ;;
16475     *)  val=$undef
16476         set d_memrchr
16477         eval $setvar
16478         ;;
16479 esac
16480
16481 : see if mkdir exists
16482 set mkdir d_mkdir
16483 eval $inlibc
16484
16485 : see if mkdtemp exists
16486 set mkdtemp d_mkdtemp
16487 eval $inlibc
16488
16489 : see if mkfifo exists
16490 set mkfifo d_mkfifo
16491 eval $inlibc
16492
16493 : see if mkostemp exists
16494 set mkostemp d_mkostemp
16495 eval $inlibc
16496
16497 : see if mkstemp exists
16498 set mkstemp d_mkstemp
16499 eval $inlibc
16500
16501 : see if mkstemps exists
16502 set mkstemps d_mkstemps
16503 eval $inlibc
16504
16505 : see if mktime exists
16506 set mktime d_mktime
16507 eval $inlibc
16508
16509 : see if sys/mman.h has to be included
16510 set sys/mman.h i_sysmman
16511 eval $inhdr
16512
16513 : see if mmap exists
16514 set mmap d_mmap
16515 eval $inlibc
16516 : see what shmat returns
16517 : default to something harmless
16518 mmaptype='void *'
16519 case "$i_sysmman$d_mmap" in
16520 "$define$define")
16521         $cat >mmap.c <<'END'
16522 #include <sys/mman.h>
16523 void *mmap();
16524 END
16525         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16526                 mmaptype='void *'
16527         else
16528                 mmaptype='caddr_t'
16529         fi
16530         echo "and it returns ($mmaptype)." >&4
16531         ;;
16532 esac
16533
16534 : see if sqrtl exists
16535 set sqrtl d_sqrtl
16536 eval $inlibc
16537
16538 : see if scalbnl exists
16539 set scalbnl d_scalbnl
16540 eval $inlibc
16541
16542 : see if truncl exists
16543 set truncl d_truncl
16544 eval $inlibc
16545
16546 : see if modfl exists
16547 set modfl d_modfl
16548 eval $inlibc
16549
16550 : see if prototype for modfl is available
16551 echo " "
16552 set d_modflproto modfl define math.h
16553 eval $hasproto
16554
16555 if $test "$uselongdouble" = "$define"; then
16556     message=""
16557     if $test "$d_sqrtl" != "$define"; then
16558         message="$message sqrtl"
16559     fi
16560     if $test "$d_modfl" != "$define"; then
16561         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16562             echo "You have both truncl and copysignl, so I can emulate modfl."
16563         else
16564             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16565                 echo "You have both aintl and copysignl, so I can emulate modfl."
16566             else
16567                 message="$message modfl"
16568             fi
16569         fi
16570     fi
16571     if $test "$d_frexpl" != "$define"; then
16572         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16573             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16574         else
16575             message="$message frexpl"
16576         fi
16577     fi
16578     if $test "$d_ldexpl" != "$define"; then
16579         message="$message ldexpl"
16580     fi
16581
16582     if $test "$message" != ""; then
16583         $cat <<EOM >&4
16584
16585 *** You requested the use of long doubles but you do not seem to have
16586 *** the following mathematical functions needed for long double support:
16587 ***    $message
16588 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16589 *** Cannot continue, aborting.
16590
16591 EOM
16592
16593         exit 1
16594     fi
16595 fi
16596
16597 : see if mprotect exists
16598 set mprotect d_mprotect
16599 eval $inlibc
16600
16601 : see if msgctl exists
16602 set msgctl d_msgctl
16603 eval $inlibc
16604
16605 : see if msgget exists
16606 set msgget d_msgget
16607 eval $inlibc
16608
16609 : see if msgsnd exists
16610 set msgsnd d_msgsnd
16611 eval $inlibc
16612
16613 : see if msgrcv exists
16614 set msgrcv d_msgrcv
16615 eval $inlibc
16616
16617 : see how much of the 'msg*(2)' library is present.
16618 h_msg=true
16619 echo " "
16620 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16621 *"$undef"*) h_msg=false;;
16622 esac
16623 case "$osname" in
16624 freebsd)
16625     case "`ipcs 2>&1`" in
16626     "SVID messages"*"not configured"*)
16627         echo "Your $osname does not have the msg*(2) configured." >&4
16628         h_msg=false
16629         val="$undef"
16630         set msgctl d_msgctl
16631         eval $setvar
16632         set msgget d_msgget
16633         eval $setvar
16634         set msgsnd d_msgsnd
16635         eval $setvar
16636         set msgrcv d_msgrcv
16637         eval $setvar
16638         ;;
16639     esac
16640     ;;
16641 esac
16642 : we could also check for sys/ipc.h ...
16643 if $h_msg && $test `./findhdr sys/msg.h`; then
16644         echo "You have the full msg*(2) library." >&4
16645         val="$define"
16646 else
16647         echo "You don't have the full msg*(2) library." >&4
16648         val="$undef"
16649 fi
16650 set d_msg
16651 eval $setvar
16652
16653 : Check for msghdr_s
16654 echo " "
16655 echo "Checking to see if your system supports struct msghdr..." >&4
16656 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16657 eval $hasstruct
16658 case "$d_msghdr_s" in
16659 "$define")      echo "Yes, it does."   ;;
16660 *)              echo "No, it doesn't." ;;
16661 esac
16662
16663 : see if msync exists
16664 set msync d_msync
16665 eval $inlibc
16666
16667 : see if munmap exists
16668 set munmap d_munmap
16669 eval $inlibc
16670
16671 : see if nan exists
16672 set nan d_nan
16673 eval $inlibc
16674
16675 : see if nanosleep exists
16676 set nanosleep d_nanosleep
16677 eval $inlibc
16678
16679 : see if nearbyint exists
16680 set nearbyint d_nearbyint
16681 eval $inlibc
16682
16683 : see if nextafter exists
16684 set nextafter d_nextafter
16685 eval $inlibc
16686
16687 : see if nexttoward exists
16688 set nexttoward d_nexttoward
16689 eval $inlibc
16690
16691 : see if nice exists
16692 set nice d_nice
16693 eval $inlibc
16694
16695 : see if this is a langinfo.h system
16696 set langinfo.h i_langinfo
16697 eval $inhdr
16698
16699 : see if nl_langinfo and/or nl_langinfo_l exist
16700 set nl_langinfo d_nl_langinfo
16701 eval $inlibc
16702 set nl_langinfo_l d_nl_langinfo_l
16703 eval $inlibc
16704
16705 : Look for non 'int'-sized bitfields
16706 case "$d_non_int_bitfields" in
16707 '')
16708 echo " " >&4
16709 echo "Checking whether your compiler can handle struct bitfields that aren't 'int' or 'unsigned int' ..." >&4
16710 $cat >try.c <<'EOCP'
16711 #include <stdio.h>
16712 struct foo {
16713     unsigned char byte:1;
16714     unsigned short halfword:1;
16715 } bar;
16716 EOCP
16717 if $cc $ccflags -c try.c >try.out 2>&1 ; then
16718         if $compiler_warning try.out >/dev/null 2>&1; then
16719                 echo "Your C compiler doesn't support struct bitfields that aren't 'int' or 'unsigned int'." >&4
16720                 val="$undef"
16721         else
16722                 echo "Your C compiler supports struct bitfields besides 'int' and 'unsigned int'." >&4
16723                 val="$define"
16724         fi
16725 else
16726         echo "Your C compiler doesn't seem to understand struct bitfields that aren't 'int' or 'unsigned int' at all." >&4
16727         val="$undef"
16728 fi
16729 ;;
16730 *) val="$d_non_int_bitfields" ;;
16731 esac
16732 set d_non_int_bitfields
16733 eval $setvar
16734 $rm_try
16735
16736 : see if this is a quadmath.h system
16737 set quadmath.h i_quadmath
16738 eval $inhdr
16739
16740 : Check basic sizes
16741 echo " "
16742 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16743
16744 case "$use64bitint:$d_quad:$quadtype" in
16745 define:define:?*)
16746         ivtype="$quadtype"
16747         uvtype="$uquadtype"
16748         ivsize=8
16749         uvsize=8
16750         ;;
16751 *)      ivtype="long"
16752         uvtype="unsigned long"
16753         ivsize=$longsize
16754         uvsize=$longsize
16755         ;;
16756 esac
16757
16758 case "$uselongdouble:$d_longdbl" in
16759 define:define)
16760         nvtype="long double"
16761         nvsize=$longdblsize
16762         ;;
16763 *)      nvtype=double
16764         nvsize=$doublesize
16765         ;;
16766 esac
16767
16768 case "$usequadmath:$i_quadmath" in
16769 define:define)
16770   nvtype="__float128"
16771   nvsize=16
16772   : libquadmath is not in the usual places, and the place
16773   : changes if the compiler is upgraded.  So ask the compiler if it
16774   : can find it.
16775   : We do not need to save this, if it fails we abort.
16776   libs="$libs -lquadmath"
16777   set try
16778   $cat >try.c <<EOM
16779 #include <quadmath.h>
16780 #include <stdio.h>
16781 int main(int argc, char *argv[]) {
16782   __float128 x = 1.0;
16783   if (fabsq(logq(x)) > 1e-6) {
16784      fputs("quadmath is broken\n", stderr);
16785      return 1;
16786   }
16787   puts("define");
16788   return 0;
16789 }
16790 EOM
16791   yyy=''
16792   if eval $compile_ok; then
16793       yyy=`$run ./try`
16794       case "$yyy" in
16795       define) ;;
16796       *) cat <<EOM >&4
16797
16798 *** You requested the use of the quadmath library, but
16799 *** it appears to be nonfunctional.
16800 *** Cannot continue, aborting.
16801
16802 EOM
16803        exit 1
16804        ;;
16805        esac
16806   else
16807       $cat <<EOM >&4
16808
16809 *** You requested the use of the quadmath library, but you
16810 *** do not seem to have the quadmath library installed.
16811 *** Cannot continue, aborting.
16812 EOM
16813     exit 1
16814   fi
16815   ;;
16816 define:*) $cat <<EOM >&4
16817
16818 *** You requested the use of the quadmath library, but you
16819 *** do not seem to have the required header, <quadmath.h>.
16820 EOM
16821   case "$gccversion" in
16822   [23].*|4.[0-5]*)
16823    $cat <<EOM >&4
16824 *** Your gcc looks a bit old:
16825 *** $gccversion
16826 EOM
16827     ;;
16828   '')
16829    $cat <<EOM >&4
16830 *** You are not running a gcc.
16831 EOM
16832     ;;
16833   esac
16834   $cat <<EOM >&4
16835 *** For the quadmath library you need at least gcc 4.6.
16836 *** Cannot continue, aborting.
16837 EOM
16838   exit 1
16839   ;;
16840 esac
16841
16842 $echo "(IV will be "$ivtype", $ivsize bytes)"
16843 $echo "(UV will be "$uvtype", $uvsize bytes)"
16844 $echo "(NV will be "$nvtype", $nvsize bytes)"
16845
16846 $cat >try.c <<EOCP
16847 #$i_inttypes I_INTTYPES
16848 #ifdef I_INTTYPES
16849 #include <inttypes.h>
16850 #endif
16851 #include <stdio.h>
16852 int main() {
16853 #ifdef INT8
16854    int8_t i =  INT8_MAX;
16855   uint8_t u = UINT8_MAX;
16856   printf("int8_t\n");
16857 #endif
16858 #ifdef INT16
16859    int16_t i =  INT16_MAX;
16860   uint16_t u = UINT16_MAX;
16861   printf("int16_t\n");
16862 #endif
16863 #ifdef INT32
16864    int32_t i =  INT32_MAX;
16865   uint32_t u = UINT32_MAX;
16866   printf("int32_t\n");
16867 #endif
16868 }
16869 EOCP
16870
16871 i8type="signed char"
16872 u8type="unsigned char"
16873 i8size=1
16874 u8size=1
16875
16876 case "$i16type" in
16877 '')     case "$shortsize" in
16878         2)      i16type=short
16879                 u16type="unsigned short"
16880                 i16size=$shortsize
16881                 u16size=$shortsize
16882                 ;;
16883         esac
16884         ;;
16885 esac
16886 case "$i16type" in
16887 '')     set try -DINT16
16888         if eval $compile; then
16889                 case "`$run ./try`" in
16890                 int16_t)
16891                         i16type=int16_t
16892                         u16type=uint16_t
16893                         i16size=2
16894                         u16size=2
16895                         ;;
16896                 esac
16897         fi
16898         ;;
16899 esac
16900 case "$i16type" in
16901 '')     if $test $shortsize -ge 2; then
16902                 i16type=short
16903                 u16type="unsigned short"
16904                 i16size=$shortsize
16905                 u16size=$shortsize
16906         fi
16907         ;;
16908 esac
16909
16910 case "$i32type" in
16911 '')     case "$longsize" in
16912         4)      i32type=long
16913                 u32type="unsigned long"
16914                 i32size=$longsize
16915                 u32size=$longsize
16916                 ;;
16917         *)      case "$intsize" in
16918                 4)      i32type=int
16919                         u32type="unsigned int"
16920                         i32size=$intsize
16921                         u32size=$intsize
16922                         ;;
16923                 esac
16924                 ;;
16925         esac
16926         ;;
16927 esac
16928 case "$i32type" in
16929 '')     set try -DINT32
16930         if eval $compile; then
16931                 case "`$run ./try`" in
16932                 int32_t)
16933                         i32type=int32_t
16934                         u32type=uint32_t
16935                         i32size=4
16936                         u32size=4
16937                         ;;
16938                 esac
16939         fi
16940         ;;
16941 esac
16942 case "$i32type" in
16943 '')     if $test $intsize -ge 4; then
16944                 i32type=int
16945                 u32type="unsigned int"
16946                 i32size=$intsize
16947                 u32size=$intsize
16948         fi
16949         ;;
16950 esac
16951
16952 case "$i64type" in
16953 '')     case "$d_quad:$quadtype" in
16954         define:?*)
16955                 i64type="$quadtype"
16956                 u64type="$uquadtype"
16957                 i64size=8
16958                 u64size=8
16959                 ;;
16960         esac
16961         ;;
16962 esac
16963
16964 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16965 $cat <<EOP >try.c
16966 #include <stdio.h>
16967 #$i_stdlib I_STDLIB
16968 #ifdef I_STDLIB
16969 #include <stdlib.h>
16970 #endif
16971 #$i_inttypes I_INTTYPES
16972 #ifdef I_INTTYPES
16973 #include <inttypes.h>
16974 #endif
16975 #include <sys/types.h>
16976 #include <signal.h>
16977 #ifdef SIGFPE
16978 /* volatile so that the compiler has to store it out to memory */
16979 volatile int bletched = 0;
16980 $signal_t blech(int s) { bletched = 1; }
16981 #endif
16982 int main() {
16983     $uvtype u = 0;
16984     $nvtype d;
16985     int     n = 8 * $uvsize;
16986     int     i;
16987 #ifdef SIGFPE
16988     signal(SIGFPE, blech);
16989 #endif
16990
16991     for (i = 0; i < n; i++) {
16992       u = u << 1 | ($uvtype)1;
16993       d = ($nvtype)u;
16994       if (($uvtype)d != u)
16995         break;
16996       if (d <= 0)
16997         break;
16998       d = ($nvtype)(u - 1);
16999       if (($uvtype)d != (u - 1))
17000         break;
17001 #ifdef SIGFPE
17002       if (bletched)
17003         break;
17004 #endif
17005     }
17006     printf("%d\n", ((i == n) ? -n : i));
17007     exit(0);
17008 }
17009 EOP
17010 set try
17011
17012 d_nv_preserves_uv="$undef"
17013 if eval $compile; then
17014         nv_preserves_uv_bits="`$run ./try`"
17015 fi
17016 case "$nv_preserves_uv_bits" in
17017 \-[1-9]*)
17018         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
17019         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  >&4
17020         d_nv_preserves_uv="$define"
17021         ;;
17022 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  >&4
17023         d_nv_preserves_uv="$undef" ;;
17024 *)      $echo "Can't figure out how many bits your NVs preserve." >&4
17025         nv_preserves_uv_bits="0" ;;
17026 esac
17027 $rm_try
17028
17029 $echo "Checking to find the largest integer value your NVs can hold..." >&4
17030 $cat <<EOP >try.c
17031 #include <stdio.h>
17032
17033 typedef $nvtype NV;
17034
17035 int
17036 main() {
17037   NV value = 2;
17038   int count = 1;
17039
17040   while(count < 256) {
17041     /* volatile so that the compiler has to store it out to memory */
17042     volatile NV up = value + 1.0;
17043     volatile NV negated = -value;
17044     volatile NV down = negated - 1.0;
17045     volatile NV got_up = up - value;
17046     int up_good = got_up == 1.0;
17047     int got_down = down - negated;
17048     int down_good = got_down == -1.0;
17049
17050     if (down_good != up_good) {
17051       fprintf(stderr,
17052               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
17053               up_good, (double) got_up, down_good, (double) got_down,
17054               count, (double) value);
17055       return 1;
17056     }
17057     if (!up_good) {
17058       while (1) {
17059         if (count > 8) {
17060           count -= 8;
17061           fputs("256.0", stdout);
17062         } else {
17063           count--;
17064           fputs("2.0", stdout);
17065         }
17066         if (!count) {
17067           puts("");
17068           return 0;
17069         }
17070         fputs("*", stdout);
17071       }
17072     }
17073     value *= 2;
17074     ++count;
17075   }
17076   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
17077           count, (double) value);
17078   return 1;
17079 }
17080 EOP
17081 set try
17082
17083 nv_overflows_integers_at='0'
17084 if eval $compile; then
17085     xxx="`$run ./try`"
17086     case "$?" in
17087         0)
17088             case "$xxx" in
17089                 2*)  cat >&4 <<EOM
17090 The largest integer your NVs can preserve is equal to $xxx
17091 EOM
17092                     nv_overflows_integers_at="$xxx"
17093                     ;;
17094                 *)  cat >&4 <<EOM
17095 Cannot determine the largest integer value your NVs can hold, unexpected output
17096 '$xxx'
17097 EOM
17098                     ;;
17099             esac
17100             ;;
17101         *)  cat >&4 <<EOM
17102 Cannot determine the largest integer value your NVs can hold
17103 EOM
17104             ;;
17105     esac
17106 fi
17107 $rm_try
17108
17109 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
17110 $cat <<EOP >try.c
17111 #include <stdio.h>
17112 #$i_stdlib I_STDLIB
17113 #ifdef I_STDLIB
17114 #include <stdlib.h>
17115 #endif
17116 #include <string.h>
17117 #include <sys/types.h>
17118 #include <signal.h>
17119 #ifdef SIGFPE
17120 /* volatile so that the compiler has to store it out to memory */
17121 volatile int bletched = 0;
17122 $signal_t blech(int s) { bletched = 1; }
17123 #endif
17124
17125 int checkit($nvtype d, const char *where) {
17126     void *v = &d;
17127     unsigned char *p = (unsigned char *)v;
17128     unsigned char *end = p + sizeof(d);
17129     int fail = 0;
17130
17131     while (p < end)
17132         fail += *p++;
17133
17134     if (!fail)
17135         return 0;
17136
17137     p = (unsigned char *)v;
17138     printf("No - %s: 0x", where);
17139     while (p < end)
17140         printf ("%02X", *p++);
17141     printf("\n");
17142     return 1;
17143 }
17144
17145 int main(int argc, char **argv) {
17146     $nvtype d = 0.0;
17147     int fail = 0;
17148     fail += checkit(d, "0.0");
17149
17150     /* The compiler shouldn't be assuming that bletched is 0  */
17151     d = bletched;
17152
17153     fail += checkit(d, "bleched");
17154
17155 #ifdef SIGFPE
17156     signal(SIGFPE, blech);
17157 #endif
17158
17159     /* Paranoia - the compiler should have no way of knowing that ANSI says
17160        that argv[argc] will always be NULL.  Actually, if it did assume this it
17161        would be buggy, as this is C and main() can be called from elsewhere in
17162        the program.  */
17163     d = argv[argc] ? 1 : 0;
17164
17165     if (d) {
17166         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17167     }
17168
17169     fail += checkit(d, "ternary");
17170
17171     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17172
17173     if (d != 0.0) {
17174         printf("No - memset doesn't give 0.0\n");
17175         /* This might just blow up:  */
17176         printf("(gives %g)\n", d);
17177         return 1;
17178     }
17179
17180 #ifdef SIGFPE
17181     if (bletched) {
17182         printf("No - something bleched\n");
17183         return 1;
17184     }
17185 #endif
17186     if (fail) {
17187       printf("No - %d fail(s)\n", fail);
17188       return 1;
17189     }
17190     printf("Yes\n");
17191     return 0;
17192 }
17193 EOP
17194 set try
17195
17196 d_nv_zero_is_allbits_zero="$undef"
17197 if eval $compile; then
17198     xxx="`$run ./try`"
17199     case "$?" in
17200         0)
17201             case "$xxx" in
17202                 Yes)  cat >&4 <<EOM
17203 0.0 is represented as all bits zero in memory
17204 EOM
17205                     d_nv_zero_is_allbits_zero="$define"
17206                     ;;
17207                 *)  cat >&4 <<EOM
17208 0.0 is not represented as all bits zero in memory
17209 EOM
17210                     d_nv_zero_is_allbits_zero="$undef"
17211                     ;;
17212             esac
17213             ;;
17214         *)  cat >&4 <<EOM
17215 0.0 is not represented as all bits zero in memory
17216 EOM
17217             d_nv_zero_is_allbits_zero="$undef"
17218             ;;
17219     esac
17220 fi
17221 $rm_try
17222
17223 : check for off64_t
17224 echo " "
17225 echo "Checking to see if you have off64_t..." >&4
17226 $cat >try.c <<EOCP
17227 #include <sys/types.h>
17228 #include <unistd.h>
17229 int main() { off64_t x = 7; }
17230 EOCP
17231 set try
17232 if eval $compile; then
17233         val="$define"
17234         echo "You have off64_t."
17235 else
17236         val="$undef"
17237         echo "You do not have off64_t."
17238         case "$lseeksize" in
17239         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17240         esac
17241 fi
17242 $rm_try
17243 set d_off64_t
17244 eval $setvar
17245
17246 : how to create joinable pthreads
17247 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17248         echo " "
17249         echo "Checking what constant to use for creating joinable pthreads..." >&4
17250         $cat >try.c <<'EOCP'
17251 #include <pthread.h>
17252 int main() {
17253     int detachstate = JOINABLE;
17254 }
17255 EOCP
17256         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17257         if eval $compile; then
17258                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17259                 val="$undef" # Yes, undef.
17260                 set d_old_pthread_create_joinable
17261                 eval $setvar
17262                 val=""
17263                 set old_pthread_create_joinable
17264                 eval $setvar
17265         else
17266                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17267                 if eval $compile; then
17268                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17269                         val="$define"
17270                         set d_old_pthread_create_joinable
17271                         eval $setvar
17272                         val=PTHREAD_CREATE_UNDETACHED
17273                         set old_pthread_create_joinable
17274                         eval $setvar
17275                 else
17276                         set try -DJOINABLE=__UNDETACHED
17277                         if eval $compile; then
17278                                 echo "You seem to use __UNDETACHED." >&4
17279                                 val="$define"
17280                                 set d_old_pthread_create_joinable
17281                                 eval $setvar
17282                                 val=__UNDETACHED
17283                                 set old_pthread_create_joinable
17284                                 eval $setvar
17285                         else
17286                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17287                                 val="$define"
17288                                 set d_old_pthread_create_joinable
17289                                 eval $setvar
17290                                 val=0
17291                                 set old_pthread_create_joinable
17292                                 eval $setvar
17293                         fi
17294                 fi
17295         fi
17296         $rm_try
17297 else
17298     d_old_pthread_create_joinable="$undef"
17299     old_pthread_create_joinable=""
17300 fi
17301
17302 : see if pause exists
17303 set pause d_pause
17304 eval $inlibc
17305
17306 : see if locale.h is available
17307 set locale.h i_locale
17308 eval $inhdr
17309
17310 : see if this system has wctype.h
17311 set wctype.h i_wctype
17312 eval $inhdr
17313
17314 : see if towupper exists
17315 set towupper d_towupper
17316 eval $inlibc
17317
17318 : check for setlocale function and behavior
17319 case "$d_setlocale" in
17320 '')
17321 $cat >&4 <<EOM
17322
17323 Checking to see if you have setlocale() and its behavior
17324 EOM
17325 $cat >try.c <<EOCP
17326 #include <stdlib.h>
17327 #include <string.h>
17328 #$i_locale I_LOCALE
17329 #ifdef I_LOCALE
17330 #  include <locale.h>
17331 #endif
17332 #$i_wctype I_WCTYPE
17333 #ifdef I_WCTYPE
17334 #  include <wctype.h>
17335 #endif
17336
17337 int main() {
17338     const char * invalid_name = "\a";   /* This is really invalid! */
17339     int accepts_any_locale_name = 0;
17340     int has_C_UTF8 = 0;
17341     unsigned char bad_setlocale = 255;
17342
17343     /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17344      * disabled.  It's hard to imagine an instance where meaningful locale
17345      * handling could be done without LC_CTYPE */
17346     const char *  name = setlocale(LC_CTYPE, "C");
17347
17348     if (name == NULL || strcmp(name, "C") != 0) {
17349         exit(bad_setlocale);
17350     }
17351
17352     name = setlocale(LC_CTYPE, invalid_name);
17353     if (name != NULL) {
17354
17355         /* Let it pass if it accepts the name but gives back one of the C
17356          * locales */
17357         if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17358             accepts_any_locale_name = 1;
17359         }
17360     }
17361
17362     name = setlocale(LC_CTYPE, "C.UTF-8");
17363     if (name != NULL) {
17364         unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17365
17366 #$d_towupper HAS_TOWUPPER
17367 #ifdef HAS_TOWUPPER
17368
17369         /* We assume that if the machine doesn't have the C99 towupper, it
17370          * doesn't have C.UTF-8, even if we successfully changed locales to
17371          * include it.  This seems safer even on platforms that didn't accept
17372          * the really invalid name */
17373
17374         if (towupper(y_with_diaeresis) == 0x178) {
17375             has_C_UTF8 = 1;
17376         }
17377
17378 #endif
17379
17380     }
17381
17382     exit( 0 /* (separator - min_separator) << 3
17383         | uses_name_value_pair_names      << 2
17384           */
17385         | has_C_UTF8                      << 1
17386         | accepts_any_locale_name);
17387
17388 }
17389 EOCP
17390 val=
17391 set d_setlocale
17392 eval $setvar
17393 case $d_setlocale in
17394     $undef) d_setlocale_accepts_any_locale_name="$undef"
17395             d_has_C_UTF8="false"
17396             ;;
17397     *) set try
17398        if eval $compile; then
17399            echo "Your system has setlocale()..." >&4
17400            $run ./try
17401            case $? in
17402                0) echo "and it seems sane; you don't have a C.UTF-8 locale" >&4
17403                   d_setlocale="$define"
17404                   d_setlocale_accepts_any_locale_name="$undef"
17405                   d_has_C_UTF8="false"
17406                   ;;
17407                1) echo "and it seems sane, but accepts any locale name as valid" >&4
17408                   d_setlocale="$define"
17409                   d_setlocale_accepts_any_locale_name="$define"
17410                   d_has_C_UTF8="false"
17411                   ;;
17412                2) echo "and it seems sane; you have a C.UTF-8 locale" >&4
17413                   d_setlocale="$define"
17414                   d_setlocale_accepts_any_locale_name="$undef"
17415                   d_has_C_UTF8="true"
17416                   ;;
17417                3) echo "and it seems sane, but accepts any locale name as valid" >&4
17418                   d_setlocale="$define"
17419                   d_setlocale_accepts_any_locale_name="$define"
17420                   d_has_C_UTF8="true"
17421                   ;;
17422                *) echo "but it doesn't seem to work, so we won't use it." >&4
17423                   d_setlocale="$undef"
17424                   d_setlocale_accepts_any_locale_name="$undef"
17425                   d_has_C_UTF8="false"
17426                   ;;
17427            esac
17428        else
17429            echo "your system does not have setlocale()" >&4
17430            d_setlocale="$undef"
17431            d_setlocale_accepts_any_locale_name="$undef"
17432            d_has_C_UTF8="false"
17433        fi
17434 esac
17435 $rm_try
17436 ;;
17437 *) val="$d_setlocale"
17438     set d_setlocale
17439     eval $setvar
17440     case "$d_setlocale" in
17441         $undef) echo "There may be other ways to set the locale on your system, so we need to ask:" >&4
17442         ;;
17443     esac
17444     rp="Does your system have the C.UTF-8 locale?"
17445     dflt=n
17446     . ./myread
17447     case "$ans" in
17448         [Yy]*) d_has_C_UTF8="true"
17449                c_utf8_locale=" or C.UTF-8"
17450                ;;
17451         *)     d_has_C_UTF8="false"
17452                c_utf8_locale=""
17453                ;;
17454     esac
17455     case "$d_setlocale" in
17456         $define)
17457             rp="When you set your locale to something besides C$c_utf8_locale, does it actually do so? (Answer no if it just pretends to set it)" >&4
17458             dflt=n
17459             . ./myread
17460             case "$ans" in
17461                 true|[Yy]*)
17462                    d_setlocale_accepts_any_locale_name="$define"
17463                    ;;
17464                 *) d_setlocale_accepts_any_locale_name="$undef"
17465                    ;;
17466             esac
17467             ;;
17468         *) d_setlocale_accepts_any_locale_name="$undef"
17469            ;;
17470     esac
17471 esac
17472
17473 : Check the syntax of LC_ALL when categories are set to different locales
17474 echo " "
17475 $echo "Checking the syntax of LC_ALL when categories are set to different locales..." >&4
17476
17477 case $d_setlocale in
17478     $define)
17479 $rm -f try try.*
17480 $cat >try.c <<'EOF'
17481 #include <limits.h>
17482 #include <locale.h>
17483 #include <stdlib.h>
17484 #include <string.h>
17485 #include <stdio.h>
17486
17487 #ifndef LC_ALL
17488
17489 int
17490 main (const int argc, const char ** argv)
17491 {
17492 }
17493
17494 #else
17495 #  define C_ARRAY_LENGTH(a)  (sizeof(a)/sizeof((a)[0]))
17496 #  define strEQ(s1,s2) (strcmp(s1,s2) == 0)
17497 #  define strNE(s1,s2) (strcmp(s1,s2) != 0)
17498 #  define Copy(s,d,n,t) (void)memcpy((char*)(d),(const char*)(s), (n) * sizeof(t))
17499 #  define memEQ(s1,s2,l) (memcmp(((const void *) (s1)), ((const void *) (s2)), l) == 0)
17500 #  define memNE(s1,s2,l) (! memEQ(s1,s2,l))
17501
17502 int
17503 main (const int argc, const char ** argv)
17504 {
17505
17506     int debug = 0;
17507
17508     /* All categories Perl knows about on any system.  If any are missing, this
17509      * won't work for that system, and they must be added here and in perl.h,
17510      * locale.c */
17511     const int categories[] = {
17512
17513 #  ifdef LC_CTYPE
17514         LC_CTYPE,
17515 #  endif
17516 #  ifdef LC_NUMERIC
17517         LC_NUMERIC,
17518 #  endif
17519 #  ifdef LC_COLLATE
17520         LC_COLLATE,
17521 #  endif
17522 #  ifdef LC_TIME
17523         LC_TIME,
17524 #  endif
17525 #  ifdef LC_MESSAGES
17526         LC_MESSAGES,
17527 #  endif
17528 #  ifdef LC_MONETARY
17529         LC_MONETARY,
17530 #  endif
17531 #  ifdef LC_ADDRESS
17532         LC_ADDRESS,
17533 #  endif
17534 #  ifdef LC_IDENTIFICATION
17535         LC_IDENTIFICATION,
17536 #  endif
17537 #  ifdef LC_MEASUREMENT
17538         LC_MEASUREMENT,
17539 #  endif
17540 #  ifdef LC_PAPER
17541         LC_PAPER,
17542 #  endif
17543 #  ifdef LC_TELEPHONE
17544         LC_TELEPHONE,
17545 #  endif
17546 #  ifdef LC_NAME
17547         LC_NAME,
17548 #  endif
17549 #  ifdef LC_SYNTAX
17550         LC_SYNTAX,
17551 #  endif
17552 #  ifdef LC_TOD
17553         LC_TOD
17554 #  endif
17555
17556     };
17557
17558     const char * category_names[] = {
17559
17560 #  ifdef LC_CTYPE
17561         "LC_CTYPE",
17562 #  endif
17563 #  ifdef LC_NUMERIC
17564         "LC_NUMERIC",
17565 #  endif
17566 #  ifdef LC_COLLATE
17567         "LC_COLLATE",
17568 #  endif
17569 #  ifdef LC_TIME
17570         "LC_TIME",
17571 #  endif
17572 #  ifdef LC_MESSAGES
17573         "LC_MESSAGES",
17574 #  endif
17575 #  ifdef LC_MONETARY
17576         "LC_MONETARY",
17577 #  endif
17578 #  ifdef LC_ADDRESS
17579         "LC_ADDRESS",
17580 #  endif
17581 #  ifdef LC_IDENTIFICATION
17582         "LC_IDENTIFICATION",
17583 #  endif
17584 #  ifdef LC_MEASUREMENT
17585         "LC_MEASUREMENT",
17586 #  endif
17587 #  ifdef LC_PAPER
17588         "LC_PAPER",
17589 #  endif
17590 #  ifdef LC_TELEPHONE
17591         "LC_TELEPHONE",
17592 #  endif
17593 #  ifdef LC_NAME
17594         "LC_NAME",
17595 #  endif
17596 #  ifdef LC_SYNTAX
17597         "LC_SYNTAX",
17598 #  endif
17599 #  ifdef LC_TOD
17600         "LC_TOD"
17601 #  endif
17602
17603     };
17604
17605     char alternate[1024] = { '\0' } ;
17606
17607     /* This is a list of locales that are likely to be found on any machine
17608      * (Windows and non-Windows) */
17609     const char * candidates[] = {
17610                                   "POSIX",
17611                                   "C.UTF-8",
17612                                   "en_US",
17613                                   "en_US.UTF-8",
17614                                   "American",
17615                                   "English"
17616                                 };
17617     char separator[1024];
17618     size_t separator_len = 0;
17619     unsigned int distincts_count = 0;
17620
17621     /* We look through the candidates for one which returns the same non-C
17622      * locale for every category */
17623     for (unsigned int i = 0; i < C_ARRAY_LENGTH(candidates); i++) {
17624         const char * candidate = candidates[i];
17625         distincts_count = 0;
17626         alternate[0] = '\0';
17627
17628         for (unsigned int j = 0; j < C_ARRAY_LENGTH(categories); j++) {
17629             const int category = categories[j];
17630             const char * locale_name = setlocale(category, candidate);
17631
17632             if (locale_name == NULL) {  /* Not on this system */
17633                 break;
17634             }
17635
17636             if (debug) fprintf(stderr,
17637                                "i=%d,j=%d;"
17638                                " Return of setlocale(%d=%s, '%s') is '%s'\n",
17639                                i, j,
17640                                category, category_names[j],
17641                                candidate, locale_name);
17642
17643             /* If the candidate is indistinguishable from C, break to try the
17644              * next candidate */
17645             if (strEQ(locale_name, "C")) {
17646                 break;
17647             }
17648
17649             /* Save the name the first time through, and on subsequent ones */
17650             /* make sure the name is the same as before, so the code below can
17651              * be assured of finding it when searching */
17652             if (j == 0) {
17653                 strncpy(alternate, locale_name, sizeof(alternate));
17654             }
17655             else if (strNE(alternate, locale_name)) {
17656                 break;
17657             }
17658
17659             distincts_count++;
17660         }
17661
17662         /* Done with this candidate.  If every category returned the same non-C
17663          * name, this candidate works.  It not, loop to try the next candidate
17664          * */
17665         if (distincts_count == C_ARRAY_LENGTH(categories)) {
17666             break;
17667         }
17668     }
17669
17670     /* Here, either found a suitable candidate, or exhausted the possibilities.
17671      * In the latter case, give up */
17672     if (distincts_count < C_ARRAY_LENGTH(categories)) {
17673         fprintf(stderr, "Couldn't find a locale distinguishable from C\n");
17674         return 1;
17675     }
17676
17677     /* An example syntax, from cygwin, is:
17678      *     LC_COLLATE/LC_CTYPE/LC_MONETARY/LC_NUMERIC/LC_TIME/LC_MESSAGES
17679      * The locales for a given category are always in the same position,
17680      * indicated above, with a slash separating them */
17681
17682     int map_LC_ALL_position_to_category[C_ARRAY_LENGTH(categories)];
17683
17684     /* Initialize */
17685     for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories); i++) {
17686         map_LC_ALL_position_to_category[i] = INT_MAX;
17687     }
17688
17689     const char * lc_all = NULL;
17690
17691     /* We need to find the category that goes in each position */
17692     for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories); i++) {
17693
17694         /* First set everything to 'C' */
17695         if (! setlocale(LC_ALL, "C")) {
17696             fprintf(stderr, "Failed to set LC_ALL to C\n");
17697             return 1;
17698         }
17699
17700         /* Then set this category to the alternate */
17701         if (! setlocale(categories[i], alternate)) {
17702             fprintf(stderr, "Failed to set %d to to '%s'\n",
17703                             categories[i], alternate);
17704             return 1;
17705         }
17706
17707         /* Then find what the system says LC_ALL looks like with just this one
17708          * category not set to 'C' */
17709         lc_all = setlocale(LC_ALL, NULL);
17710         if (! lc_all) {
17711             fprintf(stderr, "Failed to retrieve LC_ALL\n");
17712             return 1;
17713         }
17714
17715         if (debug) fprintf(stderr, "LC_ALL is '%s'\n", lc_all);
17716
17717         /* Assume is name=value pairs if the result contains both an equals and
17718          * a semi-colon. */
17719         if (strchr(lc_all, '=') && strchr(lc_all, ';')) {
17720             fprintf(stdout, "\"=;\"\n\n");
17721             return 0;
17722         }
17723
17724         /* Here isn't name=value pairs.  Find the position of the alternate */
17725         const char * alt_pos = strstr(lc_all, alternate);
17726         if (! alt_pos) {
17727             fprintf(stderr, "Couldn't find '%s' in '%s'\n", alternate, lc_all);
17728             return 1;
17729         }
17730
17731         /* Parse the LC_ALL string from the beginning up to where the alternate
17732          * locale is */
17733         const char * s = lc_all;
17734         int count = 0;
17735         while (s < alt_pos) {
17736
17737             /* Count the 'C' locales before the non-C one.  (Note the letter
17738              * 'C' can only occur as the entire 'C' locale, since all of them
17739              * are that locale before 'alt_pos') */
17740             const char * next_C = (const char *) memchr(s, 'C', alt_pos - s);
17741             if (next_C) {
17742                 count++;
17743                 s = next_C + 1;
17744                 continue;
17745             }
17746
17747             /* Here, there is no 'C' between 's' and the alternate locale, so
17748              * 'count' gives the total number of occurrences of 'C' in that
17749              * span.  If count is 0, this is the first category in an LC_ALL
17750              * string, and we know its position, but not the separator. */
17751             if (count == 0) {
17752                 break;
17753             }
17754
17755             /* When 'count' isn't 0,  's' points to one past the previous 'C'.
17756              * The separator starts here, ending just before the non-C locale.
17757              */
17758
17759             const char * new_sep = s;
17760             unsigned int new_sep_len = alt_pos - s;
17761
17762             /* If we don't already have a separator saved, save this as it */
17763             if (separator_len == 0) {
17764                 separator_len = new_sep_len;
17765                 Copy(s, separator, separator_len, char);
17766                 separator[separator_len] = '\0';
17767             }
17768             else {  /* Otherwise make sure it's the same string as previously
17769                      * calculated */
17770                 if (   new_sep_len != separator_len
17771                     || memNE(separator, new_sep, separator_len))
17772                 {
17773                     fprintf(stderr, "Unexpectedly got distinct separators"
17774                                     " '%s' vs '%s\n", separator, new_sep);
17775                     return 1;
17776                 }
17777             }
17778
17779             /* Here, we have found the position of category[i] in LC_ALL. */
17780             break;
17781
17782         } /* End of loop parsing the LC_ALL string */
17783
17784         if (map_LC_ALL_position_to_category[count] != INT_MAX) {
17785             fprintf(stderr, "Categories %d and %d both appear to occupy"
17786                             " position %d in LC_ALL; there is something"
17787                             " wrong with the calculation\n",
17788                             categories[count], categories[i],
17789                             count);
17790             return 1;
17791         }
17792
17793         /* Save the position of this category */
17794         map_LC_ALL_position_to_category[count] = categories[i];
17795
17796     } /* End of loop through all the categories */
17797
17798     fprintf(stdout, "\"%s\"\n{", separator);
17799     for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories) - 1; i++) {
17800         fprintf(stdout, " %d,", map_LC_ALL_position_to_category[i]);
17801     }
17802     fprintf(stdout, " %d }\n", map_LC_ALL_position_to_category[
17803                                                 C_ARRAY_LENGTH(categories) - 1]);
17804     return 0;
17805
17806 }
17807
17808 #endif
17809 EOF
17810 set try
17811 if eval $compile_ok; then
17812     output=`$run ./try 2>/dev/null`
17813     separator=`echo "$output" | $sed 1q`
17814     case $separator in
17815         "\"=;\"")
17816           d_perl_lc_all_uses_name_value_pairs="$define"
17817           d_perl_lc_all_separator="$undef"
17818             perl_lc_all_separator=
17819           d_perl_lc_all_category_positions_init="$undef"
17820             perl_lc_all_category_positions_init=
17821             ;;
17822         "") d_perl_lc_all_uses_name_value_pairs="$undef"
17823             d_perl_lc_all_separator="$undef"
17824               perl_lc_all_separator=
17825             d_perl_lc_all_category_positions_init="$undef"
17826               perl_lc_all_category_positions_init=
17827             ;;
17828         *)  d_perl_lc_all_uses_name_value_pairs="$undef"
17829             d_perl_lc_all_separator="$define"
17830               perl_lc_all_separator="$separator"
17831             d_perl_lc_all_category_positions_init="$define"
17832               perl_lc_all_category_positions_init=`echo "$output" | sed -n 2p`
17833             ;;
17834     esac
17835 else
17836     $echo "Failed to compile lc_all probe" >&4
17837 fi
17838 $rm -f try try.*
17839 ;;
17840 *)        d_perl_lc_all_separator="$undef"
17841             perl_lc_all_separator=
17842           d_perl_lc_all_category_positions_init="$undef"
17843             perl_lc_all_category_positions_init=
17844
17845           # No setlocale(), but using this default allows our code to compile
17846           # and run without having to have a bunch more #ifdef's
17847           d_perl_lc_all_uses_name_value_pairs="$define"
17848 ;;
17849 esac
17850
17851 : see if pipe2 exists
17852 set pipe2 d_pipe2
17853 eval $inlibc
17854
17855 : see if poll exists
17856 set poll d_poll
17857 eval $inlibc
17858
17859 : see if prctl exists
17860 set prctl d_prctl
17861 eval $inlibc
17862
17863 : see if prctl supports PR_SET_NAME
17864 d_prctl_set_name=$undef
17865 case $d_prctl in
17866     $define)
17867         $cat >try.c <<EOM
17868 #ifdef __ANDROID__
17869 #include <unistd.h>
17870 #endif
17871 #include <sys/prctl.h>
17872
17873 int main (int argc, char *argv[])
17874 {
17875     return (prctl (PR_SET_NAME, "Test"));
17876     } /* main */
17877 EOM
17878         set try
17879         if eval $compile_ok && $run ./try; then
17880             echo "Your prctl (PR_SET_NAME, ...) works"
17881             d_prctl_set_name=$define
17882             fi
17883         $rm_try
17884         ;;
17885     esac
17886
17887 : see if readlink exists
17888 set readlink d_readlink
17889 eval $inlibc
17890
17891 : Check if there is a /proc symlink to the abs path of
17892 : the executing program.  We will honor hints of d_procselfexe=$undef
17893 : or procselfexe being non-empty, otherwise will try to determine both
17894 : if we have readlink.
17895 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17896 : referenced, and AmigaOS does not have a proc filesystem anyway.
17897 echo " "
17898 val="$undef"
17899 if $test "X$d_procselfexe" = Xundef; then
17900         procselfexe=''
17901 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17902         val="$define"
17903 elif $test "X$d_readlink" = Xdefine; then
17904         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17905         : and it feels more tidy to avoid an extra level of symlink
17906         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17907         while test $# -gt 0; do
17908             type=$1; try=$2
17909             shift; shift
17910             if $issymlink $try; then
17911                 $ls -l $try > reflect
17912                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17913                     echo "You have $type-like $try."
17914                     procselfexe='"'$try'"'
17915                     val="$define"
17916                     : This will break out of the loop
17917                     set X; shift
17918                 fi
17919             fi
17920         done
17921 fi
17922 $rm -f reflect
17923 set d_procselfexe
17924 eval $setvar
17925
17926 : backward compatibility for d_hvfork
17927 if test X$d_hvfork != X; then
17928         d_vfork="$d_hvfork"
17929         d_hvfork=''
17930 fi
17931 : see if there is a vfork
17932 val=''
17933 set vfork val
17934 eval $inlibc
17935
17936 d_pseudofork=$undef
17937
17938 : Ok, but do we want to use it. vfork is reportedly unreliable in
17939 : perl on Solaris 2.x, and probably elsewhere.
17940 case "$val" in
17941 $define)
17942         echo " "
17943         case "$usevfork" in
17944         false) dflt='n';;
17945         *) dflt='y';;
17946         esac
17947         cat <<'EOM'
17948
17949 Perl can only use a vfork() that doesn't suffer from strict
17950 restrictions on calling functions or modifying global data in
17951 the child.  For example, glibc-2.1 contains such a vfork()
17952 that is unsuitable.  If your system provides a proper fork()
17953 call, chances are that you do NOT want perl to use vfork().
17954
17955 EOM
17956         rp="Do you still want to use vfork()?"
17957         . ./myread
17958         case "$ans" in
17959         y|Y) ;;
17960         *)
17961                 echo "Ok, we won't use vfork()."
17962                 val="$undef"
17963                 ;;
17964         esac
17965         ;;
17966 esac
17967 set d_vfork
17968 eval $setvar
17969 case "$d_vfork" in
17970 $define) usevfork='true';;
17971 *) usevfork='false';;
17972 esac
17973
17974 : see whether the pthread_atfork exists
17975 $cat >try.c <<EOP
17976 #include <pthread.h>
17977 #include <stdio.h>
17978 int main() {
17979 #ifdef  PTHREAD_ATFORK
17980         pthread_atfork(NULL,NULL,NULL);
17981 #endif
17982 }
17983 EOP
17984
17985 : see if pthread_atfork exists
17986 set try -DPTHREAD_ATFORK
17987 if eval $compile; then
17988     val="$define"
17989 else
17990     val="$undef"
17991 fi
17992 case "$usethreads" in
17993 $define)
17994         case "$val" in
17995         $define) echo 'pthread_atfork found.' >&4        ;;
17996         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17997         esac
17998 esac
17999 set d_pthread_atfork
18000 eval $setvar
18001
18002 : see if pthread_attr_setscope exists
18003 set pthread_attr_setscope d_pthread_attr_setscope
18004 eval $inlibc
18005
18006 : see whether the various POSIXish _yields exist
18007 $cat >try.c <<EOP
18008 #include <pthread.h>
18009 #include <stdio.h>
18010 int main() {
18011 #ifdef SCHED_YIELD
18012         sched_yield();
18013 #else
18014 #ifdef PTHREAD_YIELD
18015         pthread_yield();
18016 #else
18017 #ifdef PTHREAD_YIELD_NULL
18018         pthread_yield(NULL);
18019 #endif
18020 #endif
18021 #endif
18022 }
18023 EOP
18024 : see if sched_yield exists
18025 set try -DSCHED_YIELD
18026 if eval $compile; then
18027     val="$define"
18028     sched_yield='sched_yield()'
18029 else
18030     val="$undef"
18031 fi
18032 case "$usethreads" in
18033 $define)
18034         case "$val" in
18035         $define) echo 'sched_yield() found.' >&4        ;;
18036         *)       echo 'sched_yield() NOT found.' >&4    ;;
18037         esac
18038 esac
18039 set d_sched_yield
18040 eval $setvar
18041
18042 : see if pthread_yield exists
18043 set try -DPTHREAD_YIELD
18044 if eval $compile; then
18045     val="$define"
18046     case "$sched_yield" in
18047     '') sched_yield='pthread_yield()' ;;
18048     esac
18049 else
18050     set try -DPTHREAD_YIELD_NULL
18051     if eval $compile; then
18052         val="$define"
18053         case "$sched_yield" in
18054         '') sched_yield='pthread_yield(NULL)' ;;
18055         esac
18056     else
18057         val="$undef"
18058     fi
18059 fi
18060 case "$usethreads" in
18061 $define)
18062         case "$val" in
18063         $define) echo 'pthread_yield() found.' >&4      ;;
18064         *)       echo 'pthread_yield() NOT found.' >&4  ;;
18065         esac
18066         ;;
18067 esac
18068 set d_pthread_yield
18069 eval $setvar
18070 case "$sched_yield" in
18071 '') sched_yield=undef ;;
18072 esac
18073 $rm_try
18074
18075 : check for ptrdiff_t
18076 echo " "
18077 echo "Checking to see if you have ptrdiff_t..." >&4
18078 $cat >try.c <<EOCP
18079 #include <stddef.h>
18080 int main() { ptrdiff_t x = 7; }
18081 EOCP
18082 set try
18083 if eval $compile; then
18084         val="$define"
18085         echo "You have ptrdiff_t."
18086 else
18087         val="$undef"
18088         echo "You do not have ptrdiff_t."
18089 fi
18090 $rm_try
18091 set d_ptrdiff_t
18092 eval $setvar
18093
18094 : see if random_r exists
18095 set random_r d_random_r
18096 eval $inlibc
18097 case "$d_random_r" in
18098 "$define")
18099         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18100         case "$d_random_r_proto:$usethreads" in
18101         ":define")      d_random_r_proto=define
18102                 set d_random_r_proto random_r $hdrs
18103                 eval $hasproto ;;
18104         *)      ;;
18105         esac
18106         case "$d_random_r_proto" in
18107         define)
18108         case "$random_r_proto" in
18109         ''|0) try='int random_r(int*, struct random_data*);'
18110         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
18111         esac
18112         case "$random_r_proto" in
18113         ''|0) try='int random_r(long*, struct random_data*);'
18114         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
18115         esac
18116         case "$random_r_proto" in
18117         ''|0) try='int random_r(struct random_data*, int32_t*);'
18118         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
18119         esac
18120         case "$random_r_proto" in
18121         ''|0)   d_random_r=undef
18122                 random_r_proto=0
18123                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
18124         * )     case "$random_r_proto" in
18125                 REENTRANT_PROTO*) ;;
18126                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
18127                 esac
18128                 echo "Prototype: $try" ;;
18129         esac
18130         ;;
18131         *)      case "$usethreads" in
18132                 define) echo "random_r has no prototype, not using it." >&4 ;;
18133                 esac
18134                 d_random_r=undef
18135                 random_r_proto=0
18136                 ;;
18137         esac
18138         ;;
18139 *)      random_r_proto=0
18140         ;;
18141 esac
18142
18143 : see if readdir and friends exist
18144 set readdir d_readdir
18145 eval $inlibc
18146 set seekdir d_seekdir
18147 eval $inlibc
18148 set telldir d_telldir
18149 eval $inlibc
18150 set rewinddir d_rewinddir
18151 eval $inlibc
18152
18153 : see if readdir64_r exists
18154 set readdir64_r d_readdir64_r
18155 eval $inlibc
18156 case "$d_readdir64_r" in
18157 "$define")
18158         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
18159         case "$d_readdir64_r_proto:$usethreads" in
18160         ":define")      d_readdir64_r_proto=define
18161                 set d_readdir64_r_proto readdir64_r $hdrs
18162                 eval $hasproto ;;
18163         *)      ;;
18164         esac
18165         case "$d_readdir64_r_proto" in
18166         define)
18167         case "$readdir64_r_proto" in
18168         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
18169         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
18170         esac
18171         case "$readdir64_r_proto" in
18172         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
18173         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
18174         esac
18175         case "$readdir64_r_proto" in
18176         ''|0)   d_readdir64_r=undef
18177                 readdir64_r_proto=0
18178                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
18179         * )     case "$readdir64_r_proto" in
18180                 REENTRANT_PROTO*) ;;
18181                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
18182                 esac
18183                 echo "Prototype: $try" ;;
18184         esac
18185         ;;
18186         *)      case "$usethreads" in
18187                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
18188                 esac
18189                 d_readdir64_r=undef
18190                 readdir64_r_proto=0
18191                 ;;
18192         esac
18193         ;;
18194 *)      readdir64_r_proto=0
18195         ;;
18196 esac
18197
18198 : see if readdir_r exists
18199 set readdir_r d_readdir_r
18200 eval $inlibc
18201 case "$d_readdir_r" in
18202 "$define")
18203         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
18204         case "$d_readdir_r_proto:$usethreads" in
18205         ":define")      d_readdir_r_proto=define
18206                 set d_readdir_r_proto readdir_r $hdrs
18207                 eval $hasproto ;;
18208         *)      ;;
18209         esac
18210         case "$d_readdir_r_proto" in
18211         define)
18212         case "$readdir_r_proto" in
18213         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
18214         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
18215         esac
18216         case "$readdir_r_proto" in
18217         ''|0) try='int readdir_r(DIR*, struct dirent*);'
18218         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
18219         esac
18220         case "$readdir_r_proto" in
18221         ''|0)   d_readdir_r=undef
18222                 readdir_r_proto=0
18223                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
18224         * )     case "$readdir_r_proto" in
18225                 REENTRANT_PROTO*) ;;
18226                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
18227                 esac
18228                 echo "Prototype: $try" ;;
18229         esac
18230         ;;
18231         *)      case "$usethreads" in
18232                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
18233                 esac
18234                 d_readdir_r=undef
18235                 readdir_r_proto=0
18236                 ;;
18237         esac
18238         ;;
18239 *)      readdir_r_proto=0
18240         ;;
18241 esac
18242
18243 : see if readv exists
18244 set readv d_readv
18245 eval $inlibc
18246
18247 : see if recvmsg exists
18248 set recvmsg d_recvmsg
18249 eval $inlibc
18250
18251 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
18252 echo " "
18253 if set regcomp val -f d_regcomp; eval $csym; $val; then
18254         echo 'regcomp() found.' >&4
18255         d_regcomp="$define"
18256         d_regcmp="$undef"
18257         d_re_comp="$undef"
18258 elif set regcmp val -f d_regcmp; eval $csym; $val; then
18259         echo 'regcmp() found.' >&4
18260         d_regcmp="$define"
18261         d_regcomp="$undef"
18262         d_re_comp="$undef"
18263 elif set re_comp val -f d_re_comp; eval $csym; $val; then
18264         echo 're_comp() found, assuming re_exec() also exists.' >&4
18265         d_re_comp="$define"
18266         d_regcomp="$undef"
18267         d_regcmp="$undef"
18268 else
18269         $cat >&4 <<EOM
18270 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
18271 EOM
18272         d_regcmp="$undef"
18273         d_re_comp="$undef"
18274         d_regcomp="$undef"
18275 fi
18276
18277 : see if remainder exists
18278 set remainder d_remainder
18279 eval $inlibc
18280
18281 : see if remquo exists
18282 set remquo d_remquo
18283 eval $inlibc
18284
18285 : see if rename exists
18286 set rename d_rename
18287 eval $inlibc
18288
18289 : see if rint exists
18290 set rint d_rint
18291 eval $inlibc
18292
18293 : see if rmdir exists
18294 set rmdir d_rmdir
18295 eval $inlibc
18296
18297 : see if round exists
18298 set round d_round
18299 eval $inlibc
18300
18301 : see if prototype for sbrk is available
18302 echo " "
18303 set d_sbrkproto sbrk $i_unistd unistd.h
18304 eval $hasproto
18305
18306 : see if scalbn exists
18307 set scalbn d_scalbn
18308 eval $inlibc
18309
18310 : see if select exists
18311 set select d_select
18312 eval $inlibc
18313
18314 : see if semctl exists
18315 set semctl d_semctl
18316 eval $inlibc
18317
18318 : see if semget exists
18319 set semget d_semget
18320 eval $inlibc
18321
18322 : see if semop exists
18323 set semop d_semop
18324 eval $inlibc
18325
18326 : see how much of the 'sem*(2)' library is present.
18327 h_sem=true
18328 echo " "
18329 case "$d_semctl$d_semget$d_semop" in
18330 *"$undef"*) h_sem=false;;
18331 esac
18332 case "$osname" in
18333 freebsd)
18334     case "`ipcs 2>&1`" in
18335     "SVID messages"*"not configured"*)
18336         echo "Your $osname does not have the sem*(2) configured." >&4
18337         h_sem=false
18338         val="$undef"
18339         set semctl d_semctl
18340         eval $setvar
18341         set semget d_semget
18342         eval $setvar
18343         set semop d_semop
18344         eval $setvar
18345         ;;
18346     esac
18347     ;;
18348 esac
18349 : we could also check for sys/ipc.h ...
18350 if $h_sem && $test `./findhdr sys/sem.h`; then
18351         echo "You have the full sem*(2) library." >&4
18352         val="$define"
18353 else
18354         echo "You don't have the full sem*(2) library." >&4
18355         val="$undef"
18356 fi
18357 set d_sem
18358 eval $setvar
18359
18360 : see whether sys/sem.h defines union semun
18361 echo " "
18362 $cat > try.c <<'END'
18363 #include <sys/types.h>
18364 #include <sys/ipc.h>
18365 #include <sys/sem.h>
18366 int main () { union semun semun; semun.buf = 0; }
18367 END
18368 set try
18369 if eval $compile; then
18370     echo "You have union semun in <sys/sem.h>." >&4
18371     val="$define"
18372 else
18373     echo "You do not have union semun in <sys/sem.h>." >&4
18374     val="$undef"
18375 fi
18376 $rm_try
18377 set d_union_semun
18378 eval $setvar
18379
18380 : see how to do semctl IPC_STAT
18381 case "$d_sem" in
18382 $define)
18383     echo " "
18384     $cat > tryh.h <<END
18385 #ifndef S_IRUSR
18386 #   ifdef S_IREAD
18387 #       define S_IRUSR S_IREAD
18388 #       define S_IWUSR S_IWRITE
18389 #       define S_IXUSR S_IEXEC
18390 #   else
18391 #       define S_IRUSR 0400
18392 #       define S_IWUSR 0200
18393 #       define S_IXUSR 0100
18394 #   endif
18395 #   define S_IRGRP (S_IRUSR>>3)
18396 #   define S_IWGRP (S_IWUSR>>3)
18397 #   define S_IXGRP (S_IXUSR>>3)
18398 #   define S_IROTH (S_IRUSR>>6)
18399 #   define S_IWOTH (S_IWUSR>>6)
18400 #   define S_IXOTH (S_IXUSR>>6)
18401 #endif
18402 #ifndef S_IRWXU
18403 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
18404 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
18405 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
18406 #endif
18407 END
18408     : see whether semctl IPC_STAT can use union semun
18409     case "$d_semctl_semun" in
18410     '')
18411       val="$undef"
18412       $cat > try.c <<END
18413 #include <sys/types.h>
18414 #include <sys/ipc.h>
18415 #include <sys/sem.h>
18416 #include <sys/stat.h>
18417 #include <stdio.h>
18418 #include <errno.h>
18419 #include "tryh.h"
18420 #ifndef errno
18421 extern int errno;
18422 #endif
18423 #$d_union_semun HAS_UNION_SEMUN
18424 int main() {
18425     union semun
18426 #ifndef HAS_UNION_SEMUN
18427     {
18428         int val;
18429         struct semid_ds *buf;
18430         unsigned short *array;
18431     }
18432 #endif
18433     arg;
18434     int sem, st;
18435
18436 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
18437     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18438     if (sem > -1) {
18439         struct semid_ds argbuf;
18440         arg.buf = &argbuf;
18441 #       ifdef IPC_STAT
18442         st = semctl(sem, 0, IPC_STAT, arg);
18443         if (st == 0)
18444             printf("semun\n");
18445         else
18446 #       endif /* IPC_STAT */
18447             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18448 #       ifdef IPC_RMID
18449         if (semctl(sem, 0, IPC_RMID, arg) != 0)
18450 #       endif /* IPC_RMID */
18451             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18452     } else
18453 #endif /* IPC_PRIVATE && ... */
18454         printf("semget failed: errno = %d\n", errno);
18455   return 0;
18456 }
18457 END
18458       set try
18459       if eval $compile; then
18460           xxx=`$run ./try`
18461           case "$xxx" in
18462           semun) val="$define" ;;
18463           esac
18464       fi
18465       $rm_try
18466       set d_semctl_semun
18467       eval $setvar
18468       ;;
18469     esac
18470     case "$d_semctl_semun" in
18471     $define)
18472         echo "You can use union semun for semctl IPC_STAT." >&4
18473         also='also'
18474         ;;
18475     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
18476         also=''
18477         ;;
18478     esac
18479
18480     : see whether semctl IPC_STAT can use struct semid_ds pointer
18481     case "$d_semctl_semid_ds" in
18482     '')
18483       val="$undef"
18484       $cat > try.c <<'END'
18485 #include <sys/types.h>
18486 #include <sys/ipc.h>
18487 #include <sys/sem.h>
18488 #include <sys/stat.h>
18489 #include "tryh.h"
18490 #include <stdio.h>
18491 #include <errno.h>
18492 #ifndef errno
18493 extern int errno;
18494 #endif
18495 int main() {
18496     union semun
18497 #ifndef HAS_UNION_SEMUN
18498     {
18499         int val;
18500         struct semid_ds *buf;
18501         unsigned short *array;
18502     }
18503 #endif
18504     arg;
18505     struct semid_ds argbuf;
18506     int sem, st;
18507
18508 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18509     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18510     if (sem > -1) {
18511         arg.buf = &argbuf;
18512 #       ifdef IPC_STAT
18513         st = semctl(sem, 0, IPC_STAT, arg);
18514         if (st == 0)
18515             printf("semid_ds\n");
18516         else
18517 #       endif /* IPC_STAT */
18518             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18519 #       ifdef IPC_RMID
18520         if (semctl(sem, 0, IPC_RMID, arg) != 0)
18521 #       endif /* IPC_RMID */
18522             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18523     } else
18524 #endif /* IPC_PRIVATE && ... */
18525         printf("semget failed: errno = %d\n", errno);
18526
18527     return 0;
18528 }
18529 END
18530       set try
18531       if eval $compile; then
18532           xxx=`$run ./try`
18533           case "$xxx" in
18534           semid_ds) val="$define" ;;
18535           esac
18536       fi
18537       $rm_try
18538       set d_semctl_semid_ds
18539       eval $setvar
18540       ;;
18541     esac
18542     case "$d_semctl_semid_ds" in
18543     $define)
18544         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18545         ;;
18546     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18547         ;;
18548     esac
18549     ;;
18550 *)  val="$undef"
18551
18552     # We do not have the full sem*(2) library, so assume we can not
18553     # use either.
18554
18555     set d_semctl_semun
18556     eval $setvar
18557
18558     set d_semctl_semid_ds
18559     eval $setvar
18560     ;;
18561 esac
18562 $rm_try tryh.h
18563
18564 : see if sendmsg exists
18565 set sendmsg d_sendmsg
18566 eval $inlibc
18567
18568 : see if setegid exists
18569 set setegid d_setegid
18570 eval $inlibc
18571
18572 : see if setenv exists
18573 set setenv d_setenv
18574 eval $inlibc
18575
18576 : see if seteuid exists
18577 set seteuid d_seteuid
18578 eval $inlibc
18579
18580 : see if setgrent exists
18581 set setgrent d_setgrent
18582 eval $inlibc
18583
18584 : see if setgrent_r exists
18585 set setgrent_r d_setgrent_r
18586 eval $inlibc
18587 case "$d_setgrent_r" in
18588 "$define")
18589         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18590         case "$d_setgrent_r_proto:$usethreads" in
18591         ":define")      d_setgrent_r_proto=define
18592                 set d_setgrent_r_proto setgrent_r $hdrs
18593                 eval $hasproto ;;
18594         *)      ;;
18595         esac
18596         case "$d_setgrent_r_proto" in
18597         define)
18598         case "$setgrent_r_proto" in
18599         ''|0) try='int setgrent_r(FILE**);'
18600         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18601         esac
18602         case "$setgrent_r_proto" in
18603         ''|0) try='void setgrent_r(FILE**);'
18604         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18605         esac
18606         case "$setgrent_r_proto" in
18607         ''|0)   d_setgrent_r=undef
18608                 setgrent_r_proto=0
18609                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18610         * )     case "$setgrent_r_proto" in
18611                 REENTRANT_PROTO*) ;;
18612                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18613                 esac
18614                 echo "Prototype: $try" ;;
18615         esac
18616         ;;
18617         *)      case "$usethreads" in
18618                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18619                 esac
18620                 d_setgrent_r=undef
18621                 setgrent_r_proto=0
18622                 ;;
18623         esac
18624         ;;
18625 *)      setgrent_r_proto=0
18626         ;;
18627 esac
18628
18629 : see if sethostent exists
18630 set sethostent d_sethent
18631 eval $inlibc
18632
18633 : see if sethostent_r exists
18634 set sethostent_r d_sethostent_r
18635 eval $inlibc
18636 case "$d_sethostent_r" in
18637 "$define")
18638         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18639         case "$d_sethostent_r_proto:$usethreads" in
18640         ":define")      d_sethostent_r_proto=define
18641                 set d_sethostent_r_proto sethostent_r $hdrs
18642                 eval $hasproto ;;
18643         *)      ;;
18644         esac
18645         case "$d_sethostent_r_proto" in
18646         define)
18647         case "$sethostent_r_proto" in
18648         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18649         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18650         esac
18651         case "$sethostent_r_proto" in
18652         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18653         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18654         esac
18655         case "$sethostent_r_proto" in
18656         ''|0)   d_sethostent_r=undef
18657                 sethostent_r_proto=0
18658                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18659         * )     case "$sethostent_r_proto" in
18660                 REENTRANT_PROTO*) ;;
18661                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18662                 esac
18663                 echo "Prototype: $try" ;;
18664         esac
18665         ;;
18666         *)      case "$usethreads" in
18667                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18668                 esac
18669                 d_sethostent_r=undef
18670                 sethostent_r_proto=0
18671                 ;;
18672         esac
18673         ;;
18674 *)      sethostent_r_proto=0
18675         ;;
18676 esac
18677
18678 : see if setitimer exists
18679 set setitimer d_setitimer
18680 eval $inlibc
18681
18682 : see if setlinebuf exists
18683 set setlinebuf d_setlinebuf
18684 eval $inlibc
18685
18686 : see if setlocale_r exists
18687 set setlocale_r d_setlocale_r
18688 eval $inlibc
18689 case "$d_setlocale_r" in
18690 "$define")
18691         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18692         case "$d_setlocale_r_proto:$usethreads" in
18693         ":define")      d_setlocale_r_proto=define
18694                 set d_setlocale_r_proto setlocale_r $hdrs
18695                 eval $hasproto ;;
18696         *)      ;;
18697         esac
18698         case "$d_setlocale_r_proto" in
18699         define)
18700         case "$setlocale_r_proto" in
18701         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18702         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18703         esac
18704         case "$setlocale_r_proto" in
18705         ''|0)   d_setlocale_r=undef
18706                 setlocale_r_proto=0
18707                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18708         * )     case "$setlocale_r_proto" in
18709                 REENTRANT_PROTO*) ;;
18710                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18711                 esac
18712                 echo "Prototype: $try" ;;
18713         esac
18714         ;;
18715         *)      case "$usethreads" in
18716                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18717                 esac
18718                 d_setlocale_r=undef
18719                 setlocale_r_proto=0
18720                 ;;
18721         esac
18722         ;;
18723 *)      setlocale_r_proto=0
18724         ;;
18725 esac
18726
18727 : see if setnetent exists
18728 set setnetent d_setnent
18729 eval $inlibc
18730
18731 : see if setnetent_r exists
18732 set setnetent_r d_setnetent_r
18733 eval $inlibc
18734 case "$d_setnetent_r" in
18735 "$define")
18736         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18737         case "$d_setnetent_r_proto:$usethreads" in
18738         ":define")      d_setnetent_r_proto=define
18739                 set d_setnetent_r_proto setnetent_r $hdrs
18740                 eval $hasproto ;;
18741         *)      ;;
18742         esac
18743         case "$d_setnetent_r_proto" in
18744         define)
18745         case "$setnetent_r_proto" in
18746         ''|0) try='int setnetent_r(int, struct netent_data*);'
18747         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18748         esac
18749         case "$setnetent_r_proto" in
18750         ''|0) try='void setnetent_r(int, struct netent_data*);'
18751         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18752         esac
18753         case "$setnetent_r_proto" in
18754         ''|0)   d_setnetent_r=undef
18755                 setnetent_r_proto=0
18756                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18757         * )     case "$setnetent_r_proto" in
18758                 REENTRANT_PROTO*) ;;
18759                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18760                 esac
18761                 echo "Prototype: $try" ;;
18762         esac
18763         ;;
18764         *)      case "$usethreads" in
18765                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18766                 esac
18767                 d_setnetent_r=undef
18768                 setnetent_r_proto=0
18769                 ;;
18770         esac
18771         ;;
18772 *)      setnetent_r_proto=0
18773         ;;
18774 esac
18775
18776 : see if setprotoent exists
18777 set setprotoent d_setpent
18778 eval $inlibc
18779
18780 : see if setpgid exists
18781 set setpgid d_setpgid
18782 eval $inlibc
18783
18784 : see if setpgrp2 exists
18785 set setpgrp2 d_setpgrp2
18786 eval $inlibc
18787
18788 : see if setpriority exists
18789 set setpriority d_setprior
18790 eval $inlibc
18791
18792 : see if setproctitle exists
18793 set setproctitle d_setproctitle
18794 eval $inlibc
18795
18796 : see if setprotoent_r exists
18797 set setprotoent_r d_setprotoent_r
18798 eval $inlibc
18799 case "$d_setprotoent_r" in
18800 "$define")
18801         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18802         case "$d_setprotoent_r_proto:$usethreads" in
18803         ":define")      d_setprotoent_r_proto=define
18804                 set d_setprotoent_r_proto setprotoent_r $hdrs
18805                 eval $hasproto ;;
18806         *)      ;;
18807         esac
18808         case "$d_setprotoent_r_proto" in
18809         define)
18810         case "$setprotoent_r_proto" in
18811         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18812         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18813         esac
18814         case "$setprotoent_r_proto" in
18815         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18816         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18817         esac
18818         case "$setprotoent_r_proto" in
18819         ''|0)   d_setprotoent_r=undef
18820                 setprotoent_r_proto=0
18821                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18822         * )     case "$setprotoent_r_proto" in
18823                 REENTRANT_PROTO*) ;;
18824                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18825                 esac
18826                 echo "Prototype: $try" ;;
18827         esac
18828         ;;
18829         *)      case "$usethreads" in
18830                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18831                 esac
18832                 d_setprotoent_r=undef
18833                 setprotoent_r_proto=0
18834                 ;;
18835         esac
18836         ;;
18837 *)      setprotoent_r_proto=0
18838         ;;
18839 esac
18840
18841 : see if setpwent exists
18842 set setpwent d_setpwent
18843 eval $inlibc
18844
18845 : see if setpwent_r exists
18846 set setpwent_r d_setpwent_r
18847 eval $inlibc
18848 case "$d_setpwent_r" in
18849 "$define")
18850         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18851         case "$d_setpwent_r_proto:$usethreads" in
18852         ":define")      d_setpwent_r_proto=define
18853                 set d_setpwent_r_proto setpwent_r $hdrs
18854                 eval $hasproto ;;
18855         *)      ;;
18856         esac
18857         case "$d_setpwent_r_proto" in
18858         define)
18859         case "$setpwent_r_proto" in
18860         ''|0) try='int setpwent_r(FILE**);'
18861         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18862         esac
18863         case "$setpwent_r_proto" in
18864         ''|0) try='void setpwent_r(FILE**);'
18865         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18866         esac
18867         case "$setpwent_r_proto" in
18868         ''|0)   d_setpwent_r=undef
18869                 setpwent_r_proto=0
18870                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18871         * )     case "$setpwent_r_proto" in
18872                 REENTRANT_PROTO*) ;;
18873                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18874                 esac
18875                 echo "Prototype: $try" ;;
18876         esac
18877         ;;
18878         *)      case "$usethreads" in
18879                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18880                 esac
18881                 d_setpwent_r=undef
18882                 setpwent_r_proto=0
18883                 ;;
18884         esac
18885         ;;
18886 *)      setpwent_r_proto=0
18887         ;;
18888 esac
18889
18890 : see if setregid exists
18891 set setregid d_setregid
18892 eval $inlibc
18893 set setresgid d_setresgid
18894 eval $inlibc
18895
18896 : see if setreuid exists
18897 set setreuid d_setreuid
18898 eval $inlibc
18899 set setresuid d_setresuid
18900 eval $inlibc
18901
18902 : see if setrgid exists
18903 set setrgid d_setrgid
18904 eval $inlibc
18905
18906 : see if setruid exists
18907 set setruid d_setruid
18908 eval $inlibc
18909
18910 : see if setservent exists
18911 set setservent d_setsent
18912 eval $inlibc
18913
18914 : see if setservent_r exists
18915 set setservent_r d_setservent_r
18916 eval $inlibc
18917 case "$d_setservent_r" in
18918 "$define")
18919         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18920         case "$d_setservent_r_proto:$usethreads" in
18921         ":define")      d_setservent_r_proto=define
18922                 set d_setservent_r_proto setservent_r $hdrs
18923                 eval $hasproto ;;
18924         *)      ;;
18925         esac
18926         case "$d_setservent_r_proto" in
18927         define)
18928         case "$setservent_r_proto" in
18929         ''|0) try='int setservent_r(int, struct servent_data*);'
18930         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18931         esac
18932         case "$setservent_r_proto" in
18933         ''|0) try='void setservent_r(int, struct servent_data*);'
18934         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18935         esac
18936         case "$setservent_r_proto" in
18937         ''|0)   d_setservent_r=undef
18938                 setservent_r_proto=0
18939                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18940         * )     case "$setservent_r_proto" in
18941                 REENTRANT_PROTO*) ;;
18942                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18943                 esac
18944                 echo "Prototype: $try" ;;
18945         esac
18946         ;;
18947         *)      case "$usethreads" in
18948                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18949                 esac
18950                 d_setservent_r=undef
18951                 setservent_r_proto=0
18952                 ;;
18953         esac
18954         ;;
18955 *)      setservent_r_proto=0
18956         ;;
18957 esac
18958
18959 : see if setsid exists
18960 set setsid d_setsid
18961 eval $inlibc
18962
18963 : see if setvbuf exists
18964 set setvbuf d_setvbuf
18965 eval $inlibc
18966
18967 : see if shmctl exists
18968 set shmctl d_shmctl
18969 eval $inlibc
18970
18971 : see if shmget exists
18972 set shmget d_shmget
18973 eval $inlibc
18974
18975 : see if shmat exists
18976 set shmat d_shmat
18977 eval $inlibc
18978 : see what shmat returns
18979 case "$d_shmat" in
18980 "$define")
18981         $cat >shmat.c <<'END'
18982 #include <sys/shm.h>
18983 void *shmat();
18984 END
18985         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18986                 shmattype='void *'
18987         else
18988                 shmattype='char *'
18989         fi
18990         echo "and it returns ($shmattype)." >&4
18991         : see if a prototype for shmat is available
18992         xxx=`./findhdr sys/shm.h`
18993         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18994         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18995                 val="$define"
18996         else
18997                 val="$undef"
18998         fi
18999         $rm -f shmat.[co]
19000         ;;
19001 *)
19002         val="$undef"
19003         ;;
19004 esac
19005 set d_shmatprototype
19006 eval $setvar
19007
19008 : see if shmdt exists
19009 set shmdt d_shmdt
19010 eval $inlibc
19011
19012 : see how much of the 'shm*(2)' library is present.
19013 h_shm=true
19014 echo " "
19015 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
19016 *"$undef"*) h_shm=false;;
19017 esac
19018 case "$osname" in
19019 freebsd)
19020     case "`ipcs 2>&1`" in
19021     "SVID shared memory"*"not configured"*)
19022         echo "Your $osname does not have the shm*(2) configured." >&4
19023         h_shm=false
19024         val="$undef"
19025         set shmctl d_shmctl
19026         eval $setvar
19027         set shmget d_shmget
19028         eval $setvar
19029         set shmat d_shmat
19030         eval $setvar
19031         set shmdt d_shmdt
19032         eval $setvar
19033         ;;
19034     esac
19035     ;;
19036 esac
19037 : we could also check for sys/ipc.h ...
19038 if $h_shm && $test `./findhdr sys/shm.h`; then
19039         echo "You have the full shm*(2) library." >&4
19040         val="$define"
19041 else
19042         echo "You don't have the full shm*(2) library." >&4
19043         val="$undef"
19044 fi
19045 set d_shm
19046 eval $setvar
19047
19048 : see if we have sigaction
19049 echo " "
19050 if set sigaction val -f d_sigaction; eval $csym; $val; then
19051         echo 'sigaction() found.' >&4
19052         $cat > try.c <<EOP
19053 #include <stdio.h>
19054 #include <sys/types.h>
19055 #include <signal.h>
19056 #$i_stdlib I_STDLIB
19057 #ifdef I_STDLIB
19058 #include <stdlib.h>
19059 #endif
19060 int main()
19061 {
19062     struct sigaction act, oact;
19063     act.sa_flags = 0;
19064     oact.sa_handler = 0;
19065     /* so that act and oact are used */
19066     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
19067 }
19068 EOP
19069         set try
19070         if eval $compile_ok; then
19071                 val="$define"
19072         else
19073                 echo "But you don't seem to have a usable struct sigaction." >&4
19074                 val="$undef"
19075         fi
19076 else
19077         echo 'sigaction NOT found.' >&4
19078         val="$undef"
19079 fi
19080 set d_sigaction; eval $setvar
19081 $rm_try
19082
19083 : see what type pids are declared as in the kernel
19084 rp="What is the type of process ids on this system?"
19085 set pid_t pidtype int stdio.h sys/types.h
19086 eval $typedef_ask
19087
19088 : see what type uids are declared as in the kernel
19089 echo " "
19090 echo "Looking for the type for user ids returned by getuid()."
19091 set uid_t uidtype xxx stdio.h sys/types.h
19092 eval $typedef
19093 case "$uidtype" in
19094 xxx)
19095         xxx=`./findhdr sys/user.h`
19096         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19097         case $1 in
19098         unsigned) dflt="$1 $2" ;;
19099         *) dflt="$1" ;;
19100         esac
19101         ;;
19102 *) dflt="$uidtype";;
19103 esac
19104 case "$uidtype" in
19105 uid_t)  echo "uid_t found." ;;
19106 *)      rp="What is the type for user ids returned by getuid()?"
19107         . ./myread
19108         uidtype="$ans"
19109         ;;
19110 esac
19111
19112 : Define hasfield_t macro for Configure internal use
19113 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
19114 while $test $# -ge 2; do
19115     case "$1" in
19116         $define) echo "#include <$2>";;
19117     esac ;
19118     shift 2;
19119 done > try.c;
19120 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
19121 set try;
19122 if eval $compile; then
19123         val="$define";
19124 else
19125         val="$undef";
19126 fi;
19127 set $varname;
19128 eval $setvar;
19129 $rm_try'
19130
19131 : see what siginfo fields we have
19132 case "$d_sigaction" in
19133 "$define")
19134         echo "Checking if your siginfo_t has si_errno field...">&4
19135         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
19136         eval $hasfield_t;
19137
19138         echo "Checking if your siginfo_t has si_pid field...">&4
19139         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
19140         eval $hasfield_t;
19141
19142         echo "Checking if your siginfo_t has si_uid field...">&4
19143         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
19144         eval $hasfield_t;
19145
19146         echo "Checking if your siginfo_t has si_addr field...">&4
19147         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
19148         eval $hasfield_t;
19149
19150         echo "Checking if your siginfo_t has si_status field...">&4
19151         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
19152         eval $hasfield_t;
19153
19154         echo "Checking if your siginfo_t has si_band field...">&4
19155         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
19156         eval $hasfield_t;
19157
19158         echo "Checking if your siginfo_t has si_value field...">&4
19159         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
19160         eval $hasfield_t;
19161
19162         echo "Checking if your siginfo_t has si_fd field...">&4
19163         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
19164         eval $hasfield_t;
19165
19166         ;;
19167 *)
19168         d_siginfo_si_errno="$undef"
19169         d_siginfo_si_pid="$undef"
19170         d_siginfo_si_uid="$undef"
19171         d_siginfo_si_addr="$undef"
19172         d_siginfo_si_status="$undef"
19173         d_siginfo_si_band="$undef"
19174         d_siginfo_si_value="$undef"
19175         d_siginfo_si_fd="$undef"
19176         ;;
19177 esac
19178
19179 : see if this is a sunmath.h system
19180 set sunmath.h i_sunmath
19181 eval $inhdr
19182
19183 : see if signbit exists
19184 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
19185 $cat >try.c <<EOCP
19186 #$i_sunmath I_SUNMATH
19187 #include <math.h>
19188 #ifdef I_SUNMATH  /* Solaris special math library */
19189 #  include <sunmath.h>
19190 #endif
19191 #define NV $nvtype
19192 int main(int argc, char **argv)
19193 {
19194     NV x = 0.0;
19195     NV y = -1.0;
19196     if ((signbit(x) == 0) && (signbit(y) != 0))
19197         return 0;
19198     else
19199         return 1;
19200 }
19201 EOCP
19202 val="$undef"
19203 set try
19204 if eval $compile; then
19205     if $run ./try; then
19206         $echo "Yes." >&4
19207         val="$define"
19208     else
19209         $echo "Signbit seems to be available, but doesn't work as I expected."
19210         $echo "I won't use it." >&4
19211         val="$undef"
19212     fi
19213 else
19214     $echo "Nope." >&4
19215     dflt="$undef"
19216 fi
19217 set d_signbit
19218 eval $setvar
19219 $rm_try
19220
19221 : see if sigprocmask exists
19222 set sigprocmask d_sigprocmask
19223 eval $inlibc
19224
19225 : see if sigsetjmp exists
19226 echo " "
19227 case "$d_sigsetjmp" in
19228 '')
19229         $cat >try.c <<EOP
19230 #include <setjmp.h>
19231 #$i_stdlib I_STDLIB
19232 #ifdef I_STDLIB
19233 #include <stdlib.h>
19234 #endif
19235 sigjmp_buf env;
19236 int set = 1;
19237 int main()
19238 {
19239         if (sigsetjmp(env,1))
19240                 exit(set);
19241         set = 0;
19242         siglongjmp(env, 1);
19243         exit(1);
19244 }
19245 EOP
19246         set try
19247         if eval $compile; then
19248                 if $run ./try >/dev/null 2>&1; then
19249                         echo "POSIX sigsetjmp found." >&4
19250                         val="$define"
19251                 else
19252                         $cat >&4 <<EOM
19253 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
19254 I'll ignore them.
19255 EOM
19256                         val="$undef"
19257                 fi
19258         else
19259                 echo "sigsetjmp not found." >&4
19260                 val="$undef"
19261         fi
19262         ;;
19263 *) val="$d_sigsetjmp"
19264         case "$d_sigsetjmp" in
19265         $define) echo "POSIX sigsetjmp found." >&4;;
19266         $undef) echo "sigsetjmp not found." >&4;;
19267         esac
19268         ;;
19269 esac
19270 set d_sigsetjmp
19271 eval $setvar
19272 $rm_try
19273
19274 : see if snprintf exists
19275 set snprintf d_snprintf
19276 eval $inlibc
19277
19278 : see if vsnprintf exists
19279 set vsnprintf d_vsnprintf
19280 eval $inlibc
19281
19282 case "$d_snprintf-$d_vsnprintf" in
19283 "$define-$define")
19284     $cat <<EOM
19285 Checking whether your snprintf() and vsnprintf() work okay...
19286 EOM
19287     $cat >try.c <<'EOCP'
19288 /* v?snprintf testing logic courtesy of Russ Allbery.
19289  * According to C99:
19290  * - if the buffer is too short it still must be \0-terminated
19291  * - if the buffer is too short the potentially required length
19292  *   must be returned and not -1
19293  * - if the buffer is NULL the potentially required length
19294  *   must be returned and not -1 or core dump
19295  */
19296 #include <stdio.h>
19297 #include <stdarg.h>
19298
19299 char buf[2];
19300
19301 int test (char *format, ...)
19302 {
19303     va_list args;
19304     int count;
19305
19306     va_start (args, format);
19307     count = vsnprintf (buf, sizeof buf, format, args);
19308     va_end (args);
19309     return count;
19310 }
19311
19312 int main ()
19313 {
19314     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
19315              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
19316 }
19317 EOCP
19318     set try
19319     if eval $compile; then
19320         `$run ./try`
19321         case "$?" in
19322         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
19323         *) cat <<EOM >&4
19324 Your snprintf() and snprintf() don't seem to be working okay.
19325 EOM
19326            d_snprintf="$undef"
19327            d_vsnprintf="$undef"
19328            ;;
19329         esac
19330     else
19331         echo "(I can't seem to compile the test program--assuming they don't)"
19332         d_snprintf="$undef"
19333         d_vsnprintf="$undef"
19334     fi
19335     $rm_try
19336     ;;
19337 esac
19338
19339 : see if sockatmark exists
19340 set sockatmark d_sockatmark
19341 eval $inlibc
19342
19343 : see if prototype for sockatmark is available
19344 echo " "
19345 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
19346 eval $hasproto
19347
19348 : see if socks5_init exists
19349 set socks5_init d_socks5_init
19350 eval $inlibc
19351
19352 : see if srand48_r exists
19353 set srand48_r d_srand48_r
19354 eval $inlibc
19355 case "$d_srand48_r" in
19356 "$define")
19357         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19358         case "$d_srand48_r_proto:$usethreads" in
19359         ":define")      d_srand48_r_proto=define
19360                 set d_srand48_r_proto srand48_r $hdrs
19361                 eval $hasproto ;;
19362         *)      ;;
19363         esac
19364         case "$d_srand48_r_proto" in
19365         define)
19366         case "$srand48_r_proto" in
19367         ''|0) try='int srand48_r(long, struct drand48_data*);'
19368         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
19369         esac
19370         case "$srand48_r_proto" in
19371         ''|0)   d_srand48_r=undef
19372                 srand48_r_proto=0
19373                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
19374         * )     case "$srand48_r_proto" in
19375                 REENTRANT_PROTO*) ;;
19376                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
19377                 esac
19378                 echo "Prototype: $try" ;;
19379         esac
19380         ;;
19381         *)      case "$usethreads" in
19382                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
19383                 esac
19384                 d_srand48_r=undef
19385                 srand48_r_proto=0
19386                 ;;
19387         esac
19388         ;;
19389 *)      srand48_r_proto=0
19390         ;;
19391 esac
19392
19393 : see if srandom_r exists
19394 set srandom_r d_srandom_r
19395 eval $inlibc
19396 case "$d_srandom_r" in
19397 "$define")
19398         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19399         case "$d_srandom_r_proto:$usethreads" in
19400         ":define")      d_srandom_r_proto=define
19401                 set d_srandom_r_proto srandom_r $hdrs
19402                 eval $hasproto ;;
19403         *)      ;;
19404         esac
19405         case "$d_srandom_r_proto" in
19406         define)
19407         case "$srandom_r_proto" in
19408         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
19409         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
19410         esac
19411         case "$srandom_r_proto" in
19412         ''|0)   d_srandom_r=undef
19413                 srandom_r_proto=0
19414                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
19415         * )     case "$srandom_r_proto" in
19416                 REENTRANT_PROTO*) ;;
19417                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
19418                 esac
19419                 echo "Prototype: $try" ;;
19420         esac
19421         ;;
19422         *)      case "$usethreads" in
19423                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
19424                 esac
19425                 d_srandom_r=undef
19426                 srandom_r_proto=0
19427                 ;;
19428         esac
19429         ;;
19430 *)      srandom_r_proto=0
19431         ;;
19432 esac
19433
19434 : see if prototype for setresgid is available
19435 echo " "
19436 set d_sresgproto setresgid $i_unistd unistd.h
19437 eval $hasproto
19438
19439 : see if prototype for setresuid is available
19440 echo " "
19441 set d_sresuproto setresuid $i_unistd unistd.h
19442 eval $hasproto
19443
19444 : see if stat exists
19445 set stat d_stat
19446 eval $inlibc
19447
19448 : see if sys/stat.h is available
19449 set sys/stat.h i_sysstat
19450 eval $inhdr
19451
19452 : see if stat knows about block sizes
19453 echo " "
19454 echo "Checking to see if your struct stat has st_blocks field..." >&4
19455 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19456 eval $hasfield
19457
19458 : see if this is a sys/vfs.h system
19459 set sys/vfs.h i_sysvfs
19460 eval $inhdr
19461
19462 : see if this is a sys/statfs.h system
19463 set sys/statfs.h i_sysstatfs
19464 eval $inhdr
19465
19466 : Check for statfs_s
19467 echo " "
19468 echo "Checking to see if your system supports struct statfs..." >&4
19469 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
19470 eval $hasstruct
19471 case "$d_statfs_s" in
19472 "$define")      echo "Yes, it does."   ;;
19473 *)              echo "No, it doesn't." ;;
19474 esac
19475
19476 : see if struct statfs knows about f_flags
19477 case "$d_statfs_s" in
19478 define)
19479         echo " "
19480         echo "Checking to see if your struct statfs has f_flags field..." >&4
19481         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
19482         eval $hasfield
19483         ;;
19484 *)      val="$undef"
19485         set d_statfs_f_flags
19486         eval $setvar
19487         ;;
19488 esac
19489 case "$d_statfs_f_flags" in
19490 "$define")      echo "Yes, it does."   ;;
19491 *)              echo "No, it doesn't." ;;
19492 esac
19493
19494 : see what flavor, if any, of static inline is supported
19495 echo " "
19496 echo "Checking to see if your system supports static inline..."
19497 $cat > try.c <<'EOCP'
19498 #include <stdlib.h>
19499 extern int f_via_a(int x);
19500 extern int f_via_b(int x);
19501 int main(int argc, char **argv)
19502 {
19503     int y;
19504
19505     y = f_via_a(0);
19506 #ifdef USE_B
19507     y = f_via_b(0);
19508 #endif
19509     if (y == 42) {
19510         return EXIT_SUCCESS;
19511     }
19512     else {
19513         return EXIT_FAILURE;
19514     }
19515 }
19516 EOCP
19517 $cat > a.c <<'EOCP'
19518 static INLINE int f(int x) {
19519     int y;
19520     y = x + 42;
19521     return y;
19522 }
19523
19524 int f_via_a(int x)
19525 {
19526     return f(x);
19527 }
19528 EOCP
19529 $cat > b.c <<'EOCP'
19530 extern int f(int x);
19531
19532 int f_via_b(int x)
19533 {
19534     return f(x);
19535 }
19536 EOCP
19537
19538 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19539 case "$perl_static_inline" in
19540 '')     # Check the various possibilities, and break out on success.
19541         # For gcc, prefer __inline__, which will still permit
19542         # cflags.SH to add in -ansi.
19543         case "$gccversion" in
19544                 '') xxx="inline __inline__ __inline _inline";;
19545                 *)  xxx="__inline__ inline __inline _inline";;
19546         esac
19547         for inline in $xxx; do
19548                 set try -DINLINE=$inline a.c
19549                 if eval $compile && $run ./try; then
19550                         # Now make sure there is no external linkage of static
19551                         # functions
19552                         set try -DINLINE=$inline -DUSE_B a.c b.c
19553                         if eval $compile && $run ./try; then
19554                                 $echo "Your compiler supports static $inline, " >&4
19555                                 $echo "but it also creates an external definition," >&4
19556                                 $echo "so I won't use it." >&4
19557                                 val=$undef
19558                         else
19559                                 $echo "Your compiler supports static $inline." >&4
19560                                 val=$define
19561                                 perl_static_inline="static $inline";
19562                                 break;
19563                         fi
19564                 else
19565                         $echo "Your compiler does NOT support static $inline." >&4
19566                         val="$undef"
19567                 fi
19568         done
19569         ;;
19570 *inline*) # Some variant of inline exists.
19571         echo "Keeping your $hint value of $perl_static_inline."
19572         val=$define
19573         ;;
19574 static)  # No inline capabilities
19575         echo "Keeping your $hint value of $perl_static_inline."
19576         val=$undef
19577         ;;
19578 *)  # Unrecognized previous value -- blindly trust the supplied
19579         # value and hope it makes sense.  Use old value for
19580         # d_static_inline, if there is one.
19581         echo "Keeping your $hint value of $perl_static_inline."
19582         case "$d_static_inline" in
19583                 '') val=$define ;;
19584                 *)  val=$d_static_inline ;;
19585         esac
19586         ;;
19587 esac
19588 # Fallback to plain 'static' if nothing worked.
19589 case "$perl_static_inline" in
19590 '')
19591         perl_static_inline="static"
19592         val=$undef
19593         ;;
19594 esac
19595 set d_static_inline
19596 eval $setvar
19597 $rm -f a.[co] b.[co]
19598 $rm_try
19599
19600 : Check stream access
19601 $cat >&4 <<EOM
19602 Checking how to access stdio streams by file descriptor number...
19603 EOM
19604 case "$stdio_stream_array" in
19605 '')     $cat >try.c <<EOCP
19606 #include <stdio.h>
19607 int main() {
19608   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19609     printf("yes\n");
19610 }
19611 EOCP
19612         for s in _iob __iob __sF
19613         do
19614                 set try -DSTDIO_STREAM_ARRAY=$s
19615                 if eval $compile; then
19616                         case "`$run ./try`" in
19617                         yes)    stdio_stream_array=$s; break ;;
19618                         esac
19619                 fi
19620         done
19621         $rm_try
19622 esac
19623 case "$stdio_stream_array" in
19624 '')     $cat >&4 <<EOM
19625 I can't figure out how to access stdio streams by file descriptor number.
19626 EOM
19627         d_stdio_stream_array="$undef"
19628         ;;
19629 *)      $cat >&4 <<EOM
19630 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19631 EOM
19632         d_stdio_stream_array="$define"
19633         ;;
19634 esac
19635
19636 : see if strcoll exists
19637 set strcoll d_strcoll
19638 eval $inlibc
19639
19640 : see if strerror_l exists
19641 set strerror_l d_strerror_l
19642 eval $inlibc
19643
19644 : see if strerror_r exists
19645 set strerror_r d_strerror_r
19646 eval $inlibc
19647 case "$d_strerror_r" in
19648 "$define")
19649         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
19650         case "$d_strerror_r_proto:$usethreads" in
19651         ":define")      d_strerror_r_proto=define
19652                 set d_strerror_r_proto strerror_r $hdrs
19653                 eval $hasproto ;;
19654         *)      ;;
19655         esac
19656         case "$d_strerror_r_proto" in
19657         define)
19658         case "$strerror_r_proto" in
19659         ''|0) try='int strerror_r(int, char*, size_t);'
19660         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19661         esac
19662         case "$strerror_r_proto" in
19663         ''|0) try='int strerror_r(int, char*, int);'
19664         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19665         esac
19666         case "$strerror_r_proto" in
19667         ''|0) try='char* strerror_r(int, char*, size_t);'
19668         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19669         esac
19670         case "$strerror_r_proto" in
19671         ''|0)   d_strerror_r=undef
19672                 strerror_r_proto=0
19673                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19674         * )     case "$strerror_r_proto" in
19675                 REENTRANT_PROTO*) ;;
19676                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19677                 esac
19678                 echo "Prototype: $try" ;;
19679         esac
19680         ;;
19681         *)      case "$usethreads" in
19682                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19683                 esac
19684                 d_strerror_r=undef
19685                 strerror_r_proto=0
19686                 ;;
19687         esac
19688         ;;
19689 *)      strerror_r_proto=0
19690         ;;
19691 esac
19692
19693 : see if strftime exists
19694 set strftime d_strftime
19695 eval $inlibc
19696
19697 : see if strlcat exists
19698 : We need both a prototype in string.h and the symbol in libc.
19699 echo " "
19700 d_strlcat_proto=''
19701 xx1="#$d_gnulibc HAS_GNULIBC"
19702 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19703 xx3='#   define _GNU_SOURCE'
19704 xx4='#endif'
19705 set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19706 eval $hasproto
19707 case "$d_strlcat_proto" in
19708     define) # see if strlcat exists
19709         set strlcat d_strlcat
19710         eval $inlibc
19711         ;;
19712     *)  val=$undef
19713         set d_strlcat
19714         eval $setvar
19715         ;;
19716 esac
19717
19718 : see if strlcpy exists
19719 : We need both a prototype in string.h and the symbol in libc.
19720 echo " "
19721 d_strlcpy_proto=''
19722 xx1="#$d_gnulibc HAS_GNULIBC"
19723 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19724 xx3='#   define _GNU_SOURCE'
19725 xx4='#endif'
19726 set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19727 eval $hasproto
19728 case "$d_strlcpy_proto" in
19729     define) # see if strlcpy exists
19730         set strlcpy d_strlcpy
19731         eval $inlibc
19732         ;;
19733     *)  val=$undef
19734         set d_strlcpy
19735         eval $setvar
19736         ;;
19737 esac
19738
19739 : see if strnlen exists
19740 set strnlen d_strnlen
19741 eval $inlibc
19742
19743 : see if strtod exists
19744 set strtod d_strtod
19745 eval $inlibc
19746
19747 : see if strtod_l exists
19748 set strtod_l d_strtod_l
19749 eval $inlibc
19750
19751 : see if strtol exists
19752 set strtol d_strtol
19753 eval $inlibc
19754
19755 : see if strtold exists
19756 set strtold d_strtold
19757 eval $inlibc
19758
19759 : see if strtold_l exists
19760 set strtold_l d_strtold_l
19761 eval $inlibc
19762
19763 : see if strtoll exists
19764 set strtoll d_strtoll
19765 eval $inlibc
19766
19767 case "$d_longlong-$d_strtoll" in
19768 "$define-$define")
19769         $cat <<EOM
19770 Checking whether your strtoll() works okay...
19771 EOM
19772         $cat >try.c <<'EOCP'
19773 #include <errno.h>
19774 #ifdef __hpux
19775 #define strtoll __strtoll
19776 #endif
19777 #ifdef __EMX__
19778 #define strtoll _strtoll
19779 #endif
19780 #include <stdio.h>
19781 #include <stdlib.h>
19782 static int bad = 0;
19783 void check(const char *s, long long ell, int een) {
19784         long long gll;
19785         errno = 0;
19786         gll = strtoll(s, 0, 10);
19787         if (!((gll == ell) && (errno == een)))
19788                 bad++;
19789 }
19790 int main() {
19791         check(" 1",                                      1LL, 0);
19792         check(" 0",                                      0LL, 0);
19793         check("-1",                                     -1LL, 0);
19794         check("-9223372036854775808", -9223372036854775808LL, 0);
19795         check("-9223372036854775808", -9223372036854775808LL, 0);
19796         check(" 9223372036854775807",  9223372036854775807LL, 0);
19797         check("-9223372036854775808", -9223372036854775808LL, 0);
19798         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19799         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19800         if (!bad)
19801                 printf("ok\n");
19802 }
19803 EOCP
19804         set try
19805         if eval $compile; then
19806                 yyy=`$run ./try`
19807                 case "$yyy" in
19808                 ok) echo "Your strtoll() seems to be working okay." ;;
19809                 *) cat <<EOM >&4
19810 Your strtoll() doesn't seem to be working okay.
19811 EOM
19812                    d_strtoll="$undef"
19813                    ;;
19814                 esac
19815         else
19816                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19817                 d_strtoll="$undef"
19818         fi
19819         ;;
19820 esac
19821
19822 : see if strtoq exists
19823 set strtoq d_strtoq
19824 eval $inlibc
19825
19826 : see if strtoul exists
19827 set strtoul d_strtoul
19828 eval $inlibc
19829
19830 case "$d_strtoul" in
19831 "$define")
19832         $cat <<EOM
19833 Checking whether your strtoul() works okay...
19834 EOM
19835         $cat >try.c <<'EOCP'
19836 #include <stdlib.h>
19837 #include <errno.h>
19838 #include <stdio.h>
19839 static int bad = 0;
19840 void check(const char *s, unsigned long eul, int een) {
19841         unsigned long gul;
19842         errno = 0;
19843         gul = strtoul(s, 0, 10);
19844         if (!((gul == eul) && (errno == een)))
19845                 bad++;
19846 }
19847 int main() {
19848         check(" 1", 1L, 0);
19849         check(" 0", 0L, 0);
19850 EOCP
19851         case "$longsize" in
19852         8)
19853             $cat >>try.c <<'EOCP'
19854         check("18446744073709551615", 18446744073709551615UL, 0);
19855         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19856 #if 0 /* strtoul() for /^-/ strings is undefined. */
19857         check("-1", 18446744073709551615UL, 0);
19858         check("-18446744073709551614", 2, 0);
19859         check("-18446744073709551615", 1, 0);
19860         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19861         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19862 #endif
19863 EOCP
19864                 ;;
19865         4)
19866                     $cat >>try.c <<'EOCP'
19867         check("4294967295", 4294967295UL, 0);
19868         check("4294967296", 4294967295UL, ERANGE);
19869 #if 0 /* strtoul() for /^-/ strings is undefined. */
19870         check("-1", 4294967295UL, 0);
19871         check("-4294967294", 2, 0);
19872         check("-4294967295", 1, 0);
19873         check("-4294967296", 4294967295UL, ERANGE);
19874         check("-4294967297", 4294967295UL, ERANGE);
19875 #endif
19876 EOCP
19877                 ;;
19878         *)
19879 : Should we write these tests to be more portable by sprintf-ing
19880 : ~0 and then manipulating that char string as input for strtol?
19881                 ;;
19882         esac
19883         $cat >>try.c <<'EOCP'
19884         if (!bad)
19885                 printf("ok\n");
19886         return 0;
19887 }
19888 EOCP
19889         set try
19890         if eval $compile; then
19891                 case "`$run ./try`" in
19892                 ok) echo "Your strtoul() seems to be working okay." ;;
19893                 *) cat <<EOM >&4
19894 Your strtoul() doesn't seem to be working okay.
19895 EOM
19896                    d_strtoul="$undef"
19897                    ;;
19898                 esac
19899         else
19900                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19901                 d_strtoul="$undef"
19902         fi
19903         ;;
19904 esac
19905
19906 : see if strtoull exists
19907 set strtoull d_strtoull
19908 eval $inlibc
19909
19910 case "$d_longlong-$d_strtoull" in
19911 "$define-$define")
19912         $cat <<EOM
19913 Checking whether your strtoull() works okay...
19914 EOM
19915         $cat >try.c <<'EOCP'
19916 #include <stdlib.h>
19917 #include <errno.h>
19918 #ifdef __hpux
19919 #define strtoull __strtoull
19920 #endif
19921 #include <stdio.h>
19922 static int bad = 0;
19923 void check(const char *s, long long eull, int een) {
19924         long long gull;
19925         errno = 0;
19926         gull = strtoull(s, 0, 10);
19927         if (!((gull == eull) && (errno == een)))
19928                 bad++;
19929 }
19930 int main() {
19931         check(" 1",                                        1LL, 0);
19932         check(" 0",                                        0LL, 0);
19933         check("18446744073709551615",  18446744073709551615ULL, 0);
19934         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19935 #if 0 /* strtoull() for /^-/ strings is undefined. */
19936         check("-1",                    18446744073709551615ULL, 0);
19937         check("-18446744073709551614",                     2LL, 0);
19938         check("-18446744073709551615",                     1LL, 0);
19939         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19940         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19941 #endif
19942         if (!bad)
19943                 printf("ok\n");
19944 }
19945 EOCP
19946         set try
19947         if eval $compile; then
19948                 case "`$run ./try`" in
19949                 ok) echo "Your strtoull() seems to be working okay." ;;
19950                 *) cat <<EOM >&4
19951 Your strtoull() doesn't seem to be working okay.
19952 EOM
19953                    d_strtoull="$undef"
19954                    ;;
19955                 esac
19956         else
19957                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19958                 d_strtoull="$undef"
19959         fi
19960         ;;
19961 esac
19962
19963 : see if strtouq exists
19964 set strtouq d_strtouq
19965 eval $inlibc
19966
19967 case "$d_strtouq" in
19968 "$define")
19969         $cat <<EOM
19970 Checking whether your strtouq() works okay...
19971 EOM
19972         $cat >try.c <<'EOCP'
19973 #include <stdlib.h>
19974 #include <errno.h>
19975 #include <stdio.h>
19976 static int bad = 0;
19977 void check(const char *s, unsigned long long eull, int een) {
19978         unsigned long long gull;
19979         errno = 0;
19980         gull = strtouq(s, 0, 10);
19981         if (!((gull == eull) && (errno == een)))
19982                 bad++;
19983 }
19984 int main() {
19985         check(" 1",                                        1LL, 0);
19986         check(" 0",                                        0LL, 0);
19987         check("18446744073709551615",  18446744073709551615ULL, 0);
19988         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19989 #if 0 /* strtouq() for /^-/ strings is undefined. */
19990         check("-1",                    18446744073709551615ULL, 0);
19991         check("-18446744073709551614",                     2LL, 0);
19992         check("-18446744073709551615",                     1LL, 0);
19993         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19994         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19995 #endif
19996         if (!bad)
19997                 printf("ok\n");
19998         return 0;
19999 }
20000 EOCP
20001         set try
20002         if eval $compile; then
20003                 case "`$run ./try`" in
20004                 ok) echo "Your strtouq() seems to be working okay." ;;
20005                 *) cat <<EOM >&4
20006 Your strtouq() doesn't seem to be working okay.
20007 EOM
20008                    d_strtouq="$undef"
20009                    ;;
20010                 esac
20011         else
20012                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20013                 d_strtouq="$undef"
20014         fi
20015         ;;
20016 esac
20017
20018 : see if strxfrm exists
20019 set strxfrm d_strxfrm
20020 eval $inlibc
20021
20022 : see if strxfrm_l exists
20023 set strxfrm_l d_strxfrm_l
20024 eval $inlibc
20025
20026 : see if symlink exists
20027 set symlink d_symlink
20028 eval $inlibc
20029
20030 : see if syscall exists
20031 set syscall d_syscall
20032 eval $inlibc
20033
20034 : see if this is a sys/syscall.h system
20035 set sys/syscall.h i_syssyscall
20036 eval $inhdr
20037
20038 : see if prototype for syscall is available
20039 echo " "
20040 set d_syscallproto syscall $i_unistd unistd.h $i_syssyscall sys/syscall.h
20041 eval $hasproto
20042
20043 : see if sysconf exists
20044 set sysconf d_sysconf
20045 eval $inlibc
20046
20047 : see if sys_errlist[] exists
20048 echo " "
20049 if test "X$d_syserrlst" = X; then
20050         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
20051                 echo "You have sys_errlist[], so we could roll our own strerror."
20052                 d_syserrlst="$define"
20053         else
20054                 echo "You don't have sys_errlist[], so strerror() is welcome."
20055                 d_syserrlst="$undef"
20056         fi
20057 fi
20058
20059 : see if system exists
20060 set system d_system
20061 eval $inlibc
20062
20063 : see if tcgetpgrp exists
20064 set tcgetpgrp d_tcgetpgrp
20065 eval $inlibc
20066
20067 : see if tcsetpgrp exists
20068 set tcsetpgrp d_tcsetpgrp
20069 eval $inlibc
20070
20071 : see if prototype for telldir is available
20072 echo " "
20073 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
20074 eval $hasproto
20075
20076 : see if tgamma exists
20077 set tgamma d_tgamma
20078 eval $inlibc
20079
20080 : see what flavor, if any, of thread local storage is supported
20081 echo " "
20082 echo "Checking to see if your system supports C11 thread local storage..."
20083 $cat > try.c <<'EOCP'
20084 #include <stdio.h>
20085 #include <stdlib.h>
20086 #include <pthread.h>
20087
20088 static int plus_one = 1;
20089 static int minus_one = -1;
20090
20091 PROBE_MACRO int *minion;
20092
20093 int callback (const void *a, const void *b) {
20094     int val_a = *minion * *(const int *)a;
20095     int val_b = *minion * *(const int *)b;
20096     return val_a < val_b ? -1 : val_a > val_b;
20097 }
20098
20099 #define SIZE 8
20100
20101 void *thread_function(void *arg) {
20102     /* thread local variables should start zeroed in each thread. */
20103     if (minion != NULL) {
20104         fprintf(stderr, "__thread variable started with %p, should be NULL\n",
20105                 minion);
20106         exit(2);
20107     }
20108     minion = &minus_one;
20109
20110     int array[SIZE];
20111     unsigned int i;
20112     for (i = 0; i < SIZE; ++i) {
20113         /* "Hash randomisation" - this array isn't in sorted order: */
20114         array[i ^ 5] = i * i;
20115     }
20116
20117     qsort(array, SIZE, sizeof(int), callback);
20118
20119     int bad = 0;
20120     for (i = 0; i < SIZE; ++i) {
20121         int want = (SIZE - 1 - i) * (SIZE - 1 - i);
20122         int have = array[i];
20123         if (want != have) {
20124             ++bad;
20125             fprintf(stderr, "array[%u] - want %i, have %i\n", i, want, have);
20126         }
20127     }
20128     if (bad)
20129         exit(3);
20130
20131     return NULL;
20132 }
20133
20134 int main(int argc, char **argv) {
20135     if (minion != NULL) {
20136         fprintf(stderr, "__thread variable started with %p, should be NULL\n",
20137                 minion);
20138         exit(4);
20139     }
20140
20141     minion = &plus_one;
20142
20143     pthread_t tid;
20144     int result = pthread_create(&tid, NULL, thread_function, NULL);
20145     if (result) {
20146         fprintf(stderr, "pthread_create failed (%d)\n", result);
20147         exit(5);
20148     }
20149
20150     result = pthread_join(tid, NULL);
20151     if (result) {
20152         fprintf(stderr, "pthread_join failed (%d)\n", result);
20153         exit(6);
20154     }
20155
20156     if (minion == NULL) {
20157         fprintf(stderr, "__thread variable should not be NULL\n");
20158         exit(7);
20159     }
20160     if (!(minion == &plus_one && *minion == 1)) {
20161         fprintf(stderr, "__thread variable should be %d @ %p, not %d @ %p\n",
20162                 1, &plus_one, *minion, minion);
20163         exit(8);
20164     }
20165
20166     return 0;
20167 }
20168 EOCP
20169
20170 # Respect a hint (or previous) value for perl_thread_local, if there is one.
20171 case "$perl_thread_local" in
20172 '')     # Check the various possibilities, and break out on success.
20173         for thread_local in _Thread_local __thread; do
20174                 set try -DPROBE_MACRO=$thread_local
20175                 if eval $compile && $run ./try; then
20176                         $echo "Your compiler supports $thread_local." >&4
20177                         val=$define
20178                         perl_thread_local="$thread_local";
20179                         break;
20180                 fi
20181                 $echo "Your compiler does NOT support $thread_local." >&4
20182                 val="$undef"
20183         done
20184         ;;
20185 *thread*|*Thread*) # Some variant of thread local exists.
20186         echo "Keeping your $hint value of $perl_thread_local."
20187         val=$define
20188         ;;
20189 *)  # Unrecognized previous value -- blindly trust the supplied
20190         # value and hope it makes sense.  Use old value for
20191         # d_thread_local, if there is one.
20192         echo "Keeping your $hint value of $perl_thread_local."
20193         case "$d_thread_local" in
20194                 '') val=$define ;;
20195                 *)  val=$d_thread_local ;;
20196         esac
20197         ;;
20198 esac
20199 set d_thread_local
20200 eval $setvar
20201 $rm_try
20202
20203 : see if time exists
20204 echo " "
20205 if test "X$d_time" = X -o X"$timetype" = X; then
20206     if set time val -f d_time; eval $csym; $val; then
20207                 echo 'time() found.' >&4
20208                 val="$define"
20209                 rp="What is the type returned by time() on this system?"
20210                 set time_t timetype long stdio.h sys/types.h
20211                 eval $typedef_ask
20212     else
20213                 echo 'time() not found, hope that will do.' >&4
20214                 val="$undef"
20215                 timetype='int';
20216     fi
20217     set d_time
20218     eval $setvar
20219 fi
20220
20221 : see if timegm exists
20222 set timegm d_timegm
20223 eval $inlibc
20224
20225 : see if this is a sys/times.h system
20226 set sys/times.h i_systimes
20227 eval $inhdr
20228
20229 : see if times exists
20230 echo " "
20231 if set times val -f d_times; eval $csym; $val; then
20232         echo 'times() found.' >&4
20233         d_times="$define"
20234         inc=''
20235         case "$i_systimes" in
20236         "$define") inc='sys/times.h';;
20237         esac
20238         rp="What is the type returned by times() on this system?"
20239         set clock_t clocktype long stdio.h sys/types.h $inc
20240         eval $typedef_ask
20241 else
20242         echo 'times() NOT found, hope that will do.' >&4
20243         d_times="$undef"
20244         clocktype='int'
20245 fi
20246
20247 : see if tmpnam_r exists
20248 set tmpnam_r d_tmpnam_r
20249 eval $inlibc
20250 case "$d_tmpnam_r" in
20251 "$define")
20252         hdrs="$i_systypes sys/types.h define stdio.h "
20253         case "$d_tmpnam_r_proto:$usethreads" in
20254         ":define")      d_tmpnam_r_proto=define
20255                 set d_tmpnam_r_proto tmpnam_r $hdrs
20256                 eval $hasproto ;;
20257         *)      ;;
20258         esac
20259         case "$d_tmpnam_r_proto" in
20260         define)
20261         case "$tmpnam_r_proto" in
20262         ''|0) try='char* tmpnam_r(char*);'
20263         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
20264         esac
20265         case "$tmpnam_r_proto" in
20266         ''|0)   d_tmpnam_r=undef
20267                 tmpnam_r_proto=0
20268                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
20269         * )     case "$tmpnam_r_proto" in
20270                 REENTRANT_PROTO*) ;;
20271                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
20272                 esac
20273                 echo "Prototype: $try" ;;
20274         esac
20275         ;;
20276         *)      case "$usethreads" in
20277                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
20278                 esac
20279                 d_tmpnam_r=undef
20280                 tmpnam_r_proto=0
20281                 ;;
20282         esac
20283         ;;
20284 *)      tmpnam_r_proto=0
20285         ;;
20286 esac
20287
20288 : see if towlower exists
20289 set towlower d_towlower
20290 eval $inlibc
20291
20292 : see if trunc exists
20293 set trunc d_trunc
20294 eval $inlibc
20295
20296 : see if truncate exists
20297 set truncate d_truncate
20298 eval $inlibc
20299
20300 : see if ttyname_r exists
20301 set ttyname_r d_ttyname_r
20302 eval $inlibc
20303 case "$d_ttyname_r" in
20304 "$define")
20305         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
20306         case "$d_ttyname_r_proto:$usethreads" in
20307         ":define")      d_ttyname_r_proto=define
20308                 set d_ttyname_r_proto ttyname_r $hdrs
20309                 eval $hasproto ;;
20310         *)      ;;
20311         esac
20312         case "$d_ttyname_r_proto" in
20313         define)
20314         case "$ttyname_r_proto" in
20315         ''|0) try='int ttyname_r(int, char*, size_t);'
20316         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
20317         esac
20318         case "$ttyname_r_proto" in
20319         ''|0) try='int ttyname_r(int, char*, int);'
20320         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
20321         esac
20322         case "$ttyname_r_proto" in
20323         ''|0) try='char* ttyname_r(int, char*, int);'
20324         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
20325         esac
20326         case "$ttyname_r_proto" in
20327         ''|0)   d_ttyname_r=undef
20328                 ttyname_r_proto=0
20329                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
20330         * )     case "$ttyname_r_proto" in
20331                 REENTRANT_PROTO*) ;;
20332                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
20333                 esac
20334                 echo "Prototype: $try" ;;
20335         esac
20336         ;;
20337         *)      case "$usethreads" in
20338                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
20339                 esac
20340                 d_ttyname_r=undef
20341                 ttyname_r_proto=0
20342                 ;;
20343         esac
20344         ;;
20345 *)      ttyname_r_proto=0
20346         ;;
20347 esac
20348
20349 : see if tzname[] exists
20350 echo " "
20351 if set tzname val -a d_tzname; eval $csym; $val; then
20352         val="$define"
20353         echo 'tzname[] found.' >&4
20354 else
20355         val="$undef"
20356         echo 'tzname[] NOT found.' >&4
20357 fi
20358 set d_tzname
20359 eval $setvar
20360
20361 : Check if is a multiplatform env
20362 case "$osname" in
20363 darwin) multiarch="$define" ;;
20364 esac
20365 case "$multiarch" in
20366 ''|[nN]*) multiarch="$undef" ;;
20367 esac
20368
20369 : check for ordering of bytes in a UV
20370 echo " "
20371 case "$multiarch" in
20372 *$define*)
20373         $cat <<EOM
20374 You seem to be doing a multiarchitecture build,
20375 skipping the byteorder check.
20376
20377 EOM
20378         byteorder='ffff'
20379         ;;
20380 *)
20381         case "$byteorder" in
20382         '')
20383                 $cat <<'EOM'
20384 In the following, larger digits indicate more significance.  A big-endian
20385 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
20386 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
20387 machines may have weird orders like 3412.  A Cray will report 87654321,
20388 an Alpha will report 12345678. If the test program works the default is
20389 probably right.
20390 I'm now running the test program...
20391 EOM
20392                 $cat >try.c <<EOCP
20393 #include <stdio.h>
20394 #$i_stdlib I_STDLIB
20395 #ifdef I_STDLIB
20396 #include <stdlib.h>
20397 #endif
20398 #$i_inttypes I_INTTYPES
20399 #ifdef I_INTTYPES
20400 #include <inttypes.h>
20401 #endif
20402 #include <sys/types.h>
20403 typedef $uvtype UV;
20404 int main()
20405 {
20406         int i;
20407         union {
20408                 UV l;
20409                 char c[$uvsize];
20410         } u;
20411
20412         if ($uvsize > 4)
20413                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
20414         else
20415                 u.l = (UV)0x04030201;
20416         for (i = 0; i < $uvsize; i++)
20417                 printf("%c", u.c[i]+'0');
20418         printf("\n");
20419         exit(0);
20420 }
20421 EOCP
20422                 xxx_prompt=y
20423                 set try
20424                 if eval $compile && $run ./try > /dev/null; then
20425                         dflt=`$run ./try`
20426                         case "$dflt" in
20427                         [1-4][1-4][1-4][1-4]|12345678|87654321)
20428                                 echo "(The test program ran ok.)"
20429                                 echo "byteorder=$dflt"
20430                                 xxx_prompt=n
20431                         ;;
20432                         ????|????????) echo "(The test program ran ok.)" ;;
20433                         *) echo "(The test program didn't run right for some reason.)" ;;
20434                         esac
20435                 else
20436                         dflt='4321'
20437                         cat <<'EOM'
20438 (I can't seem to compile the test program.  Guessing big-endian...)
20439 EOM
20440                 fi
20441                 case "$xxx_prompt" in
20442                 y)
20443                         rp="What is the order of bytes in $uvtype?"
20444                         . ./myread
20445                         byteorder="$ans"
20446                         ;;
20447                 *)      byteorder=$dflt
20448                         ;;
20449                 esac
20450                 ;;
20451         esac
20452         $rm_try
20453         ;;
20454 esac
20455
20456 : Checking 32bit alignedness
20457 $cat <<EOM
20458
20459 Checking to see whether you can access character data unalignedly...
20460 EOM
20461 case "$d_u32align" in
20462 '')   $cat >try.c <<EOCP
20463 #include <stdio.h>
20464 #$i_stdlib I_STDLIB
20465 #ifdef I_STDLIB
20466 #include <stdlib.h>
20467 #endif
20468 #define U32 $u32type
20469 #define BYTEORDER 0x$byteorder
20470 #define U8 $u8type
20471 #include <signal.h>
20472 #ifdef SIGBUS
20473 $signal_t bletch(int s) { exit(4); }
20474 #endif
20475 int main() {
20476 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
20477     volatile U8 buf[8];
20478     volatile U32 *up;
20479     int i;
20480
20481     if (sizeof(U32) != 4) {
20482         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
20483         exit(1);
20484     }
20485
20486     fflush(stdout);
20487
20488 #ifdef SIGBUS
20489     signal(SIGBUS, bletch);
20490 #endif
20491
20492     buf[0] = 0;
20493     buf[1] = 0;
20494     buf[2] = 0;
20495     buf[3] = 1;
20496     buf[4] = 0;
20497     buf[5] = 0;
20498     buf[6] = 0;
20499     buf[7] = 1;
20500
20501     for (i = 0; i < 4; i++) {
20502         up = (U32*)(buf + i);
20503         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
20504                (*up == 1 << (8*(3-i)))  /* little-endian */
20505               )
20506            )
20507         {
20508             printf("read failed (%x)\n", *up);
20509             exit(2);
20510         }
20511     }
20512
20513     /* write test */
20514     for (i = 0; i < 4; i++) {
20515         up = (U32*)(buf + i);
20516         *up = 0xBeef;
20517         if (*up != 0xBeef) {
20518             printf("write failed (%x)\n", *up);
20519             exit(3);
20520         }
20521     }
20522
20523     exit(0);
20524 #else
20525     printf("1\n");
20526     exit(1);
20527 #endif
20528     return 0;
20529 }
20530 EOCP
20531 set try
20532 if eval $compile_ok; then
20533         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
20534         $run ./try 2>&1 >/dev/null
20535         case "$?" in
20536         0)      cat >&4 <<EOM
20537 You can access character data pretty unalignedly.
20538 EOM
20539                 d_u32align="$undef"
20540                 ;;
20541         *)      cat >&4 <<EOM
20542 It seems that you must access character data in an aligned manner.
20543 EOM
20544                 d_u32align="$define"
20545                 ;;
20546         esac
20547 else
20548         rp='Can you access character data at unaligned addresses?'
20549         dflt='n'
20550         . ./myread
20551         case "$ans" in
20552         [yY]*)  d_u32align="$undef"  ;;
20553         *)      d_u32align="$define" ;;
20554         esac
20555 fi
20556 $rm_try
20557 ;;
20558 esac
20559
20560 : see if ualarm exists
20561 set ualarm d_ualarm
20562 eval $inlibc
20563
20564 : see if umask exists
20565 set umask d_umask
20566 eval $inlibc
20567
20568 : see if unordered exists
20569 set unordered d_unordered
20570 eval $inlibc
20571
20572 : see if unsetenv exists
20573 set unsetenv d_unsetenv
20574 eval $inlibc
20575
20576 : see if usleep exists
20577 set usleep d_usleep
20578 eval $inlibc
20579
20580 : see if prototype for usleep is available
20581 echo " "
20582 set d_usleepproto usleep $i_unistd unistd.h
20583 eval $hasproto
20584
20585 : see if ustat exists
20586 set ustat d_ustat
20587 eval $inlibc
20588
20589 : see if closedir exists
20590 set closedir d_closedir
20591 eval $inlibc
20592
20593 case "$d_closedir" in
20594 "$define")
20595         echo " "
20596         echo "Checking whether closedir() returns a status..." >&4
20597         cat > try.c <<EOM
20598 #$i_dirent I_DIRENT             /**/
20599 #$i_sysdir I_SYS_DIR            /**/
20600 #$i_sysndir I_SYS_NDIR          /**/
20601 #$i_systypes I_SYS_TYPES        /**/
20602
20603 #if defined(I_SYS_TYPES)
20604 #include <sys/types.h>
20605 #endif
20606 #if defined(I_DIRENT)
20607 #include <dirent.h>
20608 #else
20609 #ifdef I_SYS_NDIR
20610 #include <sys/ndir.h>
20611 #else
20612 #ifdef I_SYS_DIR
20613 #include <sys/dir.h>
20614 #endif
20615 #endif
20616 #endif
20617 int main() { return closedir(opendir(".")); }
20618 EOM
20619         set try
20620         if eval $compile_ok; then
20621                 if $run ./try > /dev/null 2>&1 ; then
20622                         echo "Yes, it does."
20623                         val="$undef"
20624                 else
20625                         echo "No, it doesn't."
20626                         val="$define"
20627                 fi
20628         else
20629                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20630                 val="$define"
20631         fi
20632         ;;
20633 *)
20634         val="$undef";
20635         ;;
20636 esac
20637 set d_void_closedir
20638 eval $setvar
20639 $rm_try
20640
20641 : see if there is a wait4
20642 set wait4 d_wait4
20643 eval $inlibc
20644
20645 : see if waitpid exists
20646 set waitpid d_waitpid
20647 eval $inlibc
20648
20649 : see if wcrtomb exists
20650 set wcrtomb d_wcrtomb
20651 eval $inlibc
20652
20653 : look for wcscmp
20654 echo " "
20655 $cat >try.c <<'EOCP'
20656 #include <stdio.h>
20657 #include <wchar.h>
20658 int main ()
20659 {
20660     wchar_t *s = L" ";
20661     return (wcscmp (s, s) ? 1 : 0);
20662     }
20663 EOCP
20664 set try
20665 val="$undef"
20666 if eval $compile; then
20667     `$run ./try`
20668     case "$?" in
20669         0)  echo "A working wcscmp() found." >&4
20670             val="$define" ;;
20671         *)  echo "wcscmp() found, but it doesn't work" >&4
20672             ;;
20673         esac
20674 else
20675     echo "wcscmp() NOT found." >&4
20676     fi
20677 set d_wcscmp
20678 eval $setvar
20679 $rm_try
20680
20681 : see if wcstombs exists
20682 set wcstombs d_wcstombs
20683 eval $inlibc
20684
20685 : look for wcsxfrm
20686 echo " "
20687 $cat >try.c <<'EOCP'
20688 #include <errno.h>
20689 #include <wchar.h>
20690 int main ()
20691 {
20692     wchar_t dst[4], *src = L" ";
20693     errno = 0;
20694     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20695     }
20696 EOCP
20697 set try
20698 val="$undef"
20699 if eval $compile; then
20700     `$run ./try`
20701     case "$?" in
20702         0)  echo "A working wcsxfrm() found." >&4
20703             val="$define" ;;
20704         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20705             ;;
20706         esac
20707 else
20708     echo "wcsxfrm() NOT found." >&4
20709     fi
20710 set d_wcsxfrm
20711 eval $setvar
20712 $rm_try
20713
20714 : see if wctomb exists
20715 set wctomb d_wctomb
20716 eval $inlibc
20717
20718 : see if writev exists
20719 set writev d_writev
20720 eval $inlibc
20721
20722 : check for alignment requirements
20723 echo " "
20724 case "$alignbytes" in
20725     '') echo "Checking alignment constraints..." >&4
20726         $cat >try.c <<EOCP
20727 #include <stdio.h>
20728 struct foobar {
20729     char foo;
20730     $nvtype bar;
20731 } try_algn;
20732 int main()
20733 {
20734     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20735     return(0);
20736 }
20737 EOCP
20738         set try
20739         if eval $compile_ok; then
20740             dflt=`$run ./try`
20741         else
20742             dflt='8'
20743             echo "(I can't seem to compile the test program...)"
20744         fi
20745         case "$multiarch" in
20746             *$define*)
20747                 : The usual safe value is 8, but Darwin with -Duselongdouble
20748                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20749                 : Configure to pick a larger value if needed.
20750                 if $test "$dflt" -lt 8; then
20751                     dflt='8'
20752                     echo "Setting alignment to 8 for multiarch support.">&4
20753                 fi
20754                 ;;
20755         esac
20756         ;;
20757     *) dflt="$alignbytes"
20758         ;;
20759 esac
20760 rp="Doubles must be aligned on a how-many-byte boundary?"
20761 . ./myread
20762 alignbytes="$ans"
20763 $rm_try
20764
20765 : set the base revision
20766 baserev=5.0
20767
20768 : length of character in bytes. Is always 1, otherwise it is not C
20769 : This used to be a test using sizeof
20770 charsize=1
20771
20772 : Check for the number of bits in a character
20773 case "$charbits" in
20774 '')     echo "Checking how long a character is (in bits)..." >&4
20775         $cat >try.c <<EOCP
20776 #include <stdio.h>
20777 int main ()
20778 {
20779     int n;
20780     unsigned char c;
20781     for (c = 1, n = 0; c; c <<= 1, n++) ;
20782     printf ("%d\n", n);
20783     return (0);
20784     }
20785 EOCP
20786         set try
20787         if eval $compile_ok; then
20788                 dflt=`$run ./try`
20789         else
20790                 dflt='8'
20791                 echo "(I can't seem to compile the test program.  Guessing...)"
20792         fi
20793         ;;
20794 *)
20795         dflt="$charbits"
20796         ;;
20797 esac
20798 rp="What is the length of a character (in bits)?"
20799 . ./myread
20800 charbits="$ans"
20801 $rm_try
20802 case "$charbits" in
20803 8)      ;;
20804 *)      cat >&4 << EOM
20805 Your system has an unsigned character size of $charbits bits, which
20806 is rather unusual (normally it is 8 bits).  Perl likely will not work
20807 correctly on your system, with subtle bugs in various places.
20808 EOM
20809         rp='Do you really want to continue?'
20810         dflt='n'
20811         . ./myread
20812         case "$ans" in
20813                 [yY])   echo >&4 "Okay, continuing."    ;;
20814                 *)      exit 1                          ;;
20815         esac
20816 esac
20817
20818 : how do we concatenate cpp tokens here?
20819 echo " "
20820 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20821 $cat >cpp_stuff.c <<'EOCP'
20822 #define RCAT(a,b)a/**/b
20823 #define ACAT(a,b)a ## b
20824 RCAT(Rei,ser)
20825 ACAT(Cir,cus)
20826 EOCP
20827 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20828 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20829         echo "Oh!  Smells like ANSI's been here." >&4
20830         echo "We can catify or stringify, separately or together!"
20831         cpp_stuff=42
20832 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20833         echo "Ah, yes!  The good old days!" >&4
20834         echo "However, in the good old days we don't know how to stringify and"
20835         echo "catify at the same time."
20836         cpp_stuff=1
20837 else
20838         $cat >&4 <<EOM
20839 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20840 You're going to have to edit the values of CAT[2-5] in config.h...
20841 EOM
20842         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20843 fi
20844 $rm -f cpp_stuff.*
20845
20846 : see if this is a db.h system
20847 set db.h i_db
20848 eval $inhdr
20849
20850 case "$i_db" in
20851 $define)
20852         : Check db version.
20853         echo " "
20854         echo "Checking Berkeley DB version ..." >&4
20855         $cat >try.c <<EOCP
20856 #include <sys/types.h>
20857 #include <stdio.h>
20858 #$i_stdlib I_STDLIB
20859 #ifdef I_STDLIB
20860 #include <stdlib.h>
20861 #endif
20862 #include <db.h>
20863 int main(int argc, char *argv[])
20864 {
20865 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20866     int Major, Minor, Patch ;
20867     unsigned long Version ;
20868     (void)db_version(&Major, &Minor, &Patch) ;
20869     if (argc == 2) {
20870         printf("%d %d %d %d %d %d\n",
20871                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20872                Major, Minor, Patch);
20873         exit(0);
20874     }
20875     printf("You have Berkeley DB Version 2 or greater.\n");
20876
20877     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20878                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20879     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20880                 Major, Minor, Patch) ;
20881
20882     /* check that db.h & libdb are compatible */
20883     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20884         printf("db.h and libdb are incompatible.\n") ;
20885         exit(3);
20886     }
20887
20888     printf("db.h and libdb are compatible.\n") ;
20889
20890     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20891                 + DB_VERSION_PATCH ;
20892
20893     /* needs to be >= 2.3.4 */
20894     if (Version < 2003004) {
20895     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20896         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20897         exit(2);
20898     }
20899
20900     exit(0);
20901 #else
20902 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20903     if (argc == 2) {
20904         printf("1 0 0\n");
20905         exit(0);
20906     }
20907     printf("You have Berkeley DB Version 1.\n");
20908     exit(0);    /* DB version < 2: the coast is clear. */
20909 #else
20910     exit(1);    /* <db.h> not Berkeley DB? */
20911 #endif
20912 #endif
20913 }
20914 EOCP
20915         set try
20916         if eval $compile_ok && $run ./try; then
20917                 echo 'Looks OK.' >&4
20918                 set `$run ./try 1`
20919                 db_version_major=$1
20920                 db_version_minor=$2
20921                 db_version_patch=$3
20922         else
20923                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20924                 i_db=$undef
20925                 case " $libs " in
20926                 *"-ldb "*)
20927                         : Remove db from list of libraries to use
20928                         echo "Removing unusable -ldb from library list" >&4
20929                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20930                         shift
20931                         libs="$*"
20932                         echo "libs = $libs" >&4
20933                         ;;
20934                 esac
20935         fi
20936         $rm_try
20937         ;;
20938 esac
20939
20940 case "$i_db" in
20941 define)
20942         : Check the return type needed for hash
20943         echo " "
20944         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20945         $cat >try.c <<EOCP
20946 #include <sys/types.h>
20947 #include <db.h>
20948
20949 #ifndef DB_VERSION_MAJOR
20950 u_int32_t hash_cb (const void* ptr, size_t size)
20951 {
20952         return 0;
20953 }
20954 HASHINFO info;
20955 int main()
20956 {
20957         info.hash = hash_cb;
20958 }
20959 #endif
20960 EOCP
20961         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20962                 if $compiler_warning try.out >>/dev/null 2>&1 ; then
20963                         db_hashtype='int'
20964                 else
20965                         db_hashtype='u_int32_t'
20966                 fi
20967         else
20968                 : XXX Maybe we should just give up here.
20969                 db_hashtype=u_int32_t
20970                 $cat try.out >&4
20971                 echo "Help:  I can't seem to compile the db test program." >&4
20972                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20973         fi
20974         $rm_try
20975         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20976         ;;
20977 *)      db_hashtype=u_int32_t
20978         ;;
20979 esac
20980 case "$i_db" in
20981 define)
20982         : Check the return type needed for prefix
20983         echo " "
20984         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20985         cat >try.c <<EOCP
20986 #include <sys/types.h>
20987 #include <db.h>
20988
20989 #ifndef DB_VERSION_MAJOR
20990 size_t prefix_cb (const DBT *key1, const DBT *key2)
20991 {
20992         return 0;
20993 }
20994 BTREEINFO info;
20995 int main()
20996 {
20997         info.prefix = prefix_cb;
20998 }
20999 #endif
21000 EOCP
21001         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
21002                 if $compiler_warning try.out >>/dev/null 2>&1 ; then
21003                         db_prefixtype='int'
21004                 else
21005                         db_prefixtype='size_t'
21006                 fi
21007         else
21008                 db_prefixtype='size_t'
21009                 : XXX Maybe we should just give up here.
21010                 $cat try.out >&4
21011                 echo "Help:  I can't seem to compile the db test program." >&4
21012                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
21013         fi
21014         $rm_try
21015         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
21016         ;;
21017 *)      db_prefixtype='size_t'
21018         ;;
21019 esac
21020
21021 : Include . in @INC
21022 $cat <<EOM
21023
21024 Historically Perl has provided a final fallback of the current working
21025 directory '.' when searching for a library. This, however, can lead to
21026 problems when a Perl program which loads optional modules is called from
21027 a shared directory. This can lead to executing unexpected code.
21028
21029 EOM
21030
21031 # When changing to exclude by default:
21032 case "$default_inc_excludes_dot" in
21033     $undef|false|[nN]*) dflt="n" ;;
21034     *)                  dflt="y" ;;
21035 esac
21036 # To turn exclude off by default:
21037 #case "$default_inc_excludes_dot" in
21038 #    $define|true|[yY]*) dflt="y" ;;
21039 #    *)                  dflt="n" ;;
21040 #esac
21041
21042 rp='Exclude '.' from @INC by default? '
21043 . ./myread
21044 case "$ans" in
21045     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
21046     *)          default_inc_excludes_dot="$define" ;;
21047 esac
21048
21049 : Check what kind of inf/nan your system has
21050 $echo "Checking the kind of infinities and nans you have..." >&4
21051 $echo "(The following tests may crash.  That's okay.)" >&4
21052 $cat >try.c <<EOP
21053 #define DOUBLESIZE $doublesize
21054 #$d_longdbl HAS_LONG_DOUBLE
21055 #ifdef HAS_LONG_DOUBLE
21056 #define LONG_DOUBLESIZE $longdblsize
21057 #define LONG_DOUBLEKIND $longdblkind
21058 #endif
21059 #include <math.h>
21060 #include <string.h>
21061 #include <stdio.h>
21062 /* Note that whether the sign bit is on or off
21063  * for NaN depends on the CPU/FPU, and possibly
21064  * can be affected by the build toolchain.
21065  *
21066  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
21067  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
21068  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
21069  * (respectively) as opposed to the more usual
21070  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
21071  *
21072  * Pre-IEEE-754 floating point format do not even have inf/nan support
21073  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
21074  * to even mention, causing immediate SIGFPE or equivalent: this is
21075  * the case with VAX floating point, for example.
21076  */
21077 static void bytes(void *v, unsigned int n) {
21078   unsigned char *p = (unsigned char *)v;
21079   int i;
21080   for (i = 0; i < n; i++) {
21081     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
21082   }
21083 }
21084 int main(int argc, char *argv[]) {
21085    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
21086     * because some compilers are 'smart' and not only warn but refuse to
21087     * compile such 'illegal' values. */
21088    double dinf = exp(1e9);
21089    double dnan = sqrt(-1.0);
21090 #ifdef HAS_LONG_DOUBLE
21091    long double ldinf = (long double)exp(1e9);
21092    long double ldnan = (long double)sqrt(-1.0);
21093 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
21094 /* the 80-bit long doubles might have garbage in their excess bytes */
21095     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
21096     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
21097 # endif
21098 #endif
21099   if (argc == 2) {
21100     switch (argv[1][0]) {
21101     case '1': bytes(&dinf, sizeof(dinf)); break;
21102     case '2': bytes(&dnan, sizeof(dnan)); break;
21103 #ifdef HAS_LONG_DOUBLE
21104     case '3': bytes(&ldinf, sizeof(ldinf)); break;
21105     case '4': bytes(&ldnan, sizeof(ldnan)); break;
21106 #endif
21107     }
21108   }
21109   return 0;
21110 }
21111 EOP
21112 set try
21113 if eval $compile; then
21114     doubleinfbytes=`$run ./try 1`
21115     doublenanbytes=`$run ./try 2`
21116     case "$d_longdbl" in
21117     $define)
21118       longdblinfbytes=`$run ./try 3`
21119       longdblnanbytes=`$run ./try 4`
21120       ;;
21121     esac
21122 else
21123     # Defaults in case the above test program failed.
21124     case "$doublekind" in
21125     1) # IEEE 754 32-bit LE
21126        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
21127        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
21128        ;;
21129     2) # IEEE 754 32-bit BE
21130        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
21131        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
21132        ;;
21133     3) # IEEE 754 64-bit LE
21134        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
21135        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
21136        ;;
21137     4) # IEEE 754 64-bit BE
21138        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21139        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21140        ;;
21141     5) # IEEE 754 128-bit LE
21142        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
21143        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
21144        ;;
21145     6) # IEEE 754 128-bit BE
21146        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21147        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21148        ;;
21149     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
21150        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
21151        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
21152        ;;
21153     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
21154        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
21155        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
21156        ;;
21157     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
21158        doubleinfbytes=$undef
21159        doublenanbytes=$undef
21160        ;;
21161     *) # No idea.
21162        doubleinfbytes=$undef
21163        doublenanbytes=$undef
21164        ;;
21165     esac
21166     case "$longdblkind" in
21167     1) # IEEE 754 128-bit LE
21168        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
21169        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
21170        ;;
21171     2) # IEEE 754 128-bit BE
21172        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21173        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21174        ;;
21175     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
21176        case "$longdblsize" in
21177        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
21178            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
21179            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
21180            ;;
21181        16) # x86_64
21182            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21183            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21184            ;;
21185        *)  # No idea.
21186            longdblinfbytes=$undef
21187            longdblnanbytes=$undef
21188        ;;
21189        esac
21190        ;;
21191     4) # IEEE 754 80-bit BE, 12 or 16 bytes
21192        case "$longdblsize" in
21193        12) # 32-bit system
21194            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21195            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21196            ;;
21197        16) # 64-bit system
21198            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21199            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21200            ;;
21201        *)  # No idea.
21202            longdblinfbytes=$undef
21203            longdblnanbytes=$undef
21204        ;;
21205        esac
21206        ;;
21207     5) # 128-bit LE-LE "double double"
21208        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
21209        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
21210        ;;
21211     6) # 128-bit BE-BE "double double"
21212        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21213        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21214        ;;
21215     7) # 128-bit LE-BE "double double"
21216        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21217        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21218        ;;
21219     8) # 128-bit BE-LE "double double"
21220        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21221        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
21222        ;;
21223     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
21224        longdblinfbytes=$undef
21225        longdblnanbytes=$undef
21226        ;;
21227     *) # No idea.
21228        longdblinfbytes=$undef
21229        longdblnanbytes=$undef
21230        ;;
21231     esac
21232 fi
21233 # In case the program crashed the values are empty, turn them undef.
21234 case "$doubleinfbytes" in
21235 '') doubleinfbytes=$undef ;;
21236 esac
21237 case "$doublenanbytes" in
21238 '') doublenanbytes=$undef ;;
21239 esac
21240 case "$longdblinfbytes" in
21241 '') longdblinfbytes=$undef ;;
21242 esac
21243 case "$longdblnanbytes" in
21244 '') longdblnanbytes=$undef ;;
21245 esac
21246 $rm_try
21247
21248 : Check the length of the double mantissa
21249 $echo "Checking how many mantissa bits your doubles have..." >&4
21250 $cat >try.c <<EOP
21251 #$i_sunmath I_SUNMATH
21252 #include <float.h>
21253 #ifdef I_SUNMATH
21254 # include <sunmath.h>
21255 #endif
21256 #ifdef DBL_MANT_DIG
21257 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
21258 #endif
21259 #include <stdio.h>
21260 int main(int argc, char *argv[]) {
21261 #ifdef BITS
21262   printf("%d\n", BITS);
21263 #endif
21264   return 0;
21265 }
21266 EOP
21267 set try
21268 if eval $compile; then
21269     doublemantbits=`$run ./try`
21270 else
21271     doublemantbits="$undef"
21272 fi
21273 $rm_try
21274
21275 : Check the length of the longdouble mantissa
21276 $echo "Checking how many mantissa bits your long doubles have..." >&4
21277 $cat >try.c <<EOP
21278 #$i_sunmath I_SUNMATH
21279 #include <float.h>
21280 #ifdef I_SUNMATH
21281 # include <sunmath.h>
21282 #endif
21283 #$d_longdbl HAS_LONG_DOUBLE
21284 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
21285 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
21286 /* This format has no implicit bit.  Beware, however, that for
21287  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
21288  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
21289  * and the top bit must have been one since 387, zero is plain invalid.
21290  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
21291 #  define BITS LDBL_MANT_DIG
21292 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
21293 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
21294  * reason e.g. Irix thinks 107.  But in any case, we want only
21295  * the number of real bits, the implicit bits are of no interest.  */
21296 #  define BITS 2 * (DBL_MANT_DIG - 1)
21297 # else
21298 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
21299 # endif
21300 #endif
21301 #include <stdio.h>
21302 int main(int argc, char *argv[]) {
21303 #ifdef BITS
21304   printf("%d\n", BITS);
21305 #endif
21306   return 0;
21307 }
21308 EOP
21309 set try
21310 if eval $compile; then
21311     longdblmantbits=`$run ./try`
21312 else
21313     longdblmantbits="$undef"
21314 fi
21315 $rm_try
21316
21317 : Check the length of the NV mantissa
21318 $echo "Checking how many mantissa bits your NVs have..." >&4
21319 if test "X$usequadmath" = "X$define"; then
21320   nvmantbits=112 # 128-1-15
21321 else
21322   if test "X$nvsize" = "X$doublesize"; then
21323     nvmantbits="$doublemantbits"
21324   else
21325      if test "X$nvsize" = "X$longdblsize"; then
21326        nvmantbits="$longdblmantbits"
21327      else
21328        nvmantbits="$undef"
21329      fi
21330   fi
21331 fi
21332
21333 : How can we generate normalized random numbers ?
21334 echo " "
21335 echo "Using our internal random number implementation..." >&4
21336
21337 case "$ccflags" in
21338 *-Dmy_rand=*|*-Dmy_srand=*)
21339         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
21340         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
21341         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
21342         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
21343         ;;
21344 esac
21345
21346 randfunc=Perl_drand48
21347 drand01="Perl_drand48()"
21348 seedfunc="Perl_drand48_init"
21349 randbits=48
21350 randseedtype=U32
21351
21352 : Probe whether dtrace builds an object, as newer Illumos requires an input
21353 : object file that uses at least one of the probes defined in the .d file
21354 case "$usedtrace" in
21355 $define)
21356     case "$dtracexnolibs" in
21357     $define|true|[yY]*)
21358         dtracexnolibs=$define
21359         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
21360         ;;
21361     ' '|'')
21362         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
21363              dtracexnolibs=$define
21364              echo "Your dtrace accepts -xnolibs"
21365         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
21366              dtracexnolibs=$undef
21367              echo "Your dtrace doesn't accept -xnolibs"
21368         else
21369              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
21370              exit 1
21371         fi
21372         ;;
21373     *)
21374         dtracexnolibs=$undef
21375         $dtrace -h -s ../perldtrace.d -o perldtrace.h
21376         ;;
21377     esac
21378     case $dtracexnolibs in
21379     $define) xnolibs=-xnolibs ;;
21380     *) xnolibs= ;;
21381     esac
21382
21383     case "$dtraceobject" in
21384     $define|true|[yY]*)
21385         dtraceobject=$define
21386         ;;
21387     ' '|'')
21388         $cat >try.c <<EOM
21389 #include "perldtrace.h"
21390 int main(void) {
21391     PERL_LOADED_FILE("dummy");
21392     return 0;
21393 }
21394 EOM
21395         dtraceobject=$undef
21396         if $cc -c -o try.o $optimize $ccflags try.c \
21397                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
21398                 dtraceobject=$define
21399             echo "Your dtrace builds an object file"
21400         fi
21401         ;;
21402     *) dtraceobject=$undef ;;
21403     esac
21404     $rm_try perldtrace.o perldtrace.h
21405 esac
21406
21407 : Determine if this is an EBCDIC system
21408 echo " "
21409 echo "Determining whether or not we are on an EBCDIC system..." >&4
21410 $cat >try.c <<'EOM'
21411 int main()
21412 {
21413   if ('M'==0xd4) return 0;
21414   return 1;
21415 }
21416 EOM
21417
21418 val=$undef
21419 set try
21420 if eval $compile_ok; then
21421         if $run ./try; then
21422                 echo "You seem to speak EBCDIC." >&4
21423                 val="$define"
21424         else
21425                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
21426         fi
21427 else
21428         echo "I'm unable to compile the test program." >&4
21429         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
21430 fi
21431 $rm_try
21432 set ebcdic
21433 eval $setvar
21434
21435 : Check how to flush
21436 echo " "
21437 $cat >&4 <<EOM
21438 Checking how to flush all pending stdio output...
21439 EOM
21440 # I only know how to find the first 32 possibly open files on SunOS.
21441 # See also hints/sunos_4_1.sh and util.c  --AD
21442 case "$osname" in
21443 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
21444 esac
21445 $cat >>try.c <<EOCP
21446 #include <stdio.h>
21447 #$i_stdlib I_STDLIB
21448 #ifdef I_STDLIB
21449 #include <stdlib.h>
21450 #endif
21451 #$i_unistd I_UNISTD
21452 #ifdef I_UNISTD
21453 # include <unistd.h>
21454 #endif
21455 #$d_sysconf HAS_SYSCONF
21456 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
21457 #ifdef HAS_STDIO_STREAM_ARRAY
21458 # define STDIO_STREAM_ARRAY $stdio_stream_array
21459 #endif
21460 int main() {
21461   FILE* p;
21462   unlink("try.out");
21463   p = fopen("try.out", "w");
21464 #ifdef TRY_FPUTC
21465   fputc('x', p);
21466 #else
21467 # ifdef TRY_FPRINTF
21468   fprintf(p, "x");
21469 # endif
21470 #endif
21471 #ifdef TRY_FFLUSH_NULL
21472   fflush(NULL);
21473 #endif
21474 #ifdef TRY_FFLUSH_ALL
21475   {
21476     long open_max = -1;
21477 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
21478     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
21479 # else
21480 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
21481     open_max = sysconf(_SC_OPEN_MAX);
21482 #  else
21483 #   ifdef FOPEN_MAX
21484     open_max = FOPEN_MAX;
21485 #   else
21486 #    ifdef OPEN_MAX
21487     open_max = OPEN_MAX;
21488 #    else
21489 #     ifdef _NFILE
21490     open_max = _NFILE;
21491 #     endif
21492 #    endif
21493 #   endif
21494 #  endif
21495 # endif
21496 # ifdef HAS_STDIO_STREAM_ARRAY
21497     if (open_max > 0) {
21498       long i;
21499       for (i = 0; i < open_max; i++)
21500             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
21501                 STDIO_STREAM_ARRAY[i]._file < open_max &&
21502                 STDIO_STREAM_ARRAY[i]._flag)
21503                 fflush(&STDIO_STREAM_ARRAY[i]);
21504     }
21505 # endif
21506   }
21507 #endif
21508   _exit(42);
21509 }
21510 EOCP
21511 : first we have to find out how _not_ to flush
21512 $to try.c
21513 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
21514     output=''
21515     set try -DTRY_FPUTC
21516     if eval $compile; then
21517             $run ./try 2>/dev/null
21518             code="$?"
21519             $from try.out
21520             if $test ! -s try.out -a "X$code" = X42; then
21521                 output=-DTRY_FPUTC
21522             fi
21523     fi
21524     case "$output" in
21525     '')
21526             set try -DTRY_FPRINTF
21527             if eval $compile; then
21528                     $run ./try 2>/dev/null
21529                     code="$?"
21530                     $from try.out
21531                     if $test ! -s try.out -a "X$code" = X42; then
21532                         output=-DTRY_FPRINTF
21533                     fi
21534             fi
21535         ;;
21536     esac
21537 fi
21538 : check for fflush NULL behavior
21539 case "$fflushNULL" in
21540 '')     set try -DTRY_FFLUSH_NULL $output
21541         if eval $compile; then
21542                 $run ./try 2>/dev/null
21543                 code="$?"
21544                 $from try.out
21545                 if $test -s try.out -a "X$code" = X42; then
21546                         fflushNULL="`$cat try.out`"
21547                 else
21548                         if $test "X$code" != X42; then
21549                                 $cat >&4 <<EOM
21550 (If this test failed, don't worry, we'll try another method shortly.)
21551 EOM
21552                         fi
21553                 fi
21554         fi
21555         $rm -f core try.core core.try.*
21556         case "$fflushNULL" in
21557         x)      $cat >&4 <<EOM
21558 Your fflush(NULL) works okay for output streams.
21559 Let's see if it clobbers input pipes...
21560 EOM
21561 # As of mid-March 2000 all versions of Solaris appear to have a stdio
21562 # bug that improperly flushes the input end of pipes.  So we avoid the
21563 # autoflush on fork/system/exec support for now. :-(
21564 $cat >tryp.c <<EOCP
21565 #include <stdio.h>
21566 int
21567 main(int argc, char **argv)
21568 {
21569     char buf[1024];
21570     int i;
21571     char *bp = buf;
21572     while (1) {
21573         while ((i = getc(stdin)) != -1
21574                && (*bp++ = i) != '\n'
21575                && bp < &buf[1024])
21576         /* DO NOTHING */ ;
21577         *bp = '\0';
21578         fprintf(stdout, "%s", buf);
21579         fflush(NULL);
21580         if (i == -1)
21581             return 0;
21582         bp = buf;
21583     }
21584 }
21585 EOCP
21586                 fflushNULL="$define"
21587                 set tryp
21588                 if eval $compile; then
21589                     $rm -f tryp.out
21590                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
21591                     if $test "X$targethost" != X; then
21592                         $to tryp.c
21593                         $to tryp
21594                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21595                     else
21596                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21597                     fi
21598                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
21599                        $cat >&4 <<EOM
21600 fflush(NULL) seems to behave okay with input streams.
21601 EOM
21602                         fflushNULL="$define"
21603                     else
21604                         $cat >&4 <<EOM
21605 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
21606 EOM
21607                         fflushNULL="$undef"
21608                     fi
21609                 fi
21610                 $rm -f core tryp.c tryp.core core.tryp.*
21611                 ;;
21612         '')     $cat >&4 <<EOM
21613 Your fflush(NULL) isn't working (contrary to ANSI C).
21614 EOM
21615                 fflushNULL="$undef"
21616                 ;;
21617         *)      $cat >&4 <<EOM
21618 Cannot figure out whether your fflush(NULL) works or not.
21619 I'm assuming it doesn't (contrary to ANSI C).
21620 EOM
21621                 fflushNULL="$undef"
21622                 ;;
21623         esac
21624         ;;
21625 $define|true|[yY]*)
21626         fflushNULL="$define"
21627         ;;
21628 *)
21629         fflushNULL="$undef"
21630         ;;
21631 esac
21632 : check explicit looping only if NULL did not work, and if the pipe
21633 : bug does not show up on an explicit flush too
21634 case "$fflushNULL" in
21635 "$undef")
21636         $cat >tryp.c <<EOCP
21637 #include <stdio.h>
21638 int
21639 main(int argc, char **argv)
21640 {
21641     char buf[1024];
21642     int i;
21643     char *bp = buf;
21644     while (1) {
21645         while ((i = getc(stdin)) != -1
21646                && (*bp++ = i) != '\n'
21647                && bp < &buf[1024])
21648         /* DO NOTHING */ ;
21649         *bp = '\0';
21650         fprintf(stdout, "%s", buf);
21651         fflush(stdin);
21652         if (i == -1)
21653             return 0;
21654         bp = buf;
21655     }
21656 }
21657 EOCP
21658         set tryp
21659         if eval $compile; then
21660             $rm -f tryp.out
21661             if $test "X$targethost" != X; then
21662                 $to tryp.c
21663                 $to tryp
21664                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21665             else
21666                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21667             fi
21668             if cmp tryp.c tryp.out >/dev/null 2>&1; then
21669                $cat >&4 <<EOM
21670 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21671 EOM
21672                 : now check for fflushall behaviour
21673                 case "$fflushall" in
21674                 '')     set try -DTRY_FFLUSH_ALL $output
21675                         if eval $compile; then
21676                                 $cat >&4 <<EOM
21677 (Now testing the other method--but note that this also may fail.)
21678 EOM
21679                                 $run ./try 2>/dev/null
21680                                 code=$?
21681                                 $from try.out
21682                                 if $test -s try.out -a "X$code" = X42; then
21683                                         fflushall="`$cat try.out`"
21684                                 fi
21685                         fi
21686                         $rm_try
21687                         case "$fflushall" in
21688                         x)      $cat >&4 <<EOM
21689 Whew. Flushing explicitly all the stdio streams works.
21690 EOM
21691                                 fflushall="$define"
21692                                 ;;
21693                         '')     $cat >&4 <<EOM
21694 Sigh. Flushing explicitly all the stdio streams doesn't work.
21695 EOM
21696                                 fflushall="$undef"
21697                                 ;;
21698                         *)      $cat >&4 <<EOM
21699 Cannot figure out whether flushing stdio streams explicitly works or not.
21700 I'm assuming it doesn't.
21701 EOM
21702                                 fflushall="$undef"
21703                                 ;;
21704                         esac
21705                         ;;
21706                 "$define"|true|[yY]*)
21707                         fflushall="$define"
21708                         ;;
21709                 *)
21710                         fflushall="$undef"
21711                         ;;
21712                 esac
21713             else
21714                 $cat >&4 <<EOM
21715 All is futile.  Even fflush(stdin) clobbers input pipes!
21716 EOM
21717                 fflushall="$undef"
21718             fi
21719         else
21720             fflushall="$undef"
21721         fi
21722         $rm -f core tryp.c tryp.core core.tryp.*
21723         ;;
21724 *)      fflushall="$undef"
21725         ;;
21726 esac
21727
21728 case "$fflushNULL$fflushall" in
21729 undefundef)
21730         $cat <<EOM
21731 OK, I give up.  I cannot figure out how to flush pending stdio output.
21732 We won't be flushing handles at all before fork/exec/popen.
21733 EOM
21734         ;;
21735 esac
21736 $rm_try tryp
21737
21738 : Store the full pathname to the ar program for use in the C program
21739 : Respect a hint or command line value for full_ar.
21740 case "$full_ar" in
21741 '') full_ar=$ar ;;
21742 esac
21743
21744 : Store the full pathname to the sed program for use in the C program
21745 full_sed=$sed
21746
21747 : see what type gids are declared as in the kernel
21748 echo " "
21749 echo "Looking for the type for group ids returned by getgid()."
21750 set gid_t gidtype xxx stdio.h sys/types.h
21751 eval $typedef
21752 case "$gidtype" in
21753 xxx)
21754         xxx=`./findhdr sys/user.h`
21755         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21756         case $1 in
21757         unsigned) dflt="$1 $2" ;;
21758         *) dflt="$1" ;;
21759         esac
21760         ;;
21761 *) dflt="$gidtype";;
21762 esac
21763 case "$gidtype" in
21764 gid_t) echo "gid_t found." ;;
21765 *)      rp="What is the type for group ids returned by getgid()?"
21766         . ./myread
21767         gidtype="$ans"
21768         ;;
21769 esac
21770
21771 : Check the size of GID
21772 echo " "
21773 case "$gidtype" in
21774 *_t) zzz="$gidtype"     ;;
21775 *)   zzz="gid"          ;;
21776 esac
21777 echo "Checking the size of $zzz..." >&4
21778 cat > try.c <<EOCP
21779 #include <sys/types.h>
21780 #include <stdio.h>
21781 #$i_stdlib I_STDLIB
21782 #ifdef I_STDLIB
21783 #include <stdlib.h>
21784 #endif
21785 int main() {
21786     printf("%d\n", (int)sizeof($gidtype));
21787     exit(0);
21788 }
21789 EOCP
21790 set try
21791 if eval $compile_ok; then
21792         yyy=`$run ./try`
21793         case "$yyy" in
21794         '')     gidsize=4
21795                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21796                 ;;
21797         *)      gidsize=$yyy
21798                 echo "Your $zzz is $gidsize bytes long."
21799                 ;;
21800         esac
21801 else
21802         gidsize=4
21803         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21804 fi
21805
21806 : Check if GID is signed
21807 echo " "
21808 case "$gidtype" in
21809 *_t) zzz="$gidtype"     ;;
21810 *)   zzz="gid"          ;;
21811 esac
21812 echo "Checking the sign of $zzz..." >&4
21813 cat > try.c <<EOCP
21814 #include <sys/types.h>
21815 #include <stdio.h>
21816 int main() {
21817         $gidtype foo = -1;
21818         if (foo < 0)
21819                 printf("-1\n");
21820         else
21821                 printf("1\n");
21822 }
21823 EOCP
21824 set try
21825 if eval $compile; then
21826         yyy=`$run ./try`
21827         case "$yyy" in
21828         '')     gidsign=1
21829                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21830                 ;;
21831         *)      gidsign=$yyy
21832                 case "$gidsign" in
21833                  1) echo "Your $zzz is unsigned." ;;
21834                 -1) echo "Your $zzz is signed."   ;;
21835                 esac
21836                 ;;
21837         esac
21838 else
21839         gidsign=1
21840         echo "(I can't compile the test program--guessing unsigned.)" >&4
21841 fi
21842
21843 : Check 64bit sizes
21844 echo " "
21845
21846 if $test X"$quadtype" != X; then
21847
21848 echo "Checking how to print 64-bit integers..." >&4
21849
21850 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21851         $cat >try.c <<'EOCP'
21852 #include <sys/types.h>
21853 #include <stdio.h>
21854 int main() {
21855   int q = 12345678901;
21856   printf("%ld\n", q);
21857 }
21858 EOCP
21859         set try
21860         if eval $compile; then
21861                 yyy=`$run ./try`
21862                 case "$yyy" in
21863                 12345678901)
21864                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21865                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21866                         echo "We will use %d."
21867                         ;;
21868                 esac
21869         fi
21870 fi
21871
21872 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21873         $cat >try.c <<'EOCP'
21874 #include <sys/types.h>
21875 #include <stdio.h>
21876 int main() {
21877   long q = 12345678901;
21878   printf("%ld\n", q);
21879 }
21880 EOCP
21881         set try
21882         if eval $compile; then
21883                 yyy=`$run ./try`
21884                 case "$yyy" in
21885                 12345678901)
21886                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21887                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21888                         echo "We will use %ld."
21889                         ;;
21890                 esac
21891         fi
21892 fi
21893
21894 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21895         $cat >try.c <<'EOCP'
21896 #include <sys/types.h>
21897 #include <inttypes.h>
21898 #include <stdio.h>
21899 int main() {
21900   int64_t q = 12345678901;
21901   printf("%" PRId64 "\n", q);
21902 }
21903 EOCP
21904         set try
21905         if eval $compile; then
21906                 yyy=`$run ./try`
21907                 case "$yyy" in
21908                 12345678901)
21909                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21910                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIX64;
21911                         echo "We will use the C9X style."
21912                         ;;
21913                 esac
21914         fi
21915 fi
21916
21917 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21918         $cat >try.c <<'EOCP'
21919 #include <sys/types.h>
21920 #include <stdio.h>
21921 int main() {
21922   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21923   printf("%lld\n", q);
21924 }
21925 EOCP
21926         set try
21927         if eval $compile; then
21928                 yyy=`$run ./try`
21929                 case "$yyy" in
21930                 12345678901)
21931                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21932                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21933                         echo "We will use the %lld style."
21934                         ;;
21935                 esac
21936         fi
21937 fi
21938
21939 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21940         $cat >try.c <<EOCP
21941 #include <sys/types.h>
21942 #include <stdio.h>
21943 int main() {
21944   $quadtype q = 12345678901;
21945   printf("%qd\n", q);
21946 }
21947 EOCP
21948         set try
21949         if eval $compile; then
21950                 yyy=`$run ./try`
21951                 case "$yyy" in
21952                 12345678901)
21953                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21954                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21955                         echo "We will use %qd."
21956                         ;;
21957                 esac
21958         fi
21959 fi
21960
21961 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21962         $cat >try.c <<EOCP
21963 #include <sys/types.h>
21964 #include <stdio.h>
21965 int main() {
21966   $quadtype q = 12345678901;
21967   printf("%Ld\n", q);
21968 }
21969 EOCP
21970         set try
21971         if eval $compile; then
21972                 yyy=`$run ./try`
21973                 case "$yyy" in
21974                 12345678901)
21975                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21976                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21977                         echo "We will use %Ld."
21978                         ;;
21979                 esac
21980         fi
21981 fi
21982
21983 if $test X"$sPRId64" = X; then
21984         echo "Cannot figure out how to print 64-bit integers." >&4
21985 fi
21986 $rm_try
21987
21988 fi
21989
21990 case "$sPRId64" in
21991 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21992         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21993         ;;
21994 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21995         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21996         ;;
21997 esac
21998
21999 : Check format strings for internal types
22000 echo " "
22001 $echo "Checking the format strings to be used for Perl's internal types..." >&4
22002
22003 if $test X"$ivsize" = X8; then
22004         ivdformat="$sPRId64"
22005         uvuformat="$sPRIu64"
22006         uvoformat="$sPRIo64"
22007         uvxformat="$sPRIx64"
22008         uvXUformat="$sPRIXU64"
22009 else
22010         if $test X"$ivsize" = X"$longsize"; then
22011                 ivdformat='"ld"'
22012                 uvuformat='"lu"'
22013                 uvoformat='"lo"'
22014                 uvxformat='"lx"'
22015                 uvXUformat='"lX"'
22016         else
22017                 if $test X"$ivsize" = X"$intsize"; then
22018                         ivdformat='"d"'
22019                         uvuformat='"u"'
22020                         uvoformat='"o"'
22021                         uvxformat='"x"'
22022                         uvXUformat='"X"'
22023                 else
22024                         : far out
22025                         if $test X"$ivsize" = X"$shortsize"; then
22026                                 ivdformat='"hd"'
22027                                 uvuformat='"hu"'
22028                                 uvoformat='"ho"'
22029                                 uvxformat='"hx"'
22030                                 uvXUformat='"hX"'
22031                         fi
22032                 fi
22033         fi
22034 fi
22035
22036 if $test X"$usequadmath" = X"$define"; then
22037     nveformat='"Qe"'
22038     nvfformat='"Qf"'
22039     nvgformat='"Qg"'
22040     nvEUformat='"QE"'
22041     nvFUformat='"QF"'
22042     nvGUformat='"QG"'
22043 else
22044     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
22045         nveformat="$sPRIeldbl"
22046         nvfformat="$sPRIfldbl"
22047         nvgformat="$sPRIgldbl"
22048         nvEUformat="$sPRIEUldbl"
22049         nvFUformat="$sPRIFUldbl"
22050         nvGUformat="$sPRIGUldbl"
22051     else
22052         nveformat='"e"'
22053         nvfformat='"f"'
22054         nvgformat='"g"'
22055         nvEUformat='"E"'
22056         nvFUformat='"F"'
22057         nvGUformat='"G"'
22058     fi
22059 fi
22060
22061 case "$ivdformat" in
22062 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
22063     exit 1
22064     ;;
22065 esac
22066
22067 : Check format string for GID
22068
22069 echo " "
22070 $echo "Checking the format string to be used for gids..." >&4
22071
22072 case "$gidsign" in
22073 -1)     if $test X"$gidsize" = X"$ivsize"; then
22074                 gidformat="$ivdformat"
22075         else
22076                 if $test X"$gidsize" = X"$longsize"; then
22077                         gidformat='"ld"'
22078                 else
22079                         if $test X"$gidsize" = X"$intsize"; then
22080                                 gidformat='"d"'
22081                         else
22082                                 if $test X"$gidsize" = X"$shortsize"; then
22083                                         gidformat='"hd"'
22084                                 fi
22085                         fi
22086                 fi
22087         fi
22088         ;;
22089 *)      if $test X"$gidsize" = X"$uvsize"; then
22090                 gidformat="$uvuformat"
22091         else
22092                 if $test X"$gidsize" = X"$longsize"; then
22093                         gidformat='"lu"'
22094                 else
22095                         if $test X"$gidsize" = X"$intsize"; then
22096                                 gidformat='"u"'
22097                         else
22098                                 if $test X"$gidsize" = X"$shortsize"; then
22099                                         gidformat='"hu"'
22100                                 fi
22101                         fi
22102                 fi
22103         fi
22104         ;;
22105 esac
22106
22107 : see if getgroups exists
22108 set getgroups d_getgrps
22109 eval $inlibc
22110
22111 : see if setgroups exists
22112 set setgroups d_setgrps
22113 eval $inlibc
22114
22115 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
22116 echo " "
22117 case "$d_getgrps$d_setgrps" in
22118 *define*)
22119         case "$groupstype" in
22120         '') dflt="$gidtype" ;;
22121         *)  dflt="$groupstype" ;;
22122         esac
22123         $cat <<EOM
22124 What type of pointer is the second argument to getgroups() and setgroups()?
22125 Usually this is the same as group ids, $gidtype, but not always.
22126
22127 EOM
22128         rp='What type pointer is the second argument to getgroups() and setgroups()?'
22129         . ./myread
22130         groupstype="$ans"
22131         ;;
22132 *)  groupstype="$gidtype";;
22133 esac
22134
22135 : Check format strings for internal 32bit types
22136 echo " "
22137 $echo "Checking the format strings to be used for Perl's internal 32bit-types..." >&4
22138
22139 case "$i32dformat" in
22140 '')     case "$i32type" in
22141         int)
22142                 i32dformat='"d"'
22143                 u32uformat='"u"'
22144                 u32oformat='"o"'
22145                 u32xformat='"x"'
22146                 u32XUformat='"X"'
22147                 ;;
22148         long)
22149                 i32dformat='"ld"'
22150                 u32uformat='"lu"'
22151                 u32oformat='"lo"'
22152                 u32xformat='"lx"'
22153                 u32XUformat='"lX"'
22154                 ;;
22155         int_least32_t)          : will not happen currently
22156                 i32dformat=PRIdLEAST32
22157                 u32uformat=PRIuLEAST32
22158                 u32oformat=PRIoLEAST32
22159                 u32xformat=PRIxLEAST32
22160                 u32XUformat=PRIXLEAST32
22161                 ;;
22162         int32_t)
22163                 i32dformat=PRId32
22164                 u32uformat=PRIu32
22165                 u32oformat=PRIo32
22166                 u32xformat=PRIx32
22167                 u32XUformat=PRIX32
22168                 ;;
22169         esac ;;
22170 esac
22171
22172 case "$i32dformat" in
22173 '') echo "$0: Fatal: failed to find format strings for 32-bit integers, cannot continue." >&4
22174     exit 1
22175     ;;
22176 esac
22177
22178 : check whether make sets MAKE
22179 echo " "
22180 echo "Checking if your $make program sets \$(MAKE)..." >&4
22181 case "$make_set_make" in
22182 '')
22183         $sed 's/^X //' > testmake.mak << 'EOF'
22184 Xall:
22185 X       @echo 'maketemp="$(MAKE)"'
22186 EOF
22187         case "`$make -f testmake.mak 2>/dev/null`" in
22188         *maketemp=*) make_set_make='#' ;;
22189         *)      make_set_make="MAKE=$make" ;;
22190         esac
22191         $rm -f testmake.mak
22192         ;;
22193 esac
22194 case "$make_set_make" in
22195 '#') echo "Yup, it does.";;
22196 *) echo "Nope, it doesn't.";;
22197 esac
22198
22199 : see what type is used for mode_t
22200 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
22201 set mode_t modetype int stdio.h sys/types.h
22202 eval $typedef_ask
22203
22204 : see if we need va_copy
22205 echo " "
22206 $cat >try.c <<EOCP
22207 #include <stdarg.h>
22208 #include <stdio.h>
22209 #include <stdlib.h>
22210 #include <signal.h>
22211
22212 int
22213 ivfprintf(FILE *f, const char *fmt, va_list *valp)
22214 {
22215   return vfprintf(f, fmt, *valp);
22216 }
22217
22218 int
22219 myvfprintf(FILE *f, const  char *fmt, va_list val)
22220 {
22221   return ivfprintf(f, fmt, &val);
22222 }
22223
22224 int
22225 myprintf(char *fmt, ...)
22226 {
22227   va_list val;
22228   va_start(val, fmt);
22229   return myvfprintf(stdout, fmt, val);
22230 }
22231
22232 int
22233 main(int ac, char **av)
22234 {
22235   signal(SIGSEGV, exit);
22236 #ifdef SIGBUS
22237   signal(SIGBUS,  exit);
22238 #endif
22239
22240   myprintf("%s%cs all right, then\n", "that", '\'');
22241   exit(0);
22242 }
22243 EOCP
22244 set try
22245 if eval $compile && $run ./try 2>&1 >/dev/null; then
22246         case "`$run ./try`" in
22247         "that's all right, then")
22248                 okay=yes
22249                 ;;
22250         esac
22251 fi
22252 case "$okay" in
22253 yes)    echo "It seems that you don't need va_copy()." >&4
22254         need_va_copy="$undef"
22255         ;;
22256 *)      echo "It seems that va_copy() or similar will be needed." >&4
22257         need_va_copy="$define"
22258         ;;
22259 esac
22260 $rm_try
22261
22262 : see what type is used for size_t
22263 rp="What is the type used for the length parameter for string functions?"
22264 set size_t sizetype 'unsigned int' stdio.h sys/types.h
22265 eval $typedef_ask
22266
22267 : check for type of arguments to gethostbyaddr.
22268 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
22269         case "$d_gethbyaddr" in
22270         $define)
22271                 $cat <<EOM
22272
22273 Checking to see what type of arguments are accepted by gethostbyaddr().
22274 EOM
22275                 hdrs="$define sys/types.h
22276                         $d_socket sys/socket.h
22277                         $i_niin netinet/in.h
22278                         $i_netdb netdb.h
22279                         $i_unistd unistd.h"
22280                 : The first arg can 'char *' or 'void *'
22281                 : The second arg is some of integral type
22282                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
22283                         for yyy in size_t long int; do
22284                                 case "$netdb_host_type" in
22285                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
22286                                         if ./protochk "$try" $hdrs; then
22287                                                 echo "Your system accepts $xxx for the first arg."
22288                                                 echo "...and $yyy for the second arg."
22289                                                 netdb_host_type="$xxx"
22290                                                 netdb_hlen_type="$yyy"
22291                                         fi
22292                                         ;;
22293                                 esac
22294                         done
22295                 done
22296                 : In case none of those worked, prompt the user.
22297                 case "$netdb_host_type" in
22298                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
22299                         dflt='char *'
22300                         . ./myread
22301                         netdb_host_type=$ans
22302                         rp='What is the type for the 2nd argument to gethostbyaddr?'
22303                         dflt="$sizetype"
22304                         . ./myread
22305                         netdb_hlen_type=$ans
22306                         ;;
22307                 esac
22308                 ;;
22309         *)      : no gethostbyaddr, so pick harmless defaults
22310                 netdb_host_type='char *'
22311                 netdb_hlen_type="$sizetype"
22312                 ;;
22313         esac
22314         # Remove the "const" if needed. -- but then we'll have a
22315         # prototype clash!
22316         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
22317 fi
22318
22319 : check for type of argument to gethostbyname.
22320 if test "X$netdb_name_type" = X ; then
22321         case "$d_gethbyname" in
22322         $define)
22323                 $cat <<EOM
22324
22325 Checking to see what type of argument is accepted by gethostbyname().
22326 EOM
22327                 hdrs="$define sys/types.h
22328                         $d_socket sys/socket.h
22329                         $i_niin netinet/in.h
22330                         $i_netdb netdb.h
22331                         $i_unistd unistd.h"
22332                 for xxx in "const char *" "char *"; do
22333                         case "$netdb_name_type" in
22334                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
22335                                 if ./protochk "$try" $hdrs; then
22336                                         echo "Your system accepts $xxx."
22337                                         netdb_name_type="$xxx"
22338                                 fi
22339                                 ;;
22340                         esac
22341                 done
22342                 : In case none of those worked, prompt the user.
22343                 case "$netdb_name_type" in
22344                 '')     rp='What is the type for the 1st argument to gethostbyname?'
22345                         dflt='char *'
22346                         . ./myread
22347                         netdb_name_type=$ans
22348                         ;;
22349                 esac
22350                 ;;
22351         *)      : no gethostbyname, so pick harmless default
22352                 netdb_name_type='char *'
22353                 ;;
22354         esac
22355 fi
22356
22357 : check for type of 1st argument to getnetbyaddr.
22358 if test "X$netdb_net_type" = X ; then
22359         case "$d_getnbyaddr" in
22360         $define)
22361                 $cat <<EOM
22362
22363 Checking to see what type of 1st argument is accepted by getnetbyaddr().
22364 EOM
22365                 hdrs="$define sys/types.h
22366                         $d_socket sys/socket.h
22367                         $i_niin netinet/in.h
22368                         $i_netdb netdb.h
22369                         $i_unistd unistd.h"
22370                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
22371                         case "$netdb_net_type" in
22372                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
22373                                 if ./protochk "$try" $hdrs; then
22374                                         echo "Your system accepts $xxx."
22375                                         netdb_net_type="$xxx"
22376                                 fi
22377                                 ;;
22378                         esac
22379                 done
22380                 : In case none of those worked, prompt the user.
22381                 case "$netdb_net_type" in
22382                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
22383                         dflt='long'
22384                         . ./myread
22385                         netdb_net_type=$ans
22386                         ;;
22387                 esac
22388                 ;;
22389         *)      : no getnetbyaddr, so pick harmless default
22390                 netdb_net_type='long'
22391                 ;;
22392         esac
22393 fi
22394 : locate the preferred pager for this system
22395 fn=f/
22396 case "$pager" in
22397 '')
22398         dflt=''
22399         case "$pg" in
22400         /*) dflt=$pg;;
22401         [a-zA-Z]:/*) dflt=$pg;;
22402         esac
22403         case "$more" in
22404         /*) dflt=$more;;
22405         [a-zA-Z]:/*) dflt=$more;;
22406         esac
22407         case "$less" in
22408         /*) dflt=$less;;
22409         [a-zA-Z]:/*) dflt=$less;;
22410         esac
22411         case "$dflt" in
22412         '') dflt=/usr/ucb/more;;
22413         esac
22414         ;;
22415 *)      dflt="$pager"
22416         ;;
22417 esac
22418 fn="f/($dflt)"
22419 echo " "
22420 rp='What pager is used on your system?'
22421 . ./getfile
22422 pager="$ans"
22423
22424 : see if ar generates random libraries by itself
22425 echo " "
22426 echo "Checking how to generate random libraries on your machine..." >&4
22427 echo 'extern int bar2(); int bar1() { return bar2(); }' > bar1.c
22428 echo 'int bar2() { return 2; }' > bar2.c
22429 $cat > foo.c <<EOP
22430 #$i_stdlib I_STDLIB
22431 #ifdef I_STDLIB
22432 #include <stdlib.h>
22433 #endif
22434 #include <stdio.h>
22435 extern int bar1();
22436 int main() { printf("%d\n", bar1()); exit(0); }
22437 EOP
22438 $cc $ccflags -c bar1.c >/dev/null 2>&1
22439 $cc $ccflags -c bar2.c >/dev/null 2>&1
22440 $cc $ccflags -c foo.c >/dev/null 2>&1
22441 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
22442 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22443         $run ./foobar >/dev/null 2>&1; then
22444         echo "$ar appears to generate random libraries itself."
22445         orderlib=false
22446         if [ "X$ranlib" = "X" ]; then
22447             ranlib=":"
22448         fi
22449 elif $ar s bar$_a >/dev/null 2>&1 &&
22450         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22451         $run ./foobar >/dev/null 2>&1; then
22452                 echo "a table of contents needs to be added with '$ar s'."
22453                 orderlib=false
22454                 ranlib="$ar s"
22455 elif $ar ts bar$_a >/dev/null 2>&1 &&
22456         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22457         $run ./foobar >/dev/null 2>&1; then
22458                 echo "a table of contents needs to be added with '$ar ts'."
22459                 orderlib=false
22460                 ranlib="$ar ts"
22461 else
22462         case "$ranlib" in
22463         :) ranlib='';;
22464         '')
22465                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
22466                 $test -f $ranlib || ranlib=''
22467                 ;;
22468         esac
22469         if $test -n "$ranlib"; then
22470                 echo "your system has '$ranlib'; we'll use that."
22471                 orderlib=false
22472         else
22473                 echo "your system doesn't seem to support random libraries"
22474                 echo "so we'll use lorder and tsort to order the libraries."
22475                 orderlib=true
22476                 ranlib=":"
22477         fi
22478 fi
22479 $rm -f foo* bar*
22480
22481 : Check the max offset that gmtime and localtime accept
22482 echo "Checking max offsets that gmtime () accepts"
22483
22484 case "$sGMTIME_min/$sGMTIME_max" in
22485     0/0|/)
22486         $cat >try.c <<EOCP
22487 #include <sys/types.h>
22488 #include <stdio.h>
22489 #include <time.h>
22490
22491 int i;
22492 struct tm *tmp;
22493 time_t pt;
22494
22495 void gm_check (time_t t, int min_year, int max_year)
22496 {
22497     tmp = gmtime (&t);
22498     if ( tmp == NULL ||
22499         /* Check tm_year overflow */
22500          tmp->tm_year < min_year || tmp->tm_year > max_year)
22501         tmp = NULL;
22502     else
22503         pt = t;
22504     } /* gm_check */
22505
22506 int check_max ()
22507 {
22508     tmp = NULL;
22509     pt  = 0;
22510 #ifdef MAXLONG
22511     gm_check (MAXLONG, 69, 0x7fffffff);
22512 #endif
22513     if (tmp == NULL || tmp->tm_year < 0) {
22514         for (i = 63; i >= 0; i--) {
22515             time_t x = pt | ((time_t)1 << i);
22516             if (x < 0 || x < pt) continue;
22517             gm_check (x, 69, 0x7fffffff);
22518             }
22519         }
22520     printf ("sGMTIME_max=%ld\n", pt);
22521     return (0);
22522     } /* check_max */
22523
22524 int check_min ()
22525 {
22526     tmp = NULL;
22527     pt  = 0;
22528 #ifdef MINLONG
22529     gm_check (MINLONG, -1900, 70);
22530 #endif
22531     if (tmp == NULL) {
22532         for (i = 36; i >= 0; i--) {
22533             time_t x = pt - ((time_t)1 << i);
22534             if (x > 0) continue;
22535             gm_check (x, -1900, 70);
22536             }
22537         }
22538     printf ("sGMTIME_min=%ld\n", pt);
22539     return (0);
22540     } /* check_min */
22541
22542 int main (int argc, char *argv[])
22543 {
22544     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
22545     check_max ();
22546     check_min ();
22547     return (0);
22548     } /* main */
22549 EOCP
22550         set try
22551         if eval $compile; then
22552             eval `$run ./try 2>/dev/null`
22553         else
22554             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
22555             fi
22556         $rm_try
22557         ;;
22558     esac
22559
22560 echo "Checking max offsets that localtime () accepts"
22561
22562 case "$sLOCALTIME_min/$sLOCALTIME_max" in
22563     0/0|/)
22564         $cat >try.c <<EOCP
22565 #include <sys/types.h>
22566 #include <stdio.h>
22567 #include <time.h>
22568
22569 int i;
22570 struct tm *tmp;
22571 time_t pt;
22572
22573 void local_check (time_t t, int min_year, int max_year)
22574 {
22575     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
22576         tmp = NULL;
22577     else
22578         tmp = localtime (&t);
22579     if ( tmp == NULL ||
22580         /* Check tm_year overflow */
22581          tmp->tm_year < min_year || tmp->tm_year > max_year)
22582         tmp = NULL;
22583     else
22584         pt = t;
22585     } /* local_check */
22586
22587 int check_max ()
22588 {
22589     tmp = NULL;
22590     pt  = 0;
22591 #ifdef MAXLONG
22592     local_check (MAXLONG, 69, 0x7fffffff);
22593 #endif
22594     if (tmp == NULL || tmp->tm_year < 0) {
22595         for (i = 63; i >= 0; i--) {
22596             time_t x = pt | ((time_t)1 << i);
22597             if (x < 0 || x < pt) continue;
22598             local_check (x, 69, 0x7fffffff);
22599             }
22600         }
22601     printf ("sLOCALTIME_max=%ld\n", pt);
22602     return (0);
22603    } /* check_max */
22604
22605 int check_min ()
22606 {
22607     tmp = NULL;
22608     pt  = 0;
22609 #ifdef MINLONG
22610     local_check (MINLONG, -1900, 70);
22611 #endif
22612     if (tmp == NULL) {
22613         for (i = 36; i >= 0; i--) {
22614             time_t x = pt - ((time_t)1 << i);
22615             if (x > 0) continue;
22616             local_check (x, -1900, 70);
22617             }
22618         }
22619     printf ("sLOCALTIME_min=%ld\n", pt);
22620     return (0);
22621     } /* check_min */
22622
22623 int main (int argc, char *argv[])
22624 {
22625     check_max ();
22626     check_min ();
22627     return (0);
22628     } /* main */
22629 EOCP
22630         set try
22631         if eval $compile; then
22632             eval `$run ./try 2>/dev/null`
22633         else
22634             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
22635             fi
22636         $rm_try
22637         ;;
22638     esac
22639
22640 : check for type of arguments to select.
22641 case "$selecttype" in
22642 '') case "$d_select" in
22643         $define)
22644                 echo " "
22645                 $cat <<EOM
22646 Checking to see what type of arguments are accepted by select().
22647 EOM
22648                 hdrs="$define sys/types.h
22649                         $i_systime sys/time.h
22650                         $i_sysselct sys/select.h
22651                         $d_socket sys/socket.h"
22652                 : The first arg can be int, unsigned, or size_t
22653                 : The last arg may or may not be 'const'
22654                 val=''
22655                 : void pointer has been seen but using that
22656                 : breaks the selectminbits test
22657                 for xxx in 'fd_set *' 'int *'; do
22658                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
22659                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
22660                                         case "$val" in
22661                                         '')     try="$extern_C int select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
22662                                                 if ./protochk "$try" $hdrs; then
22663                                                         echo "Your system accepts $xxx."
22664                                                         val="$xxx"
22665                                                 fi
22666                                                 ;;
22667                                         esac
22668                                 done
22669                         done
22670                 done
22671                 case "$val" in
22672                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22673                         case "$d_fd_set" in
22674                                 $define) dflt="fd_set *" ;;
22675                                 *)              dflt="int *" ;;
22676                         esac
22677                         . ./myread
22678                         val=$ans
22679                         ;;
22680                 esac
22681                 selecttype="$val"
22682                 ;;
22683         *)      : no select, so pick a harmless default
22684                 selecttype='int *'
22685                 ;;
22686         esac
22687         ;;
22688 esac
22689
22690 : check for the select 'width'
22691 case "$selectminbits" in
22692 '') safebits=`expr $ptrsize \* 8`
22693     case "$d_select" in
22694         $define)
22695                 $cat <<EOM
22696
22697 Checking to see on how many bits at a time your select() operates...
22698 EOM
22699                 $cat >try.c <<EOCP
22700 #include <sys/types.h>
22701 #$i_time I_TIME
22702 #$i_systime I_SYS_TIME
22703 #$i_systimek I_SYS_TIME_KERNEL
22704 #ifdef I_TIME
22705 #   include <time.h>
22706 #endif
22707 #ifdef I_SYS_TIME
22708 #   ifdef I_SYS_TIME_KERNEL
22709 #       define KERNEL
22710 #   endif
22711 #   include <sys/time.h>
22712 #   ifdef I_SYS_TIME_KERNEL
22713 #       undef KERNEL
22714 #   endif
22715 #endif
22716 #$i_sysselct I_SYS_SELECT
22717 #ifdef I_SYS_SELECT
22718 #include <sys/select.h>
22719 #endif
22720 #$d_socket HAS_SOCKET
22721 #ifdef HAS_SOCKET
22722 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22723 #endif
22724 #include <stdio.h>
22725 #$i_stdlib I_STDLIB
22726 #ifdef I_STDLIB
22727 #include <stdlib.h>
22728 #endif
22729 $selecttype b;
22730 #define S sizeof(*(b))
22731 #define MINBITS 64
22732 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22733 #define NBITS  (NBYTES * 8)
22734 int main() {
22735     char *s = (char *)malloc(NBYTES);
22736     struct timeval t;
22737     int i;
22738     FILE* fp;
22739     int fd;
22740
22741     if (!s)
22742         exit(1);
22743     fclose(stdin);
22744     fp = fopen("try.c", "r");
22745     if (fp == 0)
22746       exit(2);
22747     fd = fileno(fp);
22748     if (fd < 0)
22749       exit(3);
22750     b = ($selecttype)s;
22751     for (i = 0; i < NBITS; i++)
22752         FD_SET(i, b);
22753     t.tv_sec  = 0;
22754     t.tv_usec = 0;
22755     select(fd + 1, b, 0, 0, &t);
22756     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22757     free(s);
22758     printf("%d\n", i + 1);
22759     return 0;
22760 }
22761 EOCP
22762                 set try
22763                 if eval $compile_ok; then
22764                         selectminbits=`$run ./try 2>/dev/null`
22765                         case "$selectminbits" in
22766                         '')     cat >&4 <<EOM
22767 Cannot figure out on how many bits at a time your select() operates.
22768 I'll play safe and guess it is $safebits bits.
22769 EOM
22770                                 selectminbits=$safebits
22771                                 bits="$safebits bits"
22772                                 ;;
22773                         1)      bits="1 bit" ;;
22774                         *)      bits="$selectminbits bits" ;;
22775                         esac
22776                         echo "Your select() operates on $bits at a time." >&4
22777                 else
22778                         rp='What is the minimum number of bits your select() operates on?'
22779                         case "$byteorder" in
22780                         12345678)       dflt=64 ;;
22781                         1234)           dflt=32 ;;
22782                         *)              dflt=1  ;;
22783                         esac
22784                         . ./myread
22785                         val=$ans
22786                         selectminbits="$val"
22787                 fi
22788                 $rm_try
22789                 ;;
22790         *)      : no select, so pick a harmless default
22791                 selectminbits=$safebits
22792                 ;;
22793         esac
22794         ;;
22795 esac
22796
22797 : Trace out the files included by signal.h, then look for SIGxxx names.
22798 case "$sig_num_init" in
22799 '')
22800 if [ "X$fieldn" = X ]; then
22801         : Just make some guesses.  We check them later.
22802         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22803 else
22804         xxx=`echo '#include <signal.h>' |
22805         $cppstdin $cppminus $cppflags 2>/dev/null |
22806         $grep '^[       ]*#.*include' |
22807         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22808                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22809 fi
22810 xxxfiles=''
22811 for xx in $xxx /dev/null ; do
22812         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22813 done
22814 case "$xxxfiles" in
22815 '')     xxxfiles=`./findhdr signal.h` ;;
22816 esac
22817 xxx=`awk '
22818 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22819         print substr($2, 4, 20)
22820 }
22821 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22822         print substr($3, 4, 20)
22823 }' $xxxfiles`
22824 : Append some common names just in case the awk scan failed.
22825 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22826 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22827 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22828 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22829 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22830
22831 : generate a few handy files for later
22832 $cat > signal.c <<EOCP
22833 #include <sys/types.h>
22834 #include <signal.h>
22835 #$i_stdlib I_STDLIB
22836 #ifdef I_STDLIB
22837 #include <stdlib.h>
22838 #endif
22839 #include <stdio.h>
22840 int main() {
22841
22842 /* Strange style to avoid deeply-nested #if/#else/#endif */
22843 #ifndef NSIG
22844 #  ifdef _NSIG
22845 #    define NSIG (_NSIG)
22846 #  endif
22847 #endif
22848
22849 #ifndef NSIG
22850 #  ifdef SIGMAX
22851 #    define NSIG (SIGMAX+1)
22852 #  endif
22853 #endif
22854
22855 #ifndef NSIG
22856 #  ifdef SIG_MAX
22857 #    define NSIG (SIG_MAX+1)
22858 #  endif
22859 #endif
22860
22861 #ifndef NSIG
22862 #  ifdef _SIG_MAX
22863 #    define NSIG (_SIG_MAX+1)
22864 #  endif
22865 #endif
22866
22867 #ifndef NSIG
22868 #  ifdef MAXSIG
22869 #    define NSIG (MAXSIG+1)
22870 #  endif
22871 #endif
22872
22873 #ifndef NSIG
22874 #  ifdef MAX_SIG
22875 #    define NSIG (MAX_SIG+1)
22876 #  endif
22877 #endif
22878
22879 #ifndef NSIG
22880 #  ifdef SIGARRAYSIZE
22881 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22882 #  endif
22883 #endif
22884
22885 #ifndef NSIG
22886 #  ifdef _sys_nsig
22887 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22888 #  endif
22889 #endif
22890
22891 /* Default to some arbitrary number that's big enough to get most
22892    of the common signals.
22893 */
22894 #ifndef NSIG
22895 #    define NSIG 50
22896 #endif
22897
22898 printf("NSIG %d\n", NSIG);
22899
22900 #ifndef JUST_NSIG
22901
22902 EOCP
22903
22904 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22905 {
22906         printf "#ifdef SIG"; printf $1; printf "\n"
22907         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22908         printf $1; printf ");\n"
22909         printf "#endif\n"
22910 }
22911 END {
22912         printf "#endif /* JUST_NSIG */\n";
22913         printf "exit(0);\n}\n";
22914 }
22915 ' >>signal.c
22916 $cat >signal.awk <<'EOP'
22917 BEGIN { ndups = 0 }
22918 $1 ~ /^NSIG$/ { nsig = $2 }
22919 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22920     if ($2 > maxsig) { maxsig = $2 }
22921     if (sig_name[$2]) {
22922         dup_name[ndups] = $1
22923         dup_num[ndups] = $2
22924         ndups++
22925     }
22926     else {
22927         sig_name[$2] = $1
22928         sig_num[$2] = $2
22929     }
22930 }
22931 END {
22932     if (nsig == 0) {
22933         nsig = maxsig + 1
22934     }
22935     printf("NSIG %d\n", nsig);
22936     for (n = 1; n < nsig; n++) {
22937         if (sig_name[n]) {
22938             printf("%s %d\n", sig_name[n], sig_num[n])
22939         }
22940         else {
22941             printf("NUM%d %d\n", n, n)
22942         }
22943     }
22944     for (n = 0; n < ndups; n++) {
22945         printf("%s %d\n", dup_name[n], dup_num[n])
22946     }
22947 }
22948 EOP
22949 $cat >signal_cmd <<EOS
22950 $startsh
22951 if $test -s signal.lst; then
22952     echo "Using your existing signal.lst file"
22953         exit 0
22954 fi
22955 xxx="$xxx"
22956 EOS
22957 $cat >>signal_cmd <<'EOS'
22958
22959 set signal
22960 if eval $compile_ok; then
22961         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22962                 $uniq | $awk -f signal.awk >signal.lst
22963 else
22964         echo "(I can't seem be able to compile the whole test program)" >&4
22965         echo "(I'll try it in little pieces.)" >&4
22966         set signal -DJUST_NSIG
22967         if eval $compile_ok; then
22968                 $run ./signal$_exe > signal.nsg
22969                 $cat signal.nsg
22970         else
22971                 echo "I can't seem to figure out how many signals you have." >&4
22972                 echo "Guessing 50." >&4
22973                 echo 'NSIG 50' > signal.nsg
22974         fi
22975         : Now look at all the signal names, one at a time.
22976         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22977                 $cat > signal.c <<EOCP
22978 #include <sys/types.h>
22979 #include <signal.h>
22980 #include <stdio.h>
22981 int main() {
22982 printf("$xx %ld\n", (long) SIG${xx});
22983 return 0;
22984 }
22985 EOCP
22986                 set signal
22987                 if eval $compile; then
22988                         echo "SIG${xx} found."
22989                         $run ./signal$_exe  >> signal.ls1
22990                 else
22991                         echo "SIG${xx} NOT found."
22992                 fi
22993         done
22994         if $test -s signal.ls1; then
22995                 $cat signal.nsg signal.ls1 |
22996                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22997         fi
22998
22999 fi
23000 if $test -s signal.lst; then
23001         :
23002 else
23003         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
23004         echo 'kill -l' >signal
23005         set X `csh -f <signal`
23006         $rm -f signal
23007         shift
23008         case $# in
23009         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
23010         esac
23011         echo $@ | $tr ' ' $trnl | \
23012             $awk '{ printf "%s %d\n", $1, ++s; }
23013                   END { printf "NSIG %d\n", ++s }' >signal.lst
23014 fi
23015 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
23016 EOS
23017 chmod a+x signal_cmd
23018 $eunicefix signal_cmd
23019 ;;
23020 esac
23021
23022 : generate list of signal names
23023 case "$sig_num_init" in
23024 '')
23025 echo " "
23026 case "$sig_name_init" in
23027 '') doinit=yes ;;
23028 *)  case "$sig_num_init" in
23029     ''|*,*) doinit=yes ;;
23030     esac ;;
23031 esac
23032 case "$doinit" in
23033 yes)
23034         echo "Generating a list of signal names and numbers..." >&4
23035         . ./signal_cmd
23036         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
23037         sig_name=`$awk 'BEGIN { printf "ZERO " }
23038                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
23039         sig_num=`$awk  'BEGIN { printf "0 " }
23040                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
23041         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
23042                              !/^NSIG/   { printf "\"%s\", ", $1 }
23043                              END        { printf "0\n" }' signal.lst`
23044         sig_num_init=`$awk  'BEGIN      { printf "0, " }
23045                              !/^NSIG/   { printf "%d, ", $2}
23046                              END        { printf "0\n"}' signal.lst`
23047         ;;
23048 esac
23049 echo "The following $sig_count signals are available:"
23050 echo " "
23051 echo $sig_name | $awk \
23052 'BEGIN { linelen = 0 }
23053 {
23054         for (i = 1; i <= NF; i++) {
23055                 name = "SIG" $i " "
23056                 linelen = linelen + length(name)
23057                 if (linelen > 70) {
23058                         printf "\n"
23059                         linelen = length(name)
23060                 }
23061                 printf "%s", name
23062         }
23063         printf "\n"
23064 }'
23065 sig_size=`echo $sig_name | awk '{print NF}'`
23066 $rm -f signal signal.c signal.awk signal.lst signal_cmd
23067 ;;
23068 esac
23069
23070 : Check size of size
23071 echo " "
23072 case "$sizetype" in
23073 *_t) zzz="$sizetype"    ;;
23074 *)   zzz="filesize"     ;;
23075 esac
23076 echo "Checking the size of $zzz..." >&4
23077 cat > try.c <<EOCP
23078 #include <sys/types.h>
23079 #include <stdio.h>
23080 #$i_stdlib I_STDLIB
23081 #ifdef I_STDLIB
23082 #include <stdlib.h>
23083 #endif
23084 int main() {
23085     printf("%d\n", (int)sizeof($sizetype));
23086     exit(0);
23087 }
23088 EOCP
23089 set try
23090 if eval $compile_ok; then
23091         yyy=`$run ./try`
23092         case "$yyy" in
23093         '')     sizesize=4
23094                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
23095                 ;;
23096         *)      sizesize=$yyy
23097                 echo "Your $zzz size is $sizesize bytes."
23098                 ;;
23099         esac
23100 else
23101         sizesize=4
23102         echo "(I can't compile the test program--guessing $sizesize.)" >&4
23103 fi
23104
23105 : check for socklen_t
23106 echo " "
23107 echo "Checking to see if you have socklen_t..." >&4
23108 $cat >try.c <<EOCP
23109 #include <sys/types.h>
23110 #$d_socket HAS_SOCKET
23111 #ifdef HAS_SOCKET
23112 #include <sys/socket.h>
23113 #endif
23114 int main() { socklen_t x = 16; }
23115 EOCP
23116 set try
23117 if eval $compile; then
23118         val="$define"
23119         echo "You have socklen_t."
23120 else
23121         val="$undef"
23122         echo "You do not have socklen_t."
23123         case "$sizetype" in
23124         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
23125         esac
23126 fi
23127 $rm_try
23128 set d_socklen_t
23129 eval $setvar
23130
23131 : see if this is a socks.h system
23132 set socks.h i_socks
23133 eval $inhdr
23134
23135 : check for type of the size argument to socket calls
23136 case "$d_socket" in
23137 "$define")
23138         $cat <<EOM
23139
23140 Checking to see what type is the last argument of accept().
23141 EOM
23142         yyy=''
23143         case "$d_socklen_t" in
23144         "$define") yyy="$yyy socklen_t"
23145         esac
23146         yyy="$yyy $sizetype int long unsigned"
23147         for xxx in $yyy; do
23148                 case "$socksizetype" in
23149                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
23150                         case "$usesocks" in
23151                         "$define")
23152                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
23153                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
23154                                         socksizetype="$xxx"
23155                                 fi
23156                                 ;;
23157                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
23158                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
23159                                         socksizetype="$xxx"
23160                                 fi
23161                                 ;;
23162                         esac
23163                         ;;
23164                 esac
23165         done
23166 : In case none of those worked, prompt the user.
23167         case "$socksizetype" in
23168         '')     rp='What is the type for socket address structure sizes?'
23169                 dflt='int'
23170                 . ./myread
23171                 socksizetype=$ans
23172                 ;;
23173         esac
23174         ;;
23175 *)      : no sockets, so pick relatively harmless default
23176         socksizetype='int'
23177         ;;
23178 esac
23179
23180 : see what type is used for signed size_t
23181 set ssize_t ssizetype int stdio.h sys/types.h
23182 eval $typedef
23183 dflt="$ssizetype"
23184 $cat > try.c <<EOM
23185 #include <stdio.h>
23186 #$i_stdlib I_STDLIB
23187 #ifdef I_STDLIB
23188 #include <stdlib.h>
23189 #endif
23190 #include <sys/types.h>
23191 #define Size_t $sizetype
23192 #define SSize_t $dflt
23193 int main()
23194 {
23195         if (sizeof(Size_t) == sizeof(SSize_t))
23196                 printf("$dflt\n");
23197         else if (sizeof(Size_t) == sizeof(int))
23198                 printf("int\n");
23199         else
23200                 printf("long\n");
23201         exit(0);
23202 }
23203 EOM
23204 echo " "
23205 set try
23206 if eval $compile_ok && $run ./try > /dev/null; then
23207         ssizetype=`$run ./try`
23208         echo "I'll be using $ssizetype for functions returning a byte count." >&4
23209 else
23210         $cat >&4 <<EOM
23211 Help! I can't compile and run the ssize_t test program: please enlighten me!
23212 (This is probably a misconfiguration in your system or libraries, and
23213 you really ought to fix it.  Still, I'll try anyway.)
23214
23215 I need a type that is the same size as $sizetype, but is guaranteed to
23216 be signed.  Common values are ssize_t, int and long.
23217
23218 EOM
23219         rp="What signed type is the same size as $sizetype?"
23220         . ./myread
23221         ssizetype="$ans"
23222 fi
23223 $rm_try
23224
23225 : Check the size of st_dev
23226 $echo " "
23227 $echo "Checking the size of st_dev..." >&4
23228 $cat > try.c <<EOCP
23229 #include <sys/stat.h>
23230 #include <stdio.h>
23231 #$i_stdlib I_STDLIB
23232 #ifdef I_STDLIB
23233 #include <stdlib.h>
23234 #endif
23235 int main() {
23236     struct stat st;
23237     printf("%d\n", (int)sizeof(st.st_dev));
23238     exit(0);
23239 }
23240 EOCP
23241 set try
23242 if eval $compile_ok; then
23243         val=`$run ./try`
23244         case "$val" in
23245         '')     st_dev_size=4
23246                 $echo "(I can't execute the test program--guessing $st_dev_size.)" >&4
23247                 ;;
23248         *)      st_dev_size=$val
23249                 $echo "Your st_dev is $st_dev_size bytes long."
23250                 ;;
23251         esac
23252 else
23253         st_dev_size=4
23254         $echo "(I can't compile the test program--guessing $st_dev_size.)" >&4
23255 fi
23256 $rm_try
23257
23258 : Check if st_dev is signed
23259 $echo " "
23260 $echo "Checking the sign of st_dev..." >&4
23261 $cat > try.c <<EOCP
23262 #include <sys/stat.h>
23263 #include <stdio.h>
23264 int main() {
23265         struct stat foo;
23266         foo.st_dev = -1;
23267         if (foo.st_dev < 0)
23268                 printf("-1\n");
23269         else
23270                 printf("1\n");
23271 }
23272 EOCP
23273 set try
23274 if eval $compile; then
23275         val=`$run ./try`
23276         case "$val" in
23277         '')     st_dev_sign=1
23278                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
23279                 ;;
23280         *)      st_dev_sign=$val
23281                 case "$st_dev_sign" in
23282                  1) $echo "Your st_dev is unsigned." ;;
23283                 -1) $echo "Your st_dev is signed."   ;;
23284                 esac
23285                 ;;
23286         esac
23287 else
23288         st_dev_sign=1
23289         $echo "(I can't compile the test program--guessing unsigned.)" >&4
23290 fi
23291 $rm_try
23292
23293 : Check the size of st_ino
23294 $echo " "
23295 $echo "Checking the size of st_ino..." >&4
23296 $cat > try.c <<EOCP
23297 #include <sys/stat.h>
23298 #include <stdio.h>
23299 #$i_stdlib I_STDLIB
23300 #ifdef I_STDLIB
23301 #include <stdlib.h>
23302 #endif
23303 int main() {
23304     struct stat st;
23305     printf("%d\n", (int)sizeof(st.st_ino));
23306     exit(0);
23307 }
23308 EOCP
23309 set try
23310 if eval $compile_ok; then
23311         val=`$run ./try`
23312         case "$val" in
23313         '')     st_ino_size=4
23314                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
23315                 ;;
23316         *)      st_ino_size=$val
23317                 $echo "Your st_ino is $st_ino_size bytes long."
23318                 ;;
23319         esac
23320 else
23321         st_ino_size=4
23322         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
23323 fi
23324 $rm_try
23325
23326 : Check if st_ino is signed
23327 $echo " "
23328 $echo "Checking the sign of st_ino..." >&4
23329 $cat > try.c <<EOCP
23330 #include <sys/stat.h>
23331 #include <stdio.h>
23332 int main() {
23333         struct stat foo;
23334         foo.st_ino = -1;
23335         if (foo.st_ino < 0)
23336                 printf("-1\n");
23337         else
23338                 printf("1\n");
23339 }
23340 EOCP
23341 set try
23342 if eval $compile; then
23343         val=`$run ./try`
23344         case "$val" in
23345         '')     st_ino_sign=1
23346                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
23347                 ;;
23348         *)      st_ino_sign=$val
23349                 case "$st_ino_sign" in
23350                  1) $echo "Your st_ino is unsigned." ;;
23351                 -1) $echo "Your st_ino is signed."   ;;
23352                 esac
23353                 ;;
23354         esac
23355 else
23356         st_ino_sign=1
23357         $echo "(I can't compile the test program--guessing unsigned.)" >&4
23358 fi
23359 $rm_try
23360
23361 : see what type of char stdio uses.
23362 echo " "
23363 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
23364 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
23365         echo "Your stdio uses unsigned chars." >&4
23366         stdchar="unsigned char"
23367 else
23368         echo "Your stdio uses signed chars." >&4
23369         stdchar="char"
23370 fi
23371 $rm -f stdioh
23372
23373 : Check size of UID
23374 echo " "
23375 case "$uidtype" in
23376 *_t) zzz="$uidtype"     ;;
23377 *)   zzz="uid"          ;;
23378 esac
23379 echo "Checking the size of $zzz..." >&4
23380 cat > try.c <<EOCP
23381 #include <sys/types.h>
23382 #include <stdio.h>
23383 #$i_stdlib I_STDLIB
23384 #ifdef I_STDLIB
23385 #include <stdlib.h>
23386 #endif
23387 int main() {
23388     printf("%d\n", (int)sizeof($uidtype));
23389     exit(0);
23390 }
23391 EOCP
23392 set try
23393 if eval $compile_ok; then
23394         yyy=`$run ./try`
23395         case "$yyy" in
23396         '')     uidsize=4
23397                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
23398                 ;;
23399         *)      uidsize=$yyy
23400                 echo "Your $zzz is $uidsize bytes long."
23401                 ;;
23402         esac
23403 else
23404         uidsize=4
23405         echo "(I can't compile the test program--guessing $uidsize.)" >&4
23406 fi
23407
23408 : Check if UID is signed
23409 echo " "
23410 case "$uidtype" in
23411 *_t) zzz="$uidtype"     ;;
23412 *)   zzz="uid"          ;;
23413 esac
23414 echo "Checking the sign of $zzz..." >&4
23415 cat > try.c <<EOCP
23416 #include <sys/types.h>
23417 #include <stdio.h>
23418 int main() {
23419         $uidtype foo = -1;
23420         if (foo < 0)
23421                 printf("-1\n");
23422         else
23423                 printf("1\n");
23424 }
23425 EOCP
23426 set try
23427 if eval $compile; then
23428         yyy=`$run ./try`
23429         case "$yyy" in
23430         '')     uidsign=1
23431                 echo "(I can't execute the test program--guessing unsigned.)" >&4
23432                 ;;
23433         *)      uidsign=$yyy
23434                 case "$uidsign" in
23435                  1) echo "Your $zzz is unsigned." ;;
23436                 -1) echo "Your $zzz is signed."   ;;
23437                 esac
23438                 ;;
23439         esac
23440 else
23441         uidsign=1
23442         echo "(I can't compile the test program--guessing unsigned.)" >&4
23443 fi
23444
23445 : Check format string for UID
23446 echo " "
23447 $echo "Checking the format string to be used for uids..." >&4
23448
23449 case "$uidsign" in
23450 -1)     if $test X"$uidsize" = X"$ivsize"; then
23451                 uidformat="$ivdformat"
23452         else
23453                 if $test X"$uidsize" = X"$longsize"; then
23454                         uidformat='"ld"'
23455                 else
23456                         if $test X"$uidsize" = X"$intsize"; then
23457                                 uidformat='"d"'
23458                         else
23459                                 if $test X"$uidsize" = X"$shortsize"; then
23460                                         uidformat='"hd"'
23461                                 fi
23462                         fi
23463                 fi
23464         fi
23465         ;;
23466 *)      if $test X"$uidsize" = X"$uvsize"; then
23467                 uidformat="$uvuformat"
23468         else
23469                 if $test X"$uidsize" = X"$longsize"; then
23470                         uidformat='"lu"'
23471                 else
23472                         if $test X"$uidsize" = X"$intsize"; then
23473                                 uidformat='"u"'
23474                         else
23475                                 if $test X"$uidsize" = X"$shortsize"; then
23476                                         uidformat='"hu"'
23477                                 fi
23478                         fi
23479                 fi
23480         fi
23481         ;;
23482 esac
23483
23484 : Ask about strict by default.
23485 case "$usedefaultstrict" in
23486     $define|true|[Yy]*)
23487        dflt="y"
23488        ;;
23489     *)
23490        dflt="n"
23491        ;;
23492     esac
23493
23494 cat <<EOM
23495
23496 EXPERIMENTAL: Perl can now be built with strict on by default when not
23497 invoked with -e or -E. This is a diagnostic tool for development.
23498
23499 Unless you are familiar with this feature, you should probably answer 'no'.
23500
23501 EOM
23502
23503 rp='Would you like to build perl with strict enabled by default?'
23504 . ./myread
23505 case "$ans" in
23506 y|Y) val="$define" ;;
23507 *)   val="$undef"  ;;
23508 esac
23509 set usedefaultstrict
23510 eval $setvar
23511
23512 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
23513 echo " "
23514 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
23515 $cat >try.c <<'EOM'
23516 /* Intentionally a long probe as I'd like to sanity check that the exact
23517    approach is going to work, as thinking it will work, but only having it
23518    part working at runtime is worse than not having it.  */
23519
23520 #include <sys/types.h>
23521 #include <sys/sysctl.h>
23522 #include <sys/param.h>
23523 #include <stdio.h>
23524 #include <string.h>
23525 #include <stdlib.h>
23526 #include <unistd.h>
23527
23528 int
23529 main(int argc, char **argv) {
23530     char *buffer;
23531     char *argv_leaf = strrchr(argv[0], '/');
23532     char *buffer_leaf;
23533     size_t size = 0;
23534     int mib[4];
23535
23536     mib[0] = CTL_KERN;
23537     mib[1] = KERN_PROC;
23538     mib[2] = KERN_PROC_PATHNAME;
23539     mib[3] = -1;
23540
23541     if (!argv_leaf) {
23542         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23543         return 1;
23544     }
23545
23546     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
23547         perror("sysctl");
23548         return 2;
23549     }
23550
23551     if (size < strlen(argv_leaf) + 1) {
23552         fprintf(stderr, "size %lu is too short for a path\n",
23553                 (unsigned long) size);
23554         return 3;
23555     }
23556
23557     if (size > MAXPATHLEN * MAXPATHLEN) {
23558         fprintf(stderr, "size %lu is too long for a path\n",
23559                 (unsigned long) size);
23560         return 4;
23561     }
23562
23563     buffer = (char *)malloc(size);
23564     if (!buffer) {
23565         perror("malloc");
23566         return 5;
23567     }
23568
23569     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
23570         perror("sysctl");
23571         return 6;
23572     }
23573
23574     if (strlen(buffer) + 1 != size) {
23575         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
23576                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
23577         return 7;
23578     }
23579
23580
23581     if (*buffer != '/') {
23582         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
23583         return 8;
23584     }
23585
23586     if (strstr(buffer, "/./")) {
23587         fprintf(stderr, "Contains /./: '%s'\n", buffer);
23588         return 9;
23589     }
23590
23591     if (strstr(buffer, "/../")) {
23592         fprintf(stderr, "Contains /../: '%s'\n", buffer);
23593         return 10;
23594     }
23595
23596     buffer_leaf = strrchr(buffer, '/');
23597     if (strcmp(buffer_leaf, argv_leaf) != 0) {
23598         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
23599         return 11;
23600     }
23601
23602     free(buffer);
23603
23604     return 0;
23605 }
23606 EOM
23607
23608 val=$undef
23609 set try
23610 if eval $compile; then
23611         if $run ./try; then
23612                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
23613                 val="$define"
23614         else
23615                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
23616                 val="$undef"
23617         fi
23618 else
23619         echo "I'm unable to compile the test program." >&4
23620         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
23621         val="$undef"
23622 fi
23623 $rm_try
23624 set usekernprocpathname
23625 eval $setvar
23626
23627 : Determine if we can use _NSGetExecutablePath to find executing program
23628 echo " "
23629 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
23630 $cat >try.c <<'EOM'
23631 /* Intentionally a long probe as I'd like to sanity check that the exact
23632    approach is going to work, as thinking it will work, but only having it
23633    part working at runtime is worse than not having it.  */
23634 #include <mach-o/dyld.h>
23635 #include <stdio.h>
23636 #include <stdlib.h>
23637 #include <sys/param.h>
23638 #include <string.h>
23639
23640 int
23641 main(int argc, char **argv) {
23642     char buf[1];
23643     uint32_t size = sizeof(buf);
23644     int result;
23645     char *buffer;
23646     char *tidied;
23647     char *argv_leaf = strrchr(argv[0], '/');
23648     char *tidied_leaf;
23649
23650     if (!argv_leaf) {
23651         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23652         return 1;
23653     }
23654
23655     _NSGetExecutablePath(buf, &size);
23656     if (size > MAXPATHLEN * MAXPATHLEN) {
23657         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
23658                 (unsigned int) size);
23659         return 2;
23660     }
23661
23662     buffer = (char *)malloc(size);
23663     if (!buffer) {
23664         perror("malloc");
23665         return 3;
23666     }
23667
23668     result = _NSGetExecutablePath(buffer, &size);
23669     if (result != 0) {
23670         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
23671                 result, (unsigned int) size);
23672         return 4;
23673     }
23674
23675     tidied = realpath(buffer, NULL);
23676     if (!tidied) {
23677         perror("realpath");
23678         return 5;
23679     }
23680
23681     free(buffer);
23682
23683     if (*tidied != '/') {
23684         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
23685         return 6;
23686     }
23687
23688     if (strstr(tidied, "/./")) {
23689         fprintf(stderr, "Contains /./: '%s'\n", tidied);
23690         return 7;
23691     }
23692
23693     if (strstr(tidied, "/../")) {
23694         fprintf(stderr, "Contains /../: '%s'\n", tidied);
23695         return 8;
23696     }
23697
23698     tidied_leaf = strrchr(tidied, '/');
23699     if (strcmp(tidied_leaf, argv_leaf) != 0) {
23700         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
23701         return 9;
23702     }
23703
23704     free(tidied);
23705
23706     return 0;
23707 }
23708 EOM
23709
23710 val=$undef
23711 set try
23712 if eval $compile; then
23713         if $run ./try; then
23714                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
23715                 val="$define"
23716         else
23717                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23718         fi
23719 else
23720         echo "I'm unable to compile the test program." >&4
23721         echo "I'll assume no _NSGetExecutablePath here." >&4
23722 fi
23723 $rm_try
23724 set usensgetexecutablepath
23725 eval $setvar
23726
23727 : Check if site customization support was requested
23728 case "$usesitecustomize" in
23729     $define|true|[Yy]*)
23730         usesitecustomize="$define"
23731         ;;
23732     *)
23733         usesitecustomize="$undef"
23734         ;;
23735     esac
23736
23737 : determine compiler compiler
23738 case "$yacc" in
23739 '')
23740         dflt=yacc;;
23741 *)
23742         dflt="$yacc";;
23743 esac
23744 echo " "
23745 comp='yacc'
23746 if $test -f "$byacc$_exe"; then
23747         dflt="$byacc"
23748         comp="byacc or $comp"
23749 fi
23750 if $test -f "$bison$_exe"; then
23751         comp="$comp or bison -y"
23752 fi
23753 rp="Which compiler compiler ($comp) shall I use?"
23754 . ./myread
23755 yacc="$ans"
23756 case "$yacc" in
23757 *bis*)
23758         case "$yacc" in
23759         *-y*) ;;
23760         *)
23761                 yacc="$yacc -y"
23762                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23763                 ;;
23764         esac
23765         ;;
23766 esac
23767
23768 : see if this is a bfd.h system
23769 set bfd.h i_bfd
23770 eval $inhdr
23771
23772 : see if this is an execinfo.h system
23773 set execinfo.h i_execinfo
23774 eval $inhdr
23775
23776 : see if this is a fenv.h system
23777 set fenv.h i_fenv
23778 eval $inhdr
23779
23780 : see if this is a fp.h system
23781 set fp.h i_fp
23782 eval $inhdr
23783
23784 : see if this is a fp_class.h system
23785 set fp_class.h i_fp_class
23786 eval $inhdr
23787
23788 : see if gdbm.h is available
23789 set gdbm.h t_gdbm
23790 eval $inhdr
23791 case "$t_gdbm" in
23792 $define)
23793         : see if gdbm_open exists
23794         set gdbm_open d_gdbm_open
23795         eval $inlibc
23796         case "$d_gdbm_open" in
23797         $undef)
23798                 t_gdbm="$undef"
23799                 echo "We won't be including <gdbm.h>"
23800                 ;;
23801         esac
23802         ;;
23803 esac
23804 val="$t_gdbm"
23805 set i_gdbm
23806 eval $setvar
23807
23808 : see if this is a ieeefp.h system
23809 case "$i_ieeefp" in
23810 '' ) set ieeefp.h i_ieeefp
23811      eval $inhdr
23812      ;;
23813 esac
23814
23815 : see if this is a libutil.h system
23816 set libutil.h i_libutil
23817 eval $inhdr
23818
23819 : see if mach cthreads are available
23820 if test "X$usethreads" = "X$define"; then
23821         set mach/cthreads.h i_machcthr
23822         eval $inhdr
23823 else
23824         i_machcthr="$undef"
23825 fi
23826
23827 : see if this is a mntent.h system
23828 set mntent.h i_mntent
23829 eval $inhdr
23830
23831 : see if net/errno.h is available
23832 val=''
23833 set net/errno.h val
23834 eval $inhdr
23835
23836 : Unfortunately, it causes problems on some systems.  Arrgh.
23837 case "$val" in
23838 $define)
23839         cat > try.c <<'EOM'
23840 #include <stdio.h>
23841 #include <errno.h>
23842 #include <net/errno.h>
23843 int func()
23844 {
23845         return ENOTSOCK;
23846 }
23847 EOM
23848         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23849                 echo "We'll be including <net/errno.h>." >&4
23850         else
23851                 echo "We won't be including <net/errno.h>." >&4
23852                 val="$undef"
23853         fi
23854         $rm_try
23855         ;;
23856 esac
23857 set i_neterrno
23858 eval $setvar
23859
23860 : see if netinet/tcp.h is available
23861 set netinet/tcp.h i_netinettcp
23862 eval $inhdr
23863
23864 : see if this is a poll.h system
23865 set poll.h i_poll
23866 eval $inhdr
23867
23868 : see if this is a prot.h system
23869 set prot.h i_prot
23870 eval $inhdr
23871
23872 : Preprocessor symbols
23873 echo " "
23874 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23875 $cat <<'EOSH' > Cppsym.know
23876 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23877 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23878 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23879 arch_pwr ardent ARM ARM32 atarist att386 att3b
23880 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23881 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23882 byteorder byte_order
23883 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23884 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23885 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23886 ELF encore EPI EXTENSIONS
23887 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23888 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23889 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23890 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23891 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
23892 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23893 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23894 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23895 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23896 ksr1
23897 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23898 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23899 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23900 luna88k Lynx
23901 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23902 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23903 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23904 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23905 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23906 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23907 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23908 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23909 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23910 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23911 ns32000 ns32016 ns32332 ns32k nsc32000
23912 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23913 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23914 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23915 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23916 QK_USER QNX
23917 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23918 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23919 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23920 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23921 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23922 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23923 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23924 SYSV4 SYSV5 sysV68 sysV88
23925 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23926 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23927 tower32_800 tower32_850 tss
23928 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23929 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23930 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23931 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23932 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23933 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23934 uxpm uxps
23935 vax venix VMESA vms
23936 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23937 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23938 z8000 zarch
23939 EOSH
23940 # Maybe put other stuff here too.
23941 ./tr '-' '_' <<EOSH >>Cppsym.know
23942 $osname
23943 EOSH
23944 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23945 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23946 $cat Cppsym.know > Cppsym.c
23947 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23948 $rm -f Cppsym.a Cppsym.b Cppsym.c
23949 cat <<EOSH > Cppsym
23950 $startsh
23951 if $test \$# -gt 0; then
23952     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23953     if $test -s Cppsym.got; then
23954         $rm -f Cppsym.got
23955         exit 0
23956     fi
23957     $rm -f Cppsym.got
23958     exit 1
23959 else
23960     $tr " " "$trnl" | ./Cppsym.try
23961     exit 0
23962 fi
23963 EOSH
23964 chmod +x Cppsym
23965 $eunicefix Cppsym
23966 cat <<EOSH > Cppsym.try
23967 $startsh
23968 cat <<'EOCP' > try.c
23969 #include <stdio.h>
23970 #if cpp_stuff == 1
23971 #define STRINGIFY(a)    "a"
23972 #endif
23973 #if cpp_stuff == 42
23974 #define StGiFy(a)  #a
23975 #define STRINGIFY(a)    StGiFy(a)
23976 #endif
23977 #if $cpp_stuff != 1 && $cpp_stuff != 42
23978 #   include "Bletch: How does this C preprocessor stringify macros?"
23979 #endif
23980 int main() {
23981 EOCP
23982 $awk \\
23983 EOSH
23984 cat <<'EOSH' >> Cppsym.try
23985 'length($1) > 0 {
23986     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23987     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23988     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23989     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23990 }' >> try.c
23991 echo 'return 0;}' >> try.c
23992 EOSH
23993 cat <<EOSH >> Cppsym.try
23994 ccflags="$ccflags"
23995 case "$osname-$gccversion" in
23996 irix-) ccflags="\$ccflags -woff 1178" ;;
23997 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23998 esac
23999 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
24000 EOSH
24001 chmod +x Cppsym.try
24002 $eunicefix Cppsym.try
24003 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
24004 : Add in any Linux cpp "predefined macros":
24005 case "$osname::$gccversion" in
24006   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
24007     tHdrH=_tmpHdr
24008     rm -f $tHdrH'.h' $tHdrH
24009     touch $tHdrH'.h'
24010     # Filter out macro arguments, such as Linux's __INT8_C(c)
24011     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
24012        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
24013        if [ -s $tHdrH'_cppsym.real' ]; then
24014           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
24015        fi
24016     fi
24017     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
24018   ;;
24019 esac
24020 : now check the C compiler for additional symbols
24021 postprocess_cc_v=''
24022 case "$osname" in
24023 aix) postprocess_cc_v="|$tr , ' '" ;;
24024 esac
24025 $cat >ccsym <<EOS
24026 $startsh
24027 $cat >tmp.c <<EOF
24028 extern int foo;
24029 EOF
24030 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
24031 do
24032         case "\$i" in
24033         -D*) echo "\$i" | $sed 's/^-D//;s/['\''\"]//g';;
24034         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
24035         esac
24036 done
24037 $rm_try
24038 EOS
24039 postprocess_cc_v=''
24040 chmod +x ccsym
24041 $eunicefix ccsym
24042 ./ccsym > ccsym1.raw
24043 if $test -s ccsym1.raw; then
24044     $sort ccsym1.raw | $uniq >ccsym.raw
24045 else
24046     mv ccsym1.raw ccsym.raw
24047 fi
24048
24049 $awk '/=/ { print $0; next }
24050         { print $0"=1" }' ccsym.raw >ccsym.list
24051 $comm -13 Cppsym.true ccsym.list >ccsym.own
24052 $comm -12 Cppsym.true ccsym.list >ccsym.com
24053 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
24054 also=''
24055 if $test -z ccsym.raw; then
24056         echo "Your C compiler doesn't seem to define any symbols!" >&4
24057         echo " "
24058         echo "However, your C preprocessor defines the following symbols:"
24059         $cat Cppsym.true
24060         ccsymbols=''
24061         cppsymbols=`$cat Cppsym.true`
24062         cppsymbols=`echo $cppsymbols`
24063         cppccsymbols="$cppsymbols"
24064 else
24065         if $test -s ccsym.com; then
24066                 echo "Your C compiler and pre-processor define these symbols:"
24067                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
24068                 also='also '
24069                 symbols='ones'
24070                 cppccsymbols=`$cat ccsym.com`
24071                 cppccsymbols=`echo $cppccsymbols`
24072                 $test "$silent" || sleep 1
24073         fi
24074         if $test -s ccsym.cpp; then
24075                 $test "$also" && echo " "
24076                 echo "Your C pre-processor ${also}defines the following symbols:"
24077                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
24078                 also='further '
24079                 cppsymbols=`$cat ccsym.cpp`
24080                 cppsymbols=`echo $cppsymbols`
24081                 $test "$silent" || sleep 1
24082         fi
24083         if $test -s ccsym.own; then
24084                 $test "$also" && echo " "
24085                 echo "Your C compiler ${also}defines the following cpp symbols:"
24086                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
24087                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
24088                 ccsymbols=`$cat ccsym.own`
24089                 ccsymbols=`echo $ccsymbols`
24090                 $test "$silent" || sleep 1
24091         fi
24092 fi
24093
24094 : add -D_FORTIFY_SOURCE if feasible and not already there
24095 case "$gccversion" in
24096 [456789].*|[1-9][0-9]*) case "$optimize$ccflags" in
24097         *-O*)   case "$ccflags$cppsymbols" in
24098                 *_FORTIFY_SOURCE=*) # Don't add it again.
24099                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
24100                         ;;
24101                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
24102                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
24103                         ;;
24104                 esac
24105                 ;;
24106         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
24107                 ;;
24108         esac
24109         ;;
24110 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
24111         ;;
24112 esac
24113
24114 : script used to emit important warnings
24115 cat >warn <<EOS
24116 $startsh
24117 if test \$# -gt 0; then
24118         echo "\$@" >msg
24119 else
24120         cat >msg
24121 fi
24122 echo "*** WARNING:" >&4
24123 sed -e 's/^/*** /' <msg >&4
24124 echo "*** " >&4
24125 cat msg >>config.msg
24126 echo " " >>config.msg
24127 rm -f msg
24128 EOS
24129 chmod +x warn
24130 $eunicefix warn
24131
24132 : see if this is a termio system
24133 val="$undef"
24134 val2="$undef"
24135 val3="$undef"
24136 if $test `./findhdr termios.h`; then
24137     set tcsetattr i_termios
24138     eval $inlibc
24139     val3="$i_termios"
24140 fi
24141 echo " "
24142 case "$val3" in
24143     "$define") echo "You have POSIX termios.h... good!" >&4;;
24144     *)  if ./Cppsym pyr; then
24145             case "`$run /bin/universe`" in
24146                 ucb) if $test `./findhdr sgtty.h`; then
24147                         val2="$define"
24148                         echo "<sgtty.h> found." >&4
24149                     else
24150                         echo "System is pyramid with BSD universe."
24151                         ./warn "<sgtty.h> not found--you could have problems."
24152                     fi;;
24153                 *)  if $test `./findhdr termio.h`; then
24154                         val="$define"
24155                         echo "<termio.h> found." >&4
24156                     else
24157                         echo "System is pyramid with USG universe."
24158                         ./warn "<termio.h> not found--you could have problems."
24159                     fi;;
24160             esac
24161         elif ./usg; then
24162             if $test `./findhdr termio.h`; then
24163                 echo "<termio.h> found." >&4
24164                 val="$define"
24165             elif $test `./findhdr sgtty.h`; then
24166                 echo "<sgtty.h> found." >&4
24167                 val2="$define"
24168             else
24169                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
24170             fi
24171         else
24172             if $test `./findhdr sgtty.h`; then
24173                 echo "<sgtty.h> found." >&4
24174                 val2="$define"
24175             elif $test `./findhdr termio.h`; then
24176                 echo "<termio.h> found." >&4
24177                 val="$define"
24178             else
24179                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
24180             fi
24181         fi;;
24182 esac
24183 set i_termio; eval $setvar
24184 val=$val2; set i_sgtty; eval $setvar
24185 val=$val3; set i_termios; eval $setvar
24186
24187 : see if stdbool is available
24188 : we want a real compile instead of Inhdr because some Solaris systems
24189 : have stdbool.h, but it can only be used if the compiler indicates it
24190 : is sufficiently c99-compliant.
24191 echo " "
24192 $cat >try.c <<EOCP
24193 #include <stdio.h>
24194 #include <stdbool.h>
24195 int func(bool x)
24196 {
24197     return x ? 1 : 0;
24198 }
24199 int main(int argc, char **argv)
24200 {
24201     return func(0);
24202 }
24203 EOCP
24204 set try
24205 if eval $compile; then
24206         echo "<stdbool.h> found." >&4
24207         val="$define"
24208 else
24209         echo "<stdbool.h> NOT found." >&4
24210         val="$undef"
24211 fi
24212 $rm_try
24213 set i_stdbool
24214 eval $setvar
24215
24216 : see if stdint is available
24217 set stdint.h i_stdint
24218 eval $inhdr
24219
24220 : see if sys/access.h is available
24221 set sys/access.h i_sysaccess
24222 eval $inhdr
24223
24224 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
24225 set sys/filio.h i_sysfilio
24226 eval $inhdr
24227 echo " "
24228 if $test `./findhdr sys/ioctl.h`; then
24229         val="$define"
24230         echo '<sys/ioctl.h> found.' >&4
24231 else
24232         val="$undef"
24233         if $test $i_sysfilio = "$define"; then
24234             echo '<sys/ioctl.h> NOT found.' >&4
24235         else
24236                 $test $i_sgtty = "$define" && xxx="sgtty.h"
24237                 $test $i_termio = "$define" && xxx="termio.h"
24238                 $test $i_termios = "$define" && xxx="termios.h"
24239 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
24240         fi
24241 fi
24242 set i_sysioctl
24243 eval $setvar
24244
24245 : see if socket ioctl defs are in sys/sockio.h
24246 echo " "
24247 xxx=`./findhdr sys/sockio.h`
24248 if $test "$xxx"; then
24249         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
24250                 val="$define"
24251                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
24252         else
24253                 val="$undef"
24254                 echo "No socket ioctls found in <sys/sockio.h>." >&4
24255         fi
24256 else
24257         val="$undef"
24258         $cat <<EOM
24259 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
24260 EOM
24261 fi
24262 set i_syssockio
24263 eval $setvar
24264
24265 : see if this is a syslog.h system
24266 set syslog.h i_syslog
24267 eval $inhdr
24268
24269 : see if this is a sys/mode.h system
24270 set sys/mode.h i_sysmode
24271 eval $inhdr
24272
24273 : see if there is a sys/poll.h file
24274 set sys/poll.h i_syspoll
24275 eval $inhdr
24276
24277 : see if sys/resource.h has to be included
24278 set sys/resource.h i_sysresrc
24279 eval $inhdr
24280
24281 : see if sys/security.h is available
24282 set sys/security.h i_syssecrt
24283 eval $inhdr
24284
24285 : see if this is a sys/statvfs.h system
24286 set sys/statvfs.h i_sysstatvfs
24287 eval $inhdr
24288
24289 : see if this is a sys/un.h system
24290 set sys/un.h i_sysun
24291 eval $inhdr
24292
24293 : see if this is a sys/utsname.h system
24294 set sys/utsname.h i_sysutsname
24295 eval $inhdr
24296
24297 : see if this is a syswait system
24298 set sys/wait.h i_syswait
24299 eval $inhdr
24300
24301 : see if this is a ustat.h system
24302 set ustat.h i_ustat
24303 eval $inhdr
24304
24305 : see if this is an utime system
24306 set utime.h i_utime
24307 eval $inhdr
24308
24309 : see if this is a vfork system
24310 case "$d_vfork" in
24311 "$define")
24312         set vfork.h i_vfork
24313         eval $inhdr
24314         ;;
24315 *)
24316         i_vfork="$undef"
24317         ;;
24318 esac
24319
24320 : see if wchar.h is present
24321 set wchar.h i_wchar
24322 eval $inhdr
24323
24324 : Check extensions
24325 echo " "
24326 echo "Looking for extensions..." >&4
24327 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
24328 : contain old or inaccurate or duplicate values.
24329 nonxs_extensions=''
24330 xs_extensions=''
24331 : We do not use find because it might not be available.
24332 : We do not just use MANIFEST because the user may have dropped
24333 : some additional extensions into the source tree and expect them
24334 : to be built.
24335
24336 : Function to recursively find available extensions, ignoring DynaLoader
24337 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
24338 : In 5.10.1 and later, extensions are stored in directories
24339 : like File-Glob instead of the older File/Glob/.
24340 find_extensions='
24341     for xxx in *; do
24342         case "$xxx" in
24343             DynaLoader|dynaload) ;;
24344             *)
24345             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
24346             case "$this_ext" in
24347                 Scalar/List/Utils) this_ext="List/Util" ;;
24348                 PathTools)         this_ext="Cwd"       ;;
24349             esac;
24350             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
24351             if $contains " $this_ext " "$tdir/$$.tmp"; then
24352                 echo >&4;
24353                 echo "Duplicate directories detected for extension $xxx" >&4;
24354                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
24355                 case "$knowitall" in
24356                 "") dflt=y;;
24357                 *) dflt=n;;
24358                 esac;
24359                 . ../UU/myread;
24360                 case "$ans" in
24361                 n*|N*) ;;
24362                 *) echo >&4;
24363                     echo "Ok.  Stopping Configure." >&4;
24364                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
24365                     exit 1;;
24366                 esac;
24367                 echo "Ok.  You will need to correct config.sh before running make." >&4;
24368             fi;
24369             $ls -1 "$xxx" > "$tdir/$$.tmp";
24370             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
24371                 xs_extensions="$xs_extensions $this_ext";
24372             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
24373                 xs_extensions="$xs_extensions $this_ext";
24374             elif $test -d "$xxx"; then
24375                 nonxs_extensions="$nonxs_extensions $this_ext";
24376             fi;
24377             $rm -f "$tdir/$$.tmp";
24378             ;;
24379         esac;
24380     done'
24381 tdir=`pwd`
24382 cd "$rsrc/cpan"
24383 set X
24384 shift
24385 eval $find_extensions
24386 cd "$rsrc/dist"
24387 set X
24388 shift
24389 eval $find_extensions
24390 cd "$rsrc/ext"
24391 set X
24392 shift
24393 eval $find_extensions
24394 set X $xs_extensions
24395 shift
24396 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
24397 set X $nonxs_extensions
24398 shift
24399 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
24400 cd "$tdir"
24401 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
24402
24403 : Now see which are supported on this system.
24404 avail_ext=''
24405 for xxx in $xs_extensions ; do
24406         case "$xxx" in
24407         Amiga*)
24408                 case "$osname" in
24409                 amigaos) avail_ext="$avail_ext $xxx" ;;
24410                 esac
24411                 ;;
24412         DB_File|db_file)
24413                 case "$i_db" in
24414                 $define) avail_ext="$avail_ext $xxx" ;;
24415                 esac
24416                 ;;
24417         GDBM_File|gdbm_fil)
24418                 case "$i_gdbm" in
24419                 $define) avail_ext="$avail_ext $xxx" ;;
24420                 esac
24421                 ;;
24422         IPC/SysV|ipc/sysv)
24423                 : XXX Do we need a useipcsysv variable here
24424                 case "${d_msg}${d_sem}${d_shm}" in
24425                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
24426                 esac
24427                 ;;
24428         NDBM_File|ndbm_fil)
24429                 case "$d_ndbm" in
24430                 $define)
24431                     case "$osname-$use64bitint" in
24432                     hpux-define)
24433                         case "$libs" in
24434                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
24435                         esac
24436                         ;;
24437                     *) avail_ext="$avail_ext $xxx" ;;
24438                     esac
24439                     ;;
24440                 esac
24441                 ;;
24442         ODBM_File|odbm_fil)
24443                 case "${i_dbm}${i_rpcsvcdbm}" in
24444                 *"${define}"*)
24445                     case "$d_cplusplus" in
24446                     define) ;; # delete as a function name will not work
24447                     *)  case "$osname-$use64bitint" in
24448                         hpux-define)
24449                             case "$libs" in
24450                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
24451                             esac
24452                             ;;
24453                         *) avail_ext="$avail_ext $xxx" ;;
24454                         esac
24455                         ;;
24456                     esac
24457                     ;;
24458                 esac
24459                 ;;
24460         Opcode|opcode)
24461                 case "$useopcode" in
24462                 true|define|y) avail_ext="$avail_ext $xxx" ;;
24463                 esac
24464                 ;;
24465         POSIX|posix)
24466                 case "$useposix" in
24467                 true|define|y) avail_ext="$avail_ext $xxx" ;;
24468                 esac
24469                 ;;
24470         Socket|socket)
24471                 case "$d_socket" in
24472                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
24473                 esac
24474                 ;;
24475         I18N/Langinfo|langinfo)
24476                 case "$uselanginfo" in
24477                 true|define|y) avail_ext="$avail_ext $xxx" ;;
24478                 esac
24479                 ;;
24480         Sys/Syslog|sys/syslog)
24481                 case $osname in
24482                         amigaos) ;; # not really very useful on AmigaOS
24483                         *)
24484                         : XXX syslog requires socket
24485                         case "$d_socket" in
24486                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
24487                         esac
24488                         ;;
24489                 esac
24490                 ;;
24491         threads|threads/shared)
24492                 # threads and threads::shared are special cases.
24493                 # To stop people from asking "Perl 5.8.0 was supposed
24494                 # to have this new fancy threads implementation but my
24495                 # perl doesn't have it" and from people trying to
24496                 # (re)install the threads module using CPAN.pm and
24497                 # CPAN.pm then offering to reinstall Perl 5.8.0,
24498                 # the threads.pm and threads/shared.pm will always be
24499                 # there, croaking informatively ("you need to rebuild
24500                 # all of Perl with threads, sorry") when threads haven't
24501                 # been compiled in.
24502                 # --jhi
24503                 avail_ext="$avail_ext $xxx"
24504                 ;;
24505         VMS*)
24506                 ;;
24507         Win32*)
24508                 case "$osname" in
24509                 cygwin) avail_ext="$avail_ext $xxx" ;;
24510                 esac
24511                 ;;
24512         XS/APItest|xs/apitest)
24513                 # This is just for testing.  Skip it unless we have dynamic loading.
24514
24515                 case "$usedl" in
24516                 $define) avail_ext="$avail_ext $xxx" ;;
24517                 esac
24518                 ;;
24519         XS/Typemap|xs/typemap)
24520                 # This is just for testing.  Skip it unless we have dynamic loading.
24521                 case "$usedl" in
24522                 $define) avail_ext="$avail_ext $xxx" ;;
24523                 esac
24524                 ;;
24525         *)      avail_ext="$avail_ext $xxx"
24526                 ;;
24527         esac
24528 done
24529
24530 set X $avail_ext
24531 shift
24532 avail_ext="$*"
24533
24534 case "$onlyextensions" in
24535 '') ;;
24536 *)  keepextensions=''
24537     echo "You have requested that only certain extensions be included..." >&4
24538     for i in $onlyextensions; do
24539         case " $avail_ext " in
24540         *" $i "*)
24541             echo "Keeping extension $i."
24542             keepextensions="$keepextensions $i"
24543             ;;
24544         *) echo "Ignoring extension $i." ;;
24545         esac
24546     done
24547     avail_ext="$keepextensions"
24548     ;;
24549 esac
24550
24551 case "$noextensions" in
24552 '') ;;
24553 *)  keepextensions=''
24554     echo "You have requested that certain extensions be ignored..." >&4
24555     for i in $avail_ext; do
24556         case " $noextensions " in
24557         *" $i "*) echo "Ignoring extension $i." ;;
24558         *) echo "Keeping extension $i.";
24559            keepextensions="$keepextensions $i"
24560            ;;
24561         esac
24562     done
24563     avail_ext="$keepextensions"
24564     ;;
24565 esac
24566
24567 : Now see which nonxs extensions are supported on this system.
24568 : For now assume all are.
24569 nonxs_ext=''
24570 for xxx in $nonxs_extensions ; do
24571         case "$xxx" in
24572         VMS*)
24573                 ;;
24574         *)      nonxs_ext="$nonxs_ext $xxx"
24575                 ;;
24576         esac
24577 done
24578
24579 set X $nonxs_ext
24580 shift
24581 nonxs_ext="$*"
24582
24583 case $usedl in
24584 $define)
24585         $cat <<EOM
24586 A number of extensions are supplied with $package.  You may choose to
24587 compile these extensions for dynamic loading (the default), compile
24588 them into the $package executable (static loading), or not include
24589 them at all.  Answer "none" to include no extensions.
24590 Note that DynaLoader is always built and need not be mentioned here.
24591
24592 EOM
24593         case "$dynamic_ext" in
24594         '')
24595                 : Exclude those listed in static_ext
24596                 dflt=''
24597                 for xxx in $avail_ext; do
24598                         case " $static_ext " in
24599                         *" $xxx "*) ;;
24600                         *) dflt="$dflt $xxx" ;;
24601                         esac
24602                 done
24603                 set X $dflt
24604                 shift
24605                 dflt="$*"
24606                 ;;
24607         *)      dflt="$dynamic_ext"
24608                 # Perhaps we are reusing an old out-of-date config.sh.
24609                 case "$hint" in
24610                 previous)
24611                         if test X"$dynamic_ext" != X"$avail_ext"; then
24612                                 $cat <<EOM
24613 NOTICE:  Your previous config.sh list may be incorrect.
24614 The extensions now available to you are
24615         ${avail_ext}
24616 but the default list from your previous config.sh is
24617         ${dynamic_ext}
24618
24619 EOM
24620                         fi
24621                         ;;
24622                 esac
24623                 ;;
24624         esac
24625         case "$dflt" in
24626         '')     dflt=none;;
24627         esac
24628         rp="What extensions do you wish to load dynamically?"
24629         . ./myread
24630         case "$ans" in
24631         none) dynamic_ext=' ' ;;
24632         *) dynamic_ext="$ans" ;;
24633         esac
24634
24635         case "$static_ext" in
24636         '')
24637                 : Exclude those already listed in dynamic linking
24638                 dflt=''
24639                 for xxx in $avail_ext; do
24640                         case " $dynamic_ext " in
24641                         *" $xxx "*) ;;
24642                         *) dflt="$dflt $xxx" ;;
24643                         esac
24644                 done
24645                 set X $dflt
24646                 shift
24647                 dflt="$*"
24648                 ;;
24649         *)  dflt="$static_ext"
24650                 ;;
24651         esac
24652
24653         case "$dflt" in
24654         '')     dflt=none;;
24655         esac
24656         rp="What extensions do you wish to load statically?"
24657         . ./myread
24658         case "$ans" in
24659         none) static_ext=' ' ;;
24660         *) static_ext="$ans" ;;
24661         esac
24662         ;;
24663 *)
24664         $cat <<EOM
24665 A number of extensions are supplied with $package.  Answer "none"
24666 to include no extensions.
24667 Note that DynaLoader is always built and need not be mentioned here.
24668
24669 EOM
24670         case "$static_ext" in
24671         '') dflt="$avail_ext" ;;
24672         *)      dflt="$static_ext"
24673                 # Perhaps we are reusing an old out-of-date config.sh.
24674                 case "$hint" in
24675                 previous)
24676                         if test X"$static_ext" != X"$avail_ext"; then
24677                                 $cat <<EOM
24678 NOTICE:  Your previous config.sh list may be incorrect.
24679 The extensions now available to you are
24680         ${avail_ext}
24681 but the default list from your previous config.sh is
24682         ${static_ext}
24683
24684 EOM
24685                         fi
24686                         ;;
24687                 esac
24688                 ;;
24689         esac
24690         : Exclude those that are not xs extensions
24691         case "$dflt" in
24692         '')     dflt=none;;
24693         esac
24694         rp="What extensions do you wish to include?"
24695         . ./myread
24696         case "$ans" in
24697         none) static_ext=' ' ;;
24698         *) static_ext="$ans" ;;
24699         esac
24700         ;;
24701 esac
24702 #
24703 # Encode is a special case.  If we are building Encode as a static
24704 # extension, we need to explicitly list its subextensions as well.
24705 # For other nested extensions, this is handled automatically by
24706 # the appropriate Makefile.PL.
24707 case " $static_ext " in
24708         *" Encode "*) # Add the subextensions of Encode
24709         cd "$rsrc/cpan"
24710         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24711                 static_ext="$static_ext Encode/$xxx"
24712                 known_extensions="$known_extensions Encode/$xxx"
24713         done
24714         cd "$tdir"
24715         ;;
24716 esac
24717
24718 set X $dynamic_ext $static_ext $nonxs_ext
24719 shift
24720 extensions="$*"
24721
24722 # Sanity check:  We require an extension suitable for use with
24723 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
24724 # should show up as failures in the test suite, but it's helpful to
24725 # catch them now.) The 'extensions' list is normally sorted
24726 # alphabetically, so we need to accept either
24727 #    DB_File ... Fcntl ... IO  ....
24728 # or something like
24729 #    Fcntl ... NDBM_File ... IO  ....
24730 case " $extensions"  in
24731 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
24732 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24733 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24734 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24735    echo "WARNING: The Perl you are building will be quite crippled." >&4
24736    ;;
24737 esac
24738
24739 : Remove libraries needed only for extensions
24740 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24741 : The exception is SunOS 4.x, which needs them.
24742 case "${osname}X${osvers}" in
24743 sunos*X4*)
24744     perllibs="$libs"
24745     ;;
24746 *) case "$usedl" in
24747     $define|true|[yY]*)
24748             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24749             shift
24750             perllibs="$*"
24751             ;;
24752     *)  perllibs="$libs"
24753             ;;
24754     esac
24755     ;;
24756 esac
24757
24758 : Remove build directory name from cppstdin so it can be used from
24759 : either the present location or the final installed location.
24760 echo " "
24761 : Get out of the UU directory to get correct path name.
24762 cd ..
24763 case "$cppstdin" in
24764 `pwd`/cppstdin)
24765         echo "Stripping down cppstdin path name"
24766         cppstdin=cppstdin
24767         ;;
24768 esac
24769 cd UU
24770
24771 : end of configuration questions
24772 echo " "
24773 echo "End of configuration questions."
24774 echo " "
24775
24776 : back to where it started
24777 if test -d ../UU; then
24778         cd ..
24779 fi
24780
24781 : configuration may be unconditionally patched via a 'config.arch' file
24782 if $test -f config.arch; then
24783         echo "I see a config.arch file, loading it." >&4
24784         . ./config.arch
24785 fi
24786
24787 : configuration may be patched via a 'config.over' file
24788 if $test -f config.over; then
24789         echo " "
24790         dflt=y
24791         rp='I see a config.over file.  Do you wish to load it?'
24792         . UU/myread
24793         case "$ans" in
24794         n*) echo "OK, I'll ignore it.";;
24795         *)      . ./config.over
24796                 echo "Configuration override changes have been loaded."
24797                 ;;
24798         esac
24799 fi
24800
24801 : in case they want portability, strip down executable paths
24802 case "$d_portable" in
24803 "$define")
24804         echo " "
24805         echo "Stripping down executable paths..." >&4
24806         for file in $loclist $trylist; do
24807                 eval temp=\$$file
24808                 eval $file=`basename $temp`
24809         done
24810         ;;
24811 esac
24812
24813 : create config.sh file
24814 echo " "
24815 echo "Creating config.sh..." >&4
24816 $spitshell <<EOT >config.sh
24817 $startsh
24818 #
24819 # This file was produced by running the Configure script. It holds all the
24820 # definitions figured out by Configure. Should you modify one of these values,
24821 # do not forget to propagate your changes by running "Configure -der". You may
24822 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24823 #
24824
24825 # Package name      : $package
24826 # Source directory  : $src
24827 # Configuration time: $cf_time
24828 # Configured by     : $cf_by
24829 # Target system     : $myuname
24830
24831 EOT
24832 : Add in command line options if available
24833 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24834
24835 $spitshell <<EOT >>config.sh
24836
24837 Author='$Author'
24838 Date='$Date'
24839 Header='$Header'
24840 Id='$Id'
24841 Locker='$Locker'
24842 Log='$Log'
24843 RCSfile='$RCSfile'
24844 Revision='$Revision'
24845 Source='$Source'
24846 State='$State'
24847 _a='$_a'
24848 _exe='$_exe'
24849 _o='$_o'
24850 afs='$afs'
24851 afsroot='$afsroot'
24852 alignbytes='$alignbytes'
24853 aphostname='$aphostname'
24854 api_revision='$api_revision'
24855 api_subversion='$api_subversion'
24856 api_version='$api_version'
24857 api_versionstring='$api_versionstring'
24858 ar='$ar'
24859 archlib='$archlib'
24860 archlibexp='$archlibexp'
24861 archname64='$archname64'
24862 archname='$archname'
24863 archobjs='$archobjs'
24864 asctime_r_proto='$asctime_r_proto'
24865 awk='$awk'
24866 baserev='$baserev'
24867 bash='$bash'
24868 bin='$bin'
24869 bin_ELF='$bin_ELF'
24870 binexp='$binexp'
24871 bison='$bison'
24872 byacc='$byacc'
24873 byteorder='$byteorder'
24874 c='$c'
24875 castflags='$castflags'
24876 cat='$cat'
24877 cc='$cc'
24878 cccdlflags='$cccdlflags'
24879 ccdlflags='$ccdlflags'
24880 ccflags='$ccflags'
24881 ccflags_uselargefiles='$ccflags_uselargefiles'
24882 ccname='$ccname'
24883 ccsymbols='$ccsymbols'
24884 ccversion='$ccversion'
24885 cf_by='$cf_by'
24886 cf_email='$cf_email'
24887 cf_time='$cf_time'
24888 charbits='$charbits'
24889 charsize='$charsize'
24890 chgrp='$chgrp'
24891 chmod='$chmod'
24892 chown='$chown'
24893 clocktype='$clocktype'
24894 comm='$comm'
24895 compiler_warning='$compiler_warning'
24896 compress='$compress'
24897 contains='$contains'
24898 cp='$cp'
24899 cpio='$cpio'
24900 cpp='$cpp'
24901 cpp_stuff='$cpp_stuff'
24902 cppccsymbols='$cppccsymbols'
24903 cppflags='$cppflags'
24904 cpplast='$cpplast'
24905 cppminus='$cppminus'
24906 cpprun='$cpprun'
24907 cppstdin='$cppstdin'
24908 cppsymbols='$cppsymbols'
24909 crypt_r_proto='$crypt_r_proto'
24910 cryptlib='$cryptlib'
24911 csh='$csh'
24912 ctermid_r_proto='$ctermid_r_proto'
24913 ctime_r_proto='$ctime_r_proto'
24914 d_Gconvert='$d_Gconvert'
24915 d_PRIEUldbl='$d_PRIEUldbl'
24916 d_PRIFUldbl='$d_PRIFUldbl'
24917 d_PRIGUldbl='$d_PRIGUldbl'
24918 d_PRIXU64='$d_PRIXU64'
24919 d_PRId64='$d_PRId64'
24920 d_PRIeldbl='$d_PRIeldbl'
24921 d_PRIfldbl='$d_PRIfldbl'
24922 d_PRIgldbl='$d_PRIgldbl'
24923 d_PRIi64='$d_PRIi64'
24924 d_PRIo64='$d_PRIo64'
24925 d_PRIu64='$d_PRIu64'
24926 d_PRIx64='$d_PRIx64'
24927 d_SCNfldbl='$d_SCNfldbl'
24928 d__fwalk='$d__fwalk'
24929 d_accept4='$d_accept4'
24930 d_access='$d_access'
24931 d_accessx='$d_accessx'
24932 d_acosh='$d_acosh'
24933 d_aintl='$d_aintl'
24934 d_alarm='$d_alarm'
24935 d_archlib='$d_archlib'
24936 d_asctime64='$d_asctime64'
24937 d_asctime_r='$d_asctime_r'
24938 d_asinh='$d_asinh'
24939 d_atanh='$d_atanh'
24940 d_atolf='$d_atolf'
24941 d_atoll='$d_atoll'
24942 d_attribute_always_inline='$d_attribute_always_inline'
24943 d_attribute_deprecated='$d_attribute_deprecated'
24944 d_attribute_format='$d_attribute_format'
24945 d_attribute_malloc='$d_attribute_malloc'
24946 d_attribute_nonnull='$d_attribute_nonnull'
24947 d_attribute_noreturn='$d_attribute_noreturn'
24948 d_attribute_pure='$d_attribute_pure'
24949 d_attribute_unused='$d_attribute_unused'
24950 d_attribute_visibility='$d_attribute_visibility'
24951 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24952 d_backtrace='$d_backtrace'
24953 d_bsd='$d_bsd'
24954 d_bsdgetpgrp='$d_bsdgetpgrp'
24955 d_bsdsetpgrp='$d_bsdsetpgrp'
24956 d_builtin_add_overflow='$d_builtin_add_overflow'
24957 d_builtin_choose_expr='$d_builtin_choose_expr'
24958 d_builtin_expect='$d_builtin_expect'
24959 d_builtin_mul_overflow='$d_builtin_mul_overflow'
24960 d_builtin_sub_overflow='$d_builtin_sub_overflow'
24961 d_c99_variadic_macros='$d_c99_variadic_macros'
24962 d_casti32='$d_casti32'
24963 d_castneg='$d_castneg'
24964 d_cbrt='$d_cbrt'
24965 d_chown='$d_chown'
24966 d_chroot='$d_chroot'
24967 d_chsize='$d_chsize'
24968 d_class='$d_class'
24969 d_clearenv='$d_clearenv'
24970 d_closedir='$d_closedir'
24971 d_cmsghdr_s='$d_cmsghdr_s'
24972 d_copysign='$d_copysign'
24973 d_copysignl='$d_copysignl'
24974 d_cplusplus='$d_cplusplus'
24975 d_crypt='$d_crypt'
24976 d_crypt_r='$d_crypt_r'
24977 d_csh='$d_csh'
24978 d_ctermid='$d_ctermid'
24979 d_ctermid_r='$d_ctermid_r'
24980 d_ctime64='$d_ctime64'
24981 d_ctime_r='$d_ctime_r'
24982 d_cuserid='$d_cuserid'
24983 d_dbminitproto='$d_dbminitproto'
24984 d_difftime64='$d_difftime64'
24985 d_difftime='$d_difftime'
24986 d_dir_dd_fd='$d_dir_dd_fd'
24987 d_dirfd='$d_dirfd'
24988 d_dirnamlen='$d_dirnamlen'
24989 d_dladdr='$d_dladdr'
24990 d_dlerror='$d_dlerror'
24991 d_dlopen='$d_dlopen'
24992 d_dlsymun='$d_dlsymun'
24993 d_dosuid='$d_dosuid'
24994 d_double_has_inf='$d_double_has_inf'
24995 d_double_has_nan='$d_double_has_nan'
24996 d_double_has_negative_zero='$d_double_has_negative_zero'
24997 d_double_has_subnormals='$d_double_has_subnormals'
24998 d_double_style_cray='$d_double_style_cray'
24999 d_double_style_ibm='$d_double_style_ibm'
25000 d_double_style_ieee='$d_double_style_ieee'
25001 d_double_style_vax='$d_double_style_vax'
25002 d_drand48_r='$d_drand48_r'
25003 d_drand48proto='$d_drand48proto'
25004 d_dup2='$d_dup2'
25005 d_dup3='$d_dup3'
25006 d_duplocale='$d_duplocale'
25007 d_eaccess='$d_eaccess'
25008 d_endgrent='$d_endgrent'
25009 d_endgrent_r='$d_endgrent_r'
25010 d_endhent='$d_endhent'
25011 d_endhostent_r='$d_endhostent_r'
25012 d_endnent='$d_endnent'
25013 d_endnetent_r='$d_endnetent_r'
25014 d_endpent='$d_endpent'
25015 d_endprotoent_r='$d_endprotoent_r'
25016 d_endpwent='$d_endpwent'
25017 d_endpwent_r='$d_endpwent_r'
25018 d_endsent='$d_endsent'
25019 d_endservent_r='$d_endservent_r'
25020 d_eofnblk='$d_eofnblk'
25021 d_erf='$d_erf'
25022 d_erfc='$d_erfc'
25023 d_eunice='$d_eunice'
25024 d_exp2='$d_exp2'
25025 d_expm1='$d_expm1'
25026 d_faststdio='$d_faststdio'
25027 d_fchdir='$d_fchdir'
25028 d_fchmod='$d_fchmod'
25029 d_fchmodat='$d_fchmodat'
25030 d_fchown='$d_fchown'
25031 d_fcntl='$d_fcntl'
25032 d_fcntl_can_lock='$d_fcntl_can_lock'
25033 d_fd_macros='$d_fd_macros'
25034 d_fd_set='$d_fd_set'
25035 d_fdclose='$d_fdclose'
25036 d_fdim='$d_fdim'
25037 d_fds_bits='$d_fds_bits'
25038 d_fegetround='$d_fegetround'
25039 d_ffs='$d_ffs'
25040 d_ffsl='$d_ffsl'
25041 d_fgetpos='$d_fgetpos'
25042 d_finite='$d_finite'
25043 d_finitel='$d_finitel'
25044 d_flexfnam='$d_flexfnam'
25045 d_flock='$d_flock'
25046 d_flockproto='$d_flockproto'
25047 d_fma='$d_fma'
25048 d_fmax='$d_fmax'
25049 d_fmin='$d_fmin'
25050 d_fork='$d_fork'
25051 d_fp_class='$d_fp_class'
25052 d_fp_classify='$d_fp_classify'
25053 d_fp_classl='$d_fp_classl'
25054 d_fpathconf='$d_fpathconf'
25055 d_fpclass='$d_fpclass'
25056 d_fpclassify='$d_fpclassify'
25057 d_fpclassl='$d_fpclassl'
25058 d_fpgetround='$d_fpgetround'
25059 d_fpos64_t='$d_fpos64_t'
25060 d_freelocale='$d_freelocale'
25061 d_frexpl='$d_frexpl'
25062 d_fs_data_s='$d_fs_data_s'
25063 d_fseeko='$d_fseeko'
25064 d_fsetpos='$d_fsetpos'
25065 d_fstatfs='$d_fstatfs'
25066 d_fstatvfs='$d_fstatvfs'
25067 d_fsync='$d_fsync'
25068 d_ftello='$d_ftello'
25069 d_ftime='$d_ftime'
25070 d_futimes='$d_futimes'
25071 d_gai_strerror='$d_gai_strerror'
25072 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
25073 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
25074 d_getaddrinfo='$d_getaddrinfo'
25075 d_getcwd='$d_getcwd'
25076 d_getenv_preserves_other_thread='$d_getenv_preserves_other_thread'
25077 d_getespwnam='$d_getespwnam'
25078 d_getfsstat='$d_getfsstat'
25079 d_getgrent='$d_getgrent'
25080 d_getgrent_r='$d_getgrent_r'
25081 d_getgrgid_r='$d_getgrgid_r'
25082 d_getgrnam_r='$d_getgrnam_r'
25083 d_getgrps='$d_getgrps'
25084 d_gethbyaddr='$d_gethbyaddr'
25085 d_gethbyname='$d_gethbyname'
25086 d_gethent='$d_gethent'
25087 d_gethname='$d_gethname'
25088 d_gethostbyaddr_r='$d_gethostbyaddr_r'
25089 d_gethostbyname_r='$d_gethostbyname_r'
25090 d_gethostent_r='$d_gethostent_r'
25091 d_gethostprotos='$d_gethostprotos'
25092 d_getitimer='$d_getitimer'
25093 d_getlogin='$d_getlogin'
25094 d_getlogin_r='$d_getlogin_r'
25095 d_getmnt='$d_getmnt'
25096 d_getmntent='$d_getmntent'
25097 d_getnameinfo='$d_getnameinfo'
25098 d_getnbyaddr='$d_getnbyaddr'
25099 d_getnbyname='$d_getnbyname'
25100 d_getnent='$d_getnent'
25101 d_getnetbyaddr_r='$d_getnetbyaddr_r'
25102 d_getnetbyname_r='$d_getnetbyname_r'
25103 d_getnetent_r='$d_getnetent_r'
25104 d_getnetprotos='$d_getnetprotos'
25105 d_getpagsz='$d_getpagsz'
25106 d_getpbyname='$d_getpbyname'
25107 d_getpbynumber='$d_getpbynumber'
25108 d_getpent='$d_getpent'
25109 d_getpgid='$d_getpgid'
25110 d_getpgrp2='$d_getpgrp2'
25111 d_getpgrp='$d_getpgrp'
25112 d_getppid='$d_getppid'
25113 d_getprior='$d_getprior'
25114 d_getprotobyname_r='$d_getprotobyname_r'
25115 d_getprotobynumber_r='$d_getprotobynumber_r'
25116 d_getprotoent_r='$d_getprotoent_r'
25117 d_getprotoprotos='$d_getprotoprotos'
25118 d_getprpwnam='$d_getprpwnam'
25119 d_getpwent='$d_getpwent'
25120 d_getpwent_r='$d_getpwent_r'
25121 d_getpwnam_r='$d_getpwnam_r'
25122 d_getpwuid_r='$d_getpwuid_r'
25123 d_getsbyname='$d_getsbyname'
25124 d_getsbyport='$d_getsbyport'
25125 d_getsent='$d_getsent'
25126 d_getservbyname_r='$d_getservbyname_r'
25127 d_getservbyport_r='$d_getservbyport_r'
25128 d_getservent_r='$d_getservent_r'
25129 d_getservprotos='$d_getservprotos'
25130 d_getspnam='$d_getspnam'
25131 d_getspnam_r='$d_getspnam_r'
25132 d_gettimeod='$d_gettimeod'
25133 d_gmtime64='$d_gmtime64'
25134 d_gmtime_r='$d_gmtime_r'
25135 d_gnulibc='$d_gnulibc'
25136 d_grpasswd='$d_grpasswd'
25137 d_has_C_UTF8='$d_has_C_UTF8'
25138 d_hasmntopt='$d_hasmntopt'
25139 d_htonl='$d_htonl'
25140 d_hypot='$d_hypot'
25141 d_ilogb='$d_ilogb'
25142 d_ilogbl='$d_ilogbl'
25143 d_inc_version_list='$d_inc_version_list'
25144 d_inetaton='$d_inetaton'
25145 d_inetntop='$d_inetntop'
25146 d_inetpton='$d_inetpton'
25147 d_int64_t='$d_int64_t'
25148 d_ip_mreq='$d_ip_mreq'
25149 d_ip_mreq_source='$d_ip_mreq_source'
25150 d_ipv6_mreq='$d_ipv6_mreq'
25151 d_ipv6_mreq_source='$d_ipv6_mreq_source'
25152 d_isascii='$d_isascii'
25153 d_isblank='$d_isblank'
25154 d_isfinite='$d_isfinite'
25155 d_isfinitel='$d_isfinitel'
25156 d_isinf='$d_isinf'
25157 d_isinfl='$d_isinfl'
25158 d_isless='$d_isless'
25159 d_isnan='$d_isnan'
25160 d_isnanl='$d_isnanl'
25161 d_isnormal='$d_isnormal'
25162 d_j0='$d_j0'
25163 d_j0l='$d_j0l'
25164 d_killpg='$d_killpg'
25165 d_lc_monetary_2008='$d_lc_monetary_2008'
25166 d_lchown='$d_lchown'
25167 d_ldbl_dig='$d_ldbl_dig'
25168 d_ldexpl='$d_ldexpl'
25169 d_lgamma='$d_lgamma'
25170 d_lgamma_r='$d_lgamma_r'
25171 d_libm_lib_version='$d_libm_lib_version'
25172 d_libname_unique='$d_libname_unique'
25173 d_link='$d_link'
25174 d_linkat='$d_linkat'
25175 d_llrint='$d_llrint'
25176 d_llrintl='$d_llrintl'
25177 d_llround='$d_llround'
25178 d_llroundl='$d_llroundl'
25179 d_localeconv_l='$d_localeconv_l'
25180 d_localtime64='$d_localtime64'
25181 d_localtime_r='$d_localtime_r'
25182 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
25183 d_locconv='$d_locconv'
25184 d_lockf='$d_lockf'
25185 d_log1p='$d_log1p'
25186 d_log2='$d_log2'
25187 d_logb='$d_logb'
25188 d_long_double_style_ieee='$d_long_double_style_ieee'
25189 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
25190 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
25191 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
25192 d_long_double_style_vax='$d_long_double_style_vax'
25193 d_longdbl='$d_longdbl'
25194 d_longlong='$d_longlong'
25195 d_lrint='$d_lrint'
25196 d_lrintl='$d_lrintl'
25197 d_lround='$d_lround'
25198 d_lroundl='$d_lroundl'
25199 d_lseekproto='$d_lseekproto'
25200 d_lstat='$d_lstat'
25201 d_madvise='$d_madvise'
25202 d_malloc_good_size='$d_malloc_good_size'
25203 d_malloc_size='$d_malloc_size'
25204 d_malloc_usable_size='$d_malloc_usable_size'
25205 d_mblen='$d_mblen'
25206 d_mbrlen='$d_mbrlen'
25207 d_mbrtowc='$d_mbrtowc'
25208 d_mbstowcs='$d_mbstowcs'
25209 d_mbtowc='$d_mbtowc'
25210 d_memmem='$d_memmem'
25211 d_memrchr='$d_memrchr'
25212 d_mkdir='$d_mkdir'
25213 d_mkdtemp='$d_mkdtemp'
25214 d_mkfifo='$d_mkfifo'
25215 d_mkostemp='$d_mkostemp'
25216 d_mkstemp='$d_mkstemp'
25217 d_mkstemps='$d_mkstemps'
25218 d_mktime64='$d_mktime64'
25219 d_mktime='$d_mktime'
25220 d_mmap='$d_mmap'
25221 d_modfl='$d_modfl'
25222 d_modflproto='$d_modflproto'
25223 d_mprotect='$d_mprotect'
25224 d_msg='$d_msg'
25225 d_msg_ctrunc='$d_msg_ctrunc'
25226 d_msg_dontroute='$d_msg_dontroute'
25227 d_msg_oob='$d_msg_oob'
25228 d_msg_peek='$d_msg_peek'
25229 d_msg_proxy='$d_msg_proxy'
25230 d_msgctl='$d_msgctl'
25231 d_msgget='$d_msgget'
25232 d_msghdr_s='$d_msghdr_s'
25233 d_msgrcv='$d_msgrcv'
25234 d_msgsnd='$d_msgsnd'
25235 d_msync='$d_msync'
25236 d_munmap='$d_munmap'
25237 d_mymalloc='$d_mymalloc'
25238 d_nan='$d_nan'
25239 d_nanosleep='$d_nanosleep'
25240 d_ndbm='$d_ndbm'
25241 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
25242 d_nearbyint='$d_nearbyint'
25243 d_newlocale='$d_newlocale'
25244 d_nextafter='$d_nextafter'
25245 d_nexttoward='$d_nexttoward'
25246 d_nice='$d_nice'
25247 d_nl_langinfo='$d_nl_langinfo'
25248 d_nl_langinfo_l='$d_nl_langinfo_l'
25249 d_non_int_bitfields='$d_non_int_bitfields'
25250 d_nv_preserves_uv='$d_nv_preserves_uv'
25251 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
25252 d_off64_t='$d_off64_t'
25253 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
25254 d_oldpthreads='$d_oldpthreads'
25255 d_oldsock='$d_oldsock'
25256 d_open3='$d_open3'
25257 d_openat='$d_openat'
25258 d_pathconf='$d_pathconf'
25259 d_pause='$d_pause'
25260 d_perl_lc_all_category_positions_init='$d_perl_lc_all_category_positions_init'
25261 d_perl_lc_all_separator='$d_perl_lc_all_separator'
25262 d_perl_lc_all_uses_name_value_pairs='$d_perl_lc_all_uses_name_value_pairs'
25263 d_perl_otherlibdirs='$d_perl_otherlibdirs'
25264 d_phostname='$d_phostname'
25265 d_pipe2='$d_pipe2'
25266 d_pipe='$d_pipe'
25267 d_poll='$d_poll'
25268 d_portable='$d_portable'
25269 d_prctl='$d_prctl'
25270 d_prctl_set_name='$d_prctl_set_name'
25271 d_printf_format_null='$d_printf_format_null'
25272 d_procselfexe='$d_procselfexe'
25273 d_pseudofork='$d_pseudofork'
25274 d_pthread_atfork='$d_pthread_atfork'
25275 d_pthread_attr_setscope='$d_pthread_attr_setscope'
25276 d_pthread_yield='$d_pthread_yield'
25277 d_ptrdiff_t='$d_ptrdiff_t'
25278 d_pwage='$d_pwage'
25279 d_pwchange='$d_pwchange'
25280 d_pwclass='$d_pwclass'
25281 d_pwcomment='$d_pwcomment'
25282 d_pwexpire='$d_pwexpire'
25283 d_pwgecos='$d_pwgecos'
25284 d_pwpasswd='$d_pwpasswd'
25285 d_pwquota='$d_pwquota'
25286 d_qgcvt='$d_qgcvt'
25287 d_quad='$d_quad'
25288 d_querylocale='$d_querylocale'
25289 d_random_r='$d_random_r'
25290 d_re_comp='$d_re_comp'
25291 d_readdir64_r='$d_readdir64_r'
25292 d_readdir='$d_readdir'
25293 d_readdir_r='$d_readdir_r'
25294 d_readlink='$d_readlink'
25295 d_readv='$d_readv'
25296 d_recvmsg='$d_recvmsg'
25297 d_regcmp='$d_regcmp'
25298 d_regcomp='$d_regcomp'
25299 d_remainder='$d_remainder'
25300 d_remquo='$d_remquo'
25301 d_rename='$d_rename'
25302 d_renameat='$d_renameat'
25303 d_rewinddir='$d_rewinddir'
25304 d_rint='$d_rint'
25305 d_rmdir='$d_rmdir'
25306 d_round='$d_round'
25307 d_sbrkproto='$d_sbrkproto'
25308 d_scalbn='$d_scalbn'
25309 d_scalbnl='$d_scalbnl'
25310 d_sched_yield='$d_sched_yield'
25311 d_scm_rights='$d_scm_rights'
25312 d_seekdir='$d_seekdir'
25313 d_select='$d_select'
25314 d_sem='$d_sem'
25315 d_semctl='$d_semctl'
25316 d_semctl_semid_ds='$d_semctl_semid_ds'
25317 d_semctl_semun='$d_semctl_semun'
25318 d_semget='$d_semget'
25319 d_semop='$d_semop'
25320 d_sendmsg='$d_sendmsg'
25321 d_setegid='$d_setegid'
25322 d_setenv='$d_setenv'
25323 d_seteuid='$d_seteuid'
25324 d_setgrent='$d_setgrent'
25325 d_setgrent_r='$d_setgrent_r'
25326 d_setgrps='$d_setgrps'
25327 d_sethent='$d_sethent'
25328 d_sethostent_r='$d_sethostent_r'
25329 d_setitimer='$d_setitimer'
25330 d_setlinebuf='$d_setlinebuf'
25331 d_setlocale='$d_setlocale'
25332 d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
25333 d_setlocale_r='$d_setlocale_r'
25334 d_setnent='$d_setnent'
25335 d_setnetent_r='$d_setnetent_r'
25336 d_setpent='$d_setpent'
25337 d_setpgid='$d_setpgid'
25338 d_setpgrp2='$d_setpgrp2'
25339 d_setpgrp='$d_setpgrp'
25340 d_setprior='$d_setprior'
25341 d_setproctitle='$d_setproctitle'
25342 d_setprotoent_r='$d_setprotoent_r'
25343 d_setpwent='$d_setpwent'
25344 d_setpwent_r='$d_setpwent_r'
25345 d_setregid='$d_setregid'
25346 d_setresgid='$d_setresgid'
25347 d_setresuid='$d_setresuid'
25348 d_setreuid='$d_setreuid'
25349 d_setrgid='$d_setrgid'
25350 d_setruid='$d_setruid'
25351 d_setsent='$d_setsent'
25352 d_setservent_r='$d_setservent_r'
25353 d_setsid='$d_setsid'
25354 d_setvbuf='$d_setvbuf'
25355 d_shm='$d_shm'
25356 d_shmat='$d_shmat'
25357 d_shmatprototype='$d_shmatprototype'
25358 d_shmctl='$d_shmctl'
25359 d_shmdt='$d_shmdt'
25360 d_shmget='$d_shmget'
25361 d_sigaction='$d_sigaction'
25362 d_siginfo_si_addr='$d_siginfo_si_addr'
25363 d_siginfo_si_band='$d_siginfo_si_band'
25364 d_siginfo_si_errno='$d_siginfo_si_errno'
25365 d_siginfo_si_fd='$d_siginfo_si_fd'
25366 d_siginfo_si_pid='$d_siginfo_si_pid'
25367 d_siginfo_si_status='$d_siginfo_si_status'
25368 d_siginfo_si_uid='$d_siginfo_si_uid'
25369 d_siginfo_si_value='$d_siginfo_si_value'
25370 d_signbit='$d_signbit'
25371 d_sigprocmask='$d_sigprocmask'
25372 d_sigsetjmp='$d_sigsetjmp'
25373 d_sin6_scope_id='$d_sin6_scope_id'
25374 d_sitearch='$d_sitearch'
25375 d_snprintf='$d_snprintf'
25376 d_sockaddr_in6='$d_sockaddr_in6'
25377 d_sockaddr_sa_len='$d_sockaddr_sa_len'
25378 d_sockaddr_storage='$d_sockaddr_storage'
25379 d_sockatmark='$d_sockatmark'
25380 d_sockatmarkproto='$d_sockatmarkproto'
25381 d_socket='$d_socket'
25382 d_socklen_t='$d_socklen_t'
25383 d_sockpair='$d_sockpair'
25384 d_socks5_init='$d_socks5_init'
25385 d_sqrtl='$d_sqrtl'
25386 d_srand48_r='$d_srand48_r'
25387 d_srandom_r='$d_srandom_r'
25388 d_sresgproto='$d_sresgproto'
25389 d_sresuproto='$d_sresuproto'
25390 d_stat='$d_stat'
25391 d_statblks='$d_statblks'
25392 d_statfs_f_flags='$d_statfs_f_flags'
25393 d_statfs_s='$d_statfs_s'
25394 d_static_inline='$d_static_inline'
25395 d_statvfs='$d_statvfs'
25396 d_stdio_cnt_lval='$d_stdio_cnt_lval'
25397 d_stdio_ptr_lval='$d_stdio_ptr_lval'
25398 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
25399 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
25400 d_stdio_stream_array='$d_stdio_stream_array'
25401 d_stdiobase='$d_stdiobase'
25402 d_stdstdio='$d_stdstdio'
25403 d_strcoll='$d_strcoll'
25404 d_strerror_l='$d_strerror_l'
25405 d_strerror_r='$d_strerror_r'
25406 d_strftime='$d_strftime'
25407 d_strlcat='$d_strlcat'
25408 d_strlcpy='$d_strlcpy'
25409 d_strnlen='$d_strnlen'
25410 d_strtod='$d_strtod'
25411 d_strtod_l='$d_strtod_l'
25412 d_strtol='$d_strtol'
25413 d_strtold='$d_strtold'
25414 d_strtold_l='$d_strtold_l'
25415 d_strtoll='$d_strtoll'
25416 d_strtoq='$d_strtoq'
25417 d_strtoul='$d_strtoul'
25418 d_strtoull='$d_strtoull'
25419 d_strtouq='$d_strtouq'
25420 d_strxfrm='$d_strxfrm'
25421 d_strxfrm_l='$d_strxfrm_l'
25422 d_suidsafe='$d_suidsafe'
25423 d_symlink='$d_symlink'
25424 d_syscall='$d_syscall'
25425 d_syscallproto='$d_syscallproto'
25426 d_sysconf='$d_sysconf'
25427 d_sysernlst='$d_sysernlst'
25428 d_syserrlst='$d_syserrlst'
25429 d_system='$d_system'
25430 d_tcgetpgrp='$d_tcgetpgrp'
25431 d_tcsetpgrp='$d_tcsetpgrp'
25432 d_telldir='$d_telldir'
25433 d_telldirproto='$d_telldirproto'
25434 d_tgamma='$d_tgamma'
25435 d_thread_local='$d_thread_local'
25436 d_time='$d_time'
25437 d_timegm='$d_timegm'
25438 d_times='$d_times'
25439 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
25440 d_tm_tm_zone='$d_tm_tm_zone'
25441 d_tmpnam_r='$d_tmpnam_r'
25442 d_towlower='$d_towlower'
25443 d_towupper='$d_towupper'
25444 d_trunc='$d_trunc'
25445 d_truncate='$d_truncate'
25446 d_truncl='$d_truncl'
25447 d_ttyname_r='$d_ttyname_r'
25448 d_tzname='$d_tzname'
25449 d_u32align='$d_u32align'
25450 d_ualarm='$d_ualarm'
25451 d_umask='$d_umask'
25452 d_uname='$d_uname'
25453 d_union_semun='$d_union_semun'
25454 d_unlinkat='$d_unlinkat'
25455 d_unordered='$d_unordered'
25456 d_unsetenv='$d_unsetenv'
25457 d_uselocale='$d_uselocale'
25458 d_usleep='$d_usleep'
25459 d_usleepproto='$d_usleepproto'
25460 d_ustat='$d_ustat'
25461 d_vendorarch='$d_vendorarch'
25462 d_vendorbin='$d_vendorbin'
25463 d_vendorlib='$d_vendorlib'
25464 d_vendorscript='$d_vendorscript'
25465 d_vfork='$d_vfork'
25466 d_void_closedir='$d_void_closedir'
25467 d_voidsig='$d_voidsig'
25468 d_voidtty='$d_voidtty'
25469 d_vsnprintf='$d_vsnprintf'
25470 d_wait4='$d_wait4'
25471 d_waitpid='$d_waitpid'
25472 d_wcrtomb='$d_wcrtomb'
25473 d_wcscmp='$d_wcscmp'
25474 d_wcstombs='$d_wcstombs'
25475 d_wcsxfrm='$d_wcsxfrm'
25476 d_wctomb='$d_wctomb'
25477 d_writev='$d_writev'
25478 d_xenix='$d_xenix'
25479 date='$date'
25480 db_hashtype='$db_hashtype'
25481 db_prefixtype='$db_prefixtype'
25482 db_version_major='$db_version_major'
25483 db_version_minor='$db_version_minor'
25484 db_version_patch='$db_version_patch'
25485 default_inc_excludes_dot='$default_inc_excludes_dot'
25486 direntrytype='$direntrytype'
25487 dlext='$dlext'
25488 dlsrc='$dlsrc'
25489 doubleinfbytes='$doubleinfbytes'
25490 doublekind='$doublekind'
25491 doublemantbits='$doublemantbits'
25492 doublenanbytes='$doublenanbytes'
25493 doublesize='$doublesize'
25494 drand01='$drand01'
25495 drand48_r_proto='$drand48_r_proto'
25496 dtrace='$dtrace'
25497 dtraceobject='$dtraceobject'
25498 dtracexnolibs='$dtracexnolibs'
25499 dynamic_ext='$dynamic_ext'
25500 eagain='$eagain'
25501 ebcdic='$ebcdic'
25502 echo='$echo'
25503 egrep='$egrep'
25504 emacs='$emacs'
25505 endgrent_r_proto='$endgrent_r_proto'
25506 endhostent_r_proto='$endhostent_r_proto'
25507 endnetent_r_proto='$endnetent_r_proto'
25508 endprotoent_r_proto='$endprotoent_r_proto'
25509 endpwent_r_proto='$endpwent_r_proto'
25510 endservent_r_proto='$endservent_r_proto'
25511 eunicefix='$eunicefix'
25512 exe_ext='$exe_ext'
25513 expr='$expr'
25514 extensions='$extensions'
25515 extern_C='$extern_C'
25516 extras='$extras'
25517 fflushNULL='$fflushNULL'
25518 fflushall='$fflushall'
25519 find='$find'
25520 firstmakefile='$firstmakefile'
25521 flex='$flex'
25522 fpossize='$fpossize'
25523 fpostype='$fpostype'
25524 freetype='$freetype'
25525 from='$from'
25526 full_ar='$full_ar'
25527 full_csh='$full_csh'
25528 full_sed='$full_sed'
25529 gccansipedantic='$gccansipedantic'
25530 gccosandvers='$gccosandvers'
25531 gccversion='$gccversion'
25532 getgrent_r_proto='$getgrent_r_proto'
25533 getgrgid_r_proto='$getgrgid_r_proto'
25534 getgrnam_r_proto='$getgrnam_r_proto'
25535 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
25536 gethostbyname_r_proto='$gethostbyname_r_proto'
25537 gethostent_r_proto='$gethostent_r_proto'
25538 getlogin_r_proto='$getlogin_r_proto'
25539 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
25540 getnetbyname_r_proto='$getnetbyname_r_proto'
25541 getnetent_r_proto='$getnetent_r_proto'
25542 getprotobyname_r_proto='$getprotobyname_r_proto'
25543 getprotobynumber_r_proto='$getprotobynumber_r_proto'
25544 getprotoent_r_proto='$getprotoent_r_proto'
25545 getpwent_r_proto='$getpwent_r_proto'
25546 getpwnam_r_proto='$getpwnam_r_proto'
25547 getpwuid_r_proto='$getpwuid_r_proto'
25548 getservbyname_r_proto='$getservbyname_r_proto'
25549 getservbyport_r_proto='$getservbyport_r_proto'
25550 getservent_r_proto='$getservent_r_proto'
25551 getspnam_r_proto='$getspnam_r_proto'
25552 gidformat='$gidformat'
25553 gidsign='$gidsign'
25554 gidsize='$gidsize'
25555 gidtype='$gidtype'
25556 glibpth='$glibpth'
25557 gmake='$gmake'
25558 gmtime_r_proto='$gmtime_r_proto'
25559 gnulibc_version='$gnulibc_version'
25560 grep='$grep'
25561 groupcat='$groupcat'
25562 groupstype='$groupstype'
25563 gzip='$gzip'
25564 h_fcntl='$h_fcntl'
25565 h_sysfile='$h_sysfile'
25566 hint='$hint'
25567 hostcat='$hostcat'
25568 hostgenerate='$hostgenerate'
25569 hostosname='$hostosname'
25570 hostperl='$hostperl'
25571 html1dir='$html1dir'
25572 html1direxp='$html1direxp'
25573 html3dir='$html3dir'
25574 html3direxp='$html3direxp'
25575 i16size='$i16size'
25576 i16type='$i16type'
25577 i32dformat='$i32dformat'
25578 i32size='$i32size'
25579 i32type='$i32type'
25580 i64size='$i64size'
25581 i64type='$i64type'
25582 i8size='$i8size'
25583 i8type='$i8type'
25584 i_arpainet='$i_arpainet'
25585 i_bfd='$i_bfd'
25586 i_bsdioctl='$i_bsdioctl'
25587 i_crypt='$i_crypt'
25588 i_db='$i_db'
25589 i_dbm='$i_dbm'
25590 i_dirent='$i_dirent'
25591 i_dlfcn='$i_dlfcn'
25592 i_execinfo='$i_execinfo'
25593 i_fcntl='$i_fcntl'
25594 i_fenv='$i_fenv'
25595 i_fp='$i_fp'
25596 i_fp_class='$i_fp_class'
25597 i_gdbm='$i_gdbm'
25598 i_gdbm_ndbm='$i_gdbm_ndbm'
25599 i_gdbmndbm='$i_gdbmndbm'
25600 i_grp='$i_grp'
25601 i_ieeefp='$i_ieeefp'
25602 i_inttypes='$i_inttypes'
25603 i_langinfo='$i_langinfo'
25604 i_libutil='$i_libutil'
25605 i_locale='$i_locale'
25606 i_machcthr='$i_machcthr'
25607 i_malloc='$i_malloc'
25608 i_mallocmalloc='$i_mallocmalloc'
25609 i_mntent='$i_mntent'
25610 i_ndbm='$i_ndbm'
25611 i_netdb='$i_netdb'
25612 i_neterrno='$i_neterrno'
25613 i_netinettcp='$i_netinettcp'
25614 i_niin='$i_niin'
25615 i_poll='$i_poll'
25616 i_prot='$i_prot'
25617 i_pthread='$i_pthread'
25618 i_pwd='$i_pwd'
25619 i_quadmath='$i_quadmath'
25620 i_rpcsvcdbm='$i_rpcsvcdbm'
25621 i_sgtty='$i_sgtty'
25622 i_shadow='$i_shadow'
25623 i_socks='$i_socks'
25624 i_stdbool='$i_stdbool'
25625 i_stdint='$i_stdint'
25626 i_stdlib='$i_stdlib'
25627 i_sunmath='$i_sunmath'
25628 i_sysaccess='$i_sysaccess'
25629 i_sysdir='$i_sysdir'
25630 i_sysfile='$i_sysfile'
25631 i_sysfilio='$i_sysfilio'
25632 i_sysin='$i_sysin'
25633 i_sysioctl='$i_sysioctl'
25634 i_syslog='$i_syslog'
25635 i_sysmman='$i_sysmman'
25636 i_sysmode='$i_sysmode'
25637 i_sysmount='$i_sysmount'
25638 i_sysndir='$i_sysndir'
25639 i_sysparam='$i_sysparam'
25640 i_syspoll='$i_syspoll'
25641 i_sysresrc='$i_sysresrc'
25642 i_syssecrt='$i_syssecrt'
25643 i_sysselct='$i_sysselct'
25644 i_syssockio='$i_syssockio'
25645 i_sysstat='$i_sysstat'
25646 i_sysstatfs='$i_sysstatfs'
25647 i_sysstatvfs='$i_sysstatvfs'
25648 i_syssyscall='$i_syssyscall'
25649 i_systime='$i_systime'
25650 i_systimek='$i_systimek'
25651 i_systimes='$i_systimes'
25652 i_systypes='$i_systypes'
25653 i_sysuio='$i_sysuio'
25654 i_sysun='$i_sysun'
25655 i_sysutsname='$i_sysutsname'
25656 i_sysvfs='$i_sysvfs'
25657 i_syswait='$i_syswait'
25658 i_termio='$i_termio'
25659 i_termios='$i_termios'
25660 i_time='$i_time'
25661 i_unistd='$i_unistd'
25662 i_ustat='$i_ustat'
25663 i_utime='$i_utime'
25664 i_vfork='$i_vfork'
25665 i_wchar='$i_wchar'
25666 i_wctype='$i_wctype'
25667 i_xlocale='$i_xlocale'
25668 ignore_versioned_solibs='$ignore_versioned_solibs'
25669 inc_version_list='$inc_version_list'
25670 inc_version_list_init='$inc_version_list_init'
25671 incpath='$incpath'
25672 incpth='$incpth'
25673 inews='$inews'
25674 initialinstalllocation='$initialinstalllocation'
25675 installarchlib='$installarchlib'
25676 installbin='$installbin'
25677 installhtml1dir='$installhtml1dir'
25678 installhtml3dir='$installhtml3dir'
25679 installman1dir='$installman1dir'
25680 installman3dir='$installman3dir'
25681 installprefix='$installprefix'
25682 installprefixexp='$installprefixexp'
25683 installprivlib='$installprivlib'
25684 installscript='$installscript'
25685 installsitearch='$installsitearch'
25686 installsitebin='$installsitebin'
25687 installsitehtml1dir='$installsitehtml1dir'
25688 installsitehtml3dir='$installsitehtml3dir'
25689 installsitelib='$installsitelib'
25690 installsiteman1dir='$installsiteman1dir'
25691 installsiteman3dir='$installsiteman3dir'
25692 installsitescript='$installsitescript'
25693 installstyle='$installstyle'
25694 installusrbinperl='$installusrbinperl'
25695 installvendorarch='$installvendorarch'
25696 installvendorbin='$installvendorbin'
25697 installvendorhtml1dir='$installvendorhtml1dir'
25698 installvendorhtml3dir='$installvendorhtml3dir'
25699 installvendorlib='$installvendorlib'
25700 installvendorman1dir='$installvendorman1dir'
25701 installvendorman3dir='$installvendorman3dir'
25702 installvendorscript='$installvendorscript'
25703 intsize='$intsize'
25704 issymlink='$issymlink'
25705 ivdformat='$ivdformat'
25706 ivsize='$ivsize'
25707 ivtype='$ivtype'
25708 known_extensions='$known_extensions'
25709 ksh='$ksh'
25710 ld='$ld'
25711 ld_can_script='$ld_can_script'
25712 lddlflags='$lddlflags'
25713 ldflags='$ldflags'
25714 ldflags_uselargefiles='$ldflags_uselargefiles'
25715 ldlibpthname='$ldlibpthname'
25716 less='$less'
25717 lib_ext='$lib_ext'
25718 libc='$libc'
25719 libperl='$libperl'
25720 libpth='$libpth'
25721 libs='$libs'
25722 libsdirs='$libsdirs'
25723 libsfiles='$libsfiles'
25724 libsfound='$libsfound'
25725 libspath='$libspath'
25726 libswanted='$libswanted'
25727 libswanted_uselargefiles='$libswanted_uselargefiles'
25728 line='$line'
25729 lint='$lint'
25730 lkflags='$lkflags'
25731 ln='$ln'
25732 lns='$lns'
25733 localtime_r_proto='$localtime_r_proto'
25734 locincpth='$locincpth'
25735 loclibpth='$loclibpth'
25736 longdblinfbytes='$longdblinfbytes'
25737 longdblkind='$longdblkind'
25738 longdblmantbits='$longdblmantbits'
25739 longdblnanbytes='$longdblnanbytes'
25740 longdblsize='$longdblsize'
25741 longlongsize='$longlongsize'
25742 longsize='$longsize'
25743 lp='$lp'
25744 lpr='$lpr'
25745 ls='$ls'
25746 lseeksize='$lseeksize'
25747 lseektype='$lseektype'
25748 mail='$mail'
25749 mailx='$mailx'
25750 make='$make'
25751 make_set_make='$make_set_make'
25752 mallocobj='$mallocobj'
25753 mallocsrc='$mallocsrc'
25754 malloctype='$malloctype'
25755 man1dir='$man1dir'
25756 man1direxp='$man1direxp'
25757 man1ext='$man1ext'
25758 man3dir='$man3dir'
25759 man3direxp='$man3direxp'
25760 man3ext='$man3ext'
25761 mips_type='$mips_type'
25762 mistrustnm='$mistrustnm'
25763 mkdir='$mkdir'
25764 mmaptype='$mmaptype'
25765 modetype='$modetype'
25766 more='$more'
25767 multiarch='$multiarch'
25768 mv='$mv'
25769 myarchname='$myarchname'
25770 mydomain='$mydomain'
25771 myhostname='$myhostname'
25772 myuname='$myuname'
25773 n='$n'
25774 need_va_copy='$need_va_copy'
25775 netdb_hlen_type='$netdb_hlen_type'
25776 netdb_host_type='$netdb_host_type'
25777 netdb_name_type='$netdb_name_type'
25778 netdb_net_type='$netdb_net_type'
25779 nm='$nm'
25780 nm_opt='$nm_opt'
25781 nm_so_opt='$nm_so_opt'
25782 nonxs_ext='$nonxs_ext'
25783 nroff='$nroff'
25784 nvEUformat='$nvEUformat'
25785 nvFUformat='$nvFUformat'
25786 nvGUformat='$nvGUformat'
25787 nv_overflows_integers_at='$nv_overflows_integers_at'
25788 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25789 nveformat='$nveformat'
25790 nvfformat='$nvfformat'
25791 nvgformat='$nvgformat'
25792 nvmantbits='$nvmantbits'
25793 nvsize='$nvsize'
25794 nvtype='$nvtype'
25795 o_nonblock='$o_nonblock'
25796 obj_ext='$obj_ext'
25797 old_pthread_create_joinable='$old_pthread_create_joinable'
25798 optimize='$optimize'
25799 orderlib='$orderlib'
25800 osname='$osname'
25801 osvers='$osvers'
25802 otherlibdirs='$otherlibdirs'
25803 package='$package'
25804 pager='$pager'
25805 passcat='$passcat'
25806 patchlevel='$patchlevel'
25807 path_sep='$path_sep'
25808 perl5='$perl5'
25809 perl='$perl'
25810 perl_lc_all_category_positions_init='$perl_lc_all_category_positions_init'
25811 perl_lc_all_separator='$perl_lc_all_separator'
25812 perl_patchlevel='$perl_patchlevel'
25813 perl_static_inline='$perl_static_inline'
25814 perl_thread_local='$perl_thread_local'
25815 perladmin='$perladmin'
25816 perllibs='$perllibs'
25817 perlpath='$perlpath'
25818 pg='$pg'
25819 phostname='$phostname'
25820 pidtype='$pidtype'
25821 plibpth='$plibpth'
25822 pmake='$pmake'
25823 pr='$pr'
25824 prefix='$prefix'
25825 prefixexp='$prefixexp'
25826 privlib='$privlib'
25827 privlibexp='$privlibexp'
25828 procselfexe='$procselfexe'
25829 ptrsize='$ptrsize'
25830 quadkind='$quadkind'
25831 quadtype='$quadtype'
25832 randbits='$randbits'
25833 randfunc='$randfunc'
25834 random_r_proto='$random_r_proto'
25835 randseedtype='$randseedtype'
25836 ranlib='$ranlib'
25837 rd_nodata='$rd_nodata'
25838 readdir64_r_proto='$readdir64_r_proto'
25839 readdir_r_proto='$readdir_r_proto'
25840 revision='$revision'
25841 rm='$rm'
25842 rm_try='$rm_try'
25843 rmail='$rmail'
25844 run='$run'
25845 runnm='$runnm'
25846 sGMTIME_max='$sGMTIME_max'
25847 sGMTIME_min='$sGMTIME_min'
25848 sLOCALTIME_max='$sLOCALTIME_max'
25849 sLOCALTIME_min='$sLOCALTIME_min'
25850 sPRIEUldbl='$sPRIEUldbl'
25851 sPRIFUldbl='$sPRIFUldbl'
25852 sPRIGUldbl='$sPRIGUldbl'
25853 sPRIXU64='$sPRIXU64'
25854 sPRId64='$sPRId64'
25855 sPRIeldbl='$sPRIeldbl'
25856 sPRIfldbl='$sPRIfldbl'
25857 sPRIgldbl='$sPRIgldbl'
25858 sPRIi64='$sPRIi64'
25859 sPRIo64='$sPRIo64'
25860 sPRIu64='$sPRIu64'
25861 sPRIx64='$sPRIx64'
25862 sSCNfldbl='$sSCNfldbl'
25863 sched_yield='$sched_yield'
25864 scriptdir='$scriptdir'
25865 scriptdirexp='$scriptdirexp'
25866 sed='$sed'
25867 seedfunc='$seedfunc'
25868 selectminbits='$selectminbits'
25869 selecttype='$selecttype'
25870 sendmail='$sendmail'
25871 setgrent_r_proto='$setgrent_r_proto'
25872 sethostent_r_proto='$sethostent_r_proto'
25873 setlocale_r_proto='$setlocale_r_proto'
25874 setnetent_r_proto='$setnetent_r_proto'
25875 setprotoent_r_proto='$setprotoent_r_proto'
25876 setpwent_r_proto='$setpwent_r_proto'
25877 setservent_r_proto='$setservent_r_proto'
25878 sh='$sh'
25879 shar='$shar'
25880 sharpbang='$sharpbang'
25881 shmattype='$shmattype'
25882 shortsize='$shortsize'
25883 shrpenv='$shrpenv'
25884 shsharp='$shsharp'
25885 sig_count='$sig_count'
25886 sig_name='$sig_name'
25887 sig_name_init='$sig_name_init'
25888 sig_num='$sig_num'
25889 sig_num_init='$sig_num_init'
25890 sig_size='$sig_size'
25891 signal_t='$signal_t'
25892 sitearch='$sitearch'
25893 sitearchexp='$sitearchexp'
25894 sitebin='$sitebin'
25895 sitebinexp='$sitebinexp'
25896 sitehtml1dir='$sitehtml1dir'
25897 sitehtml1direxp='$sitehtml1direxp'
25898 sitehtml3dir='$sitehtml3dir'
25899 sitehtml3direxp='$sitehtml3direxp'
25900 sitelib='$sitelib'
25901 sitelib_stem='$sitelib_stem'
25902 sitelibexp='$sitelibexp'
25903 siteman1dir='$siteman1dir'
25904 siteman1direxp='$siteman1direxp'
25905 siteman3dir='$siteman3dir'
25906 siteman3direxp='$siteman3direxp'
25907 siteprefix='$siteprefix'
25908 siteprefixexp='$siteprefixexp'
25909 sitescript='$sitescript'
25910 sitescriptexp='$sitescriptexp'
25911 sizesize='$sizesize'
25912 sizetype='$sizetype'
25913 sleep='$sleep'
25914 smail='$smail'
25915 so='$so'
25916 sockethdr='$sockethdr'
25917 socketlib='$socketlib'
25918 socksizetype='$socksizetype'
25919 sort='$sort'
25920 spackage='$spackage'
25921 spitshell='$spitshell'
25922 srand48_r_proto='$srand48_r_proto'
25923 srandom_r_proto='$srandom_r_proto'
25924 src='$src'
25925 ssizetype='$ssizetype'
25926 st_dev_sign='$st_dev_sign'
25927 st_dev_size='$st_dev_size'
25928 st_ino_sign='$st_ino_sign'
25929 st_ino_size='$st_ino_size'
25930 startperl='$startperl'
25931 startsh='$startsh'
25932 static_ext='$static_ext'
25933 stdchar='$stdchar'
25934 stdio_base='$stdio_base'
25935 stdio_bufsiz='$stdio_bufsiz'
25936 stdio_cnt='$stdio_cnt'
25937 stdio_filbuf='$stdio_filbuf'
25938 stdio_ptr='$stdio_ptr'
25939 stdio_stream_array='$stdio_stream_array'
25940 strerror_r_proto='$strerror_r_proto'
25941 submit='$submit'
25942 subversion='$subversion'
25943 sysman='$sysman'
25944 sysroot='$sysroot'
25945 tail='$tail'
25946 tar='$tar'
25947 targetarch='$targetarch'
25948 targetdir='$targetdir'
25949 targetenv='$targetenv'
25950 targethost='$targethost'
25951 targetmkdir='$targetmkdir'
25952 targetport='$targetport'
25953 targetsh='$targetsh'
25954 tbl='$tbl'
25955 tee='$tee'
25956 test='$test'
25957 timeincl='$timeincl'
25958 timetype='$timetype'
25959 tmpnam_r_proto='$tmpnam_r_proto'
25960 to='$to'
25961 touch='$touch'
25962 tr='$tr'
25963 trnl='$trnl'
25964 troff='$troff'
25965 ttyname_r_proto='$ttyname_r_proto'
25966 u16size='$u16size'
25967 u16type='$u16type'
25968 u32XUformat='$u32XUformat'
25969 u32oformat='$u32oformat'
25970 u32size='$u32size'
25971 u32type='$u32type'
25972 u32uformat='$u32uformat'
25973 u32xformat='$u32xformat'
25974 u64size='$u64size'
25975 u64type='$u64type'
25976 u8size='$u8size'
25977 u8type='$u8type'
25978 uidformat='$uidformat'
25979 uidsign='$uidsign'
25980 uidsize='$uidsize'
25981 uidtype='$uidtype'
25982 uname='$uname'
25983 uniq='$uniq'
25984 uquadtype='$uquadtype'
25985 use64bitall='$use64bitall'
25986 use64bitint='$use64bitint'
25987 usecbacktrace='$usecbacktrace'
25988 usecrosscompile='$usecrosscompile'
25989 usedefaultstrict='$usedefaultstrict'
25990 usedevel='$usedevel'
25991 usedl='$usedl'
25992 usedtrace='$usedtrace'
25993 usefaststdio='$usefaststdio'
25994 useithreads='$useithreads'
25995 usekernprocpathname='$usekernprocpathname'
25996 uselanginfo='$uselanginfo'
25997 uselargefiles='$uselargefiles'
25998 uselongdouble='$uselongdouble'
25999 usemallocwrap='$usemallocwrap'
26000 usemorebits='$usemorebits'
26001 usemultiplicity='$usemultiplicity'
26002 usemymalloc='$usemymalloc'
26003 usenm='$usenm'
26004 usensgetexecutablepath='$usensgetexecutablepath'
26005 useopcode='$useopcode'
26006 useperlio='$useperlio'
26007 useposix='$useposix'
26008 usequadmath='$usequadmath'
26009 usereentrant='$usereentrant'
26010 userelocatableinc='$userelocatableinc'
26011 useshrplib='$useshrplib'
26012 usesitecustomize='$usesitecustomize'
26013 usesocks='$usesocks'
26014 usethreads='$usethreads'
26015 usevendorprefix='$usevendorprefix'
26016 useversionedarchname='$useversionedarchname'
26017 usevfork='$usevfork'
26018 usrinc='$usrinc'
26019 uuname='$uuname'
26020 uvXUformat='$uvXUformat'
26021 uvoformat='$uvoformat'
26022 uvsize='$uvsize'
26023 uvtype='$uvtype'
26024 uvuformat='$uvuformat'
26025 uvxformat='$uvxformat'
26026 vendorarch='$vendorarch'
26027 vendorarchexp='$vendorarchexp'
26028 vendorbin='$vendorbin'
26029 vendorbinexp='$vendorbinexp'
26030 vendorhtml1dir='$vendorhtml1dir'
26031 vendorhtml1direxp='$vendorhtml1direxp'
26032 vendorhtml3dir='$vendorhtml3dir'
26033 vendorhtml3direxp='$vendorhtml3direxp'
26034 vendorlib='$vendorlib'
26035 vendorlib_stem='$vendorlib_stem'
26036 vendorlibexp='$vendorlibexp'
26037 vendorman1dir='$vendorman1dir'
26038 vendorman1direxp='$vendorman1direxp'
26039 vendorman3dir='$vendorman3dir'
26040 vendorman3direxp='$vendorman3direxp'
26041 vendorprefix='$vendorprefix'
26042 vendorprefixexp='$vendorprefixexp'
26043 vendorscript='$vendorscript'
26044 vendorscriptexp='$vendorscriptexp'
26045 version='$version'
26046 version_patchlevel_string='$version_patchlevel_string'
26047 versiononly='$versiononly'
26048 vi='$vi'
26049 xlibpth='$xlibpth'
26050 xlocale_needed='$xlocale_needed'
26051 yacc='$yacc'
26052 yaccflags='$yaccflags'
26053 zcat='$zcat'
26054 zip='$zip'
26055 EOT
26056
26057 : add special variables
26058 $test -f $src/patchlevel.h && \
26059 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
26060 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
26061 echo "PERL_CONFIG_SH=true" >>config.sh
26062
26063 : propagate old symbols
26064 if $test -f UU/config.sh; then
26065         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
26066         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
26067                 config.sh config.sh UU/oldconfig.sh |\
26068                 $sort | $uniq -u >UU/oldsyms
26069         set X `$cat UU/oldsyms`
26070         shift
26071         case $# in
26072         0) ;;
26073         *)
26074                 $cat <<EOM
26075 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
26076 EOM
26077                 echo ": Variables propagated from previous config.sh file." >>config.sh
26078                 for sym in `$cat UU/oldsyms`; do
26079                         echo "    Propagating $hint variable "'$'"$sym..."
26080                         eval 'tmp="$'"${sym}"'"'
26081                         echo "$tmp" | \
26082                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
26083                 done
26084                 ;;
26085         esac
26086 fi
26087
26088 : preserve RCS keywords in files with variable substitution, grrr
26089 Id='$Id'
26090
26091 : Finish up by extracting the .SH files
26092 case "$alldone" in
26093 exit)
26094         echo "Stopping at your request, leaving temporary files around."
26095         exit 0
26096         ;;
26097 cont)
26098         ;;
26099 '')
26100         dflt=''
26101         nostick=true
26102         $cat <<EOM
26103
26104 If you'd like to make any changes to the config.sh file before I begin
26105 to configure things, do it as a shell escape now (e.g. !vi config.sh).
26106
26107 EOM
26108         rp="Press return or use a shell escape to edit config.sh:"
26109         . UU/myread
26110         nostick=''
26111         case "$ans" in
26112         '') ;;
26113         *) : in case they cannot read
26114                 sh 1>&4 -c "$ans";;
26115         esac
26116         ;;
26117 esac
26118
26119 : if this fails, just run all the .SH files by hand
26120 . ./config.sh
26121
26122 echo " "
26123 exec 1>&4
26124 pwd=`pwd`
26125 . ./UU/extract
26126 cd "$pwd"
26127
26128 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
26129         dflt=y
26130         case "$silent" in
26131         true) ;;
26132         *)
26133                 $cat <<EOM
26134
26135 Now you need to generate make dependencies by running "$make depend".
26136 You might prefer to run it in background: "$make depend > makedepend.out &"
26137 It can take a while, so you might not want to run it right now.
26138
26139 EOM
26140                 ;;
26141         esac
26142         rp="Run $make depend now?"
26143         . UU/myread
26144         case "$ans" in
26145         y*)
26146                 $make depend && echo "Now you must run '$make'."
26147                 ;;
26148         *)
26149                 echo "You must run '$make depend' then '$make'."
26150                 ;;
26151         esac
26152 elif test -f [Mm]akefile; then
26153         echo " "
26154         echo "Now you must run a $make."
26155 else
26156         echo "Configure done."
26157 fi
26158
26159 if $test -f Policy.sh; then
26160     $cat <<EOM
26161
26162 If you compile $package on a different machine or from a different object
26163 directory, copy the Policy.sh file from this object directory to the
26164 new one before you run Configure -- this will help you with most of
26165 the policy defaults.
26166
26167 EOM
26168 fi
26169 if $test -f UU/config.msg; then
26170     echo "Hmm.  I also noted the following information while running:"
26171     echo " "
26172     $cat UU/config.msg >&4
26173 fi
26174 $rm -f kit*isdone ark*isdone
26175 $rm -rf UU
26176
26177 : End of Configure
26178