This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Promote v5.36 usage and feature bundles doc
[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_thread_safe_nl_langinfo_l=''
711 d_off64_t=''
712 d_open3=''
713 d_fpathconf=''
714 d_pathconf=''
715 d_pause=''
716 d_pipe2=''
717 d_pipe=''
718 d_poll=''
719 d_portable=''
720 d_prctl=''
721 d_prctl_set_name=''
722 d_procselfexe=''
723 procselfexe=''
724 d_old_pthread_create_joinable=''
725 old_pthread_create_joinable=''
726 d_pthread_atfork=''
727 d_pthread_attr_setscope=''
728 d_pthread_yield=''
729 d_sched_yield=''
730 sched_yield=''
731 d_ptrdiff_t=''
732 d_qgcvt=''
733 d_random_r=''
734 random_r_proto=''
735 d_readdir64_r=''
736 readdir64_r_proto=''
737 d_readdir=''
738 d_rewinddir=''
739 d_seekdir=''
740 d_telldir=''
741 d_readdir_r=''
742 readdir_r_proto=''
743 d_readlink=''
744 d_readv=''
745 d_recvmsg=''
746 d_re_comp=''
747 d_regcmp=''
748 d_regcomp=''
749 d_remainder=''
750 d_remquo=''
751 d_rename=''
752 d_rint=''
753 d_rmdir=''
754 d_round=''
755 d_sbrkproto=''
756 d_scalbn=''
757 d_scalbnl=''
758 d_select=''
759 d_sem=''
760 d_semctl=''
761 d_semget=''
762 d_semop=''
763 d_sendmsg=''
764 d_setegid=''
765 d_setenv=''
766 d_seteuid=''
767 d_setgrent=''
768 d_setgrent_r=''
769 setgrent_r_proto=''
770 d_setgrps=''
771 d_sethent=''
772 d_sethostent_r=''
773 sethostent_r_proto=''
774 d_setitimer=''
775 d_setlinebuf=''
776 d_has_C_UTF8=''
777 d_setlocale=''
778 d_setlocale_accepts_any_locale_name=''
779 d_setlocale_r=''
780 setlocale_r_proto=''
781 d_setnent=''
782 d_setnetent_r=''
783 setnetent_r_proto=''
784 d_setpent=''
785 d_setpgid=''
786 d_setpgrp2=''
787 d_bsdsetpgrp=''
788 d_setpgrp=''
789 d_setprior=''
790 d_setproctitle=''
791 d_setprotoent_r=''
792 setprotoent_r_proto=''
793 d_setpwent=''
794 d_setpwent_r=''
795 setpwent_r_proto=''
796 d_setregid=''
797 d_setresgid=''
798 d_setresuid=''
799 d_setreuid=''
800 d_setrgid=''
801 d_setruid=''
802 d_setsent=''
803 d_setservent_r=''
804 setservent_r_proto=''
805 d_setsid=''
806 d_setvbuf=''
807 d_shm=''
808 d_shmat=''
809 d_shmatprototype=''
810 shmattype=''
811 d_shmctl=''
812 d_shmdt=''
813 d_shmget=''
814 d_sigaction=''
815 d_siginfo_si_addr=''
816 d_siginfo_si_band=''
817 d_siginfo_si_errno=''
818 d_siginfo_si_fd=''
819 d_siginfo_si_pid=''
820 d_siginfo_si_status=''
821 d_siginfo_si_uid=''
822 d_siginfo_si_value=''
823 d_signbit=''
824 d_sigprocmask=''
825 d_sigsetjmp=''
826 usesitecustomize=''
827 d_snprintf=''
828 d_vsnprintf=''
829 d_sockatmark=''
830 d_sockatmarkproto=''
831 d_ip_mreq=''
832 d_ip_mreq_source=''
833 d_ipv6_mreq=''
834 d_ipv6_mreq_source=''
835 d_msg_ctrunc=''
836 d_msg_dontroute=''
837 d_msg_oob=''
838 d_msg_peek=''
839 d_msg_proxy=''
840 d_oldsock=''
841 d_scm_rights=''
842 d_sin6_scope_id=''
843 d_sockaddr_in6=''
844 d_sockaddr_sa_len=''
845 d_sockaddr_storage=''
846 d_socket=''
847 d_sockpair=''
848 sockethdr=''
849 socketlib=''
850 d_socklen_t=''
851 d_socks5_init=''
852 d_sqrtl=''
853 d_srand48_r=''
854 srand48_r_proto=''
855 d_srandom_r=''
856 srandom_r_proto=''
857 d_sresgproto=''
858 d_sresuproto=''
859 d_stat=''
860 d_statblks=''
861 d_statfs_f_flags=''
862 d_statfs_s=''
863 d_static_inline=''
864 perl_static_inline=''
865 d_fstatvfs=''
866 d_statvfs=''
867 d_stdio_cnt_lval=''
868 d_stdio_ptr_lval=''
869 d_stdio_ptr_lval_nochange_cnt=''
870 d_stdio_ptr_lval_sets_cnt=''
871 d_stdiobase=''
872 d_stdstdio=''
873 stdio_base=''
874 stdio_bufsiz=''
875 stdio_cnt=''
876 stdio_filbuf=''
877 stdio_ptr=''
878 d_strcoll=''
879 d_sysernlst=''
880 d_syserrlst=''
881 d_strerror_l=''
882 d_strerror_r=''
883 strerror_r_proto=''
884 d_strftime=''
885 d_strlcat=''
886 d_strlcpy=''
887 d_strnlen=''
888 d_strtod=''
889 d_strtod_l=''
890 d_strtol=''
891 d_strtold=''
892 d_strtold_l=''
893 d_strtoll=''
894 d_strtoq=''
895 d_strtoul=''
896 d_strtoull=''
897 d_strtouq=''
898 d_strxfrm=''
899 d_strxfrm_l=''
900 d_symlink=''
901 d_syscall=''
902 d_syscallproto=''
903 d_sysconf=''
904 d_system=''
905 d_tcgetpgrp=''
906 d_tcsetpgrp=''
907 d_telldirproto=''
908 d_tgamma=''
909 d_thread_local=''
910 perl_thread_local=''
911 d_time=''
912 timetype=''
913 d_asctime64=''
914 d_ctime64=''
915 d_difftime64=''
916 d_gmtime64=''
917 d_localtime64=''
918 d_mktime64=''
919 d_timegm=''
920 clocktype=''
921 d_times=''
922 d_tmpnam_r=''
923 tmpnam_r_proto=''
924 d_towlower=''
925 d_towupper=''
926 d_trunc=''
927 d_truncate=''
928 d_truncl=''
929 d_ttyname_r=''
930 ttyname_r_proto=''
931 d_tzname=''
932 d_u32align=''
933 d_ualarm=''
934 d_umask=''
935 d_semctl_semid_ds=''
936 d_semctl_semun=''
937 d_union_semun=''
938 d_unordered=''
939 d_unsetenv=''
940 d_usleep=''
941 d_usleepproto=''
942 d_ustat=''
943 d_pseudofork=''
944 d_vfork=''
945 usevfork=''
946 d_voidsig=''
947 signal_t=''
948 d_wait4=''
949 d_waitpid=''
950 d_wcrtomb=''
951 d_wcscmp=''
952 d_wcstombs=''
953 d_wcsxfrm=''
954 d_wctomb=''
955 d_writev=''
956 default_inc_excludes_dot=''
957 dlext=''
958 bin_ELF=''
959 cccdlflags=''
960 ccdlflags=''
961 dlsrc=''
962 ld=''
963 ld_can_script=''
964 lddlflags=''
965 usedl=''
966 doublesize=''
967 dtraceobject=''
968 dtracexnolibs=''
969 ebcdic=''
970 fflushNULL=''
971 fflushall=''
972 fpossize=''
973 fpostype=''
974 gccansipedantic=''
975 gccosandvers=''
976 gccversion=''
977 gidformat=''
978 gidsign=''
979 gidsize=''
980 gidtype=''
981 groupstype=''
982 h_fcntl=''
983 h_sysfile=''
984 html1dir=''
985 html1direxp=''
986 installhtml1dir=''
987 html3dir=''
988 html3direxp=''
989 installhtml3dir=''
990 i_arpainet=''
991 i_bfd=''
992 i_crypt=''
993 db_hashtype=''
994 db_prefixtype=''
995 db_version_major=''
996 db_version_minor=''
997 db_version_patch=''
998 i_db=''
999 i_dbm=''
1000 i_rpcsvcdbm=''
1001 d_dirnamlen=''
1002 direntrytype=''
1003 i_dirent=''
1004 i_dlfcn=''
1005 i_execinfo=''
1006 i_fcntl=''
1007 i_fenv=''
1008 i_fp=''
1009 i_fp_class=''
1010 i_gdbm=''
1011 d_grpasswd=''
1012 i_grp=''
1013 i_ieeefp=''
1014 i_inttypes=''
1015 i_langinfo=''
1016 i_libutil=''
1017 i_locale=''
1018 i_machcthr=''
1019 i_malloc=''
1020 i_mallocmalloc=''
1021 i_mntent=''
1022 d_gdbm_ndbm_h_uses_prototypes=''
1023 d_gdbmndbm_h_uses_prototypes=''
1024 d_ndbm=''
1025 d_ndbm_h_uses_prototypes=''
1026 i_gdbm_ndbm=''
1027 i_gdbmndbm=''
1028 i_ndbm=''
1029 i_netdb=''
1030 i_neterrno=''
1031 i_netinettcp=''
1032 i_niin=''
1033 i_sysin=''
1034 i_poll=''
1035 i_prot=''
1036 i_pthread=''
1037 d_pwage=''
1038 d_pwchange=''
1039 d_pwclass=''
1040 d_pwcomment=''
1041 d_pwexpire=''
1042 d_pwgecos=''
1043 d_pwpasswd=''
1044 d_pwquota=''
1045 i_pwd=''
1046 i_quadmath=''
1047 i_shadow=''
1048 i_socks=''
1049 i_stdbool=''
1050 i_stdint=''
1051 i_stdlib=''
1052 i_sunmath=''
1053 i_sysaccess=''
1054 i_sysdir=''
1055 i_sysfile=''
1056 d_voidtty=''
1057 i_bsdioctl=''
1058 i_sysfilio=''
1059 i_sysioctl=''
1060 i_syssockio=''
1061 i_syslog=''
1062 i_sysmman=''
1063 i_sysmode=''
1064 i_sysmount=''
1065 i_sysndir=''
1066 i_sysparam=''
1067 i_syspoll=''
1068 i_sysresrc=''
1069 i_syssecrt=''
1070 i_sysselct=''
1071 i_sysstat=''
1072 i_sysstatfs=''
1073 i_sysstatvfs=''
1074 i_systimes=''
1075 i_systypes=''
1076 i_sysuio=''
1077 i_sysun=''
1078 i_sysutsname=''
1079 i_sysvfs=''
1080 i_syswait=''
1081 i_sgtty=''
1082 i_termio=''
1083 i_termios=''
1084 d_tm_tm_gmtoff=''
1085 d_tm_tm_zone=''
1086 i_systime=''
1087 i_systimek=''
1088 i_time=''
1089 timeincl=''
1090 i_unistd=''
1091 i_ustat=''
1092 i_utime=''
1093 i_vfork=''
1094 i_wchar=''
1095 i_wctype=''
1096 d_inc_version_list=''
1097 inc_version_list=''
1098 inc_version_list_init=''
1099 doubleinfbytes=''
1100 doublenanbytes=''
1101 longdblinfbytes=''
1102 longdblnanbytes=''
1103 installprefix=''
1104 installprefixexp=''
1105 installstyle=''
1106 installusrbinperl=''
1107 intsize=''
1108 longsize=''
1109 shortsize=''
1110 issymlink=''
1111 libc=''
1112 ldlibpthname=''
1113 libperl=''
1114 shrpenv=''
1115 useshrplib=''
1116 glibpth=''
1117 incpth=''
1118 libpth=''
1119 loclibpth=''
1120 plibpth=''
1121 xlibpth=''
1122 ignore_versioned_solibs=''
1123 libs=''
1124 libsdirs=''
1125 libsfiles=''
1126 libsfound=''
1127 libspath=''
1128 lns=''
1129 d_PRIEUldbl=''
1130 d_PRIFUldbl=''
1131 d_PRIGUldbl=''
1132 d_PRIeldbl=''
1133 d_PRIfldbl=''
1134 d_PRIgldbl=''
1135 d_SCNfldbl=''
1136 d_double_has_inf=''
1137 d_double_has_nan=''
1138 d_double_has_negative_zero=''
1139 d_double_has_subnormals=''
1140 d_double_style_cray=''
1141 d_double_style_ibm=''
1142 d_double_style_ieee=''
1143 d_double_style_vax=''
1144 doublekind=''
1145 sPRIEUldbl=''
1146 sPRIFUldbl=''
1147 sPRIGUldbl=''
1148 sPRIeldbl=''
1149 sPRIfldbl=''
1150 sPRIgldbl=''
1151 sSCNfldbl=''
1152 lseeksize=''
1153 lseektype=''
1154 make_set_make=''
1155 d_mymalloc=''
1156 freetype=''
1157 mallocobj=''
1158 mallocsrc=''
1159 malloctype=''
1160 usemallocwrap=''
1161 usemymalloc=''
1162 installman1dir=''
1163 man1dir=''
1164 man1direxp=''
1165 man1ext=''
1166 installman3dir=''
1167 man3dir=''
1168 man3direxp=''
1169 man3ext=''
1170 doublemantbits=''
1171 longdblmantbits=''
1172 nvmantbits=''
1173 modetype=''
1174 multiarch=''
1175 mydomain=''
1176 myhostname=''
1177 phostname=''
1178 c=''
1179 n=''
1180 d_eofnblk=''
1181 eagain=''
1182 o_nonblock=''
1183 rd_nodata=''
1184 need_va_copy=''
1185 netdb_hlen_type=''
1186 netdb_host_type=''
1187 netdb_name_type=''
1188 netdb_net_type=''
1189 groupcat=''
1190 hostcat=''
1191 passcat=''
1192 orderlib=''
1193 ranlib=''
1194 d_perl_otherlibdirs=''
1195 otherlibdirs=''
1196 package=''
1197 spackage=''
1198 pager=''
1199 api_revision=''
1200 api_subversion=''
1201 api_version=''
1202 api_versionstring=''
1203 patchlevel=''
1204 perl_patchlevel=''
1205 revision=''
1206 subversion=''
1207 version=''
1208 version_patchlevel_string=''
1209 perl5=''
1210 perladmin=''
1211 perlpath=''
1212 d_nv_preserves_uv=''
1213 d_nv_zero_is_allbits_zero=''
1214 i16size=''
1215 i16type=''
1216 i32size=''
1217 i32type=''
1218 i64size=''
1219 i64type=''
1220 i8size=''
1221 i8type=''
1222 ivsize=''
1223 ivtype=''
1224 nv_overflows_integers_at=''
1225 nv_preserves_uv_bits=''
1226 nvsize=''
1227 nvtype=''
1228 u16size=''
1229 u16type=''
1230 u32size=''
1231 u32type=''
1232 u64size=''
1233 u64type=''
1234 u8size=''
1235 u8type=''
1236 uvsize=''
1237 uvtype=''
1238 ivdformat=''
1239 nvEUformat=''
1240 nvFUformat=''
1241 nvGUformat=''
1242 nveformat=''
1243 nvfformat=''
1244 nvgformat=''
1245 uvXUformat=''
1246 uvoformat=''
1247 uvuformat=''
1248 uvxformat=''
1249 pidtype=''
1250 prefix=''
1251 prefixexp=''
1252 installprivlib=''
1253 privlib=''
1254 privlibexp=''
1255 ptrsize=''
1256 d_PRIXU64=''
1257 d_PRId64=''
1258 d_PRIi64=''
1259 d_PRIo64=''
1260 d_PRIu64=''
1261 d_PRIx64=''
1262 sPRIXU64=''
1263 sPRId64=''
1264 sPRIi64=''
1265 sPRIo64=''
1266 sPRIu64=''
1267 sPRIx64=''
1268 d_quad=''
1269 quadkind=''
1270 quadtype=''
1271 uquadtype=''
1272 drand01=''
1273 randbits=''
1274 randfunc=''
1275 randseedtype=''
1276 seedfunc=''
1277 installscript=''
1278 scriptdir=''
1279 scriptdirexp=''
1280 selectminbits=''
1281 selecttype=''
1282 sh=''
1283 targetsh=''
1284 sig_count=''
1285 sig_name=''
1286 sig_name_init=''
1287 sig_num=''
1288 sig_num_init=''
1289 sig_size=''
1290 d_sitearch=''
1291 installsitearch=''
1292 sitearch=''
1293 sitearchexp=''
1294 installsitebin=''
1295 sitebin=''
1296 sitebinexp=''
1297 installsitehtml1dir=''
1298 sitehtml1dir=''
1299 sitehtml1direxp=''
1300 installsitehtml3dir=''
1301 sitehtml3dir=''
1302 sitehtml3direxp=''
1303 installsitelib=''
1304 sitelib=''
1305 sitelib_stem=''
1306 sitelibexp=''
1307 installsiteman1dir=''
1308 siteman1dir=''
1309 siteman1direxp=''
1310 installsiteman3dir=''
1311 siteman3dir=''
1312 siteman3direxp=''
1313 siteprefix=''
1314 siteprefixexp=''
1315 installsitescript=''
1316 sitescript=''
1317 sitescriptexp=''
1318 sizesize=''
1319 sizetype=''
1320 d_libname_unique=''
1321 so=''
1322 socksizetype=''
1323 sharpbang=''
1324 shsharp=''
1325 spitshell=''
1326 src=''
1327 ssizetype=''
1328 st_dev_sign=''
1329 st_dev_size=''
1330 st_ino_sign=''
1331 st_ino_size=''
1332 startperl=''
1333 startsh=''
1334 stdchar=''
1335 d_stdio_stream_array=''
1336 stdio_stream_array=''
1337 sysman=''
1338 sGMTIME_max=''
1339 sGMTIME_min=''
1340 sLOCALTIME_max=''
1341 sLOCALTIME_min=''
1342 trnl=''
1343 uidformat=''
1344 uidsign=''
1345 uidsize=''
1346 uidtype=''
1347 archname64=''
1348 use64bitall=''
1349 use64bitint=''
1350 usecbacktrace=''
1351 usedefaultstrict=''
1352 dtrace=''
1353 usedtrace=''
1354 usefaststdio=''
1355 usekernprocpathname=''
1356 ccflags_uselargefiles=''
1357 ldflags_uselargefiles=''
1358 libswanted_uselargefiles=''
1359 uselargefiles=''
1360 uselongdouble=''
1361 usemorebits=''
1362 usemultiplicity=''
1363 nm_opt=''
1364 nm_so_opt=''
1365 runnm=''
1366 usenm=''
1367 usensgetexecutablepath=''
1368 useperlio=''
1369 usequadmath=''
1370 usesocks=''
1371 d_oldpthreads=''
1372 useithreads=''
1373 usereentrant=''
1374 usethreads=''
1375 incpath=''
1376 mips_type=''
1377 usrinc=''
1378 d_vendorarch=''
1379 installvendorarch=''
1380 vendorarch=''
1381 vendorarchexp=''
1382 d_vendorbin=''
1383 installvendorbin=''
1384 vendorbin=''
1385 vendorbinexp=''
1386 installvendorhtml1dir=''
1387 vendorhtml1dir=''
1388 vendorhtml1direxp=''
1389 installvendorhtml3dir=''
1390 vendorhtml3dir=''
1391 vendorhtml3direxp=''
1392 d_vendorlib=''
1393 installvendorlib=''
1394 vendorlib=''
1395 vendorlib_stem=''
1396 vendorlibexp=''
1397 installvendorman1dir=''
1398 vendorman1dir=''
1399 vendorman1direxp=''
1400 installvendorman3dir=''
1401 vendorman3dir=''
1402 vendorman3direxp=''
1403 usevendorprefix=''
1404 vendorprefix=''
1405 vendorprefixexp=''
1406 d_vendorscript=''
1407 installvendorscript=''
1408 vendorscript=''
1409 vendorscriptexp=''
1410 versiononly=''
1411 yacc=''
1412 yaccflags=''
1413 CONFIG=''
1414
1415 : Detect odd OSs
1416 define='define'
1417 undef='undef'
1418 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1419 rmlist=''
1420
1421 : We must find out about Eunice early
1422 eunicefix=':'
1423 if test -f /etc/unixtovms; then
1424         eunicefix=/etc/unixtovms
1425 fi
1426 if test -f /etc/unixtovms.exe; then
1427         eunicefix=/etc/unixtovms.exe
1428 fi
1429
1430 : Set executable suffix now -- needed before hints available
1431 if test -f "/libs/version.library"; then
1432 : Amiga OS
1433     _exe=""
1434 elif test -f "/system/gnu_library/bin/ar.pm"; then
1435 : Stratus VOS
1436     _exe=".pm"
1437 elif test -n "$DJGPP"; then
1438 : DOS DJGPP
1439     _exe=".exe"
1440 elif test -f /kern/cookiejar; then
1441 : MiNT
1442     _exe=""
1443 elif test -d c:/. -o -n "$is_os2" ; then
1444 : OS/2 or cygwin
1445     _exe=".exe"
1446 fi
1447
1448 groupstype=''
1449 i_whoami=''
1450 : Possible local include directories to search.
1451 : Set locincpth to "" in a hint file to defeat local include searches.
1452 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1453 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1454 :
1455 : no include file wanted by default
1456 inclwanted=''
1457
1458 : Enable -DEBUGGING and -DDEBUGGING from the command line
1459 EBUGGING=''
1460 DEBUGGING=''
1461
1462 : Trailing extension.  Override this in a hint file, if needed.
1463 : Extra object files, if any, needed on this platform.
1464 archobjs=''
1465 libnames=''
1466 : change the next line if compiling for Xenix/286 on Xenix/386
1467 xlibpth='/usr/lib/386 /lib/386'
1468 : Possible local library directories to search.
1469 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1470 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1471
1472 : general looking path for locating libraries
1473 glibpth="/lib /usr/lib $xlibpth"
1474 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1475 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1476 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1477 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1478
1479 : Private path used by Configure to find libraries.  Its value
1480 : is prepended to libpth. This variable takes care of special
1481 : machines, like the mips.  Usually, it should be empty.
1482 plibpth=''
1483
1484 : default library list
1485 libswanted=''
1486 : some systems want to use only the non-versioned libso:s
1487 ignore_versioned_solibs=''
1488 ccname=''
1489 ccversion=''
1490 perllibs=''
1491 : set useposix=false in your hint file to disable the POSIX extension.
1492 useposix=true
1493 : set useopcode=false in your hint file to disable the Opcode extension.
1494 useopcode=true
1495 : set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1496 uselanginfo=true
1497 archname64=''
1498 ccflags_uselargefiles=''
1499 ldflags_uselargefiles=''
1500 libswanted_uselargefiles=''
1501 : set usemultiplicity on the Configure command line to enable multiplicity.
1502 : set usesocks on the Configure command line to enable socks.
1503 archname=''
1504 : set usethreads on the Configure command line to enable threads.
1505 usereentrant='undef'
1506 : List of libraries we want.
1507 : If anyone needs extra -lxxx, put those in a hint file.
1508 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1509 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1510 : We probably want to search /usr/shlib before most other libraries.
1511 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1512 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1513 glibpth="/usr/shlib $glibpth"
1514 : Do not use vfork unless overridden by a hint file.
1515 usevfork=false
1516
1517 : Find the basic shell for Bourne shell scripts
1518 case "$sh" in
1519 '')
1520         case "$SYSTYPE" in
1521         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1522         *) xxx='/bin/sh';;
1523         esac
1524         if test -f "$xxx"; then
1525                 sh="$xxx"
1526         else
1527                 : Build up a list and do a single loop so we can 'break' out.
1528                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1529                 for xxx in sh bash ksh pdksh ash; do
1530                         for p in $pth; do
1531                                 try="$try ${p}/${xxx}"
1532                         done
1533                 done
1534                 for xxx in $try; do
1535                         if test -f "$xxx"; then
1536                                 sh="$xxx";
1537                                 break
1538                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1539                                 sh="$xxx";
1540                                 break
1541                         elif test -f "$xxx.exe"; then
1542                                 sh="$xxx";
1543                                 break
1544                         fi
1545                 done
1546         fi
1547         ;;
1548 esac
1549
1550 case "$sh" in
1551 '')     cat >&2 <<EOM
1552 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1553
1554 Usually it's in /bin/sh.  How did you even get this far?
1555 Please report this issue at https://github.com/Perl/perl5/issues
1556 and we'll try to straighten this all out.
1557 EOM
1558         exit 1
1559         ;;
1560 esac
1561
1562 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1563 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1564 targetsh=$sh
1565
1566 : see if sh knows # comments
1567 if `$sh -c '#' >/dev/null 2>&1`; then
1568         shsharp=true
1569         spitshell=cat
1570         xcat=/bin/cat
1571         test -f $xcat$_exe || xcat=/usr/bin/cat
1572         if test ! -f $xcat$_exe; then
1573                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1574                         if test -f $p/cat$_exe; then
1575                                 xcat=$p/cat
1576                                 break
1577                         fi
1578                 done
1579                 if test ! -f $xcat$_exe; then
1580                         echo "Can't find cat anywhere!"
1581                         exit 1
1582                 fi
1583         fi
1584         echo "#!$xcat" >sharp
1585         $eunicefix sharp
1586         chmod +x sharp
1587         ./sharp > today 2>/dev/null
1588         if test -s today; then
1589                 sharpbang='#!'
1590         else
1591                 echo "#! $xcat" > sharp
1592                 $eunicefix sharp
1593                 chmod +x sharp
1594                 ./sharp > today 2>/dev/null
1595                 if test -s today; then
1596                         sharpbang='#! '
1597                 else
1598                         sharpbang=': use '
1599                 fi
1600         fi
1601 else
1602         echo " "
1603         echo "Your $sh doesn't grok # comments--I will strip them later on."
1604         shsharp=false
1605         cd ..
1606         echo "exec grep -v '^[  ]*#'" >spitshell
1607         chmod +x spitshell
1608         $eunicefix spitshell
1609         spitshell=`pwd`/spitshell
1610         cd UU
1611         echo "I presume that if # doesn't work, #! won't work either!"
1612         sharpbang=': use '
1613 fi
1614 rm -f sharp today
1615
1616 : figure out how to guarantee sh startup
1617 case "$startsh" in
1618 '') startsh=${sharpbang}${sh} ;;
1619 *)
1620 esac
1621 cat >sharp <<EOSS
1622 $startsh
1623 set abc
1624 test "$?abc" != 1
1625 EOSS
1626
1627 chmod +x sharp
1628 $eunicefix sharp
1629 if ./sharp; then
1630         : echo "Yup, it does."
1631 else
1632         echo "Hmm... '$startsh' does not guarantee sh startup..."
1633         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1634 fi
1635 rm -f sharp
1636
1637 : Save command line options in file UU/cmdline.opt for later use in
1638 : generating config.sh.
1639 cat > cmdline.opt <<EOSH
1640 : Configure command line arguments.
1641 config_arg0='$0'
1642 config_args='$*'
1643 config_argc=$#
1644 EOSH
1645 argn=1
1646 args_exp=''
1647 args_sep=''
1648 for arg in "$@"; do
1649         cat >>cmdline.opt <<EOSH
1650 config_arg$argn='$arg'
1651 EOSH
1652         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1653 $arg
1654 EOC
1655         arg_exp=`cat cmdl.opt`
1656         args_exp="$args_exp$args_sep'$arg_exp'"
1657         argn=`expr $argn + 1`
1658         args_sep=' '
1659 done
1660 rm -f cmdl.opt
1661
1662 : produce awk script to parse command line options
1663 cat >options.awk <<'EOF'
1664 BEGIN {
1665         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1666
1667         len = length(optstr);
1668         for (i = 1; i <= len; i++) {
1669                 c = substr(optstr, i, 1);
1670                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1671                 if (a == ":") {
1672                         arg[c] = 1;
1673                         i++;
1674                 }
1675                 opt[c] = 1;
1676         }
1677 }
1678 {
1679         expect = 0;
1680         str = $0;
1681         if (substr(str, 1, 1) != "-") {
1682                 printf("'%s'\n", str);
1683                 next;
1684         }
1685         len = length($0);
1686         for (i = 2; i <= len; i++) {
1687                 c = substr(str, i, 1);
1688                 if (!opt[c]) {
1689                         printf("-%s\n", substr(str, i));
1690                         next;
1691                 }
1692                 printf("-%s\n", c);
1693                 if (arg[c]) {
1694                         if (i < len)
1695                                 printf("'%s'\n", substr(str, i + 1));
1696                         else
1697                                 expect = 1;
1698                         next;
1699                 }
1700         }
1701 }
1702 END {
1703         if (expect)
1704                 print "?";
1705 }
1706 EOF
1707
1708 : process the command line options
1709 set X `for arg in "$@"; do echo "X$arg"; done |
1710         sed -e s/X// | awk -f options.awk`
1711 eval "set $*"
1712 shift
1713 rm -f options.awk
1714
1715 : set up default values
1716 fastread=''
1717 reuseval=false
1718 config_sh=''
1719 alldone=''
1720 error=''
1721 silent=''
1722 extractsh=''
1723 knowitall=''
1724 rm -f optdef.sh posthint.sh
1725 cat >optdef.sh <<EOS
1726 $startsh
1727 EOS
1728
1729
1730 : option parsing
1731 while test $# -gt 0; do
1732         case "$1" in
1733         -d) shift; fastread=yes;;
1734         -e) shift; alldone=cont;;
1735         -f)
1736                 shift
1737                 cd ..
1738                 if test -r "$1"; then
1739                         config_sh="$1"
1740                 else
1741                         echo "$me: cannot read config file $1." >&2
1742                         error=true
1743                 fi
1744                 cd UU
1745                 shift;;
1746         --help|\
1747         -h) shift; error=true;;
1748         -r) shift; reuseval=true;;
1749         -s) shift; silent=true; realsilent=true;;
1750         -E) shift; alldone=exit;;
1751         -K) shift; knowitall=true;;
1752         -O) shift;;
1753         -S) shift; silent=true; extractsh=true;;
1754         -D)
1755                 shift
1756                 case "$1" in
1757                 *=)
1758                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1759                         echo "$me: ignoring -D $1" >&2
1760                         ;;
1761                 *=*) echo "$1" | \
1762                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1763                 *) echo "$1='define'" >> optdef.sh;;
1764                 esac
1765                 shift
1766                 ;;
1767         -U)
1768                 shift
1769                 case "$1" in
1770                 *=) echo "$1" >> optdef.sh;;
1771                 *=*)
1772                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1773                         echo "$me: ignoring -U $1" >&2
1774                         ;;
1775                 *) echo "$1='undef'" >> optdef.sh;;
1776                 esac
1777                 shift
1778                 ;;
1779         -A)
1780             shift
1781             xxx=''
1782             yyy="$1"
1783             zzz=''
1784             uuu=undef
1785             case "$yyy" in
1786             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1787                  case "$zzz" in
1788                  *:*) zzz='' ;;
1789                  *)   xxx=append
1790                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1791                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1792                  esac
1793                  ;;
1794             esac
1795             case "$xxx" in
1796             '')  case "$yyy" in
1797                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1798                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1799                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1800                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1801                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1802                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1803                  esac
1804                  ;;
1805             esac
1806             case "$xxx" in
1807             append)
1808                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1809             clear)
1810                 echo "$yyy=''"                  >> posthint.sh ;;
1811             define)
1812                 case "$zzz" in
1813                 '') zzz=define ;;
1814                 esac
1815                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1816             eval)
1817                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1818             prepend)
1819                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1820             undef)
1821                 case "$zzz" in
1822                 '') zzz="$uuu" ;;
1823                 esac
1824                 echo "$yyy=$zzz"                >> posthint.sh ;;
1825             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1826             esac
1827             shift
1828             ;;
1829         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1830             exit 0;;
1831         --) break;;
1832         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1833         *) break;;
1834         esac
1835 done
1836
1837 case "$error" in
1838 true)
1839         cat >&2 <<EOM
1840 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1841                  [-U symbol] [-U symbol=] [-A command:symbol...]
1842   -d : use defaults for all answers.
1843   -e : go on without questioning past the production of config.sh.
1844   -f : specify an alternate default configuration file.
1845   -h : print this help message and exit (with an error status).
1846   -r : reuse C symbols value if possible (skips costly nm extraction).
1847   -s : silent mode, only echoes questions and essential information.
1848   -D : define symbol to have some value:
1849          -D symbol                symbol gets the value 'define'
1850          -D symbol='some value'   symbol is set to 'some value'
1851        common used examples (see INSTALL for more info):
1852          -Duse64bitint            use 64bit integers
1853          -Duse64bitall            use 64bit integers and pointers
1854          -Dusethreads             use thread support
1855          -Dinc_version_list=none  do not include older perl trees in @INC
1856          -DEBUGGING=none          DEBUGGING options
1857          -Dcc=gcc                 choose your compiler
1858          -Dprefix=/opt/perl5      choose your destination
1859   -E : stop at the end of questions, after having produced config.sh.
1860   -K : do not use unless you know what you are doing.
1861   -O : ignored for backward compatibility
1862   -S : perform variable substitutions on all .SH files (can mix with -f)
1863   -U : undefine symbol:
1864          -U symbol    symbol gets the value 'undef'
1865          -U symbol=   symbol gets completely empty
1866        e.g.:  -Uversiononly
1867   -A : manipulate symbol after the platform specific hints have been applied:
1868          -A append:symbol=value   append value to symbol
1869          -A symbol=value          like append:, but with a separating space
1870          -A define:symbol=value   define symbol to have value
1871          -A clear:symbol          define symbol to be ''
1872          -A define:symbol         define symbol to be 'define'
1873          -A eval:symbol=value     define symbol to be eval of value
1874          -A prepend:symbol=value  prepend value to symbol
1875          -A undef:symbol          define symbol to be 'undef'
1876          -A undef:symbol=         define symbol to be ''
1877        e.g.:  -A prepend:libswanted='cl pthread '
1878               -A ccflags=-DSOME_MACRO
1879   -V : print version number and exit (with a zero status).
1880 EOM
1881         exit 1
1882         ;;
1883 esac
1884
1885 : Sanity checks
1886 case "$fastread$alldone" in
1887 yescont|yesexit) ;;
1888 *)
1889         case "$extractsh" in
1890         true) ;;
1891         *)
1892                 if test ! -t 0; then
1893                         echo "Say 'sh Configure', not 'sh <Configure'"
1894                         exit 1
1895                 fi
1896                 ;;
1897         esac
1898         ;;
1899 esac
1900
1901 exec 4>&1
1902 case "$silent" in
1903 true) exec 1>/dev/null;;
1904 esac
1905
1906 : run the defines and the undefines, if any, but leave the file out there...
1907 touch optdef.sh
1908 grep '\\' optdef.sh >/dev/null 2>&1
1909 if test $? = 0; then
1910     echo "Configure does not support \\ in -D arguments"
1911     exit 1
1912 fi
1913 . ./optdef.sh
1914 : create the posthint manipulation script and leave the file out there...
1915 touch posthint.sh
1916
1917 : set package name
1918 package='perl5'
1919 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1920 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1921 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1922 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1923 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1924 esac
1925
1926 : Some greps do not return status, grrr.
1927 echo "grimblepritz" >grimble
1928 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1929         contains=contains
1930 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1931         contains=grep
1932 else
1933         contains=contains
1934 fi
1935 rm -f grimble
1936 : the following should work in any shell
1937 case "$contains" in
1938 contains*)
1939         echo " " >&4
1940         echo "AGH!  Grep doesn't return a status.  Attempting remedial action." >&4
1941         cat >contains <<'EOSS'
1942 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1943 EOSS
1944 contains=./contains
1945 chmod +x $contains
1946 esac
1947
1948 : Find the path to the source tree
1949 case "$src" in
1950 '') case "$0" in
1951     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1952          case "$src" in
1953          /*)    ;;
1954          .)     ;;
1955          *)     src=`cd ../$src && pwd` ;;
1956          esac
1957          ;;
1958     *)   src='.';;
1959     esac;;
1960 esac
1961 case "$src" in
1962 '')     src=/
1963         rsrc=/
1964         ;;
1965 /*)     rsrc="$src";;
1966 *)      rsrc="../$src";;
1967 esac
1968 if test -f $rsrc/Configure && \
1969         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1970 then
1971    : found it, so we are ok.
1972 else
1973         rsrc=''
1974         for src in . .. ../.. ../../.. ../../../..; do
1975                 if test -f ../$src/Configure && \
1976                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1977                 then
1978                         rsrc=../$src
1979                         break
1980                 fi
1981         done
1982 fi
1983 case "$rsrc" in
1984 '')
1985         cat <<EOM >&4
1986
1987 Sorry, I can't seem to locate the source dir for $package.  Please start
1988 Configure with an explicit path -- i.e. /some/path/Configure.
1989
1990 EOM
1991         exit 1
1992         ;;
1993 ../.)   rsrc='..';;
1994 *)
1995         echo " "
1996         echo "Sources for $package found in \"$src\"." >&4
1997         ;;
1998 esac
1999
2000 : script used to extract .SH files with variable substitutions
2001 cat >extract <<'EOS'
2002 PERL_CONFIG_SH=true
2003 echo "Doing variable substitutions on .SH files..."
2004 if test -f MANIFEST; then
2005         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
2006 else
2007         echo "(Looking for .SH files under the source directory.)"
2008         set x `(cd "$src"; find . -name "*.SH" -print)`
2009 fi
2010 shift
2011 case $# in
2012 0) set x `(cd "$src"; echo *.SH)`; shift;;
2013 esac
2014 if test ! -f "$src/$1"; then
2015         shift
2016 fi
2017 mkdir_p='
2018 name=$1;
2019 create="";
2020 while test $name; do
2021         if test ! -d "$name"; then
2022                 create="$name $create";
2023                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2024                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2025         else
2026                 name="";
2027         fi;
2028 done;
2029 for file in $create; do
2030         mkdir $file;
2031 done
2032 '
2033 for file in $*; do
2034         case "$src" in
2035         ".")
2036                 case "$file" in
2037                 */*)
2038                         dir=`expr X$file : 'X\(.*\)/'`
2039                         file=`expr X$file : 'X.*/\(.*\)'`
2040                         (cd "$dir" && . ./$file)
2041                         ;;
2042                 *)
2043                         . ./$file
2044                         ;;
2045                 esac
2046                 ;;
2047         *)
2048                 case "$file" in
2049                 */*)
2050                         dir=`expr X$file : 'X\(.*\)/'`
2051                         file=`expr X$file : 'X.*/\(.*\)'`
2052                         (set x $dir; shift; eval $mkdir_p)
2053                         sh <"$src/$dir/$file"
2054                         ;;
2055                 *)
2056                         sh <"$src/$file"
2057                         ;;
2058                 esac
2059                 ;;
2060         esac
2061 done
2062 if test -f "$src/config_h.SH"; then
2063         if test ! -f config.h; then
2064         : oops, they left it out of MANIFEST, probably, so do it anyway.
2065         . "$src/config_h.SH"
2066         fi
2067 fi
2068 EOS
2069
2070 : extract files and exit if asked to do so
2071 case "$extractsh" in
2072 true)
2073         case "$realsilent" in
2074         true) ;;
2075         *) exec 1>&4;;
2076         esac
2077         case "$config_sh" in
2078         '') config_sh='config.sh';;
2079         esac
2080         echo " "
2081         echo "Fetching answers from $config_sh..."
2082         cd ..
2083         . $config_sh
2084         . UU/optdef.sh
2085         echo " "
2086         . UU/extract
2087         rm -rf UU
2088         echo "Extraction done."
2089         exit 0
2090         ;;
2091 esac
2092
2093 : Eunice requires " " instead of "", can you believe it
2094 echo " "
2095 : Here we go...
2096 echo "Beginning of configuration questions for $package."
2097
2098 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2099
2100 : first determine how to suppress newline on echo command
2101 echo " "
2102 echo "Checking echo to see how to suppress newlines..."
2103 (echo "hi there\c" ; echo " ") >.echotmp
2104 if $contains c .echotmp >/dev/null 2>&1 ; then
2105         echo "...using -n."
2106         n='-n'
2107         c=''
2108 else
2109         cat <<'EOM'
2110 ...using \c
2111 EOM
2112         n=''
2113         c='\c'
2114 fi
2115 echo $n "The star should be here-->$c"
2116 echo '*'
2117 rm -f .echotmp
2118
2119 : Now test for existence of everything in MANIFEST
2120 echo " "
2121 if test -f "$rsrc/MANIFEST"; then
2122         echo "First let's make sure your kit is complete.  Checking..." >&4
2123         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2124                 (split -l 50 2>/dev/null || split -50)
2125         rm -f missing
2126         tmppwd=`pwd`
2127         for filelist in x??; do
2128                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2129                         >/dev/null 2>>"$tmppwd/missing")
2130         done
2131         if test -s missing; then
2132                 cat missing >&4
2133                 cat >&4 <<'EOM'
2134
2135 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2136
2137 You have the option of continuing the configuration process, despite the
2138 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2139 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2140 and contact the author (https://github.com/Perl/perl5/issues).
2141
2142 EOM
2143                 echo $n "Continue? [n] $c" >&4
2144                 read ans
2145                 case "$ans" in
2146                 y*)
2147                         echo "Continuing..." >&4
2148                         rm -f missing
2149                         ;;
2150                 *)
2151                         echo "ABORTING..." >&4
2152                         kill $$
2153                         ;;
2154                 esac
2155         else
2156                 echo "Looks good..."
2157         fi
2158 else
2159         echo "There is no MANIFEST file.  I hope your kit is complete !"
2160 fi
2161 rm -f missing x??
2162
2163 : Find the appropriate value for a newline for tr
2164 if test -n "$DJGPP"; then
2165        trnl='\012'
2166 fi
2167 if test X"$trnl" = X; then
2168         case "`echo foo | tr '\n' x 2>/dev/null`" in
2169         foox) trnl='\n' ;;
2170         esac
2171 fi
2172 if test X"$trnl" = X; then
2173         case "`echo foo | tr '\012' x 2>/dev/null`" in
2174         foox) trnl='\012' ;;
2175         esac
2176 fi
2177 if test X"$trnl" = X; then
2178        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2179        fooxy) trnl='\n\r' ;;
2180        esac
2181 fi
2182 if test X"$trnl" = X; then
2183         cat <<EOM >&2
2184
2185 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2186
2187 EOM
2188         exit 1
2189 fi
2190
2191 : compute the number of columns on the terminal for proper question formatting
2192 case "$COLUMNS" in
2193 '') COLUMNS='80';;
2194 esac
2195
2196 : set up the echo used in my read
2197 myecho="case \"\$xxxm\" in
2198 '') echo $n \"\$rp $c\" >&4;;
2199 *) case \"\$rp\" in
2200         '') echo $n \"[\$xxxm] $c\";;
2201         *)
2202                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2203                         echo \"\$rp\" >&4
2204                         echo $n \"[\$xxxm] $c\" >&4
2205                 else
2206                         echo $n \"\$rp [\$xxxm] $c\" >&4
2207                 fi
2208                 ;;
2209         esac;;
2210 esac"
2211
2212 : now set up to do reads with possible shell escape and default assignment
2213 cat <<EOSC >myread
2214 $startsh
2215 xxxm=\$dflt
2216 $myecho
2217 ans='!'
2218 counter=42
2219 case "\$fastread" in
2220 yes) case "\$dflt" in
2221         '') ;;
2222         *) ans='';
2223                 case "\$silent-\$rp" in
2224                 true-) ;;
2225                 *) echo " " >&4;;
2226                 esac;;
2227         esac;;
2228 *) case "\$silent" in
2229         true) case "\$rp" in
2230                 '') ans='';;
2231                 esac;;
2232         esac;;
2233 esac
2234 while expr "X\$ans" : "X!" >/dev/null; do
2235         read answ
2236         set x \$xxxm
2237         shift
2238         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2239         case  "\$answ" in
2240         "!")
2241                 sh 1>&4
2242                 echo " "
2243                 $myecho
2244                 ;;
2245         !*)
2246                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2247                 shift
2248                 sh 1>&4 -c "\$*"
2249                 echo " "
2250                 $myecho
2251                 ;;
2252         "\$ans")
2253                 case "\$ans" in
2254                 \\&*)
2255                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2256                         shift
2257                         case "\$1" in
2258                         -d)
2259                                 fastread=yes
2260                                 echo "(OK, I'll run with -d after this question.)" >&4
2261                                 ;;
2262                         -*)
2263                                 echo "*** Sorry, \$1 not supported yet." >&4
2264                                 ;;
2265                         esac
2266                         $myecho
2267                         ans=!
2268                         ;;
2269                 esac;;
2270         *)
2271                 case "\$aok" in
2272                 y)
2273                         echo "*** Substitution done -- please confirm."
2274                         xxxm="\$ans"
2275                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2276                         xxxm="\$ans"
2277                         ans=!
2278                         ;;
2279                 *)
2280                         echo "*** Error -- try again."
2281                         ans=!
2282                         ;;
2283                 esac
2284                 $myecho
2285                 ;;
2286         esac
2287         case "\$ans\$xxxm\$nostick" in
2288         '')
2289                 ans=!
2290                 $myecho
2291                 ;;
2292         esac
2293         counter=\`echo \$counter | awk '{ print --\$0 }'\`
2294         if [ \$counter = 0 ]; then
2295                 echo >&4
2296                 echo >&4 Too many attempts asking the same question.  Giving up.
2297                 exit 1
2298         fi
2299 done
2300 case "\$ans" in
2301 '') ans="\$xxxm";;
2302 esac
2303 EOSC
2304
2305 : create .config dir to save info across Configure sessions
2306 test -d ../.config || mkdir ../.config
2307 cat >../.config/README <<EOF
2308 This directory created by Configure to save information that should
2309 persist across sessions for $package.
2310
2311 You may safely delete it if you wish.
2312 EOF
2313
2314 : See if we are using a devel version and want that
2315 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2316 case "$usedevel" in
2317 $define|true|[yY]*)
2318     usedevel="$define" ;;
2319 *) case "$xversion" in
2320    *[13579])
2321         cat >&4 <<EOH
2322 *** WHOA THERE!!! ***
2323
2324     This is an UNSTABLE DEVELOPMENT release.
2325     The version of this $package distribution is $xversion, that is, odd,
2326     (as opposed to even) and that signifies a development release.
2327     If you want a maintenance release, you want an even-numbered version.
2328
2329     Do ***NOT*** install this into production use.
2330     Data corruption and crashes are possible.
2331
2332     It is most seriously suggested that you do not continue any further
2333     unless you want to help in developing and debugging Perl.
2334
2335     If you *still* want to build perl, you can answer 'y' now,
2336     or pass -Dusedevel to Configure.
2337
2338 EOH
2339         rp='Do you really want to continue?'
2340         dflt='n'
2341         . ./myread
2342         case "$ans" in
2343         [yY]) echo >&4 "Okay, continuing."
2344               usedevel="$define" ;;
2345         *) echo >&4 "Okay, bye."
2346            exit 1
2347            ;;
2348         esac
2349         ;;
2350     esac
2351     usedevel="$undef"
2352     ;;
2353 esac
2354 case "$usedevel" in
2355 $define|true|[yY]*)
2356         case "$versiononly" in
2357         '') versiononly="$define" ;;
2358         esac
2359         case "$installusrbinperl" in
2360         '') installusrbinperl="$undef" ;;
2361         esac
2362         ;;
2363 esac
2364
2365 : general instructions
2366 needman=true
2367 firsttime=true
2368 user=`(logname) 2>/dev/null`
2369 case "$user" in
2370 '') user=`whoami 2>&1`;;
2371 esac
2372 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2373         firsttime=false
2374         echo " "
2375         rp='Would you like to see the instructions?'
2376         dflt=n
2377         . ./myread
2378         case "$ans" in
2379         [yY]*) ;;
2380         *) needman=false;;
2381         esac
2382 fi
2383 if $needman; then
2384         cat <<EOH
2385
2386 This installation shell script will examine your system and ask you questions
2387 to determine how the perl5 package should be installed. If you get
2388 stuck on a question, you may use a ! shell escape to start a subshell or
2389 execute a command.  Many of the questions will have default answers in square
2390 brackets; typing carriage return will give you the default.
2391
2392 On some of the questions which ask for file or directory names you are allowed
2393 to use the ~name construct to specify the login directory belonging to "name",
2394 even if you don't have a shell which knows about that.  Questions where this is
2395 allowed will be marked "(~name ok)".
2396
2397 EOH
2398         rp=''
2399         dflt='Type carriage return to continue'
2400         . ./myread
2401         cat <<'EOH'
2402
2403 The prompter used in this script allows you to use shell variables and
2404 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2405 in the default answer, as if the default line was a set of arguments given to a
2406 script shell.  This means you may also use $* to repeat the whole default line,
2407 so you do not have to re-type everything to add something to the default.
2408
2409 Every time there is a substitution, you will have to confirm.  If there is an
2410 error (e.g. an unmatched backtick), the default answer will remain unchanged
2411 and you will be prompted again.
2412
2413 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2414 the questions and use the computed defaults (or the previous answers if there
2415 was already a config.sh file). Type 'Configure -h' for a list of options.
2416 You may also start interactively and then answer '& -d' at any prompt to turn
2417 on the non-interactive behaviour for the remainder of the execution.
2418
2419 EOH
2420         . ./myread
2421         cat <<EOH
2422
2423 Much effort has been expended to ensure that this shell script will run on any
2424 Unix system.  If despite that it blows up on yours, your best bet is to edit
2425 Configure and run it again.  If you can't run Configure for some reason,
2426 you'll have to generate a config.sh file by hand.  Whatever problems you
2427 have, let me (https://github.com/Perl/perl5/issues) know how I blew it.
2428
2429 This installation script affects things in two ways:
2430
2431 1) it may do direct variable substitutions on some of the files included
2432    in this kit.
2433 2) it builds a config.h file for inclusion in C programs.  You may edit
2434    any of these files as the need arises after running this script.
2435
2436 If you make a mistake on a question, there is no easy way to back up to it
2437 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2438 files.  Configure will offer to let you do this before it runs the SH files.
2439
2440 EOH
2441         dflt='Type carriage return to continue'
2442         . ./myread
2443         case "$firsttime" in
2444         true) echo $user >>../.config/instruct;;
2445         esac
2446 fi
2447
2448 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2449 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2450 if test "X$sysroot" = X; then
2451     sysroot=""
2452 else
2453     case "$cc" in
2454         *gcc*|*g++*)
2455             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2456             # _sysroot is used in places where we need --sysroot=foo
2457             # but using the rest of the flags could cause issues.
2458             _sysroot="--sysroot=$sysroot";
2459             case "$ccflags" in
2460                 *sysroot*) ;;
2461                 'undef'|*)
2462                 ccflags="$ccflags $_sysroot"
2463             esac
2464             case "$ldflags" in
2465                 *sysroot*) ;;
2466                 'undef'|*)
2467                 ldflags="$ldflags $_sysroot"
2468             esac
2469             case "$cppflags" in
2470                 *sysroot*) ;;
2471                 'undef'|*)
2472                 cppflags="$cppflags $_sysroot"
2473             esac
2474             # lddlflags updated below in lddlflags section;
2475             # same with cccdlflags
2476             ;;
2477     esac
2478
2479     # Adjust some defaults to also use $sysroot
2480     for var in xlibpth loclibpth locincpth glibpth; do
2481         eval xxx=\$$var
2482         eval $var=''
2483         for path in $xxx; do
2484             eval $var=\"\$$var $sysroot$path\"
2485         done
2486     done
2487
2488 fi
2489
2490 : find out where common programs are
2491 echo " "
2492 echo "Locating common programs..." >&4
2493 cat <<EOSC >loc
2494 $startsh
2495 case \$# in
2496 0) exit 1;;
2497 esac
2498 thing=\$1
2499 shift
2500 dflt=\$1
2501 shift
2502 for dir in \$*; do
2503         case "\$thing" in
2504         .)
2505         if test -d \$dir/\$thing; then
2506                 echo \$dir
2507                 exit 0
2508         fi
2509         ;;
2510         *)
2511         for thisthing in \$dir/\$thing; do
2512                 : just loop through to pick last item
2513         done
2514         if test -f \$thisthing; then
2515                 echo \$thisthing
2516                 exit 0
2517         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2518                 echo \$thisthing
2519                 exit 0
2520         elif test -f \$dir/\$thing.exe; then
2521                 if test -n "$DJGPP"; then
2522                         echo \$dir/\$thing.exe
2523                 elif test "$eunicefix" != ":"; then
2524                         : on Eunice apparently
2525                         echo \$dir/\$thing
2526                 fi
2527                 exit 0
2528         fi
2529         ;;
2530         esac
2531 done
2532 echo \$dflt
2533 exit 1
2534 EOSC
2535 chmod +x loc
2536 $eunicefix loc
2537 loclist="
2538 awk
2539 cat
2540 chmod
2541 comm
2542 cp
2543 echo
2544 expr
2545 grep
2546 ls
2547 mkdir
2548 rm
2549 sed
2550 sort
2551 touch
2552 tr
2553 uniq
2554 "
2555 trylist="
2556 ar
2557 bison
2558 byacc
2559 cpp
2560 csh
2561 date
2562 egrep
2563 gmake
2564 gzip
2565 less
2566 ln
2567 make
2568 more
2569 nm
2570 nroff
2571 perl
2572 pg
2573 test
2574 uname
2575 zip
2576 "
2577 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2578 pth="$pth $sysroot/lib $sysroot/usr/lib"
2579 for file in $loclist; do
2580         eval xxx=\$$file
2581         case "$xxx" in
2582         /*|?:[\\/]*)
2583                 if test -f "$xxx"; then
2584                         : ok
2585                 else
2586                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2587                         xxx=`./loc $file $file $pth`
2588                 fi
2589                 ;;
2590         '') xxx=`./loc $file $file $pth`;;
2591         *) xxx=`./loc $xxx $xxx $pth`;;
2592         esac
2593         eval $file=$xxx$_exe
2594         eval _$file=$xxx
2595         case "$xxx" in
2596         /*)
2597                 echo $file is in $xxx.
2598                 ;;
2599         ?:[\\/]*)
2600                 echo $file is in $xxx.
2601                 ;;
2602         *)
2603                 echo "I don't know where '$file' is, and my life depends on it." >&4
2604                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2605                 exit 1
2606                 ;;
2607         esac
2608 done
2609 echo " "
2610 echo "Don't worry if any of the following aren't found..."
2611 say=offhand
2612 for file in $trylist; do
2613         eval xxx=\$$file
2614         case "$xxx" in
2615         /*|?:[\\/]*)
2616                 if test -f "$xxx"; then
2617                         : ok
2618                 else
2619                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2620                         xxx=`./loc $file $file $pth`
2621                 fi
2622                 ;;
2623         '') xxx=`./loc $file $file $pth`;;
2624         *) xxx=`./loc $xxx $xxx $pth`;;
2625         esac
2626         eval $file=$xxx$_exe
2627         eval _$file=$xxx
2628         case "$xxx" in
2629         /*)
2630                 echo $file is in $xxx.
2631                 ;;
2632         ?:[\\/]*)
2633                 echo $file is in $xxx.
2634                 ;;
2635         *)
2636                 echo "I don't see $file out there, $say."
2637                 say=either
2638                 ;;
2639         esac
2640 done
2641 case "$egrep" in
2642 egrep)
2643         echo "Substituting grep for egrep."
2644         egrep=$grep
2645         _egrep=$grep
2646         ;;
2647 esac
2648 case "$less" in
2649 '')     ;;
2650 *)      if $less -R </dev/null >/dev/null 2>&1; then
2651                echo "Substituting less -R for less."
2652                less="$less -R"
2653                _less=$less
2654         fi
2655         ;;
2656 esac
2657 case "$ln" in
2658 ln)
2659         echo "Substituting cp for ln."
2660         ln=$cp
2661         _ln=$cp
2662         ;;
2663 esac
2664 case "$make" in
2665 make)
2666         case "$gmake" in
2667         gmake)
2668         echo "I can't find make or gmake, and my life depends on it." >&4
2669         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2670         exit 1
2671         ;;
2672         esac
2673         ;;
2674 esac
2675 case "$gmake" in
2676 gmake)  ;;
2677 *)      # We can't have osname yet.
2678         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2679                 # Assume that gmake, if found, is definitely GNU make
2680                 # and prefer it over the system make.
2681                 echo "Substituting gmake for make."
2682                 make=$gmake
2683                 _make=$gmake
2684         fi
2685         ;;
2686 esac
2687 case "$test" in
2688 test)
2689         echo "Hopefully test is built into your sh."
2690         ;;
2691 *)
2692         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2693                 echo "Using the test built into your sh."
2694                 test=test
2695                 _test=test
2696         fi
2697         ;;
2698 esac
2699 case "$echo" in
2700 echo)
2701         echo "Hopefully echo is built into your sh."
2702         ;;
2703 '') ;;
2704 *)
2705         echo " "
2706 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2707         $echo $n "hi there$c" >foo1
2708         echo $n "hi there$c" >foo2
2709         if cmp foo1 foo2 >/dev/null 2>&1; then
2710                 echo "They are compatible.  In fact, they may be identical."
2711         else
2712                 case "$n" in
2713                 '-n') n='' c='\c';;
2714                 *) n='-n' c='';;
2715                 esac
2716                 cat <<FOO
2717 They are not compatible!  You are probably running ksh on a non-USG system.
2718 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2719 have echo built in and we may have to run some Bourne shell scripts.  That
2720 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2721
2722 FOO
2723                 $echo $n "The star should be here-->$c"
2724                 $echo "*"
2725         fi
2726         $rm -f foo1 foo2
2727         ;;
2728 esac
2729
2730 # This question was auctioned at YAPC::Europe-2007 in Vienna
2731 # I never promised you could answer it. I only auctioned the question.
2732 cat <<FOO
2733 The following message is sponsored by
2734
2735   Dresden.pm<--The stars should be here.
2736
2737 Dear Perl user, system administrator or package
2738 maintainer, the Perl community sends greetings to
2739 you. Do you (emblematical) greet back [Y/n]? n
2740
2741 FOO
2742
2743 : Check what type of C compiler we use
2744 cat <<EOS >trygcc
2745 $startsh
2746 EOS
2747 cat <<'EOSC' >>trygcc
2748 case "$cc" in
2749 '') ;;
2750 *)  $rm -f try try.*
2751     $cat >try.c <<EOM
2752 int main(int argc, char *argv[]) {
2753   return 0;
2754 }
2755 EOM
2756     if $cc -o try $ccflags $ldflags try.c; then
2757        :
2758     else
2759         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2760         despair=yes
2761         trygcc=yes
2762         case "$cc" in
2763         *gcc*) trygcc=no ;;
2764         esac
2765         # Skip this test because it gives a false match on output like:
2766         #    ./trygcc: line 23: cc: command not found
2767         # case "`$cc -v -c try.c 2>&1`" in
2768         # *gcc*) trygcc=no ;;
2769         # esac
2770         if $test X"$trygcc" = Xyes; then
2771             if gcc -o try -c try.c; then
2772                 echo " "
2773                 echo "You seem to have a working gcc, though." >&4
2774                 # Switching compilers may undo the work of hints files.
2775                 # The most common problem is -D_REENTRANT for threads.
2776                 # This heuristic catches that case, but gets false positives
2777                 # if -Dusethreads was not actually specified.  Better to
2778                 # bail out here with a useful message than fail
2779                 # mysteriously later. Should we perhaps just try to
2780                 # re-invoke Configure -Dcc=gcc config_args ?
2781                 if $test -f usethreads.cbu; then
2782                         $cat >&4 <<EOM
2783
2784 *** However, any setting of the C compiler flags (e.g. for thread support)
2785 *** will be lost.  It may be necessary for you to restart Configure and
2786 *** add -Dcc=gcc to your Configure command line.
2787
2788 EOM
2789                         rp="Would you like to go ahead and try gcc anyway?"
2790                         dflt=n
2791                 else
2792                         rp="Would you like to use it?"
2793                         dflt=y
2794                 fi
2795                 if $test -f myread; then
2796                     . ./myread
2797                 else
2798                     if $test -f UU/myread; then
2799                         . ./UU/myread
2800                     else
2801                         echo "Cannot find myread, sorry.  Aborting." >&4
2802                         exit 1
2803                     fi
2804                 fi
2805                 case "$ans" in
2806                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2807                 esac
2808             fi
2809         fi
2810     fi
2811     $rm -f try try.*
2812     ;;
2813 esac
2814 EOSC
2815
2816 cat <<EOS >checkcc
2817 $startsh
2818 EOS
2819 cat <<'EOSC' >>checkcc
2820 case "$cc" in
2821 '') ;;
2822 *)  $rm -f try try.*
2823     $cat >try.c <<EOM
2824 int main(int argc, char *argv[]) {
2825   return 0;
2826 }
2827 EOM
2828     if $cc -o try $ccflags $ldflags try.c; then
2829        :
2830     else
2831         if $test X"$despair" = Xyes; then
2832            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2833         fi
2834         $cat >&4 <<EOM
2835 You need to find a working C compiler.
2836 Either (purchase and) install the C compiler supplied by your OS vendor,
2837 or for a free C compiler try http://gcc.gnu.org/
2838 I cannot continue any further, aborting.
2839 EOM
2840         exit 1
2841     fi
2842     $rm -f try try.*
2843     ;;
2844 esac
2845 EOSC
2846
2847 : determine whether symbolic links are supported
2848 echo " "
2849 $touch blurfl
2850 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2851         echo "Symbolic links are supported." >&4
2852         lns="$ln -s"
2853 else
2854         echo "Symbolic links are NOT supported." >&4
2855         lns="$ln"
2856 fi
2857 $rm -f blurfl sym
2858
2859 : determine whether symbolic links are supported
2860 echo " "
2861 case "$lns" in
2862 *"ln"*" -s")
2863         echo "Checking how to test for symbolic links..." >&4
2864         $lns blurfl sym
2865         if $test "X$issymlink" = X; then
2866                 case "$newsh" in
2867                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2868                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2869                 esac
2870                 if test $? = 0; then
2871                         issymlink="test -h"
2872                 else
2873                         echo "Your builtin 'test -h' may be broken." >&4
2874                         case "$test" in
2875                         /*)     ;;
2876                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2877                                 for p in $pth
2878                                 do
2879                                         if test -f "$p/$test"; then
2880                                                 test="$p/$test"
2881                                                 break
2882                                         fi
2883                                 done
2884                                 ;;
2885                         esac
2886                         case "$test" in
2887                         /*)
2888                                 echo "Trying external '$test -h'." >&4
2889                                 issymlink="$test -h"
2890                                 if $test ! -h sym >/dev/null 2>&1; then
2891                                         echo "External '$test -h' is broken, too." >&4
2892                                         issymlink=''
2893                                 fi
2894                                 ;;
2895                         *)      issymlink='' ;;
2896                         esac
2897                 fi
2898         fi
2899         if $test "X$issymlink" = X; then
2900                 if $test -L sym 2>/dev/null; then
2901                         issymlink="$test -L"
2902                         echo "The builtin '$test -L' worked." >&4
2903                 fi
2904         fi
2905         if $test "X$issymlink" != X; then
2906                 echo "You can test for symbolic links with '$issymlink'." >&4
2907         else
2908                 echo "I do not know how you can test for symbolic links." >&4
2909         fi
2910         $rm -f blurfl sym
2911         ;;
2912 *)      echo "No symbolic links, so not testing for their testing..." >&4
2913         ;;
2914 esac
2915
2916 : Make symlinks util
2917 case "$mksymlinks" in
2918 $define|true|[yY]*)
2919         case "$src" in
2920         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2921                 exit 1
2922                 ;;
2923         *)      case "$lns:$issymlink" in
2924                 *"ln"*" -s:"*"test -"?)
2925                         echo "Creating the symbolic links..." >&4
2926                         cd ..
2927                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2928                         awk 'NF == 1 {
2929                                 dir=".";
2930                                 file=$1 "";
2931                              }
2932                              NF == 2 {
2933                                 dir=$1 "";
2934                                 file=$2 "";
2935                              }
2936                              {
2937                                  print "# dir = ", dir, "file = ", file
2938                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2939                              } END {
2940                                  for (d in mf) {
2941                                      if (d != ".") { print("mkdir -p "d) }
2942                                      print("ln -sf "mf[d]" "d);
2943                                  }
2944                              }' source="$src" > UU/mksymlinks.$$
2945                         sh UU/mksymlinks.$$
2946                         rm UU/mksymlinks.$$
2947                         # Sanity check 1.
2948                         if test ! -d t/base; then
2949                                 echo "Failed to create the subdirectories.  Aborting." >&4
2950                                 exit 1
2951                         fi
2952                         # Sanity check 2.
2953                         if test ! -f t/base/lex.t; then
2954                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2955                                 exit 1
2956                         fi
2957                         if test ! -f win32/win32.c; then
2958                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2959                                 exit 1
2960                         fi
2961                         cd UU
2962                         ;;
2963                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2964                         ;;
2965                 esac
2966                 ;;
2967         esac
2968         ;;
2969 esac
2970
2971 : Check for Cross-Compilation
2972 if $test "X$targethost" = "X"; then
2973     targethost=""
2974 fi
2975 if $test "X$targetenv" = "X"; then
2976     targetenv=""
2977 fi
2978 case "$usecrosscompile" in
2979 $define|true|[yY]*)
2980         $echo "Cross-compiling..."
2981         croak=''
2982         case "$cc" in
2983         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2984             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2985             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2986             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2987             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2988             # leave out ld, choosing it is more complex
2989             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2990             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2991             # We are in a weird spot. Just before us, some values
2992             # were 'saved', to be restored after the hints are
2993             # run.  This means that the changes we made to ar,
2994             # nm and ranlib will get reverted.
2995             # To avoid that, we hijack the saving mechanism and
2996             # have it save our new values.
2997             for file in ar nm ranlib; do
2998                 eval xxx=\$$file
2999                 eval $file=$xxx$_exe
3000                 eval _$file=$xxx
3001             done
3002         ;;
3003         esac
3004         case "$targetarch" in
3005         '') echo "Targetarch not defined." >&4; croak=y ;;
3006         *)  echo "Using targetarch $targetarch." >&4 ;;
3007         esac
3008         case "$targethost" in
3009         '') echo "Targethost not defined." >&4; croak=n ;;
3010         *)  echo "Using targethost $targethost." >&4
3011         esac
3012         locincpth=' '
3013         loclibpth=' '
3014         case "$croak" in
3015         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
3016         esac
3017     : compile a host miniperl and generate_uudmap, unless we got passed them
3018     if $test "X$hostperl" = X; then
3019       echo "Building host miniperl and generate_uudmap binaries" >&4
3020       before_host=`pwd`
3021       cd ..
3022       cd $src
3023       src=`pwd`
3024       rm -rf $src/host
3025       mkdir $src/host
3026       cd $src/host
3027       $src/Configure -des -Dusedevel -Dmksymlinks
3028       $make miniperl
3029       case "$hostgenerate" in
3030       '') $make generate_uudmap
3031           hostgenerate=$src/host/generate_uudmap
3032           ;;
3033        "$undef") hostgenerate=''
3034           ;;
3035       esac
3036       hostperl=$src/host/miniperl
3037       cd $before_host
3038     fi
3039     hostosname=`$hostperl -le 'print $^O'`
3040     ;;
3041 *)
3042     usecrosscompile="$undef"
3043     ;;
3044 esac
3045
3046 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3047 case "$targethost" in
3048     '') echo "Checking for cross-compile" >&4
3049     case "$usecrosscompile$multiarch" in
3050        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3051          if [ -f Makefile ]; then
3052            echo " "
3053            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3054          else
3055            echo "Configure done."
3056          fi
3057        exit 0
3058        ;;
3059      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3060         run=''
3061         to=:
3062         from=:
3063         ;;
3064     esac
3065     ;;
3066     *) echo "Using targethost $targethost." >&4
3067         case "$src" in
3068         /*) run=$src/Cross/run
3069             targetmkdir=$src/Cross/mkdir
3070             to=$src/Cross/to
3071             from=$src/Cross/from
3072             ;;
3073         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3074             run=$pwd/Cross/run
3075             targetmkdir=$pwd/Cross/mkdir
3076             to=$pwd/Cross/to
3077             from=$pwd/Cross/from
3078             ;;
3079         esac
3080         case "$targetrun" in
3081         '') targetrun=ssh ;;
3082         esac
3083         case "$targetto" in
3084         '') targetto=scp ;;
3085         esac
3086         case "$targetfrom" in
3087         '') targetfrom=scp ;;
3088         esac
3089         run=$run-$targetrun
3090         to=$to-$targetto
3091         from=$from-$targetfrom
3092         case "$targetdir" in
3093         '')  targetdir=/tmp
3094              echo "Guessing targetdir $targetdir." >&4
3095              ;;
3096         esac
3097         case "$targetuser" in
3098         '')  targetuser=root
3099              echo "Guessing targetuser $targetuser." >&4
3100              ;;
3101         esac
3102         case "$targetport" in
3103         '')  targetport=22
3104              echo "Guessing targetport $targetport." >&4
3105              ;;
3106         esac
3107         case "$targetfrom" in
3108         scp)    q=-q ;;
3109         *)      q='' ;;
3110         esac
3111         case "$targetrun" in
3112         ssh|rsh)
3113             cat >$run <<EOF
3114 #!/bin/sh
3115 env=''
3116 case "\$1" in
3117 -cwd)
3118   shift
3119   cwd=\$1
3120   shift
3121   ;;
3122 esac
3123 case "\$1" in
3124 -env)
3125   shift
3126   env=\$1
3127   shift
3128   ;;
3129 esac
3130 case "\$cwd" in
3131 '') cwd=$targetdir ;;
3132 esac
3133 exe=\$1
3134 shift
3135 $to \$exe
3136 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3137 EOF
3138             ;;
3139         adb)
3140             $touch $run
3141             ;;
3142         *)  echo "Unknown targetrun '$targetrun'" >&4
3143             exit 1
3144             ;;
3145         esac
3146         case "$targetmkdir" in
3147         */Cross/mkdir)
3148             cat >$targetmkdir <<EOF
3149 #!/bin/sh
3150 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3151 EOF
3152             $chmod a+rx $targetmkdir
3153             ;;
3154         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3155             exit 1
3156             ;;
3157         esac
3158         case "$targetto" in
3159         scp|rcp)
3160             cat >$to <<EOF
3161 #!/bin/sh
3162 for f in \$@
3163 do
3164   case "\$f" in
3165   /*)
3166     $targetmkdir \`dirname \$f\`
3167     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3168     ;;
3169   *)
3170     $targetmkdir $targetdir/\`dirname \$f\`
3171     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3172     ;;
3173   esac
3174 done
3175 exit 0
3176 EOF
3177             ;;
3178         cp) cat >$to <<EOF
3179 #!/bin/sh
3180 for f in \$@
3181 do
3182   case "\$f" in
3183   /*)
3184     $mkdir -p $targetdir/\`dirname \$f\`
3185     $cp \$f $targetdir/\$f || exit 1
3186     ;;
3187   *)
3188     $targetmkdir $targetdir/\`dirname \$f\`
3189     $cp \$f $targetdir/\$f || exit 1
3190     ;;
3191   esac
3192 done
3193 exit 0
3194 EOF
3195             ;;
3196         *)  echo "Unknown targetto '$targetto'" >&4
3197             exit 1
3198             ;;
3199         esac
3200         case "$targetfrom" in
3201         scp|rcp)
3202           cat >$from <<EOF
3203 #!/bin/sh
3204 for f in \$@
3205 do
3206   $rm -f \$f
3207   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3208 done
3209 exit 0
3210 EOF
3211             ;;
3212         cp) cat >$from <<EOF
3213 #!/bin/sh
3214 for f in \$@
3215 do
3216   $rm -f \$f
3217   cp $targetdir/\$f . || exit 1
3218 done
3219 exit 0
3220 EOF
3221             ;;
3222         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3223             exit 1
3224             ;;
3225         esac
3226         if $test ! -f $run; then
3227             echo "Target 'run' script '$run' not found." >&4
3228         else
3229             $chmod a+rx $run
3230         fi
3231         if $test ! -f $to; then
3232             echo "Target 'to' script '$to' not found." >&4
3233         else
3234             $chmod a+rx $to
3235         fi
3236         if $test ! -f $from; then
3237             echo "Target 'from' script '$from' not found." >&4
3238         else
3239             $chmod a+rx $from
3240         fi
3241         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3242             exit 1
3243         fi
3244         cat >&4 <<EOF
3245 Using '$run' for remote execution,
3246 and '$from' and '$to'
3247 for remote file transfer.
3248 EOF
3249         ;;
3250 *)      run=''
3251         to=:
3252         from=:
3253         usecrosscompile="$undef"
3254         targetarch=''
3255         ;;
3256 esac
3257
3258 : see whether [:lower:] and [:upper:] are supported character classes
3259 echo " "
3260 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3261 ABYZ-abyz)
3262         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3263         up='[:upper:]'
3264         low='[:lower:]'
3265         ;;
3266 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3267         # (0xd9 and 0xe2), therefore that is a nice testing point.
3268         if test "X$up" = X -o "X$low" = X; then
3269             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3270             rs) up='[A-Z]'
3271                 low='[a-z]'
3272                 ;;
3273             esac
3274         fi
3275         if test "X$up" = X -o "X$low" = X; then
3276             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3277             rs) up='A-Z'
3278                 low='a-z'
3279                 ;;
3280             esac
3281         fi
3282         if test "X$up" = X -o "X$low" = X; then
3283             case "`echo RS | od -x 2>/dev/null`" in
3284             *D9E2*|*d9e2*)
3285                 echo "Hey, this might be EBCDIC." >&4
3286                 if test "X$up" = X -o "X$low" = X; then
3287                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3288                     rs) up='[A-IJ-RS-Z]'
3289                         low='[a-ij-rs-z]'
3290                         ;;
3291                     esac
3292                 fi
3293                 if test "X$up" = X -o "X$low" = X; then
3294                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3295                     rs) up='A-IJ-RS-Z'
3296                         low='a-ij-rs-z'
3297                         ;;
3298                     esac
3299                 fi
3300                 ;;
3301             esac
3302         fi
3303 esac
3304 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3305 rs)
3306     echo "Using $up and $low to convert case." >&4
3307     ;;
3308 *)
3309     echo "I don't know how to translate letters from upper to lower case." >&4
3310     echo "Your tr is not acting any way I know of." >&4
3311     exit 1
3312     ;;
3313 esac
3314 : set up the translation script tr, must be called with ./tr of course
3315 cat >tr <<EOSC
3316 $startsh
3317 case "\$1\$2" in
3318 '[A-Z][a-z]') exec $tr '$up' '$low';;
3319 '[a-z][A-Z]') exec $tr '$low' '$up';;
3320 esac
3321 exec $tr "\$@"
3322 EOSC
3323 chmod +x tr
3324 $eunicefix tr
3325
3326 : Try to determine whether config.sh was made on this system
3327 case "$config_sh" in
3328 '')
3329 myuname=`$uname -a 2>/dev/null`
3330 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3331 # Downcase everything to avoid ambiguity.
3332 # Remove slashes and single quotes so we can use parts of this in
3333 # directory and file names.
3334 # Remove newlines so myuname is sane to use elsewhere.
3335 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3336 # because the A-Z/a-z are not consecutive.
3337 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3338         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3339 newmyuname="$myuname"
3340 dflt=n
3341 case "$knowitall" in
3342 '')
3343         if test -f ../config.sh; then
3344                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3345                         eval "`grep myuname= ../config.sh`"
3346                 fi
3347                 if test "X$myuname" = "X$newmyuname"; then
3348                         dflt=y
3349                 fi
3350         fi
3351         ;;
3352 *) dflt=y;;
3353 esac
3354
3355 : Get old answers from old config file if Configure was run on the
3356 : same system, otherwise use the hints.
3357 hint=default
3358 cd ..
3359 if test -f config.sh; then
3360         echo " "
3361         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3362         . UU/myread
3363         case "$ans" in
3364         n*|N*) echo "OK, I'll ignore it."
3365                 mv config.sh config.sh.old
3366                 myuname="$newmyuname"
3367                 ;;
3368         *)  echo "Fetching default answers from your old config.sh file..." >&4
3369                 tmp_n="$n"
3370                 tmp_c="$c"
3371                 tmp_sh="$sh"
3372                 . ./config.sh
3373                 cp config.sh UU
3374                 n="$tmp_n"
3375                 c="$tmp_c"
3376                 : Older versions did not always set $sh.  Catch re-use of such
3377                 : an old config.sh.
3378                 case "$sh" in
3379                 '') sh="$tmp_sh" ;;
3380                 esac
3381                 hint=previous
3382                 ;;
3383         esac
3384 fi
3385 . ./UU/checkcc
3386 if test ! -f config.sh; then
3387         $cat <<EOM
3388
3389 First time through, eh?  I have some defaults handy for some systems
3390 that need some extra help getting the Configure answers right:
3391
3392 EOM
3393         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3394         dflt=''
3395         : Half the following guesses are probably wrong... If you have better
3396         : tests or hints, please send them to https://github.com/Perl/perl5/issues
3397         : The metaconfig authors would also appreciate a copy...
3398         $test -f /irix && osname=irix
3399         $test -f /xenix && osname=sco_xenix
3400         $test -f /dynix && osname=dynix
3401         $test -f /dnix && osname=dnix
3402         $test -f /lynx.os && osname=lynxos
3403         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3404         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3405         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3406         $test -f /bin/mips && /bin/mips && osname=mips
3407         $test -d /usr/apollo/bin && osname=apollo
3408         $test -f /etc/saf/_sactab && osname=svr4
3409         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3410         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3411         $test -f /sys/utilities/MultiView && osname=amigaos
3412         if $test -d /MachTen -o -d /MachTen_Folder; then
3413                 osname=machten
3414                 if $test -x /sbin/version; then
3415                         osvers=`/sbin/version | $awk '{print $2}' |
3416                         $sed -e 's/[A-Za-z]$//'`
3417                 elif $test -x /usr/etc/version; then
3418                         osvers=`/usr/etc/version | $awk '{print $2}' |
3419                         $sed -e 's/[A-Za-z]$//'`
3420                 else
3421                         osvers="$2.$3"
3422                 fi
3423         fi
3424
3425         $test -f /sys/posix.dll &&
3426                 $test -f /usr/bin/what &&
3427                 set X `/usr/bin/what /sys/posix.dll` &&
3428                 $test "$3" = UWIN &&
3429                 osname=uwin &&
3430                 osvers="$5"
3431
3432         if $test -f $uname; then
3433                 set X $myuname
3434                 shift
3435
3436                 case "$5" in
3437                 fps*) osname=fps ;;
3438                 mips*)
3439                         case "$4" in
3440                         umips) osname=umips ;;
3441                         *) osname=mips ;;
3442                         esac;;
3443                 [23]100) osname=mips ;;
3444                 i386*)
3445                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3446                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3447                                 osname='sco'
3448                                 osvers=$tmp
3449                         elif $test -f /etc/kconfig; then
3450                                 osname=isc
3451                                 if test "$lns" = "$ln -s"; then
3452                                         osvers=4
3453                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3454                                         osvers=3
3455                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3456                                         osvers=2
3457                                 fi
3458                         fi
3459                         tmp=''
3460                         ;;
3461                 pc*)
3462                         if test -n "$DJGPP"; then
3463                                 osname=dos
3464                                 osvers=djgpp
3465                         fi
3466                         ;;
3467                 esac
3468
3469                 case "$1" in
3470                 aix) osname=aix
3471                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3472                         case "$tmp" in
3473                         # oslevel can fail with:
3474                         # oslevel: Unable to acquire lock.
3475                         *not\ found) osvers="$4"."$3" ;;
3476                         '<3240'|'<>3240') osvers=3.2.0 ;;
3477                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3478                         '=3250'|'>3250') osvers=3.2.5 ;;
3479                         *) osvers=$tmp;;
3480                         esac
3481                         ;;
3482                 bitrig) osname=bitrig
3483                         osvers="$3"
3484                         ;;
3485                 bsd386) osname=bsd386
3486                         osvers=`$uname -r`
3487                         ;;
3488                 cygwin*) osname=cygwin
3489                         osvers="$3"
3490                         ;;
3491                 *dc.osx) osname=dcosx
3492                         osvers="$3"
3493                         ;;
3494                 dnix) osname=dnix
3495                         osvers="$3"
3496                         ;;
3497                 domainos) osname=apollo
3498                         osvers="$3"
3499                         ;;
3500                 dgux)   osname=dgux
3501                         osvers="$3"
3502                         ;;
3503                 dragonfly) osname=dragonfly
3504                         case "$3" in
3505                             [0-9]*) osvers="$3" ;;
3506                             *) osvers="$2" ;;
3507                         esac
3508                         ;;
3509                 dynixptx*) osname=dynixptx
3510                         osvers=`echo "$4"|sed 's/^v//'`
3511                         ;;
3512                 freebsd) osname=freebsd
3513                         osvers="$3" ;;
3514                 genix)  osname=genix ;;
3515                 gnu)    osname=gnu
3516                         osvers="$3" ;;
3517                 hp*)    osname=hpux
3518                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3519                         ;;
3520                 irix*)  osname=irix
3521                         case "$3" in
3522                         4*) osvers=4 ;;
3523                         5*) osvers=5 ;;
3524                         *)      osvers="$3" ;;
3525                         esac
3526                         ;;
3527                 linux)  osname=linux
3528                         case "$3" in
3529                         *)      osvers="$3" ;;
3530                         esac
3531                         $test -f /system/lib/libandroid.so && osname=linux-android
3532                         ;;
3533                 MiNT)   osname=mint
3534                         ;;
3535                 minix)  osname=minix
3536                         osvers=`$uname -r`
3537                         ;;
3538                 netbsd*) osname=netbsd
3539                         osvers="$3"
3540                         ;;
3541                 news-os) osvers="$3"
3542                         case "$3" in
3543                         4*) osname=newsos4 ;;
3544                         *) osname=newsos ;;
3545                         esac
3546                         ;;
3547                 nonstop-ux) osname=nonstopux ;;
3548                 openbsd) osname=openbsd
3549                         osvers="$3"
3550                         ;;
3551                 os2)    osname=os2
3552                         osvers="$4"
3553                         ;;
3554                 POSIX-BC | posix-bc ) osname=posix-bc
3555                         osvers="$3"
3556                         ;;
3557                 powerux | power_ux | powermax_os | powermaxos | \
3558                 powerunix | power_unix) osname=powerux
3559                         osvers="$3"
3560                         ;;
3561                 qnx) osname=qnx
3562                         osvers="$4"
3563                         ;;
3564                 solaris) osname=solaris
3565                         case "$3" in
3566                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3567                         *)      osvers="$3" ;;
3568                         esac
3569                         ;;
3570                 sunos) osname=sunos
3571                         case "$3" in
3572                         5*) osname=solaris
3573                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3574                         *)      osvers="$3" ;;
3575                         esac
3576                         ;;
3577                 titanos) osname=titanos
3578                         case "$3" in
3579                         1*) osvers=1 ;;
3580                         2*) osvers=2 ;;
3581                         3*) osvers=3 ;;
3582                         4*) osvers=4 ;;
3583                         *)      osvers="$3" ;;
3584                         esac
3585                         ;;
3586                 ultrix) osname=ultrix
3587                         osvers="$3"
3588                         ;;
3589                 osf1|mls+)      case "$5" in
3590                                 alpha)
3591                                         osname=dec_osf
3592                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3593                                         case "$osvers" in
3594                                         [1-9].[0-9]*) ;;
3595                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3596                                         esac
3597                                         ;;
3598                         hp*)    osname=hp_osf1  ;;
3599                         mips)   osname=mips_osf1 ;;
3600                         esac
3601                         ;;
3602                 # UnixWare 7.1.2 is known as Open UNIX 8
3603                 openunix|unixware) osname=svr5
3604                         osvers="$4"
3605                         ;;
3606                 uts)    osname=uts
3607                         osvers="$3"
3608                         ;;
3609                 vos) osvers="$3"
3610                         ;;
3611                 $2) case "$osname" in
3612                         *isc*) ;;
3613                         *freebsd*) ;;
3614                         svr*)
3615                                 : svr4.x or possibly later
3616                                 case "svr$3" in
3617                                 ${osname}*)
3618                                         osname=svr$3
3619                                         osvers=$4
3620                                         ;;
3621                                 esac
3622                                 case "$osname" in
3623                                 svr4.0)
3624                                         : Check for ESIX
3625                                         if test -f /stand/boot ; then
3626                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3627                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3628                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3629                                                         if test -n "$isesix"; then
3630                                                                 osname=esix4
3631                                                         fi
3632                                                 fi
3633                                         fi
3634                                         ;;
3635                                 esac
3636                                 ;;
3637                         *)      if test -f /etc/systemid; then
3638                                         osname=sco
3639                                         set `echo $3 | $sed 's/\./ /g'` $4
3640                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3641                                                 osvers=$1.$2.$3
3642                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3643                                                 osvers=$1.$2
3644                                         elif $test -f $src/hints/sco_$1.sh; then
3645                                                 osvers=$1
3646                                         fi
3647                                 else
3648                                         case "$osname" in
3649                                         '') : Still unknown.  Probably a generic Sys V.
3650                                                 osname="sysv"
3651                                                 osvers="$3"
3652                                                 ;;
3653                                         esac
3654                                 fi
3655                                 ;;
3656                         esac
3657                         ;;
3658                 *)      case "$osname" in
3659                         '') : Still unknown.  Probably a generic BSD.
3660                                 osname="$1"
3661                                 osvers="$3"
3662                                 ;;
3663                         esac
3664                         ;;
3665                 esac
3666         else
3667                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3668                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3669                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3670                                 osname=news_os
3671                         fi
3672                         $rm -f UU/kernel.what
3673                 elif test -d c:/. -o -n "$is_os2" ; then
3674                         set X $myuname
3675                         osname=os2
3676                         osvers="$5"
3677                 fi
3678         fi
3679
3680         case "$targetarch" in
3681         '') ;;
3682         *)  hostarch=$osname
3683             case "$targetarch" in
3684                 nto*|*-nto-*)
3685                     # Will load qnx.sh, which should change osname to nto
3686                     osname=qnx
3687                     osvers=''
3688                     ;;
3689                 *linux-android*)
3690                     # Catch arm-linux-androideabi, mipsel-linux-android,
3691                     # and i686-linux-android
3692                     osname=linux-android
3693                     osvers=''
3694                     ;;
3695                 *linux*)
3696                     # Something like arm-linux-gnueabihf is really just
3697                     # plain linux.
3698                     osname=linux
3699                     osvers=''
3700                     ;;
3701                 *solaris*|*sunos*)
3702                     osname=solaris
3703                     # XXX perhaps we should just assume
3704                     # osvers to be 2, or maybe take the value
3705                     # from targetarch. Using $run before the
3706                     # hints are run is somewhat icky.
3707                     set X `$run $uname -a 2>/dev/null`
3708                     shift
3709                     case "$3" in
3710                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3711                         *)  osvers="$3" ;;
3712                     esac
3713                     ;;
3714                 *)
3715                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3716                     osvers=''
3717                 ;;
3718             esac
3719             ;;
3720         esac
3721
3722         : Now look for a hint file osname_osvers, unless one has been
3723         : specified already.
3724         case "$hintfile" in
3725         ''|' ')
3726                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3727                 : Also try without trailing minor version numbers.
3728                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3729                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3730                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3731                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3732                 case "$file" in
3733                 '') dflt=none ;;
3734                 *)  case "$osvers" in
3735                         '') dflt=$file
3736                                 ;;
3737                         *)  if $test -f $src/hints/$file.sh ; then
3738                                         dflt=$file
3739                                 elif $test -f $src/hints/$xfile.sh ; then
3740                                         dflt=$xfile
3741                                 elif $test -f $src/hints/$xxfile.sh ; then
3742                                         dflt=$xxfile
3743                                 elif $test -f $src/hints/$xxxfile.sh ; then
3744                                         dflt=$xxxfile
3745                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3746                                         dflt=$xxxxfile
3747                                 elif $test -f "$src/hints/${osname}.sh" ; then
3748                                         dflt="${osname}"
3749                                 else
3750                                         dflt=none
3751                                 fi
3752                                 ;;
3753                         esac
3754                         ;;
3755                 esac
3756                 if $test -f Policy.sh ; then
3757                         case "$dflt" in
3758                         *Policy*) ;;
3759                         none) dflt="Policy" ;;
3760                         *) dflt="Policy $dflt" ;;
3761                         esac
3762                 fi
3763                 ;;
3764         *)
3765                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3766                 ;;
3767         esac
3768
3769         if $test -f Policy.sh ; then
3770                 $cat <<EOM
3771
3772 There's also a Policy hint file available, which should make the
3773 site-specific (policy) questions easier to answer.
3774 EOM
3775
3776         fi
3777
3778         $cat <<EOM
3779
3780 You may give one or more space-separated answers, or "none" if appropriate.
3781 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3782 previous run of Configure, you may specify it as well as or instead of
3783 OS-specific hints.  If hints are provided for your OS, you should use them:
3784 although Perl can probably be built without hints on many platforms, using
3785 hints often improve performance and may enable features that Configure can't
3786 set up on its own. If there are no hints that match your OS, specify "none";
3787 DO NOT give a wrong version or a wrong OS.
3788
3789 EOM
3790
3791         rp="Which of these apply, if any?"
3792         . UU/myread
3793         tans=$ans
3794         for file in $tans; do
3795                 if $test X$file = XPolicy -a -f Policy.sh; then
3796                         . Policy.sh
3797                         $cat Policy.sh >> UU/config.sh
3798                 elif $test -f $src/hints/$file.sh; then
3799                         . $src/hints/$file.sh
3800                         $cat $src/hints/$file.sh >> UU/config.sh
3801                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3802                         : nothing
3803                 else
3804                         : Give one chance to correct a possible typo.
3805                         echo "$file.sh does not exist"
3806                         dflt=$file
3807                         rp="hint to use instead?"
3808                         . UU/myread
3809                         for file in $ans; do
3810                                 if $test -f "$src/hints/$file.sh"; then
3811                                         . $src/hints/$file.sh
3812                                         $cat $src/hints/$file.sh >> UU/config.sh
3813                                 elif $test X$ans = X -o X$ans = Xnone ; then
3814                                         : nothing
3815                                 else
3816                                         echo "$file.sh does not exist -- ignored."
3817                                 fi
3818                         done
3819                 fi
3820         done
3821
3822         hint=recommended
3823         : Remember our hint file for later.
3824         if $test -f "$src/hints/$file.sh" ; then
3825                 hintfile="$file"
3826         else
3827                 hintfile=''
3828         fi
3829 fi
3830 cd UU
3831 ;;
3832 *)
3833         echo " "
3834         echo "Fetching default answers from $config_sh..." >&4
3835         tmp_n="$n"
3836         tmp_c="$c"
3837         cd ..
3838         cp $config_sh config.sh 2>/dev/null
3839         chmod +w config.sh
3840         . ./config.sh
3841         cd UU
3842         cp ../config.sh .
3843         n="$tmp_n"
3844         c="$tmp_c"
3845         hint=previous
3846         ;;
3847 esac
3848 . ./optdef.sh
3849
3850 : Restore computed paths
3851 for file in $loclist $trylist; do
3852         eval $file="\$_$file"
3853 done
3854
3855 cat << EOM
3856
3857 Configure uses the operating system name and version to set some defaults.
3858 The default value is probably right if the name rings a bell. Otherwise,
3859 since spelling matters for me, either accept the default or answer "none"
3860 to leave it blank.
3861
3862 EOM
3863 case "$osname" in
3864         ''|' ')
3865                 case "$hintfile" in
3866                 ''|' '|none) dflt=none ;;
3867                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3868                 esac
3869                 ;;
3870         *) dflt="$osname" ;;
3871 esac
3872 rp="Operating system name?"
3873 . ./myread
3874 case "$ans" in
3875 none)  osname='' ;;
3876 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3877 esac
3878 echo " "
3879 case "$osvers" in
3880         ''|' ')
3881                 case "$hintfile" in
3882                 ''|' '|none) dflt=none ;;
3883                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3884                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3885                         case "$dflt" in
3886                         ''|' ') dflt=none ;;
3887                         esac
3888                         ;;
3889                 esac
3890                 ;;
3891         *) dflt="$osvers" ;;
3892 esac
3893 rp="Operating system version?"
3894 . ./myread
3895 case "$ans" in
3896 none)  osvers='' ;;
3897 *) osvers="$ans" ;;
3898 esac
3899
3900
3901 . ./posthint.sh
3902
3903 : who configured the system
3904 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3905 case "$cf_by" in
3906 "")
3907         cf_by=`(logname) 2>/dev/null`
3908         case "$cf_by" in
3909         "")
3910                 cf_by=`(whoami) 2>/dev/null`
3911                 case "$cf_by" in
3912                 "") cf_by=unknown ;;
3913                 esac ;;
3914         esac ;;
3915 esac
3916
3917 : decide how portable to be.  Allow command line overrides.
3918 case "$d_portable" in
3919 "$undef") ;;
3920 *)      d_portable="$define" ;;
3921 esac
3922
3923 : set up shell script to do ~ expansion
3924 cat >filexp <<EOSS
3925 $startsh
3926 : expand filename
3927 case "\$1" in
3928  \~/*|\~)
3929         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3930         ;;
3931  \~*)
3932         if $test -f /bin/csh; then
3933                 /bin/csh -f -c "glob \$1"
3934                 failed=\$?
3935                 echo ""
3936                 exit \$failed
3937         else
3938                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3939                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3940                 if $test ! -d "\$dir"; then
3941                         me=\`basename \$0\`
3942                         echo "\$me: can't locate home directory for: \$name" >&2
3943                         exit 1
3944                 fi
3945                 case "\$1" in
3946                 */*)
3947                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3948                         ;;
3949                 *)
3950                         echo \$dir
3951                         ;;
3952                 esac
3953         fi
3954         ;;
3955 *)
3956         echo \$1
3957         ;;
3958 esac
3959 EOSS
3960 chmod +x filexp
3961 $eunicefix filexp
3962
3963 : now set up to get a file name
3964 cat <<EOS >getfile
3965 $startsh
3966 EOS
3967 cat <<'EOSC' >>getfile
3968 tilde=''
3969 fullpath=''
3970 already=''
3971 skip=''
3972 none_ok=''
3973 exp_file=''
3974 nopath_ok=''
3975 orig_rp="$rp"
3976 orig_dflt="$dflt"
3977 case "$gfpth" in
3978 '') gfpth='.' ;;
3979 esac
3980
3981 case "$fn" in
3982 *\(*)
3983         : getfile will accept an answer from the comma-separated list
3984         : enclosed in parentheses even if it does not meet other criteria.
3985         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3986         fn=`echo $fn | sed 's/(.*)//'`
3987         ;;
3988 esac
3989
3990 case "$fn" in
3991 *:*)
3992         loc_file=`expr $fn : '.*:\(.*\)'`
3993         fn=`expr $fn : '\(.*\):.*'`
3994         ;;
3995 esac
3996
3997 case "$fn" in
3998 *~*) tilde=true;;
3999 esac
4000 case "$fn" in
4001 */*) fullpath=true;;
4002 esac
4003 case "$fn" in
4004 *+*) skip=true;;
4005 esac
4006 case "$fn" in
4007 *n*) none_ok=true;;
4008 esac
4009 case "$fn" in
4010 *e*) exp_file=true;;
4011 esac
4012 case "$fn" in
4013 *p*) nopath_ok=true;;
4014 esac
4015
4016 case "$fn" in
4017 *f*) type='File';;
4018 *d*) type='Directory';;
4019 *l*) type='Locate';;
4020 esac
4021
4022 what="$type"
4023 case "$what" in
4024 Locate) what='File';;
4025 esac
4026
4027 case "$exp_file" in
4028 '')
4029         case "$d_portable" in
4030         "$define") ;;
4031         *) exp_file=true;;
4032         esac
4033         ;;
4034 esac
4035
4036 cd ..
4037 while test "$type"; do
4038         redo=''
4039         rp="$orig_rp"
4040         dflt="$orig_dflt"
4041         case "$tilde" in
4042         true) rp="$rp (~name ok)";;
4043         esac
4044         . UU/myread
4045         if test -f UU/getfile.ok && \
4046                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4047         then
4048                 value="$ans"
4049                 ansexp="$ans"
4050                 break
4051         fi
4052         case "$ans" in
4053         none)
4054                 value=''
4055                 ansexp=''
4056                 case "$none_ok" in
4057                 true) type='';;
4058                 esac
4059                 ;;
4060         *)
4061                 case "$tilde" in
4062                 '') value="$ans"
4063                         ansexp="$ans";;
4064                 *)
4065                         value=`UU/filexp $ans`
4066                         case $? in
4067                         0)
4068                                 if test "$ans" != "$value"; then
4069                                         echo "(That expands to $value on this system.)"
4070                                 fi
4071                                 ;;
4072                         *) value="$ans";;
4073                         esac
4074                         ansexp="$value"
4075                         case "$exp_file" in
4076                         '') value="$ans";;
4077                         esac
4078                         ;;
4079                 esac
4080                 case "$fullpath" in
4081                 true)
4082                         case "$ansexp" in
4083                         /*) value="$ansexp" ;;
4084                         [a-zA-Z]:/*) value="$ansexp" ;;
4085                         *)
4086                                 redo=true
4087                                 case "$already" in
4088                                 true)
4089                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4090                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4091                                         ;;
4092                                 *)
4093                                 echo "Please give a full path name, starting with slash." >&4
4094                                         case "$tilde" in
4095                                         true)
4096                                 echo "Note that using ~name is ok provided it expands well." >&4
4097                                                 already=true
4098                                                 ;;
4099                                         esac
4100                                 esac
4101                                 ;;
4102                         esac
4103                         ;;
4104                 esac
4105                 case "$redo" in
4106                 '')
4107                         case "$type" in
4108                         File)
4109                                 for fp in $gfpth; do
4110                                         if test "X$fp" = X.; then
4111                                             pf="$ansexp"
4112                                         else    
4113                                             pf="$fp/$ansexp"
4114                                         fi
4115                                         if test -f "$pf"; then
4116                                                 type=''
4117                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4118                                         then
4119                                                 echo "($value is not a plain file, but that's ok.)"
4120                                                 type=''
4121                                         fi
4122                                         if test X"$type" = X; then
4123                                             value="$pf"
4124                                             break
4125                                         fi
4126                                 done
4127                                 ;;
4128                         Directory)
4129                                 for fp in $gfpth; do
4130                                         if test "X$fp" = X.; then
4131                                             dir="$ans"
4132                                             direxp="$ansexp"
4133                                         else    
4134                                             dir="$fp/$ansexp"
4135                                             direxp="$fp/$ansexp"
4136                                         fi
4137                                         if test -d "$direxp"; then
4138                                                 type=''
4139                                                 value="$dir"
4140                                                 break
4141                                         fi
4142                                 done
4143                                 ;;
4144                         Locate)
4145                                 if test -d "$ansexp"; then
4146                                         echo "(Looking for $loc_file in directory $value.)"
4147                                         value="$value/$loc_file"
4148                                         ansexp="$ansexp/$loc_file"
4149                                 fi
4150                                 if test -f "$ansexp"; then
4151                                         type=''
4152                                 fi
4153                                 case "$nopath_ok" in
4154                                 true)   case "$value" in
4155                                         */*) ;;
4156                                         *)      echo "Assuming $value will be in people's path."
4157                                                 type=''
4158                                                 ;;
4159                                         esac
4160                                         ;;
4161                                 esac
4162                                 ;;
4163                         esac
4164
4165                         case "$skip" in
4166                         true) type='';
4167                         esac
4168
4169                         case "$type" in
4170                         '') ;;
4171                         *)
4172                                 if test "$fastread" = yes; then
4173                                         dflt=y
4174                                 else
4175                                         dflt=n
4176                                 fi
4177                                 rp="$what $value doesn't exist.  Use that name anyway?"
4178                                 . UU/myread
4179                                 dflt=''
4180                                 case "$ans" in
4181                                 y*) type='';;
4182                                 *) echo " ";;
4183                                 esac
4184                                 ;;
4185                         esac
4186                         ;;
4187                 esac
4188                 ;;
4189         esac
4190 done
4191 cd UU
4192 ans="$value"
4193 rp="$orig_rp"
4194 dflt="$orig_dflt"
4195 rm -f getfile.ok
4196 test "X$gfpthkeep" != Xy && gfpth=""
4197 EOSC
4198
4199 : determine root of directory hierarchy where package will be installed.
4200 case "$prefix" in
4201 '')     dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4202         ;;
4203 *)      dflt="$prefix"
4204         ;;
4205 esac
4206 $cat <<EOM
4207
4208 By default, $package will be installed in $dflt/bin, manual pages
4209 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4210 installation directories. Typically this is something like /usr/local.
4211 If you wish to have binaries under /usr/bin but other parts of the
4212 installation under /usr/local, that's ok: you will be prompted
4213 separately for each of the installation directories, the prefix being
4214 only used to set the defaults.
4215
4216 EOM
4217 fn=d~
4218 rp='Installation prefix to use?'
4219 . ./getfile
4220 oldprefix=''
4221 case "$prefix" in
4222 '')     ;;
4223 *)      case "$ans" in
4224         "$prefix") ;;
4225         *) oldprefix="$prefix";;
4226         esac
4227         ;;
4228 esac
4229
4230 case "$ans" in
4231 *?/)    prefix=`echo "$ans" | sed 's/.$//'`
4232         ;;
4233 *)      prefix="$ans"
4234 esac
4235
4236 case "$ansexp" in
4237 *?/)    prefixexp=`echo "$ansexp" | sed 's/.$//'`
4238         ;;
4239 *)      prefixexp="$ansexp"
4240 esac
4241
4242 : allow them to override the AFS root
4243 case "$afsroot" in
4244 '')     afsroot=/afs ;;
4245 *)      afsroot=$afsroot ;;
4246 esac
4247
4248 : is AFS running?
4249 echo " "
4250 case "$afs" in
4251 $define|true)   afs=true ;;
4252 $undef|false)   afs=false ;;
4253 *)      if $test -d $afsroot; then
4254                 afs=true
4255         else
4256                 afs=false
4257         fi
4258         ;;
4259 esac
4260 if $afs; then
4261         echo "AFS may be running... I'll be extra cautious then..." >&4
4262 else
4263         echo "AFS does not seem to be running..." >&4
4264 fi
4265
4266 : determine installation prefix for where package is to be installed.
4267 if $afs; then
4268 $cat <<EOM
4269
4270 Since you are running AFS, I need to distinguish the directory in which
4271 files will reside from the directory in which they are installed (and from
4272 which they are presumably copied to the former directory by occult means).
4273
4274 EOM
4275         case "$installprefix" in
4276         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4277         *) dflt="$installprefix";;
4278         esac
4279 else
4280 $cat <<EOM
4281
4282 In some special cases, particularly when building $package for distribution,
4283 it is convenient to distinguish the directory in which files should be
4284 installed from the directory ($prefix) in which they will
4285 eventually reside.  For most users, these two directories are the same.
4286
4287 EOM
4288         case "$installprefix" in
4289         '') dflt=$prefix ;;
4290         *) dflt=$installprefix;;
4291         esac
4292 fi
4293 fn=d~
4294 rp='What installation prefix should I use for installing files?'
4295 . ./getfile
4296 installprefix="$ans"
4297 installprefixexp="$ansexp"
4298
4299 : Perform the prefixexp/installprefixexp correction if necessary
4300 cat <<EOS >installprefix
4301 $startsh
4302 EOS
4303 cat <<'EOSC' >>installprefix
4304 : Change installation prefix, if necessary.
4305 if $test X"$prefix" != X"$installprefix"; then
4306     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4307 else
4308     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4309 fi
4310 EOSC
4311 chmod +x installprefix
4312 $eunicefix installprefix
4313
4314 : Set variables such as privlib and privlibexp from the output of ./getfile
4315 : performing the prefixexp/installprefixexp correction if necessary.
4316 cat <<EOS >setprefixvar
4317 $startsh
4318 EOS
4319 cat <<'EOSC' >>setprefixvar
4320 eval "${prefixvar}=\"\$ans\""
4321 eval "${prefixvar}exp=\"\$ansexp\""
4322 . ./installprefix
4323 EOSC
4324 chmod +x setprefixvar
4325 $eunicefix setprefixvar
4326
4327 : set up the script used to warn in case of inconsistency
4328 cat <<EOS >whoa
4329 $startsh
4330 EOS
4331 cat <<'EOSC' >>whoa
4332 dflt=y
4333 case "$hint" in
4334     recommended)
4335         case "$hintfile" in
4336         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4337                 ;;
4338         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4339                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4340                 ;;
4341         esac
4342         ;;
4343     *)  echo " "
4344         echo "*** WHOA THERE!!! ***" >&4
4345         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4346         ;;
4347 esac
4348 rp="    Keep the $hint value?"
4349 . ./myread
4350 case "$ans" in
4351 y) td=$was; tu=$was;;
4352 esac
4353 EOSC
4354
4355 : function used to set '$1' to '$val'
4356 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4357 case "$val$was" in
4358 $define$undef) . ./whoa; eval "$var=\$td";;
4359 $undef$define) . ./whoa; eval "$var=\$tu";;
4360 *) eval "$var=$val";;
4361 esac'
4362
4363 : Do we want threads support and if so, what type
4364 case "$usethreads" in
4365 $define|true|[yY]*)     dflt='y';;
4366 *)     # Catch case where user specified ithreads but
4367        # forgot -Dusethreads (A.D. 4/2002)
4368        case "$useithreads" in
4369        *$define*)       dflt='y';;
4370        *)               dflt='n';;
4371        esac
4372        ;;
4373 esac
4374 cat <<EOM
4375
4376 Perl can be built to offer a form of threading support on some systems
4377 To do so, Configure can be run with -Dusethreads.
4378
4379 Note that Perl built with threading support runs slightly slower
4380 and uses slightly more memory than plain Perl.
4381
4382 If this doesn't make any sense to you, just accept the default '$dflt'.
4383 EOM
4384 rp='Build a threading Perl?'
4385 . ./myread
4386 case "$ans" in
4387 y|Y)    val="$define" ;;
4388 *)      val="$undef" ;;
4389 esac
4390 set usethreads
4391 eval $setvar
4392
4393 useithreads="$usethreads"
4394
4395 case "$d_oldpthreads" in
4396 '')     : Configure tests would be welcome here.  For now, assume undef.
4397         val="$undef" ;;
4398 *)      val="$d_oldpthreads" ;;
4399 esac
4400 set d_oldpthreads
4401 eval $setvar
4402
4403
4404 : Look for a hint-file generated 'call-back-unit'.  If the
4405 : user has specified that a threading perl is to be built,
4406 : we may need to set or change some other defaults.
4407 if $test -f usethreads.cbu; then
4408     echo "Your platform has some specific hints regarding threaded builds, using them..."
4409     . ./usethreads.cbu
4410 else
4411     case "$usethreads" in
4412         "$define"|true|[yY]*)
4413                 $cat <<EOM
4414 (Your platform does not have any specific hints for threaded builds.
4415  Assuming POSIX threads, then.)
4416 EOM
4417         ;;
4418     esac
4419 fi
4420
4421 : Check if multiplicity is required
4422 cat <<EOM
4423
4424 Perl can be built so that multiple Perl interpreters can coexist
4425 within the same Perl executable.
4426 EOM
4427
4428 case "$useithreads" in
4429 $define)
4430         cat <<EOM
4431 This multiple interpreter support is required for interpreter-based threads.
4432 EOM
4433         val="$define"
4434         ;;
4435 *)      case "$usemultiplicity" in
4436         $define|true|[yY]*)     dflt='y';;
4437         *) dflt='n';;
4438         esac
4439         echo " "
4440         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4441         rp='Build Perl for multiplicity?'
4442         . ./myread
4443         case "$ans" in
4444         y|Y)    val="$define" ;;
4445         *)      val="$undef" ;;
4446         esac
4447         ;;
4448 esac
4449 set usemultiplicity
4450 eval $setvar
4451
4452 : Check if morebits is requested
4453 case "$usemorebits" in
4454 "$define"|true|[yY]*)
4455         use64bitint="$define"
4456         uselongdouble="$define"
4457         usemorebits="$define"
4458         ;;
4459 *)      usemorebits="$undef"
4460         ;;
4461 esac
4462
4463 : Determine the C compiler to be used
4464 echo " "
4465 case "$cc" in
4466 '') dflt=cc;;
4467 *) dflt="$cc";;
4468 esac
4469 rp="Use which C compiler?"
4470 . ./myread
4471 cc="$ans"
4472
4473 : See whether they have no cc but they do have gcc
4474 . ./trygcc
4475 if $test -f cc.cbu; then
4476     . ./cc.cbu
4477 fi
4478 . ./checkcc
4479
4480 : make some quick guesses about what we are up against
4481 echo " "
4482 $echo $n "Hmm...  $c"
4483 echo exit 1 >bsd
4484 echo exit 1 >usg
4485 echo exit 1 >v7
4486 echo exit 1 >osf1
4487 echo exit 1 >eunice
4488 echo exit 1 >xenix
4489 echo exit 1 >venix
4490 echo exit 1 >os2
4491 d_bsd="$undef"
4492 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4493 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4494 then
4495         echo "Looks kind of like an OSF/1 system, but we'll see..."
4496         echo exit 0 >osf1
4497 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4498         xxx=`./loc addbib blurfl $pth`
4499         if $test -f $xxx; then
4500         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4501                 echo exit 0 >bsd
4502                 echo exit 0 >usg
4503         else
4504                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4505                         echo "Looks kind of like an extended USG system, but we'll see..."
4506                 else
4507                         echo "Looks kind of like a USG system, but we'll see..."
4508                 fi
4509                 echo exit 0 >usg
4510         fi
4511 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4512         echo "Looks kind of like a BSD system, but we'll see..."
4513         d_bsd="$define"
4514         echo exit 0 >bsd
4515 else
4516         echo "Looks kind of like a Version 7 system, but we'll see..."
4517         echo exit 0 >v7
4518 fi
4519 case "$eunicefix" in
4520 *unixtovms*)
4521         $cat <<'EOI'
4522 There is, however, a strange, musty smell in the air that reminds me of
4523 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4524 EOI
4525         echo exit 0 >eunice
4526         d_eunice="$define"
4527 : it so happens the Eunice I know will not run shell scripts in Unix format
4528         ;;
4529 *)
4530         echo " "
4531         echo "Congratulations.  You aren't running Eunice."
4532         d_eunice="$undef"
4533         ;;
4534 esac
4535 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4536 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4537 : semicolon as a patch separator
4538 case "$p_" in
4539 :) ;;
4540 *)
4541         $cat <<'EOI'
4542 I have the feeling something is not exactly right, however...don't tell me...
4543 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4544 (Or you may be running DOS with DJGPP.)
4545 EOI
4546         echo exit 0 >os2
4547         ;;
4548 esac
4549 if test -f /xenix; then
4550         echo "Actually, this looks more like a XENIX system..."
4551         echo exit 0 >xenix
4552         d_xenix="$define"
4553 else
4554         echo " "
4555         echo "It's not Xenix..."
4556         d_xenix="$undef"
4557 fi
4558 chmod +x xenix
4559 $eunicefix xenix
4560 if test -f /venix; then
4561         echo "Actually, this looks more like a VENIX system..."
4562         echo exit 0 >venix
4563 else
4564         echo " "
4565         if ./xenix; then
4566                 : null
4567         else
4568                 echo "Nor is it Venix..."
4569         fi
4570 fi
4571 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4572 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4573 $rm -f foo
4574
4575 : Check if we are using GNU gcc and what its version is
4576 echo " "
4577 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4578 $cat >try.c <<EOM
4579 #include <stdio.h>
4580 int main() {
4581 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4582 #ifdef __VERSION__
4583         printf("%s\n", __VERSION__);
4584 #else
4585         printf("%s\n", "1");
4586 #endif
4587 #endif
4588         return(0);
4589 }
4590 EOM
4591 if $cc -o try $ccflags $ldflags try.c; then
4592         gccversion=`$run ./try`
4593         case "$gccversion" in
4594         '') echo "You are not using GNU cc." ;;
4595         *)  echo "You are using GNU cc $gccversion."
4596             ccname=gcc
4597             ;;
4598         esac
4599 else
4600         echo " "
4601         echo "*** WHOA THERE!!! ***" >&4
4602         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4603         case "$knowitall" in
4604         '')
4605         echo "    You'd better start hunting for one and let me know about it." >&4
4606                 exit 1
4607                 ;;
4608         esac
4609 fi
4610 $rm -f try try.*
4611 case "$gccversion" in
4612 1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4613 esac
4614 case "$gccversion" in
4615 '') gccosandvers='' ;;
4616 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4617    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4618    gccshortvers=''
4619    case "$gccosandvers" in
4620    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4621    $osname$osvers) ;; # looking good
4622    $osname*) cat <<EOM >&4
4623
4624 *** WHOA THERE!!! ***
4625
4626     Your gcc has not been compiled for the exact release of
4627     your operating system ($gccosandvers versus $osname$osvers).
4628
4629     In general it is a good idea to keep gcc synchronized with
4630     the operating system because otherwise serious problems
4631     may ensue when trying to compile software, like Perl.
4632
4633     I'm trying to be optimistic here, though, and will continue.
4634     If later during the configuration and build icky compilation
4635     problems appear (headerfile conflicts being the most common
4636     manifestation), I suggest reinstalling the gcc to match
4637     your operating system release.
4638
4639 EOM
4640       ;;
4641    *) gccosandvers='' ;; # failed to parse, better be silent
4642    esac
4643    ;;
4644 esac
4645 case "$ccname" in
4646 '') ccname="$cc" ;;
4647 esac
4648
4649 # gcc 3.* complain about adding -Idirectories that they already know about,
4650 # so we will take those off from locincpth.
4651 case "$gccversion" in
4652 3.*)
4653     echo "main(){}">try.c
4654     for incdir in $locincpth; do
4655        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4656              grep '^c[cp]p*[01]: warning: changing search order '`
4657        if test "X$warn" != X; then
4658            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4659        fi
4660     done
4661     $rm -f try try.*
4662 esac
4663
4664 # gcc 4.9 by default does some optimizations that break perl.
4665 # see ticket 121505.
4666 #
4667 # The -fwrapv disables those optimizations (and probably others,) so
4668 # for gcc 4.9 (and later, since the optimizations probably won't go
4669 # away), add -fwrapv unless the user requests -fno-wrapv, which
4670 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4671 # which turns the overflows -fwrapv ignores into runtime errors.
4672 case "$gccversion" in
4673 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4674     case "$ccflags" in
4675     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4676     *) ccflags="$ccflags -fwrapv" ;;
4677     esac
4678 esac
4679
4680 # Really old versions of gcc default to C89 and will error for this code.
4681 # See if the compiler (gcc or otherwise) needs a flag to compile C99 code
4682 # Initialisations in for loops seem to be the particular problem
4683 # (Does this syntax conflict with something else that was valid C89?)
4684 # We also add a declaration after a statement to detect whether the compiler
4685 # (or the user supplied -Accflags) consider such declarations to be errors.
4686 # This causes 'Configure with -Accflags="-Werror=declaration-after-statement"'
4687 # to fail hard and early.
4688 #
4689 # Annoyingly -std=c99 will cause gcc to tell glibc not to define prototypes for
4690 # syscall, drand48 etc when including <unistd.h>, which messes up our build.
4691 # I guess we *could* loop round trying -std=c99 first with checks both for the
4692 # prototype found and the code compiling (because -std=gnu99 might do other
4693 # things we don't want, particularly on non-GCC compilers) but
4694 # 1) We would need to check for the prototype first (without any flags)
4695 # 2) We would still end up with most Linux systems either being -std=gnu99
4696 #    or "" (no flag), and so both common options would not rigorously check our
4697 #    portability to other platforms.
4698 # So it doesn't seem worth the complexity and chance of different failure.
4699 $cat >try.c <<'EOCP'
4700 int main(int argc, char **argv) {
4701     argc = argc + 1;
4702     /* This is deliberately a declaration after a statement. */
4703     unsigned long long count = 0;
4704     for (char **p = argv; *p; ++p) {
4705         ++count;
4706     }
4707     return count == 1 ? 0 : argc;
4708 }
4709 EOCP
4710 c99_for=no
4711 for flag in '' '-std=gnu99' '-std=c99'; do
4712     if $cc -o try $flag $ccflags $ldflags try.c 2>/dev/null && ./try; then
4713         c99_for="$flag"
4714         break;
4715     fi
4716 done
4717 case "$c99_for" in
4718 '') echo "Your C compiler doesn't need any special flags to compile C99 code"
4719     ;;
4720 no) echo >&4 "Your C compiler doesn't seem to be able to compile C99 code"
4721     rp='Do you really want to continue?'
4722     dflt='n'
4723     . ./myread
4724     case "$ans" in
4725         [yY])   echo >&4 "Okay, continuing."    ;;
4726         *)      exit 1                          ;;
4727     esac
4728     ;;
4729 *)  echo "Your C compiler needs $c99_for to compile C99 code"
4730     ccflags="$c99_for $ccflags"
4731     ;;
4732 esac
4733 $rm -f try try.*
4734
4735 : What should the include directory be ?
4736 : Use sysroot if set, so findhdr looks in the right place.
4737 echo " "
4738 $echo $n "Hmm...  $c"
4739 dflt="$sysroot/usr/include"
4740 incpath=''
4741 mips_type=''
4742 if $test -f /bin/mips && /bin/mips; then
4743         echo "Looks like a MIPS system..."
4744         $cat >usr.c <<'EOCP'
4745 #ifdef SYSTYPE_BSD43
4746 /bsd43
4747 #endif
4748 EOCP
4749         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4750                 dflt='/bsd43/usr/include'
4751                 incpath='/bsd43'
4752                 mips_type='BSD 4.3'
4753         else
4754                 mips_type='System V'
4755         fi
4756         $rm -f usr.c usr.out
4757         echo "and you're compiling with the $mips_type compiler and libraries."
4758         xxx_prompt=y
4759         echo "exit 0" >mips
4760 else
4761         echo "Doesn't look like a MIPS system."
4762         xxx_prompt=n
4763         echo "exit 1" >mips
4764 fi
4765 chmod +x mips
4766 $eunicefix mips
4767 case "$usrinc" in
4768 '') ;;
4769 *) dflt="$usrinc";;
4770 esac
4771 case "$xxx_prompt" in
4772 y)      fn=d/
4773         echo " "
4774         rp='Where are the include files you want to use?'
4775         . ./getfile
4776         usrinc="$ans"
4777         ;;
4778 *)      usrinc="$dflt"
4779         ;;
4780 esac
4781
4782 : see how we invoke the C preprocessor
4783 echo " "
4784 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4785 cat <<'EOT' >testcpp.c
4786 #define ABC abc
4787 #define XYZ xyz
4788 ABC.XYZ
4789 EOT
4790 cd ..
4791 if test ! -f cppstdin; then
4792         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4793                 # AIX cc -E doesn't show the absolute headerfile
4794                 # locations but we'll cheat by using the -M flag.
4795                 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
4796         else
4797                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4798         fi
4799 else
4800         echo "Keeping your $hint cppstdin wrapper."
4801 fi
4802 chmod 755 cppstdin
4803 wrapper=`pwd`/cppstdin
4804 ok='false'
4805 cd UU
4806
4807 if $test "X$cppstdin" != "X" && \
4808         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4809         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4810 then
4811         echo "You used to use $cppstdin $cppminus so we'll use that again."
4812         case "$cpprun" in
4813         '') echo "But let's see if we can live without a wrapper..." ;;
4814         *)
4815                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4816                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4817                 then
4818                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4819                         ok='true'
4820                 else
4821                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4822                 fi
4823                 ;;
4824         esac
4825 else
4826         case "$cppstdin" in
4827         '') ;;
4828         *)
4829                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4830                 ;;
4831         esac
4832 fi
4833
4834 if $ok; then
4835         : nothing
4836 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4837         $cc -E <testcpp.c >testcpp.out 2>&1; \
4838         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4839         echo "Yup, it does."
4840         x_cpp="$cc $cppflags -E"
4841         x_minus='';
4842 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4843         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4844         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4845         echo "Yup, it does."
4846         x_cpp="$cc $cppflags -E"
4847         x_minus='-';
4848 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4849         $cc -P <testcpp.c >testcpp.out 2>&1; \
4850         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4851         echo "Yipee, that works!"
4852         x_cpp="$cc $cppflags -P"
4853         x_minus='';
4854 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4855         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4856         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4857         echo "At long last!"
4858         x_cpp="$cc $cppflags -P"
4859         x_minus='-';
4860 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4861         $cpp <testcpp.c >testcpp.out 2>&1; \
4862         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4863         echo "It works!"
4864         x_cpp="$cpp $cppflags"
4865         x_minus='';
4866 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4867         $cpp - <testcpp.c >testcpp.out 2>&1; \
4868         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4869         echo "Hooray, it works!  I was beginning to wonder."
4870         x_cpp="$cpp $cppflags"
4871         x_minus='-';
4872 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4873         $wrapper <testcpp.c >testcpp.out 2>&1; \
4874         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4875         x_cpp="$wrapper"
4876         x_minus=''
4877         echo "Eureka!"
4878 else
4879         dflt=''
4880         rp="No dice.  I can't find a C preprocessor.  Name one:"
4881         . ./myread
4882         x_cpp="$ans"
4883         x_minus=''
4884         $x_cpp <testcpp.c >testcpp.out 2>&1
4885         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4886                 echo "OK, that will do." >&4
4887         else
4888 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4889                 exit 1
4890         fi
4891 fi
4892
4893 case "$ok" in
4894 false)
4895         cppstdin="$x_cpp"
4896         cppminus="$x_minus"
4897         cpprun="$x_cpp"
4898         cpplast="$x_minus"
4899         set X $x_cpp
4900         shift
4901         case "$1" in
4902         "$cpp")
4903                 echo "Perhaps can we force $cc -E using a wrapper..."
4904                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4905                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4906                 then
4907                         echo "Yup, we can."
4908                         cppstdin="$wrapper"
4909                         cppminus='';
4910                 else
4911                         echo "Nope, we'll have to live without it..."
4912                 fi
4913                 ;;
4914         esac
4915         case "$cpprun" in
4916         "$wrapper")
4917                 cpprun=''
4918                 cpplast=''
4919                 ;;
4920         esac
4921         ;;
4922 esac
4923
4924 case "$cppstdin" in
4925 "$wrapper"|'cppstdin') ;;
4926 *) $rm -f $wrapper;;
4927 esac
4928 $rm -f testcpp.c testcpp.out
4929
4930 : Adjust cppfilter for path component separator
4931 case "$osname" in
4932 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4933 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4934 *)   cppfilter='' ;;
4935 esac
4936
4937 : Use gcc to determine libpth and incpth
4938 # If using gcc or clang, we can get better values for libpth, incpth
4939 # and usrinc directly from the compiler.
4940 # Note that ccname for clang is also gcc.
4941 case "$ccname" in
4942     gcc)
4943         realpath=`which realpath 2>/dev/null | sed 's/no realpath in.*//'`
4944         $echo 'extern int foo;' > try.c
4945         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4946         shift
4947         inclibpth=""
4948         if $test $# -gt 0; then
4949             for i in $*; do
4950                 case $realpath in
4951                     */realpath) i=`$realpath $i` ;;
4952                 esac
4953                 incpth="$incpth $i"
4954                 j="`$echo $i | $sed 's,/include[^/]*,/lib,'`"
4955                 if $test -d $j; then
4956                     inclibpth="$inclibpth $j"
4957                 fi
4958             done
4959             incpth="`$echo $incpth | $sed 's/^ //'`"
4960             for xxx in $inclibpth $loclibpth $plibpth $glibpth; do
4961                 if $test -d $xxx; then
4962                     case $realpath in
4963                         */realpath) xxx=`$realpath $xxx` ;;
4964                     esac
4965                     case " $libpth " in
4966                     *" $xxx "*) ;;
4967                     *) libpth="$libpth $xxx";;
4968                     esac
4969                 fi
4970             done
4971             libpth="`$echo $libpth | $sed 's/^ //'`"
4972         fi
4973         $rm -f try.c
4974         case "$usrinc" in
4975         '') for i in $incpth; do
4976                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4977                     usrinc="$i"
4978                     break
4979                 fi
4980             done
4981             ;;
4982         esac
4983
4984         case "$usecrosscompile" in
4985         $define|true|[yY]*)
4986             case "$incpth" in
4987                 '') echo "Incpth not defined." >&4; croak=y ;;
4988                 *)  echo "Using incpth '$incpth'." >&4 ;;
4989             esac
4990             case "$libpth" in
4991                 '') echo "Libpth not defined." >&4; croak=y ;;
4992                 *)  echo "Using libpth '$libpth'." >&4 ;;
4993             esac
4994             case "$usrinc" in
4995                 '') echo "Usrinc not defined." >&4; croak=y ;;
4996                 *)  echo "Using usrinc $usrinc." >&4 ;;
4997             esac
4998             case "$croak" in
4999                 y)
5000                 if test "X$sysroot" = X; then
5001                     echo "Cannot continue, aborting." >&4; exit 1
5002                 else
5003                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5004                 fi
5005                 ;;
5006             esac
5007             ;;
5008         esac
5009     ;;
5010 esac
5011
5012 : Default value for incpth is just usrinc
5013 case "$incpth" in
5014 '') incpth="$usrinc";;
5015 esac
5016
5017 : Set private lib path
5018 case "$plibpth" in
5019 '') if ./mips; then
5020         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5021     fi;;
5022 esac
5023 case "$libpth" in
5024 ' ') dlist='';;
5025 '') dlist="$loclibpth $plibpth $glibpth";;
5026 *) dlist="$libpth";;
5027 esac
5028
5029 : Now check and see which directories actually exist, avoiding duplicates
5030 for xxx in $dlist
5031 do
5032     if $test -d $xxx; then
5033                 case " $libpth " in
5034                 *" $xxx "*) ;;
5035                 *) libpth="$libpth $xxx";;
5036                 esac
5037     fi
5038 done
5039 $cat <<'EOM'
5040
5041 Some systems have incompatible or broken versions of libraries.  Among
5042 the directories listed in the question below, please remove any you
5043 know not to be holding relevant libraries, and add any that are needed.
5044 Say "none" for none.
5045
5046 EOM
5047
5048 if test "X$sysroot" != X; then
5049     $cat <<EOM
5050 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5051
5052 EOM
5053 fi
5054
5055 case "$libpth" in
5056 '') dflt='none';;
5057 *)
5058         set X $libpth
5059         shift
5060         dflt=${1+"$@"}
5061         ;;
5062 esac
5063 rp="Directories to use for library searches?"
5064 . ./myread
5065 case "$ans" in
5066 none) libpth=' ';;
5067 *) libpth="$ans";;
5068 esac
5069
5070 : compute shared library extension
5071 case "$so" in
5072 '')
5073         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5074                 dflt='sl'
5075         else
5076                 dflt='so'
5077         fi
5078         ;;
5079 *) dflt="$so";;
5080 esac
5081 $cat <<EOM
5082
5083 On some systems, shared libraries may be available.  Answer 'none' if
5084 you want to suppress searching of shared libraries for the remainder
5085 of this configuration.
5086
5087 EOM
5088 rp='What is the file extension used for shared libraries?'
5089 . ./myread
5090 so="$ans"
5091
5092 : Does target system insist that shared library basenames are unique
5093 $cat << EOM
5094
5095 Some dynamic loaders assume that the *basename* of shared library filenames
5096 are globally unique.  We'll default this to undef as we assume your system
5097 is not this weird. Set to defined if you're on one of them.
5098
5099 EOM
5100
5101 dflt='n'
5102 rp='Make shared library basenames unique?'
5103 . ./myread
5104 case "$ans" in
5105 y|Y) val="$define" ;;
5106 *)   val="$undef"  ;;
5107 esac
5108 set d_libname_unique
5109 eval $setvar
5110
5111 : Define several unixisms.
5112 : Hints files or command line option can be used to override them.
5113 : The convoluted testing is in case hints files set either the old
5114 : or the new name.
5115 case "$_exe" in
5116 '')     case "$exe_ext" in
5117         '')     ;;
5118         *)      _exe="$exe_ext" ;;
5119         esac
5120         ;;
5121 esac
5122 case "$_a" in
5123 '')     case "$lib_ext" in
5124     '') _a='.a';;
5125         *)      _a="$lib_ext" ;;
5126         esac
5127         ;;
5128 esac
5129 case "$_o" in
5130 '') case "$obj_ext" in
5131         '')     _o='.o';;
5132         *)      _o="$obj_ext";;
5133         esac
5134         ;;
5135 esac
5136 case "$p_" in
5137 '') case "$path_sep" in
5138         '')     p_=':';;
5139         *)      p_="$path_sep";;
5140         esac
5141         ;;
5142 esac
5143 exe_ext=$_exe
5144 lib_ext=$_a
5145 obj_ext=$_o
5146 path_sep=$p_
5147
5148 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5149
5150 : Which makefile gets called first.  This is used by make depend.
5151 case "$firstmakefile" in
5152 '') firstmakefile='makefile';;
5153 esac
5154
5155 : Check is we will use socks
5156 case "$usesocks" in
5157 $define|true|[yY]*)     dflt='y';;
5158 *) dflt='n';;
5159 esac
5160 cat <<EOM
5161
5162 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5163 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5164 to use the PerlIO abstraction layer, this will be implicitly selected.
5165
5166 If this doesn't make any sense to you, just accept the default '$dflt'.
5167 EOM
5168 rp='Build Perl for SOCKS?'
5169 . ./myread
5170 case "$ans" in
5171 y|Y)    val="$define" ;;
5172 *)      val="$undef" ;;
5173 esac
5174 set usesocks
5175 eval $setvar
5176
5177 : Check for uselongdouble support
5178 case "$ccflags" in
5179 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5180 esac
5181
5182 case "$uselongdouble" in
5183 $define|true|[yY]*)     dflt='y';;
5184 *) dflt='n';;
5185 esac
5186 cat <<EOM
5187
5188 Perl can be built to take advantage of long doubles which
5189 (if available) may give more accuracy and range for floating point numbers.
5190
5191 If this doesn't make any sense to you, just accept the default '$dflt'.
5192 EOM
5193 rp='Try to use long doubles if available?'
5194 . ./myread
5195 case "$ans" in
5196 y|Y)    val="$define"   ;;
5197 *)      val="$undef"    ;;
5198 esac
5199 set uselongdouble
5200 eval $setvar
5201
5202 case "$uselongdouble" in
5203 true|[yY]*) uselongdouble="$define" ;;
5204 esac
5205
5206 : Look for a hint-file generated 'call-back-unit'.  If the
5207 : user has specified that long doubles should be used,
5208 : we may need to set or change some other defaults.
5209 if $test -f uselongdouble.cbu; then
5210     echo "Your platform has some specific hints regarding long doubles, using them..."
5211     . ./uselongdouble.cbu
5212 else
5213     case "$uselongdouble" in
5214         $define)
5215                 $cat <<EOM
5216 (Your platform does not have any specific hints for long doubles.)
5217 EOM
5218         ;;
5219     esac
5220 fi
5221
5222 : Check if quadmath is requested
5223 case "$usequadmath" in
5224 "$define"|true|[yY]*) usequadmath="$define" ;;
5225 *)                    usequadmath="$undef"  ;;
5226 esac
5227
5228 : Fail if both uselongdouble and usequadmath are requested
5229 case "$usequadmath:$uselongdouble" in
5230 define:define)
5231         $cat <<EOM >&4
5232
5233 *** You requested the use of the quadmath library and use
5234 *** of long doubles.
5235 ***
5236 *** Please select one or the other.
5237 EOM
5238         exit 1
5239         ;;
5240 esac
5241
5242 : Looking for optional libraries
5243 echo " "
5244 echo "Checking for optional libraries..." >&4
5245 case "$libs" in
5246 ' '|'') dflt='';;
5247 *) dflt="$libs";;
5248 esac
5249 case "$libswanted" in
5250 '') libswanted='c_s';;
5251 esac
5252 case "$usesocks" in
5253 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5254 esac
5255 case "$usecbacktrace" in
5256 "$define") libswanted="$libswanted bfd" ;;
5257 esac
5258 case "$usequadmath" in
5259 "$define") libswanted="$libswanted quadmath" ;;
5260 esac
5261 libsfound=''
5262 libsfiles=''
5263 libsdirs=''
5264 libspath=''
5265 for thisdir in $libpth $xlibpth; do
5266   test -d $thisdir && libspath="$libspath $thisdir"
5267 done
5268 for thislib in $libswanted; do
5269         for thisdir in $libspath; do
5270             xxx=''
5271             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5272                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5273                 $test -f "$xxx" && eval $libscheck
5274                 $test -f "$xxx" && libstyle=shared
5275                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5276                 $test -f "$xxx" && eval $libscheck
5277                 $test -f "$xxx" && libstyle=shared
5278             fi
5279             if test ! -f "$xxx"; then
5280                 xxx=$thisdir/lib$thislib.$so$_a
5281                 $test -f "$xxx" && eval $libscheck
5282                 $test -f "$xxx" && libstyle="import"
5283             fi
5284             if test ! -f "$xxx"; then
5285                 xxx=$thisdir/$thislib.$so$_a
5286                 $test -f "$xxx" && eval $libscheck
5287                 $test -f "$xxx" && libstyle="import"
5288             fi
5289             if test ! -f "$xxx"; then
5290                 xxx=$thisdir/lib$thislib.$so
5291                 $test -f "$xxx" && eval $libscheck
5292                 $test -f "$xxx" && libstyle=shared
5293             fi
5294             if test ! -f "$xxx"; then
5295                 xxx=$thisdir/lib$thislib$_a
5296                 $test -f "$xxx" && eval $libscheck
5297                 $test -f "$xxx" && libstyle=static
5298             fi
5299             if test ! -f "$xxx"; then
5300                 xxx=$thisdir/$thislib$_a
5301                 $test -f "$xxx" && eval $libscheck
5302                 $test -f "$xxx" && libstyle=static
5303             fi
5304             if test ! -f "$xxx"; then
5305                 xxx=$thisdir/lib${thislib}_s$_a
5306                 $test -f "$xxx" && eval $libscheck
5307                 $test -f "$xxx" && libstyle=static
5308                 $test -f "$xxx" && thislib=${thislib}_s
5309             fi
5310             if test ! -f "$xxx"; then
5311                 xxx=$thisdir/Slib$thislib$_a
5312                 $test -f "$xxx" && eval $libscheck
5313                 $test -f "$xxx" && libstyle=static
5314             fi
5315             if $test -f "$xxx"; then
5316                 case "$libstyle" in
5317                 shared) echo "Found -l$thislib (shared)." ;;
5318                 static) echo "Found -l$thislib." ;;
5319                 *)      echo "Found -l$thislib ($libstyle)." ;;
5320                 esac
5321                 case " $dflt " in
5322                 *"-l$thislib "*);;
5323                 *) dflt="$dflt -l$thislib"
5324                    libsfound="$libsfound $xxx"
5325                    yyy=`basename $xxx`
5326                    libsfiles="$libsfiles $yyy"
5327                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5328                    case " $libsdirs " in
5329                    *" $yyy "*) ;;
5330                    *) libsdirs="$libsdirs $yyy" ;;
5331                    esac
5332                    ;;
5333                 esac
5334                 break
5335             fi
5336         done
5337         if $test ! -f "$xxx"; then
5338             echo "No -l$thislib."
5339         fi
5340 done
5341 set X $dflt
5342 shift
5343 dflt="$*"
5344 case "$libs" in
5345 '') dflt="$dflt";;
5346 *) dflt="$libs";;
5347 esac
5348 case "$dflt" in
5349 ' '|'') dflt='none';;
5350 esac
5351
5352 $cat <<EOM
5353
5354 In order to compile $package on your machine, a number of libraries
5355 are usually needed.  Include any other special libraries here as well.
5356 Say "none" for none.  The default list is almost always right.
5357 EOM
5358
5359 echo " "
5360 rp="What libraries to use?"
5361 . ./myread
5362 case "$ans" in
5363 none) libs=' ';;
5364 *) libs="$ans";;
5365 esac
5366
5367 : determine optimization, if desired, or use for debug flag also
5368 case "$optimize" in
5369 ' '|$undef) dflt='none';;
5370 '') dflt='-O';;
5371 *) dflt="$optimize";;
5372 esac
5373 $cat <<EOH
5374
5375 By default, $package compiles with the -O flag to use the optimizer.
5376 Alternately, you might want to use the symbolic debugger, which uses
5377 the -g flag (on traditional Unix systems).  Either flag can be
5378 specified here.  To use neither flag, specify the word "none".
5379
5380 EOH
5381 rp="What optimizer/debugger flag should be used?"
5382 . ./myread
5383 optimize="$ans"
5384 case "$optimize" in
5385 'none') optimize=" ";;
5386 esac
5387
5388 : Check what DEBUGGING is required from the command line
5389 : -DEBUGGING      or -DDEBUGGING or
5390 : -DEBUGGING=both                       = -g + -DDEBUGGING
5391 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5392 : -DEBUGGING=none or -UDEBUGGING        =
5393 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5394 case "$EBUGGING" in
5395 '')     ;;
5396 *)      DEBUGGING=$EBUGGING ;;
5397 esac
5398
5399 case "$DEBUGGING" in
5400 -g|both|$define)
5401     case "$optimize" in
5402         *-g*) ;;
5403         *)    optimize="$optimize -g" ;;
5404     esac ;;
5405 none|$undef)
5406     case "$optimize" in
5407         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5408                 shift
5409                 optimize="$*"
5410                 ;;
5411     esac ;;
5412 esac
5413
5414 dflt=''
5415 case "$DEBUGGING" in
5416 both|$define) dflt='-DDEBUGGING'
5417 esac
5418
5419 : argument order is deliberate, as the flag will start with - which set could
5420 : think is an option
5421 checkccflag='check=$1; flag=$2; callback=$3;
5422 echo " ";
5423 echo "Checking if your compiler accepts $flag" >&4;
5424 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5425 echo "int main(void) { return 0; }" > gcctest.c;
5426 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5427     echo "Yes, it does." >&4;
5428     if $test -s gcctest.out ; then
5429         echo "But your platform does not like it:";
5430         cat gcctest.out;
5431     else
5432         case "$ccflags" in
5433         *$check*)
5434             echo "Leaving current flags $ccflags alone." >&4
5435             ;;
5436         *) dflt="$dflt $flag";
5437             eval $callback
5438             ;;
5439         esac
5440     fi
5441 else
5442     echo "Nope, it does not, but that is ok." >&4;
5443 fi
5444 '
5445
5446 : We will not override a previous value, but we might want to
5447 : augment a hint file
5448 case "$hint" in
5449 default|recommended)
5450         case "$gccversion" in
5451         1.*) dflt="$dflt -fpcc-struct-return" ;;
5452         esac
5453         case "$optimize:$DEBUGGING" in
5454         *-g*:old) dflt="$dflt -DDEBUGGING";;
5455         esac
5456         case "$gccversion" in
5457         2.*) if $test -d /etc/conf/kconfig.d &&
5458                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5459                 then
5460                         # Interactive Systems (ISC) POSIX mode.
5461                         dflt="$dflt -posix"
5462                 fi
5463                 ;;
5464         esac
5465         case "$gccversion" in
5466         1.*) ;;
5467         2.[0-8]*) ;;
5468         ?*)     set strict-aliasing -fno-strict-aliasing
5469                 eval $checkccflag
5470                 ;;
5471         esac
5472         # For gcc, adding -pipe speeds up compilations for some, but apparently
5473         # some assemblers can't read from stdin.  (It also slows down compilations
5474         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5475         case "$gccversion" in
5476         ?*)     set pipe -pipe
5477                 eval $checkccflag
5478                 ;;
5479         esac
5480
5481         # on x86_64 (at least) we require an extra library (libssp) in the
5482         # link command line. This library is not named, so I infer that it is
5483         # an implementation detail that may change. Hence the safest approach
5484         # is to add the flag to the flags passed to the compiler at link time,
5485         # as that way the compiler can do the right implementation dependant
5486         # thing. (NWC)
5487         case "$ccflags" in
5488         *-fno-stack-protector*)
5489             echo "Do not add -fstack-protector nor -fstack-protector-strong" 2>&1
5490             ;;
5491         *) case "$gccversion" in
5492            ?*)  set stack-protector-strong -fstack-protector-strong
5493                 eval $checkccflag
5494                 case "$dflt" in
5495                 *-fstack-protector-strong*) ;; # It got added.
5496                 *) # Try the plain/older -fstack-protector.
5497                    set stack-protector -fstack-protector
5498                    eval $checkccflag
5499                    ;;
5500                 esac
5501                 ;;
5502             esac
5503             ;;
5504         esac
5505 esac
5506
5507 case "$mips_type" in
5508 *BSD*|'') inclwanted="$locincpth $usrinc";;
5509 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5510 esac
5511 for thisincl in $inclwanted; do
5512         if $test -d $thisincl; then
5513                 if $test x$thisincl != x$usrinc; then
5514                         case "$dflt" in
5515                         *" -I$thisincl "*);;
5516                         *) dflt="$dflt -I$thisincl ";;
5517                         esac
5518                 fi
5519         fi
5520 done
5521
5522 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5523         xxx=true;
5524 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5525         xxx=true;
5526 else
5527         xxx=false;
5528 fi;
5529 if $xxx; then
5530         case "$dflt" in
5531         *$2*);;
5532         *) dflt="$dflt -D$2";;
5533         esac;
5534 fi'
5535
5536 set signal.h LANGUAGE_C; eval $inctest
5537
5538 case "$usesocks" in
5539 $define)
5540         ccflags="$ccflags -DSOCKS"
5541         ;;
5542 esac
5543
5544 case "$hint" in
5545 default|recommended) dflt="$ccflags $dflt" ;;
5546 *) dflt="$ccflags";;
5547 esac
5548
5549 case "$dflt" in
5550 ''|' ') dflt=none;;
5551 esac
5552
5553 $cat <<EOH
5554
5555 Your C compiler may want other flags.  For this question you should include
5556 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5557 but you should NOT include libraries or ld flags like -lwhatever.  If you
5558 want $package to honor its debug switch, you should include -DDEBUGGING here.
5559 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5560
5561 To use no flags, specify the word "none".
5562
5563 EOH
5564 set X $dflt
5565 shift
5566 dflt=${1+"$@"}
5567 rp="Any additional cc flags?"
5568 . ./myread
5569 case "$ans" in
5570 none) ccflags='';;
5571 *) ccflags="$ans";;
5572 esac
5573
5574 : the following weeds options from ccflags that are of no interest to cpp
5575 case "$cppflags" in
5576 '') cppflags="$ccflags" ;;
5577 *)  set X $ccflags; shift
5578     case " $cppflags " in
5579     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5580     *) cppflags="$cppflags $ccflags" ;;
5581     esac
5582     ;;
5583 esac
5584 case "$gccversion" in
5585 1.*) cppflags="$cppflags -D__GNUC__"
5586 esac
5587 case "$mips_type" in
5588 '');;
5589 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5590 esac
5591 case "$cppflags" in
5592 '');;
5593 *)
5594         echo " "
5595         echo "Let me guess what the preprocessor flags are..." >&4
5596         set X $cppflags
5597         shift
5598         cppflags=''
5599         $cat >cpp.c <<'EOM'
5600 #define BLURFL foo
5601
5602 BLURFL xx LFRULB
5603 EOM
5604         previous=''
5605         for flag in $*
5606         do
5607                 case "$flag" in
5608                 -*) ftry="$flag";;
5609                 *) ftry="$previous $flag";;
5610                 esac
5611                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5612                         >cpp1.out 2>/dev/null && \
5613                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5614                         >cpp2.out 2>/dev/null && \
5615                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5616                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5617                 then
5618                         cppflags="$cppflags $ftry"
5619                         previous=''
5620                 else
5621                         previous="$flag"
5622                 fi
5623         done
5624         set X $cppflags
5625         shift
5626         cppflags=${1+"$@"}
5627         case "$cppflags" in
5628         *-*)  echo "They appear to be: $cppflags";;
5629         esac
5630         $rm -f cpp.c cpp?.out
5631         ;;
5632 esac
5633
5634 : flags used in final linking phase
5635 case "$ldflags" in
5636 '') if ./venix; then
5637                 dflt='-i -z'
5638         else
5639                 dflt=''
5640         fi
5641         case "$ccflags" in
5642         *-posix*) dflt="$dflt -posix" ;;
5643         esac
5644         ;;
5645 *) dflt="$ldflags";;
5646 esac
5647 # See note above about -fstack-protector
5648 case "$ccflags" in
5649 *-fstack-protector-strong*)
5650         case "$dflt" in
5651         *-fstack-protector-strong*) ;; # Don't add it again
5652         *) dflt="$dflt -fstack-protector-strong" ;;
5653         esac
5654         ;;
5655 *-fstack-protector*)
5656         case "$dflt" in
5657         *-fstack-protector*) ;; # Don't add it again
5658         *) dflt="$dflt -fstack-protector" ;;
5659         esac
5660         ;;
5661 esac
5662
5663 : Try to guess additional flags to pick up local libraries.
5664 for thislibdir in $libpth; do
5665         case " $loclibpth " in
5666         *" $thislibdir "*)
5667                 case "$dflt " in
5668                 *"-L$thislibdir "*) ;;
5669                 *)  dflt="$dflt -L$thislibdir" ;;
5670                 esac
5671                 ;;
5672         esac
5673 done
5674
5675 case "$dflt" in
5676 '') dflt='none' ;;
5677 esac
5678
5679 $cat <<EOH
5680
5681 Your C linker may need flags.  For this question you should
5682 include -L/whatever and any other flags used by the C linker, but you
5683 should NOT include libraries like -lwhatever.
5684
5685 Make sure you include the appropriate -L/path flags if your C linker
5686 does not normally search all of the directories you specified above,
5687 namely
5688         $libpth
5689 To use no flags, specify the word "none".
5690
5691 EOH
5692
5693 rp="Any additional ld flags (NOT including libraries)?"
5694 . ./myread
5695 case "$ans" in
5696 none) ldflags='';;
5697 *) ldflags="$ans";;
5698 esac
5699 rmlist="$rmlist pdp11"
5700
5701 : coherency check
5702 echo " "
5703 echo "Checking your choice of C compiler and flags for coherency..." >&4
5704 $cat > try.c <<'EOF'
5705 #include <stdio.h>
5706 int main() { printf("Ok\n"); return(0); }
5707 EOF
5708 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5709 shift
5710 $cat >try.msg <<'EOM'
5711 I've tried to compile and run the following simple program:
5712
5713 EOM
5714 $cat try.c >> try.msg
5715
5716 $cat >> try.msg <<EOM
5717
5718 I used the command:
5719
5720         $*
5721         $run ./try
5722
5723 and I got the following output:
5724
5725 EOM
5726 dflt=y
5727 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5728         if $sh -c "$run ./try " >>try.msg 2>&1; then
5729                 xxx=`$run ./try`
5730                 case "$xxx" in
5731                 "Ok") dflt=n ;;
5732                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5733                 esac
5734         else
5735                 echo "The program compiled OK, but exited with status $?." >>try.msg
5736                 rp="You have a problem.  Shall I abort Configure"
5737                 dflt=y
5738         fi
5739 else
5740         echo "I can't compile the test program." >>try.msg
5741         rp="You have a BIG problem.  Shall I abort Configure"
5742         dflt=y
5743 fi
5744 case "$dflt" in
5745 y)
5746         $cat try.msg >&4
5747         case "$knowitall" in
5748         '')
5749                 echo "(The supplied flags or libraries might be incorrect.)"
5750                 ;;
5751         *) dflt=n;;
5752         esac
5753         echo " "
5754         . ./myread
5755         case "$ans" in
5756         n*|N*) ;;
5757         *)      echo "Ok.  Stopping Configure." >&4
5758                 exit 1
5759                 ;;
5760         esac
5761         ;;
5762 n) echo "OK, that should do.";;
5763 esac
5764 $rm_try gcctest gcctest.out
5765
5766 : define a shorthand compile call
5767 compile='
5768 mc_file=$1;
5769 shift;
5770 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5771 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4;
5772 exit 1;
5773 fi;
5774 esac;
5775 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5776 : define a shorthand compile call for compilations that should be ok.
5777 compile_ok='
5778 mc_file=$1;
5779 shift;
5780 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5781
5782 : stub, used only to satisfy other units
5783 i_stdlib='define'
5784
5785 : check for lengths of integral types
5786 echo " "
5787 case "$intsize" in
5788 '')
5789         echo "Checking to see how big your integers are..." >&4
5790         $cat >try.c <<EOCP
5791 #include <stdio.h>
5792 #$i_stdlib I_STDLIB
5793 #ifdef I_STDLIB
5794 #include <stdlib.h>
5795 #endif
5796 int main()
5797 {
5798         printf("intsize=%d;\n", (int)sizeof(int));
5799         printf("longsize=%d;\n", (int)sizeof(long));
5800         printf("shortsize=%d;\n", (int)sizeof(short));
5801         exit(0);
5802 }
5803 EOCP
5804         set try
5805         if eval $compile_ok && $run ./try > /dev/null; then
5806                 eval `$run ./try`
5807                 echo "Your integers are $intsize bytes long."
5808                 echo "Your long integers are $longsize bytes long."
5809                 echo "Your short integers are $shortsize bytes long."
5810         else
5811                 $cat >&4 <<EOM
5812 !
5813 Help! I can't compile and run the intsize test program: please enlighten me!
5814 (This is probably a misconfiguration in your system or libraries, and
5815 you really ought to fix it.  Still, I'll try anyway.)
5816 !
5817 EOM
5818                 dflt=4
5819                 rp="What is the size of an integer (in bytes)?"
5820                 . ./myread
5821                 intsize="$ans"
5822                 dflt=$intsize
5823                 rp="What is the size of a long integer (in bytes)?"
5824                 . ./myread
5825                 longsize="$ans"
5826                 dflt=2
5827                 rp="What is the size of a short integer (in bytes)?"
5828                 . ./myread
5829                 shortsize="$ans"
5830         fi
5831         ;;
5832 esac
5833 $rm_try
5834
5835 : check for long long
5836 echo " "
5837 echo "Checking to see if you have long long..." >&4
5838 echo 'int main() { long long x = 7; return 0; }' > try.c
5839 set try
5840 if eval $compile; then
5841         val="$define"
5842         echo "You have long long."
5843 else
5844         val="$undef"
5845         echo "You do not have long long."
5846 fi
5847 $rm_try
5848 set d_longlong
5849 eval $setvar
5850
5851 : check for length of long long
5852 case "${d_longlong}${longlongsize}" in
5853 $define)
5854         echo " "
5855         echo "Checking to see how big your long longs are..." >&4
5856         $cat >try.c <<'EOCP'
5857 #include <stdio.h>
5858 int main()
5859 {
5860     printf("%d\n", (int)sizeof(long long));
5861     return(0);
5862 }
5863 EOCP
5864         set try
5865         if eval $compile_ok; then
5866                 longlongsize=`$run ./try`
5867                 echo "Your long longs are $longlongsize bytes long."
5868         else
5869                 dflt='8'
5870                 echo " "
5871                 echo "(I can't seem to compile the test program.  Guessing...)"
5872                 rp="What is the size of a long long (in bytes)?"
5873                 . ./myread
5874                 longlongsize="$ans"
5875         fi
5876         if $test "X$longsize" = "X$longlongsize"; then
5877                 echo "(That isn't any different from an ordinary long.)"
5878         fi
5879         ;;
5880 esac
5881 $rm_try
5882
5883 : determine filename position in cpp output
5884 echo " "
5885 echo "Computing filename position in cpp output for #include directives..." >&4
5886 case "$osname" in
5887 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5888 esac
5889 case "$fieldn" in
5890 '')
5891 case "$osname" in
5892 vos) testaccess=-e ;;
5893 *)   testaccess=-r ;;
5894 esac
5895 echo '#include <stdio.h>' > foo.c
5896 $cat >fieldn <<EOF
5897 $startsh
5898 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5899 $grep '^[       ]*#.*stdio\.h' | \
5900 while read cline; do
5901         pos=1
5902         set \$cline
5903         while $test \$# -gt 0; do
5904                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5905                         echo "\$pos"
5906                         exit 0
5907                 fi
5908                 shift
5909                 pos=\`expr \$pos + 1\`
5910         done
5911 done
5912 EOF
5913 chmod +x fieldn
5914 fieldn=`./fieldn`
5915 $rm -f foo.c fieldn
5916 ;;
5917 esac
5918 case $fieldn in
5919 '') pos='???';;
5920 1) pos=first;;
5921 2) pos=second;;
5922 3) pos=third;;
5923 *) pos="${fieldn}th";;
5924 esac
5925 echo "Your cpp writes the filename in the $pos field of the line."
5926
5927 : locate header file
5928 $cat >findhdr <<EOF
5929 $startsh
5930 wanted=\$1
5931 name=''
5932 for usrincdir in $incpth
5933 do
5934         if test -f \$usrincdir/\$wanted; then
5935                 echo "\$usrincdir/\$wanted"
5936                 exit 0
5937         fi
5938 done
5939 awkprg='{ print \$$fieldn }'
5940 echo "#include <\$wanted>" > foo\$\$.c
5941 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5942 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5943 while read cline; do
5944         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5945         case "\$name" in
5946         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5947         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5948         *) exit 2;;
5949         esac;
5950 done;
5951 #
5952 # status = 0: grep returned 0 lines, case statement not executed
5953 # status = 1: headerfile found
5954 # status = 2: while loop executed, no headerfile found
5955 #
5956 status=\$?
5957 $rm -f foo\$\$.c;
5958 if test \$status -eq 1; then
5959         exit 0;
5960 fi
5961 exit 1
5962 EOF
5963 chmod +x findhdr
5964
5965 : define an alternate in-header-list? function
5966 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5967 cont=true; xxf="echo \"<\$1> found.\" >&4";
5968 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5969 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5970 esac;
5971 case $# in 4) instead=instead;; *) instead="at last";; esac;
5972 while $test "$cont"; do
5973         xxx=`./findhdr $1`
5974         var=$2; eval "was=\$$2";
5975         if $test "$xxx" && $test -r "$xxx";
5976         then eval $xxf;
5977         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5978                 cont="";
5979         else eval $xxnf;
5980         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5981         set $yyy; shift; shift; yyy=$@;
5982         case $# in 0) cont="";;
5983         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5984                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5985         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5986                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5987         esac;
5988 done;
5989 while $test "$yyy";
5990 do set $yyy; var=$2; eval "was=\$$2";
5991         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5992         set $yyy; shift; shift; yyy=$@;
5993 done'
5994
5995 : see if inttypes.h is available
5996 : we want a real compile instead of Inhdr because some systems
5997 : have an inttypes.h which includes non-existent headers
5998 echo " "
5999 $cat >try.c <<EOCP
6000 #include <inttypes.h>
6001 int main() {
6002         static int32_t foo32 = 0x12345678;
6003 }
6004 EOCP
6005 set try
6006 if eval $compile; then
6007         echo "<inttypes.h> found." >&4
6008         val="$define"
6009 else
6010         echo "<inttypes.h> NOT found." >&4
6011         val="$undef"
6012 fi
6013 $rm_try
6014 set i_inttypes
6015 eval $setvar
6016
6017 : check for int64_t
6018 echo " "
6019 echo "Checking to see if you have int64_t..." >&4
6020 $cat >try.c <<EOCP
6021 #include <sys/types.h>
6022 #$i_inttypes I_INTTYPES
6023 #ifdef I_INTTYPES
6024 #include <inttypes.h>
6025 #endif
6026 int main() { int64_t x = 7; }
6027 EOCP
6028 set try
6029 if eval $compile; then
6030         val="$define"
6031         echo "You have int64_t."
6032 else
6033         val="$undef"
6034         echo "You do not have int64_t."
6035 fi
6036 $rm_try
6037 set d_int64_t
6038 eval $setvar
6039
6040 : Check if 64bit ints have a quad type
6041 echo " "
6042 echo "Checking which 64-bit integer type we could use..." >&4
6043
6044 case "$intsize" in
6045 8) val=int
6046    set quadtype
6047    eval $setvar
6048    val='"unsigned int"'
6049    set uquadtype
6050    eval $setvar
6051    quadkind=1
6052    ;;
6053 *) case "$longsize" in
6054    8) val=long
6055       set quadtype
6056       eval $setvar
6057       val='"unsigned long"'
6058       set uquadtype
6059       eval $setvar
6060       quadkind=2
6061       ;;
6062    *) case "$d_longlong:$longlongsize" in
6063       define:8)
6064         val='"long long"'
6065         set quadtype
6066         eval $setvar
6067         val='"unsigned long long"'
6068         set uquadtype
6069         eval $setvar
6070         quadkind=3
6071         ;;
6072       *) case "$d_int64_t" in
6073          define)
6074            val=int64_t
6075            set quadtype
6076            eval $setvar
6077            val=uint64_t
6078            set uquadtype
6079            eval $setvar
6080            quadkind=4
6081            ;;
6082          esac
6083          ;;
6084       esac
6085       ;;
6086    esac
6087    ;;
6088 esac
6089
6090 case "$quadtype" in
6091 '')     echo "Alas, no 64-bit integer types in sight." >&4
6092         d_quad="$undef"
6093         ;;
6094 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6095         d_quad="$define"
6096         ;;
6097 esac
6098
6099 : Do we want 64bit support
6100 case "$uselonglong" in
6101 "$define"|true|[yY]*)
6102         cat <<EOM >&4
6103
6104 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6105 EOM
6106         use64bitint="$define"
6107         ;;
6108 esac
6109 case "$use64bits" in
6110 "$define"|true|[yY]*)
6111         cat <<EOM >&4
6112
6113 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6114 EOM
6115         use64bitint="$define"
6116         ;;
6117 esac
6118 case "$use64bitints" in
6119 "$define"|true|[yY]*)
6120         cat <<EOM >&4
6121
6122 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6123 EOM
6124         use64bitint="$define"
6125         ;;
6126 esac
6127 case "$use64bitsint" in
6128 "$define"|true|[yY]*)
6129         cat <<EOM >&4
6130
6131 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6132 EOM
6133         use64bitint="$define"
6134         ;;
6135 esac
6136 case "$uselonglongs" in
6137 "$define"|true|[yY]*)
6138         cat <<EOM >&4
6139
6140 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6141 EOM
6142         use64bitint="$define"
6143         ;;
6144 esac
6145 case "$use64bitsall" in
6146 "$define"|true|[yY]*)
6147         cat <<EOM >&4
6148
6149 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6150 EOM
6151         use64bitall="$define"
6152         ;;
6153 esac
6154
6155 case "$ccflags" in
6156 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6157 esac
6158 case "$use64bitall" in
6159 "$define"|true|[yY]*) use64bitint="$define" ;;
6160 esac
6161
6162 case "$longsize" in
6163 8) cat <<EOM
6164
6165 You have natively 64-bit long integers.
6166 EOM
6167    val="$define"
6168    ;;
6169 *) case "$use64bitint" in
6170    "$define"|true|[yY]*) dflt='y';;
6171    *) dflt='n';;
6172    esac
6173    case "$d_quad" in
6174    "$define") ;;
6175    *) dflt='n' ;;
6176    esac
6177    cat <<EOM
6178
6179 Perl can be built to take advantage of 64-bit integer types
6180 on some systems.  To do so, Configure can be run with -Duse64bitint.
6181 Choosing this option will most probably introduce binary incompatibilities.
6182
6183 If this doesn't make any sense to you, just accept the default '$dflt'.
6184 (The default has been chosen based on your configuration.)
6185 EOM
6186    rp='Try to use 64-bit integers, if available?'
6187    . ./myread
6188    case "$ans" in
6189    [yY]*) val="$define" ;;
6190    *)     val="$undef"  ;;
6191    esac
6192    ;;
6193 esac
6194 set use64bitint
6195 eval $setvar
6196
6197 case "$use64bitall" in
6198 "$define"|true|[yY]*) dflt='y' ;;
6199 *) case "$longsize" in
6200    8) dflt='y' ;;
6201    *) dflt='n' ;;
6202    esac
6203    ;;
6204 esac
6205 cat <<EOM
6206
6207 You may also choose to try maximal 64-bitness.  It means using as much
6208 64-bitness as possible on the platform.  This in turn means even more
6209 binary incompatibilities.  On the other hand, your platform may not
6210 have any more 64-bitness available than what you already have chosen.
6211
6212 If this doesn't make any sense to you, just accept the default '$dflt'.
6213 (The default has been chosen based on your configuration.)
6214 EOM
6215 rp='Try to use maximal 64-bit support, if available?'
6216 . ./myread
6217 case "$ans" in
6218 [yY]*) val="$define" ;;
6219 *)     val="$undef"  ;;
6220 esac
6221 set use64bitall
6222 eval $setvar
6223 case "$use64bitall" in
6224 "$define")
6225         case "$use64bitint" in
6226         "$undef")
6227                 cat <<EOM
6228
6229 Since you have chosen a maximally 64-bit build, I'm also turning on
6230 the use of 64-bit integers.
6231 EOM
6232                 use64bitint="$define" ;;
6233         esac
6234         ;;
6235 esac
6236
6237 : Look for a hint-file generated 'call-back-unit'.  If the
6238 : user has specified that a 64-bit perl is to be built,
6239 : we may need to set or change some other defaults.
6240 if $test -f use64bitint.cbu; then
6241         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6242         . ./use64bitint.cbu
6243 fi
6244 case "$use64bitint" in
6245 "$define"|true|[yY]*)
6246         : This test was common to all the OpenBSD forks, and seems harmless for
6247         : other platforms:
6248         echo " "
6249         echo "Checking if your C library has broken 64-bit functions..." >&4
6250         cat >try.c <<EOCP
6251 #include <stdio.h>
6252 typedef $uquadtype myULL;
6253 int main (void)
6254 {
6255     struct {
6256         double d;
6257         myULL  u;
6258     } *p, test[] = {
6259         {4294967303.15, 4294967303ULL},
6260         {4294967294.2,  4294967294ULL},
6261         {4294967295.7,  4294967295ULL},
6262         {0.0, 0ULL}
6263     };
6264     for (p = test; p->u; p++) {
6265         myULL x = (myULL)p->d;
6266         if (x != p->u) {
6267             printf("buggy\n");
6268             return 0;
6269         }
6270     }
6271     printf("ok\n");
6272     return 0;
6273 }
6274 EOCP
6275         set try
6276         if eval $compile_ok; then
6277             libcquad=`$run ./try`
6278             echo "Your C library's 64-bit functions are $libcquad."
6279         else
6280             echo "(I can't seem to compile the test program.)"
6281             echo "Assuming that your C library's 64-bit functions are ok."
6282             libcquad="ok"
6283         fi
6284         $rm_try
6285
6286         case "$libcquad" in
6287             buggy*)
6288                 cat >&4 <<EOM
6289
6290 *** You have a C library with broken 64-bit functions.
6291 *** 64-bit support does not work reliably in this configuration.
6292 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6293 *** Cannot continue, aborting.
6294
6295 EOM
6296                 exit 1
6297                 ;;
6298         esac
6299         case "$longsize" in
6300         4) case "$archname64" in
6301            '') archname64=64int ;;
6302            esac
6303            ;;
6304         esac
6305         ;;
6306 esac
6307
6308 : Look for a hint-file generated 'call-back-unit'.  If the
6309 : user has specified that a maximally 64-bit perl is to be built,
6310 : we may need to set or change some other defaults.
6311 if $test -f use64bitall.cbu; then
6312         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6313         . ./use64bitall.cbu
6314 fi
6315 case "$use64bitall" in
6316 "$define"|true|[yY]*)
6317         case "$longsize" in
6318         4) case "$archname64" in
6319            ''|64int) archname64=64all ;;
6320            esac
6321            ;;
6322         esac
6323         ;;
6324 esac
6325
6326 case "$d_quad:$use64bitint" in
6327 $undef:$define)
6328         cat >&4 <<EOF
6329
6330 *** You have chosen to use 64-bit integers,
6331 *** but none can be found.
6332 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6333 *** Cannot continue, aborting.
6334
6335 EOF
6336         exit 1
6337         ;;
6338 esac
6339
6340 : Check if we are using the GNU C library
6341 echo " "
6342 echo "Checking for GNU C Library..." >&4
6343 cat >try.c <<'EOCP'
6344 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6345    alone are insufficient to distinguish different versions, such as
6346    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6347    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6348 */
6349 #include <stdio.h>
6350 int main(void)
6351 {
6352 #ifdef __GLIBC__
6353 #   ifdef __GLIBC_MINOR__
6354 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6355 #           include <gnu/libc-version.h>
6356             printf("%s\n",  gnu_get_libc_version());
6357 #       else
6358             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6359 #       endif
6360 #   else
6361         printf("%d\n",  __GLIBC__);
6362 #   endif
6363     return 0;
6364 #else
6365     return 1;
6366 #endif
6367 }
6368 EOCP
6369 set try
6370 if eval $compile_ok && $run ./try > glibc.ver; then
6371         val="$define"
6372         gnulibc_version=`$cat glibc.ver`
6373         echo "You are using the GNU C Library version $gnulibc_version"
6374 else
6375         val="$undef"
6376         gnulibc_version=''
6377         echo "You are not using the GNU C Library"
6378 fi
6379 $rm_try glibc.ver
6380 set d_gnulibc
6381 eval $setvar
6382
6383 : see if nm is to be used to determine whether a symbol is defined or not
6384 case "$usenm" in
6385 '')
6386         dflt=''
6387         case "$d_gnulibc" in
6388         "$define")
6389                 echo " "
6390                 echo "nm probably won't work on the GNU C Library." >&4
6391                 dflt=n
6392                 ;;
6393         esac
6394         case "$dflt" in
6395         '')
6396                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6397                         echo " "
6398                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6399                         echo "'nm' won't be sufficient on this system." >&4
6400                         dflt=n
6401                 fi
6402                 ;;
6403         esac
6404         case "$dflt" in
6405         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6406                 if $test $dflt -gt 20; then
6407                         dflt=y
6408                 else
6409                         dflt=n
6410                 fi
6411                 ;;
6412         esac
6413         ;;
6414 *)
6415         case "$usenm" in
6416         true|$define) dflt=y;;
6417         *) dflt=n;;
6418         esac
6419         ;;
6420 esac
6421 $cat <<EOM
6422
6423 I can use $nm to extract the symbols from your C libraries. This
6424 is a time consuming task which may generate huge output on the disk (up
6425 to 3 megabytes) but that should make the symbols extraction faster. The
6426 alternative is to skip the 'nm' extraction part and to compile a small
6427 test program instead to determine whether each symbol is present. If
6428 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6429 this may be the best solution.
6430
6431 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6432
6433 EOM
6434 rp="Shall I use $nm to extract C symbols from the libraries?"
6435 . ./myread
6436 case "$ans" in
6437 [Nn]*) usenm=false;;
6438 *) usenm=true;;
6439 esac
6440
6441 runnm=$usenm
6442 case "$reuseval" in
6443 true) runnm=false;;
6444 esac
6445
6446 : nm options which may be necessary
6447 case "$nm_opt" in
6448 '') if $test -f /mach_boot; then
6449                 nm_opt=''       # Mach
6450         elif $test -d /usr/ccs/lib; then
6451                 nm_opt='-p'     # Solaris (and SunOS?)
6452         elif $test -f /dgux; then
6453                 nm_opt='-p'     # DG-UX
6454         elif $test -f /lib64/rld; then
6455                 nm_opt='-p'     # 64-bit Irix
6456         else
6457                 nm_opt=''
6458         fi;;
6459 esac
6460
6461 : nm options which may be necessary for shared libraries but illegal
6462 : for archive libraries.  Thank you, Linux.
6463 case "$nm_so_opt" in
6464 '')     case "$myuname" in
6465         *linux*|gnu*)
6466                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6467                         nm_so_opt='--dynamic'
6468                 fi
6469                 ;;
6470         esac
6471         ;;
6472 esac
6473
6474 : Figure out where the libc is located
6475 case "$runnm" in
6476 true)
6477 : get list of predefined functions in a handy place
6478 echo " "
6479 case "$libc" in
6480 '') libc=unknown
6481         case "$libs" in
6482         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6483         esac
6484         ;;
6485 esac
6486 case "$libs" in
6487 '') ;;
6488 *)  for thislib in $libs; do
6489         case "$thislib" in
6490         -lc|-lc_s)
6491                 : Handle C library specially below.
6492                 ;;
6493         -l*)
6494                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6495                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6496                         :
6497                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6498                         :
6499                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6500                         :
6501                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6502                         :
6503                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6504                         :
6505                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6506                         :
6507                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6508                         :
6509                 else
6510                         try=''
6511                 fi
6512                 libnames="$libnames $try"
6513                 ;;
6514         *) libnames="$libnames $thislib" ;;
6515         esac
6516         done
6517         ;;
6518 esac
6519 xxx=normal
6520 case "$libc" in
6521 unknown)
6522         set /lib/libc.$so
6523         for xxx in $libpth; do
6524                 $test -r $1 || set $xxx/libc.$so
6525                 : The messy sed command sorts on library version numbers.
6526                 $test -r $1 || \
6527                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6528                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6529                                 h
6530                                 s/[0-9][0-9]*/0000&/g
6531                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6532                                 G
6533                                 s/\n/ /' | \
6534                          $sort | $sed -e 's/^.* //'`
6535                 eval set \$$#
6536         done
6537         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6538         $test -r $1 || set $sysroot/lib/libsys_s$_a
6539         ;;
6540 *)
6541         set blurfl
6542         ;;
6543 esac
6544 if $test -r "$1"; then
6545         echo "Your (shared) C library seems to be in $1."
6546         libc="$1"
6547 elif $test -r /lib/libc && $test -r /lib/clib; then
6548         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6549         xxx=apollo
6550         libc='/lib/clib /lib/libc'
6551         if $test -r /lib/syslib; then
6552                 echo "(Your math library is in /lib/syslib.)"
6553                 libc="$libc /lib/syslib"
6554         fi
6555 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6556         echo "Your C library seems to be in $libc, as you said before."
6557 elif $test -r $incpath/usr/lib/libc$_a; then
6558         libc=$incpath/usr/lib/libc$_a;
6559         echo "Your C library seems to be in $libc.  That's fine."
6560 elif $test -r /lib/libc$_a; then
6561         libc=/lib/libc$_a;
6562         echo "Your C library seems to be in $libc.  You're normal."
6563 else
6564         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6565                 :
6566         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6567                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6568         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6569                 :
6570         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6571                 :
6572         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6573                 :
6574         else
6575                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6576         fi
6577         if $test -r "$tans"; then
6578                 echo "Your C library seems to be in $tans, of all places."
6579                 libc=$tans
6580         else
6581                 libc='blurfl'
6582         fi
6583 fi
6584 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6585         dflt="$libc"
6586         cat <<EOM
6587
6588 If the guess above is wrong (which it might be if you're using a strange
6589 compiler, or your machine supports multiple models), you can override it here.
6590
6591 EOM
6592 else
6593         dflt=''
6594         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6595         cat >&4 <<EOM
6596 I can't seem to find your C library.  I've looked in the following places:
6597
6598 EOM
6599         $sed 's/^/      /' libpath
6600         cat <<EOM
6601
6602 None of these seems to contain your C library. I need to get its name...
6603
6604 EOM
6605 fi
6606 fn=f
6607 rp='Where is your C library?'
6608 . ./getfile
6609 libc="$ans"
6610
6611 echo " "
6612 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6613 set X `cat libnames`
6614 shift
6615 xxx=files
6616 case $# in 1) xxx=file; esac
6617 echo "Extracting names from the following $xxx for later perusal:" >&4
6618 echo " "
6619 $sed 's/^/      /' libnames >&4
6620 echo " "
6621 $echo $n "This may take a while...$c" >&4
6622
6623 for file in $*; do
6624         case $file in
6625         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6626         *) $nm $nm_opt $file 2>/dev/null;;
6627         esac
6628 done >libc.tmp
6629
6630 $echo $n ".$c"
6631 $grep fprintf libc.tmp > libc.ptf
6632 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6633 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6634 xxx='[ADTSIWi]'
6635 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6636         eval $xscan;\
6637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6638                 eval $xrun
6639 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6640         eval $xscan;\
6641         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6642                 eval $xrun
6643 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6644         eval $xscan;\
6645         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6646                 eval $xrun
6647 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6648         eval $xscan;\
6649         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6650                 eval $xrun
6651 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6652         eval $xscan;\
6653         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6654                 eval $xrun
6655 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6656         eval $xscan;\
6657         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6658                 eval $xrun
6659 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6660                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6661         eval $xscan;\
6662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6663                 eval $xrun
6664 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6665         eval $xscan;\
6666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6667                 eval $xrun
6668 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6669         eval $xscan;\
6670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6671                 eval $xrun
6672 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6673         eval $xscan;\
6674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6675                 eval $xrun
6676 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6677         eval $xscan;\
6678         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6679                 eval $xrun
6680 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6681         eval $xscan;\
6682         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6683                 eval $xrun
6684 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6685         eval $xscan;\
6686         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6687                 eval $xrun
6688 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6689         eval $xscan;\
6690         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6691                 eval $xrun
6692 else
6693         $nm -p $* 2>/dev/null >libc.tmp
6694         $grep fprintf libc.tmp > libc.ptf
6695         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6696                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6697         then
6698                 nm_opt='-p'
6699                 eval $xrun
6700         else
6701                 echo " "
6702                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6703                 com=''
6704                 if $ar t $libc > libc.tmp && \
6705                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6706                 then
6707                         for thisname in $libnames $libc; do
6708                                 $ar t $thisname >>libc.tmp
6709                         done
6710                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6711                         echo "Ok." >&4
6712                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6713                         for thisname in $libnames $libc; do
6714                                 $ar tv $thisname >>libc.tmp
6715                                 emximp -o tmp.imp $thisname \
6716                                     2>/dev/null && \
6717                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6718                                     < tmp.imp >>libc.tmp
6719                                 $rm -f tmp.imp
6720                         done
6721                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6722                         echo "Ok." >&4
6723                 else
6724                         echo "$ar didn't seem to work right." >&4
6725                         echo "Maybe this is a Cray...trying bld instead..." >&4
6726                         if  bld t $libc | \
6727                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6728                                 $test -s libc.list
6729                         then
6730                                 for thisname in $libnames; do
6731                                         bld t $libnames | \
6732                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6733                                         $ar t $thisname >>libc.tmp
6734                                 done
6735                                 echo "Ok." >&4
6736                         else
6737                                 echo "That didn't work either.  Giving up." >&4
6738                                 exit 1
6739                         fi
6740                 fi
6741         fi
6742 fi
6743 nm_extract="$com"
6744 case "$PASE" in
6745 define)
6746     echo " "
6747     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6748     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6749     ;;
6750 *)  if $test -f /lib/syscalls.exp; then
6751         echo " "
6752         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6753         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6754                 /lib/syscalls.exp >>libc.list
6755     fi
6756     ;;
6757 esac
6758 ;;
6759 esac
6760 $rm -f libnames libpath
6761
6762 : Check if we are using C++
6763 echo " "
6764 echo "Checking for C++..." >&4
6765 $cat >try.c <<'EOCP'
6766 #include <stdio.h>
6767 int main(void)
6768 {
6769 #ifdef __cplusplus
6770     return 0;
6771 #else
6772     return 1;
6773 #endif
6774 }
6775 EOCP
6776 set try
6777 if eval $compile_ok && $run ./try; then
6778         val="$define"
6779         echo "You are using a C++ compiler."
6780 else
6781         val="$undef"
6782         echo "You are not using a C++ compiler."
6783 fi
6784 $rm_try cplusplus$$
6785 set d_cplusplus
6786 eval $setvar
6787
6788 : is a C symbol defined?
6789 csym='tlook=$1;
6790 case "$3" in
6791 -v) tf=libc.tmp; tdc="";;
6792 -a) tf=libc.tmp; tdc="[]";;
6793 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6794 esac;
6795 case "$d_cplusplus" in
6796     $define)    extern_C="extern \"C\"" ;;
6797     *)          extern_C="extern"       ;;
6798 esac;
6799 tx=yes;
6800 case "$reuseval-$4" in
6801 true-) ;;
6802 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6803 esac;
6804 case "$tx" in
6805 yes)
6806         tval=false;
6807         if $test "$runnm" = true; then
6808                 if $contains $tlook $tf >/dev/null 2>&1; then
6809                         tval=true;
6810                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6811                         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;
6812                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6813                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6814                         $rm_try;
6815                 fi;
6816         else
6817                 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;
6818                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6819                 $rm_try;
6820         fi;
6821         ;;
6822 *)
6823         case "$tval" in
6824         $define) tval=true;;
6825         *) tval=false;;
6826         esac;
6827         ;;
6828 esac;
6829 eval "$2=$tval"'
6830
6831 : define an is-in-libc? function
6832 inlibc='echo " "; td=$define; tu=$undef;
6833 sym=$1; var=$2; eval "was=\$$2";
6834 tx=yes;
6835 case "$reuseval$was" in
6836 true) ;;
6837 true*) tx=no;;
6838 esac;
6839 case "$tx" in
6840 yes)
6841         set $sym tres -f;
6842         eval $csym;
6843         case "$tres" in
6844         true)
6845                 echo "$sym() found." >&4;
6846                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6847         *)
6848                 echo "$sym() NOT found." >&4;
6849                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6850         esac;;
6851 *)
6852         case "$was" in
6853         $define) echo "$sym() found." >&4;;
6854         *) echo "$sym() NOT found." >&4;;
6855         esac;;
6856 esac'
6857
6858 : check for length of double
6859 echo " "
6860 case "$doublesize" in
6861 '')
6862         echo "Checking to see how big your double precision numbers are..." >&4
6863         $cat >try.c <<EOCP
6864 #include <stdio.h>
6865 #$i_stdlib I_STDLIB
6866 #ifdef I_STDLIB
6867 #include <stdlib.h>
6868 #endif
6869 int main()
6870 {
6871     printf("%d\n", (int)sizeof(double));
6872     exit(0);
6873 }
6874 EOCP
6875         set try
6876         if eval $compile_ok; then
6877                 doublesize=`$run ./try`
6878                 echo "Your double is $doublesize bytes long."
6879         else
6880                 dflt='8'
6881                 echo "(I can't seem to compile the test program.  Guessing...)"
6882                 rp="What is the size of a double precision number (in bytes)?"
6883                 . ./myread
6884                 doublesize="$ans"
6885         fi
6886         ;;
6887 esac
6888 $rm_try
6889
6890 : check for long doubles
6891 echo " " >&4
6892 echo "Checking to see if you have long double..." >&4
6893 echo 'int main() { long double x = 7.0; }' > try.c
6894 set try
6895 if eval $compile; then
6896         val="$define"
6897         echo "You have long double." >&4
6898 else
6899         val="$undef"
6900         echo "You do not have long double." >&4
6901 fi
6902 $rm_try
6903 set d_longdbl
6904 eval $setvar
6905
6906 : see if ldexpl exists
6907 set ldexpl d_ldexpl
6908 eval $inlibc
6909
6910 : check for length of long double
6911 case "${d_longdbl}${longdblsize}" in
6912 $define)
6913         echo " " >&4
6914         echo "Checking to see how big your long doubles are..." >&4
6915         $cat >try.c <<'EOCP'
6916 #include <stdio.h>
6917 int main()
6918 {
6919         printf("%d\n", sizeof(long double));
6920 }
6921 EOCP
6922         set try
6923         set try
6924         if eval $compile; then
6925                 longdblsize=`$run ./try`
6926                 echo "Your long doubles are $longdblsize bytes long." >&4
6927         else
6928                 dflt='8'
6929                 echo " " >&4
6930                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6931                 rp="What is the size of a long double (in bytes)?"
6932                 . ./myread
6933                 longdblsize="$ans"
6934         fi
6935         if $test "X$doublesize" = "X$longdblsize"; then
6936                 echo "That isn't any different from an ordinary double." >&4
6937                 echo "I'll keep your setting anyway, but you may see some" >&4
6938                 echo "harmless compilation warnings." >&4
6939         fi
6940         ;;
6941 esac
6942 $rm_try
6943
6944 $echo "Checking the kind of long doubles you have..." >&4
6945 case "$d_longdbl" in
6946 define)
6947 $cat <<EOP >try.c
6948 #$i_stdlib I_STDLIB
6949 #define LONGDBLSIZE $longdblsize
6950 #define DOUBLESIZE $doublesize
6951 #include <float.h>
6952 #ifdef I_STDLIB
6953 #include <stdlib.h>
6954 #endif
6955 #include <stdio.h>
6956 static const long double d = -0.1L;
6957 int main() {
6958   unsigned const char* b = (unsigned const char*)(&d);
6959 #if DOUBLESIZE == LONGDBLSIZE
6960   printf("0\n"); /* if it floats like double */
6961   exit(0);
6962 #endif
6963 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6964   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6965     /* IEEE 754 128-bit little-endian */
6966     printf("1\n");
6967     exit(0);
6968   }
6969   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6970     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6971     printf("2\n");
6972     exit(0);
6973   }
6974 #endif
6975 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6976  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6977  * cannot be trusted. */
6978 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6979   if (b[0] == 0xCD && b[9] == 0xBF) {
6980     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6981      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6982      * Also known as "extended precision". */
6983     printf("3\n");
6984     exit(0);
6985   }
6986   if (b[0] == 0xBF && b[9] == 0xCD) {
6987     /* Is there ever big-endian 80-bit, really?
6988      *
6989      * The Motorola 68881 had another "extended precision" format:
6990      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6991      * for total of 96 bits of bytes.  The zero bits were unused.
6992      * See "M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL" for more details.
6993      * If it ever becomes relevant, this format should be allocated a
6994      * new doublekind code since it is quite different from the Intel x87.
6995      */
6996     printf("4\n");
6997     exit(0);
6998   }
6999 #endif
7000 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7001   /* software "double double", the 106 is 53+53.
7002    * but irix thinks it is 107. */
7003   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7004     /* double double 128-bit fully little-endian,
7005      * little-endian doubles in little-endian order,
7006      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7007     printf("5\n");
7008     exit(0);
7009   }
7010   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7011     /* double double 128-bit fully big-endian,
7012      * big-endian doubles in big-endian order,
7013      * e.g. PPC/Power and MIPS:
7014      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7015     printf("6\n");
7016     exit(0);
7017   }
7018   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7019     /* double double 128-bit mixed endian.
7020      * little-endian doubles in big-endian order,
7021      * e.g. ppc64el,
7022      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7023     printf("7\n");
7024     exit(0);
7025   }
7026   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7027     /* double double 128-bit mixed endian,
7028      * big-endian doubles in little-endian order,
7029      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7030     printf("8\n");
7031     exit(0);
7032   }
7033 #endif
7034 /* We are largely making this up because it may well be
7035  * that the VAX format H was never made available to C,
7036  * only to Fortran. */
7037 #if LONGDBLSIZE == 16 && defined(__vax__)
7038   if (b[0] == 0xFD && b[15] == 0x99) {
7039     /* VAX format H, PDP-11 mixed endian. */
7040     printf("9\n");
7041     exit(0);
7042   }
7043 #endif
7044   printf("-1\n"); /* unknown */
7045   exit(0);
7046 }
7047 EOP
7048 set try
7049 if eval $compile; then
7050     longdblkind=`$run ./try`
7051 else
7052     longdblkind=-1
7053 fi
7054 ;;
7055 *) longdblkind=0 ;;
7056 esac
7057 case "$longdblkind" in
7058 0) echo "Your long doubles are doubles." >&4 ;;
7059 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7060 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7061 3) echo "You have x86 80-bit little endian long doubles." >&4 ;;
7062 4) echo "You have x86 80-bit big endian long doubles." >&4 ;;
7063 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >&4 ;;
7064 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >&4 ;;
7065 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >&4 ;;
7066 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >&4 ;;
7067 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >&4 ;;
7068 *) echo "Cannot figure out your long double." >&4 ;;
7069 esac
7070 d_long_double_style_ieee=$undef
7071 d_long_double_style_ieee_std=$undef
7072 d_long_double_style_ieee_extended=$undef
7073 d_long_double_style_ieee_doubledouble=$undef
7074 d_long_double_style_vax=$undef
7075 case "$longdblkind" in
7076 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7077 esac
7078 case "$longdblkind" in
7079 1|2) d_long_double_style_ieee_std=$define ;;
7080 esac
7081 case "$longdblkind" in
7082 3|4) d_long_double_style_ieee_extended=$define ;;
7083 esac
7084 case "$longdblkind" in
7085 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7086 esac
7087 case "$longdblkind" in
7088 9) d_long_double_style_vax=$define ;;
7089 esac
7090 $rm_try
7091
7092 : get the patchlevel
7093 echo " "
7094 echo "Getting the current patchlevel..." >&4
7095 if $test -r $rsrc/patchlevel.h;then
7096         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
7097         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
7098         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
7099         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
7100         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
7101         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
7102         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
7103 else
7104         revision=0
7105         patchlevel=0
7106         subversion=0
7107         api_revision=0
7108         api_version=0
7109         api_subversion=0
7110         perl_patchlevel=0
7111         $echo "(You do not have patchlevel.h.  Eek.)"
7112 fi
7113 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
7114 version_patchlevel_string="version $patchlevel subversion $subversion"
7115 case "$perl_patchlevel" in
7116 0|'') ;;
7117 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
7118     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
7119     ;;
7120 esac
7121
7122 $echo "(You have $package $version_patchlevel_string.)"
7123
7124 case "$osname" in
7125 dos|vms)
7126         : XXX Should be a Configure test for double-dots in filenames.
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 *)
7133         version=`echo $revision $patchlevel $subversion | \
7134                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
7135         api_versionstring=`echo $api_revision $api_version $api_subversion | \
7136                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
7137         ;;
7138 esac
7139 : Special case the 5.005_xx maintenance series, which used 5.005
7140 : without any subversion label as a subdirectory in $sitelib
7141 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
7142         api_versionstring='5.005'
7143 fi
7144
7145 : determine the architecture name
7146 echo " "
7147 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7148         tarch=`arch`"-$osname"
7149 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7150         if uname -m > tmparch 2>&1 ; then
7151                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7152                         -e 's/$/'"-$osname/" tmparch`
7153         else
7154                 tarch="$osname"
7155         fi
7156         $rm -f tmparch
7157 else
7158         tarch="$osname"
7159 fi
7160 case "$myarchname" in
7161 ''|"$tarch") ;;
7162 *)
7163         echo "(Your architecture name used to be $myarchname.)"
7164         archname=''
7165         ;;
7166 esac
7167 case "$targetarch" in
7168 '') ;;
7169 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7170 esac
7171 myarchname="$tarch"
7172 case "$archname" in
7173 '') dflt="$tarch";;
7174 *) dflt="$archname";;
7175 esac
7176 rp='What is your architecture name'
7177 . ./myread
7178 archname="$ans"
7179
7180 : optionally add API version to the architecture for versioned archlibs
7181 case "$useversionedarchname" in
7182 $define|true|[yY]*) dflt='y';;
7183 *)                  dflt='n';;
7184 esac
7185 rp='Add the Perl API version to your archname?'
7186 . ./myread
7187 case "$ans" in
7188 y|Y)    useversionedarchname="$define" ;;
7189 *)      useversionedarchname="$undef" ;;
7190 esac
7191 case "$useversionedarchname" in
7192 $define)
7193         case "$archname" in
7194         *-$api_versionstring)
7195                 echo "...and architecture name already has -$api_versionstring" >&4
7196                 ;;
7197         *)
7198                 archname="$archname-$api_versionstring"
7199                 echo "...setting architecture name to $archname." >&4
7200                 ;;
7201         esac
7202         ;;
7203 esac
7204
7205 case "$usethreads" in
7206 $define)
7207         echo "Threads selected." >&4
7208         case "$archname" in
7209         *-thread*) echo "...and architecture name already has -thread." >&4
7210                 ;;
7211         *)      archname="$archname-thread"
7212                 echo "...setting architecture name to $archname." >&4
7213                 ;;
7214         esac
7215         ;;
7216 esac
7217 case "$usemultiplicity" in
7218 $define)
7219         echo "Multiplicity selected." >&4
7220         case "$archname" in
7221         *-multi*) echo "...and architecture name already has -multi." >&4
7222                 ;;
7223         *)      archname="$archname-multi"
7224                 echo "...setting architecture name to $archname." >&4
7225                 ;;
7226         esac
7227         ;;
7228 esac
7229 case "$use64bitint$use64bitall" in
7230 *"$define"*)
7231         case "$archname64" in
7232         '')
7233                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7234                 ;;
7235         *)
7236                 case "$use64bitint" in
7237                 "$define") echo "64 bit integers selected." >&4 ;;
7238                 esac
7239                 case "$use64bitall" in
7240                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7241                 esac
7242                 case "$archname" in
7243                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7244                         ;;
7245                 *)      archname="$archname-$archname64"
7246                         echo "...setting architecture name to $archname." >&4
7247                         ;;
7248                 esac
7249                 ;;
7250         esac
7251 esac
7252 case "$uselongdouble" in
7253 $define)
7254         echo "Long doubles selected." >&4
7255         case "$longdblsize" in
7256         $doublesize)
7257                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7258                 ;;
7259         *)
7260                 case "$archname" in
7261                 *-ld*) echo "...and architecture name already has -ld." >&4
7262                         ;;
7263                 *)      archname="$archname-ld"
7264                         echo "...setting architecture name to $archname." >&4
7265                         ;;
7266                 esac
7267                 ;;
7268         esac
7269         ;;
7270 esac
7271 case "$usequadmath" in
7272 $define)
7273         echo "quadmath selected." >&4
7274         case "$archname" in
7275         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7276                 ;;
7277         *)      archname="$archname-quadmath"
7278                 echo "...setting architecture name to $archname." >&4
7279                 ;;
7280         esac
7281         ;;
7282 esac
7283 if $test -f archname.cbu; then
7284         echo "Your platform has some specific hints for architecture name, using them..."
7285         . ./archname.cbu
7286 fi
7287
7288 : set the prefixit variable, to compute a suitable default value
7289 prefixit='case "$3" in
7290 ""|none)
7291         case "$oldprefix" in
7292         "") eval "$1=\"\$$2\"";;
7293         *)
7294                 case "$3" in
7295                 "") eval "$1=";;
7296                 none)
7297                         eval "tp=\"\$$2\"";
7298                         case "$tp" in
7299                         ""|" "|none) eval "$1=\"\$$2\"";;
7300                         *) eval "$1=";;
7301                         esac;;
7302                 esac;;
7303         esac;;
7304 *)
7305         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7306         case "$tp" in
7307         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7308         /*-$oldprefix/*|\~*-$oldprefix/*)
7309                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7310         *) eval "$1=\"\$$2\"";;
7311         esac;;
7312 esac'
7313
7314 : determine installation style
7315 : For now, try to deduce it from prefix unless it is already set.
7316 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7317 case "$installstyle" in
7318 '')     case "$prefix" in
7319                 *perl*) dflt='lib';;
7320                 *) dflt='lib/perl5' ;;
7321         esac
7322         ;;
7323 *)      dflt="$installstyle" ;;
7324 esac
7325 : Probably not worth prompting for this since we prompt for all
7326 : the directories individually, and the prompt would be too long and
7327 : confusing anyway.
7328 installstyle=$dflt
7329
7330 : determine where public executables go
7331 echo " "
7332 set dflt bin bin
7333 eval $prefixit
7334 fn=d~
7335 rp='Pathname where the public executables will reside?'
7336 . ./getfile
7337 if $test "X$ansexp" != "X$binexp"; then
7338         installbin=''
7339 fi
7340 prefixvar=bin
7341 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7342 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7343 :     this via initialinstalllocation
7344 . ./setprefixvar
7345
7346 case "$userelocatableinc" in
7347 $define|true|[yY]*)     dflt='y' ;;
7348 *)                      dflt='n' ;;
7349 esac
7350 cat <<EOM
7351
7352 Would you like to build Perl so that the installation is relocatable, so that
7353 library paths in @INC are determined relative to the path of the perl binary?
7354 This is not advised for system Perl installs, or if you need to run setid
7355 scripts or scripts under taint mode.
7356
7357 If this doesn't make any sense to you, just accept the default '$dflt'.
7358 EOM
7359 rp='Use relocatable @INC?'
7360 . ./myread
7361 case "$ans" in
7362 y|Y)    val="$define" ;;
7363 *)      val="$undef"  ;;
7364 esac
7365 set userelocatableinc
7366 eval $setvar
7367
7368 initialinstalllocation="$binexp"
7369 : Default prefix is now "up one level from where the binaries are"
7370 case "$userelocatableinc" in
7371 $define|true|[yY]*)
7372     bin=".../"
7373     binexp=".../"
7374     prefix=".../.."
7375     prefixexp=".../.."
7376     installprefixexp=".../.."
7377     ;;
7378 esac
7379
7380 : determine where private library files go
7381 : Usual default is /usr/local/lib/perl5/$version.
7382 : Also allow things like /opt/perl/lib/$version, since
7383 : /opt/perl/lib/perl5... would be redundant.
7384 : The default "style" setting is made in installstyle.U
7385 case "$installstyle" in
7386 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7387 *)       set dflt privlib lib/$version ;;
7388 esac
7389 eval $prefixit
7390 $cat <<EOM
7391
7392 There are some auxiliary files for $package that need to be put into a
7393 private library directory that is accessible by everyone.
7394
7395 EOM
7396 fn=$binexp
7397 fn=d~+
7398 rp='Pathname where the private library files will reside?'
7399 . ./getfile
7400 prefixvar=privlib
7401 . ./setprefixvar
7402
7403 : set the prefixup variable, to restore leading tilda escape
7404 prefixup='case "$prefixexp" in
7405 "$prefix") ;;
7406 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7407 esac'
7408
7409 : determine where public architecture dependent libraries go
7410 set archlib archlib
7411 eval $prefixit
7412 : privlib default is /usr/local/lib/$package/$version
7413 : archlib default is /usr/local/lib/$package/$version/$archname
7414 : privlib may have an optional trailing /share.
7415 tdflt=`echo $privlib | $sed 's,/share$,,'`
7416 tdflt=$tdflt/$archname
7417 case "$archlib" in
7418 '')     dflt=$tdflt
7419         ;;
7420 *)      dflt="$archlib"
7421     ;;
7422 esac
7423 $cat <<EOM
7424
7425 $spackage contains architecture-dependent library files.  If you are
7426 sharing libraries in a heterogeneous environment, you might store
7427 these files in a separate location.  Otherwise, you can just include
7428 them with the rest of the public library files.
7429
7430 EOM
7431 fn=$binexp
7432 fn=d+~
7433 rp='Where do you want to put the public architecture-dependent libraries?'
7434 . ./getfile
7435 prefixvar=archlib
7436 . ./setprefixvar
7437 if $test X"$archlib" = X"$privlib"; then
7438         d_archlib="$undef"
7439 else
7440         d_archlib="$define"
7441 fi
7442
7443 : see if setuid scripts can be secure
7444 $cat <<EOM
7445
7446 Some kernels have a bug that prevents setuid #! scripts from being
7447 secure.  Some sites have disabled setuid #! scripts because of this.
7448
7449 First let's decide if your kernel supports secure setuid #! scripts.
7450 (If setuid #! scripts would be secure but have been disabled anyway,
7451 don't say that they are secure if asked.)
7452
7453 EOM
7454
7455 val="$undef"
7456 if $test -d /dev/fd; then
7457         echo "#!$ls" >reflect
7458         chmod +x,u+s reflect
7459         ./reflect >flect 2>&1
7460         if $contains "/dev/fd" flect >/dev/null; then
7461                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7462                 val="$define"
7463         else
7464                 $cat <<EOM
7465 If you are not sure if they are secure, I can check but I'll need a
7466 username and password different from the one you are using right now.
7467 If you don't have such a username or don't want me to test, simply
7468 enter 'none'.
7469
7470 EOM
7471                 rp='Other username to test security of setuid scripts with?'
7472                 dflt='none'
7473                 . ./myread
7474                 case "$ans" in
7475                 n|none)
7476                         case "$d_suidsafe" in
7477                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7478                                 dflt=n;;
7479                         "$undef")
7480                                 echo "Well, the $hint value is *not* secure." >&4
7481                                 dflt=n;;
7482                         *)      echo "Well, the $hint value *is* secure." >&4
7483                                 dflt=y;;
7484                         esac
7485                         ;;
7486                 *)
7487                         $rm -f reflect flect
7488                         echo "#!$ls" >reflect
7489                         chmod +x,u+s reflect
7490                         echo >flect
7491                         chmod a+w flect
7492                         echo '"su" will (probably) prompt you for '"$ans's password."
7493                         su $ans -c './reflect >flect'
7494                         if $contains "/dev/fd" flect >/dev/null; then
7495                                 echo "Okay, it looks like setuid scripts are secure." >&4
7496                                 dflt=y
7497                         else
7498                                 echo "I don't think setuid scripts are secure." >&4
7499                                 dflt=n
7500                         fi
7501                         ;;
7502                 esac
7503                 rp='Does your kernel have *secure* setuid scripts?'
7504                 . ./myread
7505                 case "$ans" in
7506                 [yY]*)  val="$define";;
7507                 *)      val="$undef";;
7508                 esac
7509         fi
7510 else
7511         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7512         echo "(That's for file descriptors, not floppy disks.)"
7513         val="$undef"
7514 fi
7515 set d_suidsafe
7516 eval $setvar
7517
7518 $rm -f reflect flect
7519
7520 : now see if they want to do setuid emulation
7521 if $test $patchlevel -lt 11; then
7522 echo " "
7523 val="$undef"
7524 case "$d_suidsafe" in
7525 "$define")
7526         val="$undef"
7527         echo "No need to emulate SUID scripts since they are secure here." >&4
7528         ;;
7529 *)
7530         $cat <<EOM
7531 Some systems have disabled setuid scripts, especially systems where
7532 setuid scripts cannot be secure.  On systems where setuid scripts have
7533 been disabled, the setuid/setgid bits on scripts are currently
7534 useless.  It is possible for $package to detect those bits and emulate
7535 setuid/setgid in a secure fashion.  This emulation will only work if
7536 setuid scripts have been disabled in your kernel.
7537
7538 EOM
7539         case "$d_dosuid" in
7540         "$define") dflt=y ;;
7541         *) dflt=n ;;
7542         esac
7543         rp="Do you want to do setuid/setgid emulation?"
7544         . ./myread
7545         case "$ans" in
7546         [yY]*)  val="$define";;
7547         *)      val="$undef";;
7548         esac
7549         ;;
7550 esac
7551 set d_dosuid
7552 eval $setvar
7553 else
7554     case "$d_dosuid" in
7555         "$define")
7556         cat >&4 <<EOH
7557
7558 SUID emulation has been removed for 5.12
7559 Please re-run Configure without -Dd_dosuid
7560
7561 EOH
7562         exit 1;
7563         ;;
7564     esac
7565     d_dosuid=undef
7566 fi
7567
7568 : Find perl5.005 or later.
7569 echo "Looking for a previously installed perl5.005 or later... "
7570 case "$perl5" in
7571 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7572                 : Check if this perl is recent and can load a simple module
7573                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7574                         perl5=$tdir/perl
7575                         break;
7576                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7577                         perl5=$tdir/perl5
7578                         break;
7579                 fi
7580         done
7581         ;;
7582 *)      perl5="$perl5"
7583         ;;
7584 esac
7585 case "$perl5" in
7586 '')     echo "None found.  That's ok.";;
7587 *)      echo "Using $perl5." ;;
7588 esac
7589
7590 : Set the siteprefix variables
7591 $cat <<EOM
7592
7593 After $package is installed, you may wish to install various
7594 add-on modules and utilities.  Typically, these add-ons will
7595 be installed under $prefix with the rest
7596 of this package.  However, you may wish to install such add-ons
7597 elsewhere under a different prefix.
7598
7599 If you do not wish to put everything under a single prefix, that's
7600 ok.  You will be prompted for the individual locations; this siteprefix
7601 is only used to suggest the defaults.
7602
7603 The default should be fine for most people.
7604
7605 EOM
7606 fn=d~+
7607 rp='Installation prefix to use for add-on modules and utilities?'
7608 : XXX Here might be another good place for an installstyle setting.
7609 case "$siteprefix" in
7610 '') dflt=$prefix ;;
7611 *)  dflt=$siteprefix ;;
7612 esac
7613 . ./getfile
7614 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7615 oldsiteprefix=''
7616 case "$siteprefix" in
7617 '') ;;
7618 *)      case "$ans" in
7619         "$prefix") ;;
7620         *) oldsiteprefix="$prefix";;
7621         esac
7622         ;;
7623 esac
7624 siteprefix="$ans"
7625 siteprefixexp="$ansexp"
7626
7627 : determine where site specific libraries go.
7628 : Usual default is /usr/local/lib/perl5/site_perl/$version
7629 : The default "style" setting is made in installstyle.U
7630 : XXX No longer works with Prefixit stuff.
7631 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7632 case "$sitelib" in
7633 '') case "$installstyle" in
7634         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7635         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7636         esac
7637         ;;
7638 *)      dflt="$sitelib"
7639         ;;
7640 esac
7641 $cat <<EOM
7642
7643 The installation process will create a directory for
7644 site-specific extensions and modules.  Most users find it convenient
7645 to place all site-specific files in this directory rather than in the
7646 main distribution directory.
7647
7648 EOM
7649 fn=d~+
7650 rp='Pathname for the site-specific library files?'
7651 . ./getfile
7652 prefixvar=sitelib
7653 . ./setprefixvar
7654 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7655
7656 : Determine list of previous versions to include in @INC
7657 $cat > getverlist <<EOPL
7658 #!$perl5
7659 use strict;
7660 use warnings;
7661 use File::Basename;
7662 my \$api_versionstring = "$api_versionstring";
7663 my \$version = "$version";
7664 my \$stem = "$sitelib_stem";
7665 my \$archname = "$archname";
7666 EOPL
7667         $cat >> getverlist <<'EOPL'
7668 # The list found is stored twice for each entry: the original name, and
7669 # the binary broken down version into pack "s>s>s>", so sorting is easy
7670 # and unambiguous.  This will work for all versions that have a maximum
7671 # of three digit per group separate by '.'s or '_'s. Names are extended
7672 # with ".0.0" to ensure at least three elements for the pack.
7673 #                                   -- H.Merijn Brand (m)'06 23-10-2006
7674
7675 my @inc_version_list;
7676 my @candidates;
7677 # XXX Redo to do opendir/readdir?
7678 if (-d $stem) {
7679     chdir($stem);
7680     ;@candidates = map {
7681         [ $_, pack "s>s>s>", split m/[._]/, "$_.0.0" ] } glob("5.*");
7682     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7683 }
7684 else {
7685     ;@candidates = ();
7686 }
7687
7688 my ($pversion, $aversion, $vsn5005) = map {
7689     pack "s>s>s>", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7690 foreach my $d (@candidates) {
7691     if ($d->[1] lt $pversion) {
7692         if ($d->[1] ge $aversion) {
7693             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7694         }
7695         elsif ($d->[1] ge $vsn5005) {
7696             unshift(@inc_version_list, grep { -d } $d->[0]);
7697         }
7698     }
7699     else {
7700         # Skip newer version.  I.e. don't look in
7701         # 5.7.0 if we're installing 5.6.1.
7702     }
7703 }
7704
7705 if (@inc_version_list) {
7706     print join(' ', @inc_version_list);
7707 }
7708 else {
7709     # Blank space to preserve value for next Configure run.
7710     print " ";
7711 }
7712 EOPL
7713 chmod +x getverlist
7714 case "$inc_version_list" in
7715 '')     if test -x "$perl5$exe_ext"; then
7716                 dflt=`$perl5 getverlist`
7717         else
7718                 dflt='none'
7719         fi
7720         ;;
7721 $undef) dflt='none' ;;
7722 *)  eval dflt=\"$inc_version_list\" ;;
7723 esac
7724 case "$dflt" in
7725 ''|' ') dflt=none ;;
7726 esac
7727 case "$dflt" in
7728 5.005) dflt=none ;;
7729 esac
7730 $cat <<EOM
7731
7732 In order to ease the process of upgrading, this version of perl
7733 can be configured to use modules built and installed with earlier
7734 versions of perl that were installed under $prefix.  Specify here
7735 the list of earlier versions that this version of perl should check.
7736 If Configure detected no earlier versions of perl installed under
7737 $prefix, then the list will be empty.  Answer 'none' to tell perl
7738 to not search earlier versions.
7739
7740 The default should almost always be sensible, so if you're not sure,
7741 just accept the default.
7742 EOM
7743
7744 rp='List of earlier versions to include in @INC?'
7745 . ./myread
7746 case "$ans" in
7747 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7748 *) inc_version_list="$ans" ;;
7749 esac
7750 case "$inc_version_list" in
7751 ''|' ')
7752         inc_version_list_init='0'
7753         d_inc_version_list="$undef"
7754         ;;
7755 *)      inc_version_list_init=`echo $inc_version_list |
7756                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7757         d_inc_version_list="$define"
7758         ;;
7759 esac
7760 $rm -f getverlist
7761
7762 : see if malloc/malloc.h has to be included
7763 set malloc/malloc.h i_mallocmalloc
7764 eval $inhdr
7765
7766 : see if this is a malloc.h system
7767 : we want a real compile instead of Inhdr because some systems have a
7768 : malloc.h that just gives a compile error saying to use stdlib.h instead
7769 echo " "
7770 $cat >try.c <<EOCP
7771 #include <stdlib.h>
7772 #include <malloc.h>
7773 #$i_mallocmalloc I_MALLOCMALLOC
7774 #ifdef I_MALLOCMALLOC
7775 # include <malloc/malloc.h>
7776 #endif
7777
7778 int main () { return 0; }
7779 EOCP
7780 set try
7781 if eval $compile; then
7782     echo "<malloc.h> found." >&4
7783     val="$define"
7784 else
7785     echo "<malloc.h> NOT found." >&4
7786     val="$undef"
7787 fi
7788 $rm_try
7789 set i_malloc
7790 eval $setvar
7791
7792 : check for length of pointer
7793 echo " "
7794 case "$ptrsize" in
7795 '')
7796         echo "Checking to see how big your pointers are..." >&4
7797         $cat >try.c <<EOCP
7798 #include <stdio.h>
7799 #$i_stdlib I_STDLIB
7800 #ifdef I_STDLIB
7801 #include <stdlib.h>
7802 #endif
7803 int main()
7804 {
7805     printf("%d\n", (int)sizeof(void *));
7806     exit(0);
7807 }
7808 EOCP
7809         set try
7810         if eval $compile_ok; then
7811                 ptrsize=`$run ./try`
7812                 echo "Your pointers are $ptrsize bytes long."
7813         else
7814                 dflt='4'
7815                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7816                 rp="What is the size of a pointer (in bytes)?"
7817                 . ./myread
7818                 ptrsize="$ans"
7819         fi
7820         ;;
7821 esac
7822 $rm_try
7823 case "$use64bitall" in
7824 "$define"|true|[yY]*)
7825         case "$ptrsize" in
7826         4)      cat <<EOM >&4
7827
7828 *** You have chosen a maximally 64-bit build,
7829 *** but your pointers are only 4 bytes wide.
7830 *** Please rerun Configure without -Duse64bitall.
7831 EOM
7832                 case "$d_quad" in
7833                 define)
7834                         cat <<EOM >&4
7835 *** Since you have quads, you could possibly try with -Duse64bitint.
7836 EOM
7837                         ;;
7838                 esac
7839                 cat <<EOM >&4
7840 *** Cannot continue, aborting.
7841
7842 EOM
7843
7844                 exit 1
7845                 ;;
7846         esac
7847         ;;
7848 esac
7849
7850 : determine whether to use malloc wrapping
7851 echo " "
7852 case "$usemallocwrap" in
7853 [yY]*|true|$define)     dflt='y' ;;
7854 [nN]*|false|$undef)     dflt='n' ;;
7855 *)      case "$usedevel" in
7856         [yY]*|true|$define)     dflt='y' ;;
7857         *) dflt='n' ;;
7858         esac
7859         ;;
7860 esac
7861 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7862 . ./myread
7863 usemallocwrap="$ans"
7864 case "$ans" in
7865 y*|true)
7866         usemallocwrap="$define" ;;
7867 *)
7868         usemallocwrap="$undef" ;;
7869 esac
7870
7871 : determine which malloc to compile in
7872 echo " "
7873 case "$usemymalloc" in
7874 [yY]*|true|$define)     dflt='y' ;;
7875 [nN]*|false|$undef)     dflt='n' ;;
7876 *)      case "$ptrsize" in
7877         4) dflt='y' ;;
7878         *) dflt='n' ;;
7879         esac
7880         if test "$useithreads" = "$define"; then dflt='n'; fi
7881         ;;
7882 esac
7883 rp="Do you wish to attempt to use the malloc that comes with $package?"
7884 . ./myread
7885 usemymalloc="$ans"
7886 case "$ans" in
7887 y*|true)
7888         usemymalloc='y'
7889         mallocsrc='malloc.c'
7890         mallocobj="malloc$_o"
7891         d_mymalloc="$define"
7892         case "$libs" in
7893         *-lmalloc*)
7894                 : Remove malloc from list of libraries to use
7895                 echo "Removing unneeded -lmalloc from library list" >&4
7896                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7897                 shift
7898                 libs="$*"
7899                 echo "libs = $libs" >&4
7900                 ;;
7901         esac
7902         ;;
7903 *)
7904         usemymalloc='n'
7905         mallocsrc=''
7906         mallocobj=''
7907         d_mymalloc="$undef"
7908         ;;
7909 esac
7910
7911 : compute the return types of malloc and free
7912 echo " "
7913 $cat >malloc.c <<END
7914 #$i_malloc I_MALLOC
7915 #$i_stdlib I_STDLIB
7916 #include <stdio.h>
7917 #include <sys/types.h>
7918 #ifdef I_MALLOC
7919 #include <malloc.h>
7920 #endif
7921 #ifdef I_STDLIB
7922 #include <stdlib.h>
7923 #endif
7924 #ifdef TRY_MALLOC
7925 void *malloc();
7926 #endif
7927 #ifdef TRY_FREE
7928 void free();
7929 #endif
7930 END
7931 case "$malloctype" in
7932 '')
7933         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7934                 malloctype='void *'
7935         else
7936                 malloctype='char *'
7937         fi
7938         ;;
7939 esac
7940 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7941
7942 case "$freetype" in
7943 '')
7944         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7945                 freetype='void'
7946         else
7947                 freetype='int'
7948         fi
7949         ;;
7950 esac
7951 echo "Your system uses $freetype free(), it would seem." >&4
7952 $rm -f malloc.[co]
7953 : determine where site specific architecture-dependent libraries go.
7954 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7955 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7956 : sitelib may have an optional trailing /share.
7957 case "$sitearch" in
7958 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7959         dflt="$dflt/$archname"
7960         ;;
7961 *)      dflt="$sitearch"
7962         ;;
7963 esac
7964 set sitearch sitearch none
7965 eval $prefixit
7966 $cat <<EOM
7967
7968 The installation process will also create a directory for
7969 architecture-dependent site-specific extensions and modules.
7970
7971 EOM
7972 fn=d~+
7973 rp='Pathname for the site-specific architecture-dependent library files?'
7974 . ./getfile
7975 prefixvar=sitearch
7976 . ./setprefixvar
7977 if $test X"$sitearch" = X"$sitelib"; then
7978         d_sitearch="$undef"
7979 else
7980         d_sitearch="$define"
7981 fi
7982
7983 : Set the vendorprefix variables
7984 $cat <<EOM
7985
7986 The installation process will also create a directory for
7987 vendor-supplied add-ons.  Vendors who supply perl with their system
7988 may find it convenient to place all vendor-supplied files in this
7989 directory rather than in the main distribution directory.  This will
7990 ease upgrades between binary-compatible maintenance versions of perl.
7991
7992 Of course you may also use these directories in whatever way you see
7993 fit.  For example, you might use them to access modules shared over a
7994 company-wide network.
7995
7996 The default answer should be fine for most people.
7997 This causes further questions about vendor add-ons to be skipped
7998 and no vendor-specific directories will be configured for perl.
7999
8000 EOM
8001 rp='Do you want to configure vendor-specific add-on directories?'
8002 case "$usevendorprefix" in
8003 define|true|[yY]*) dflt=y ;;
8004 *)      : User may have set vendorprefix directly on Configure command line.
8005         case "$vendorprefix" in
8006         ''|' ') dflt=n ;;
8007         *)      dflt=y ;;
8008         esac
8009         ;;
8010 esac
8011 . ./myread
8012 case "$ans" in
8013 [yY]*)  fn=d~+
8014         rp='Installation prefix to use for vendor-supplied add-ons?'
8015         case "$vendorprefix" in
8016         '') dflt="$prefix" ;;
8017         *)  dflt=$vendorprefix ;;
8018         esac
8019         . ./getfile
8020         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
8021         oldvendorprefix=''
8022         case "$vendorprefix" in
8023         '') ;;
8024         *)      case "$ans" in
8025                 "$prefix") ;;
8026                 *) oldvendorprefix="$prefix";;
8027                 esac
8028                 ;;
8029         esac
8030         usevendorprefix="$define"
8031         vendorprefix="$ans"
8032         vendorprefixexp="$ansexp"
8033         ;;
8034 *)      usevendorprefix="$undef"
8035         vendorprefix=''
8036         vendorprefixexp=''
8037         ;;
8038 esac
8039
8040 : Set the vendorlib variables
8041 case "$vendorprefix" in
8042 '')     d_vendorlib="$undef"
8043         vendorlib=''
8044         vendorlibexp=''
8045         ;;
8046 *)      d_vendorlib="$define"
8047         : determine where vendor-supplied modules go.
8048         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8049         case "$vendorlib" in
8050         '')
8051                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8052                 case "$installstyle" in
8053                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8054                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8055                 esac
8056                 ;;
8057         *)      dflt="$vendorlib"
8058                 ;;
8059         esac
8060         fn=d~+
8061         rp='Pathname for the vendor-supplied library files?'
8062         . ./getfile
8063         vendorlib="$ans"
8064         vendorlibexp="$ansexp"
8065         ;;
8066 esac
8067 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8068 prefixvar=vendorlib
8069 . ./installprefix
8070
8071 : Set the vendorarch variables
8072 case "$vendorprefix" in
8073 '')     d_vendorarch="$undef"
8074         vendorarch=''
8075         vendorarchexp=''
8076         ;;
8077 *)      d_vendorarch="$define"
8078         : determine where vendor-supplied architecture-dependent libraries go.
8079         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8080         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8081         : vendorlib may have an optional trailing /share.
8082         case "$vendorarch" in
8083         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8084                 dflt="$dflt/$archname"
8085                 ;;
8086         *)      dflt="$vendorarch" ;;
8087         esac
8088         fn=d~+
8089         rp='Pathname for vendor-supplied architecture-dependent files?'
8090         . ./getfile
8091         vendorarch="$ans"
8092         vendorarchexp="$ansexp"
8093         ;;
8094 esac
8095 prefixvar=vendorarch
8096 . ./installprefix
8097 if $test X"$vendorarch" = X"$vendorlib"; then
8098         d_vendorarch="$undef"
8099 else
8100         d_vendorarch="$define"
8101 fi
8102
8103 : Final catch-all directories to search
8104 $cat <<EOM
8105
8106 Lastly, you can have perl look in other directories for extensions and
8107 modules in addition to those already specified.
8108 These directories will be searched after
8109         $sitearch
8110         $sitelib
8111 EOM
8112 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8113 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8114 echo ' '
8115 case "$otherlibdirs" in
8116 ''|' ') dflt='none' ;;
8117 *)      dflt="$otherlibdirs" ;;
8118 esac
8119 $cat <<EOM
8120 Enter a colon-separated set of extra paths to include in perl's @INC
8121 search path, or enter 'none' for no extra paths.
8122
8123 EOM
8124
8125 rp='Colon-separated list of additional directories for perl to search?'
8126 . ./myread
8127 case "$ans" in
8128 ' '|''|none)    otherlibdirs=' ' ;;
8129 *)      otherlibdirs="$ans" ;;
8130 esac
8131 case "$otherlibdirs" in
8132 ' ') val=$undef ;;
8133 *)      val=$define ;;
8134 esac
8135 set d_perl_otherlibdirs
8136 eval $setvar
8137
8138 : DTrace support
8139 dflt_dtrace='/usr/sbin/dtrace'
8140 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8141
8142 cat <<EOM
8143
8144 Perl can be built to support DTrace on platforms that support it.
8145 DTrace is a diagnosis and performance analysis tool from Sun.
8146
8147 If this doesn't make any sense to you, just accept the default.
8148 EOM
8149
8150 while $test 1 ; do
8151         case "$usedtrace" in
8152         $define|true|[yY]*)
8153                 dflt='y'
8154                 ;;
8155         $undef|false|[nN]*)
8156                 dflt='n'
8157                 dflt_dtrace=""
8158                 ;;
8159         ?*)
8160                 dflt='y'
8161                 dflt_dtrace=$usedtrace
8162                 ;;
8163         *)
8164                 dflt='n'
8165                 ;;
8166         esac
8167
8168         rp='Support DTrace if available?'
8169         . ./myread
8170         case "$ans" in
8171         y|Y)    val="$define" ;;
8172         *)      val="$undef" ;;
8173         esac
8174         set usedtrace
8175         eval $setvar
8176
8177         test "X$usedtrace" != "X$define" && break
8178
8179         echo " "
8180         rp='Where is the dtrace executable?'
8181         dflt=$dflt_dtrace
8182         . ./getfile
8183         val="$ans"
8184         set dtrace
8185         eval $setvar
8186
8187         if $test -f $dtrace
8188         then
8189                 if $dtrace -h -s ../perldtrace.d \
8190                         -o perldtrace.tmp >/dev/null 2>&1 \
8191                         && rm -f perldtrace.tmp
8192                 then
8193                         echo " "
8194                         echo "Good: your $dtrace knows about the -h flag."
8195                 else
8196                         cat >&2 <<EOM
8197
8198 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8199 ***
8200 *** Your installed dtrace doesn't support the -h switch to compile a D
8201 *** program into a C header. Can't continue.
8202
8203 EOM
8204                         exit 1
8205                 fi
8206                 break;
8207         fi
8208
8209         case "$fastread" in
8210         yes)
8211                 cat >&2 <<EOM
8212
8213 *** $me:  Fatal Error:  $dtrace not found.
8214 *** Can't continue.
8215
8216 EOM
8217                 exit 1
8218                 ;;
8219         *)
8220                 echo "*** $dtrace was not found."
8221                 echo " "
8222                 ;;
8223         esac
8224 done
8225
8226 : See if we want extra modules installed
8227 echo " "
8228 case "$extras" in
8229 '') dflt='n';;
8230 *) dflt='y';;
8231 esac
8232 cat <<EOM
8233 Perl can be built with extra modules or bundles of modules which
8234 will be fetched from the CPAN and installed alongside Perl.
8235
8236 Notice that you will need access to the CPAN; either via the Internet,
8237 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8238 be asked later to configure the CPAN.pm module which will in turn do
8239 the installation of the rest of the extra modules or bundles.)
8240
8241 Notice also that if the modules require any external software such as
8242 libraries and headers (the libz library and the zlib.h header for the
8243 Compress::Zlib module, for example) you MUST have any such software
8244 already installed, this configuration process will NOT install such
8245 things for you.
8246
8247 If this doesn't make any sense to you, just accept the default '$dflt'.
8248 EOM
8249 rp='Install any extra modules (y or n)?'
8250 . ./myread
8251 case "$ans" in
8252 y|Y)
8253         cat <<EOM
8254
8255 Please list any extra modules or bundles to be installed from CPAN,
8256 with spaces between the names.  The names can be in any format the
8257 'install' command of CPAN.pm will understand.  (Answer 'none',
8258 without the quotes, to install no extra modules or bundles.)
8259 EOM
8260         rp='Extras?'
8261         dflt="$extras"
8262         . ./myread
8263         extras="$ans"
8264 esac
8265 case "$extras" in
8266 ''|'none')
8267         val=''
8268         $rm -f ../extras.lst
8269         ;;
8270 *)      echo "(Saving the list of extras for later...)"
8271         echo "$extras" > ../extras.lst
8272         val="'$extras'"
8273         ;;
8274 esac
8275 set extras
8276 eval $setvar
8277 echo " "
8278
8279 : determine where html pages for programs go
8280 set html1dir html1dir none
8281 eval $prefixit
8282 $cat <<EOM
8283
8284 If you wish to install html files for programs in $spackage, indicate
8285 the appropriate directory here.  To skip installing html files,
8286 answer "none".
8287 EOM
8288 case "$html1dir" in
8289 ''|none|$undef|' ') dflt=none ;;
8290 *) dflt=$html1dir ;;
8291 esac
8292 fn=dn+~
8293 rp="Directory for the main $spackage html pages?"
8294 . ./getfile
8295 prefixvar=html1dir
8296 . ./setprefixvar
8297 : Use ' ' for none so value is preserved next time through Configure
8298 $test X"$html1dir" = "X" && html1dir=' '
8299
8300 : determine where html pages for libraries and modules go
8301 set html3dir html3dir none
8302 eval $prefixit
8303 $cat <<EOM
8304
8305 If you wish to install html files for modules associated with $spackage,
8306 indicate the appropriate directory here.  To skip installing html files,
8307 answer "none".
8308 EOM
8309 : There is no obvious default.  If they have specified html1dir, then
8310 : try to key off that, possibly changing .../html1 into .../html3.
8311 case "$html3dir" in
8312 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8313 *) dflt=$html3dir ;;
8314 esac
8315 fn=dn+~
8316 rp="Directory for the $spackage module html pages?"
8317 . ./getfile
8318 prefixvar=html3dir
8319 . ./setprefixvar
8320 : Use ' ' for none so value is preserved next time through Configure
8321 $test X"$html3dir" = "X" && html3dir=' '
8322
8323 : determine whether to install perl also as /usr/bin/perl
8324
8325 echo " "
8326 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8327         $cat <<EOM
8328 Many scripts expect perl to be installed as /usr/bin/perl.
8329
8330 If you want to, I can install the perl you are about to compile
8331 as /usr/bin/perl (in addition to $bin/perl).
8332 EOM
8333         if test -f /usr/bin/perl; then
8334             $cat <<EOM
8335
8336 However, please note that because you already have a /usr/bin/perl,
8337 overwriting that with a new Perl would very probably cause problems.
8338 Therefore I'm assuming you don't want to do that (unless you insist).
8339
8340 EOM
8341             case "$installusrbinperl" in
8342             "$define"|[yY]*)    dflt='y';;
8343             *)                  dflt='n';;
8344             esac
8345         else
8346             $cat <<EOM
8347
8348 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8349
8350 EOM
8351             case "$installusrbinperl" in
8352             "$undef"|[nN]*)     dflt='n';;
8353             *)                  dflt='y';;
8354             esac
8355         fi
8356         rp="Do you want to install perl as /usr/bin/perl?"
8357         . ./myread
8358         case "$ans" in
8359         [yY]*)  val="$define";;
8360         *)      val="$undef" ;;
8361         esac
8362 else
8363         val="$undef"
8364 fi
8365 set installusrbinperl
8366 eval $setvar
8367
8368 : see if dlopen exists
8369 xxx_runnm="$runnm"
8370 xxx_ccflags="$ccflags"
8371 runnm=false
8372 : with g++ one needs -shared to get is-in-libc to work for dlopen
8373 case "$gccversion" in
8374 '')     ;;
8375 *Clang*)        ;;
8376 *)      case "$d_cplusplus" in
8377         "$define") ccflags="$ccflags -shared" ;;
8378         esac
8379         ;;
8380 esac
8381 set dlopen d_dlopen
8382 eval $inlibc
8383 runnm="$xxx_runnm"
8384 ccflags="$xxx_ccflags"
8385
8386 : see if this is a unistd.h system
8387 set unistd.h i_unistd
8388 eval $inhdr
8389
8390 : determine which dynamic loading, if any, to compile in
8391 echo " "
8392 dldir="ext/DynaLoader"
8393 case "$usedl" in
8394     $define|y|true)
8395         dflt='y'
8396         usedl="$define"
8397         ;;
8398     $undef|n|false)
8399         dflt='n'
8400         usedl="$undef"
8401         ;;
8402     *)
8403         dflt='n'
8404         case "$d_dlopen" in
8405             $define) dflt='y' ;;
8406         esac
8407         : Does a dl_xxx.xs file exist for this operating system
8408         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8409         ;;
8410 esac
8411 rp="Do you wish to use dynamic loading?"
8412 . ./myread
8413 usedl="$ans"
8414 bin_ELF="$undef"
8415 case "$ans" in
8416     y*) usedl="$define"
8417         case "$dlsrc" in
8418             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8419                     dflt="$dldir/dl_${osname}.xs"
8420                 elif $test "$d_dlopen" = "$define" ; then
8421                     dflt="$dldir/dl_dlopen.xs"
8422                 else
8423                     dflt=''
8424                 fi
8425                 ;;
8426             *)  dflt="$dldir/$dlsrc"
8427                 ;;
8428         esac
8429         echo "The following dynamic loading files are available:"
8430         : Can not go over to $dldir because getfile has path hard-coded in.
8431         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8432         rp="Source file to use for dynamic loading"
8433         fn="fne"
8434         gfpth="$src"
8435         . ./getfile
8436         usedl="$define"
8437         : emulate basename
8438         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8439
8440         $cat << EOM
8441
8442 Some systems may require passing special flags to $cc -c to
8443 compile modules that will be used to create a shared library.
8444 To use no flags, say "none".
8445
8446 EOM
8447         case "$cccdlflags" in
8448             '') case "$gccversion" in
8449                 '') case "$osname" in
8450                         hpux)   dflt='+z' ;;
8451                         irix*)  dflt='-KPIC' ;;
8452                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8453                         sunos)  dflt='-pic' ;;
8454                         *)      dflt='none' ;;
8455                     esac
8456                     ;;
8457                 *)  case "$osname" in
8458                         darwin) dflt='none' ;;
8459                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8460                         *)      dflt='-fpic' ;;
8461                     esac ;;
8462                 esac ;;
8463             ' ') dflt='none' ;;
8464             *)   dflt="$cccdlflags" ;;
8465         esac
8466
8467         case "$dflt" in
8468             none) dflt='' ;;
8469         esac
8470
8471         # If -Dsysroot was specified, now's the time to add it
8472         # to cccdlflags
8473         if test "X$sysroot" != X; then
8474             case "$gccversion" in
8475                 '') ;;
8476                 *)  case "$dflt" in
8477                         *sysroot*) ;;
8478                         'undef'|*)
8479                             dflt="$dflt --sysroot=$sysroot" ;;
8480                     esac
8481                     ;;
8482             esac
8483         fi
8484
8485         case "$dflt" in
8486             '') dflt='none';;
8487         esac
8488
8489         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8490         . ./myread
8491         case "$ans" in
8492             none) cccdlflags=' ' ;;
8493             *)    cccdlflags="$ans" ;;
8494         esac
8495
8496         cat << EOM
8497
8498 Some systems use ld to create libraries that can be dynamically loaded,
8499 while other systems (such as those using ELF) use $cc.
8500
8501 EOM
8502
8503 : Determine if this is ELF
8504         $cat >try.c <<EOM
8505 /* Test for whether ELF binaries are produced */
8506 #include <fcntl.h>
8507 #$i_stdlib I_STDLIB
8508 #ifdef I_STDLIB
8509 #include <stdlib.h>
8510 #endif
8511 #$i_unistd I_UNISTD
8512 #ifdef I_UNISTD
8513 #include <unistd.h>
8514 #endif
8515 int main() {
8516     char b[4];
8517     int i = open("a.out",O_RDONLY);
8518     if(i == -1)
8519         exit(1); /* fail */
8520     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8521         exit(0); /* succeed (yes, it is ELF) */
8522     exit(1); /* fail */
8523 }
8524 EOM
8525         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8526             bin_ELF="$define"
8527         fi
8528         $rm_try
8529
8530         case "$ld" in
8531             '') if $test $bin_ELF = "$define"; then
8532                     cat <<EOM
8533 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8534 EOM
8535                     dflt="$cc"
8536                 else
8537                     echo "I'll use ld to build dynamic libraries."
8538                     dflt='ld'
8539                 fi
8540                 ;;
8541             *)  dflt="$ld"
8542                 ;;
8543         esac
8544
8545         rp="What command should be used to create dynamic libraries?"
8546         . ./myread
8547         ld="$ans"
8548
8549         cat << EOM
8550
8551 Some systems may require passing special flags to $ld to create a
8552 library that can be dynamically loaded.  If your ld flags include
8553 -L/other/path options to locate libraries outside your loader's normal
8554 search path, you may need to specify those -L options here as well.  To
8555 use no flags, say "none".
8556
8557 EOM
8558         case "$lddlflags" in
8559             '') case "$osname" in
8560                     haiku) dflt='-shared' ;;
8561                     hpux) dflt='-b';
8562                           case "$gccversion" in
8563                               '') dflt="$dflt +vnocompatwarnings" ;;
8564                           esac
8565                           ;;
8566                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8567                     solaris) # See [perl #66604].
8568                             # On Solaris 11, gcc -m64 on amd64
8569                             # appears not to understand -G.  gcc versions at
8570                             # least as old as 3.4.3 support -shared, so just
8571                             # use that with Solaris 11 and later, but keep
8572                             # the old behavior for older Solaris versions.
8573                             case "$gccversion" in
8574                                 '') dflt='-G' ;;
8575                                 *)  case "$osvers" in
8576                                         2.?|2.10) dflt='-G' ;;
8577                                         *) dflt='-shared' ;;
8578                                     esac
8579                                     ;;
8580                             esac
8581                             ;;
8582                     sunos) dflt='-assert nodefinitions' ;;
8583                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8584                     *)     dflt='none' ;;
8585                 esac
8586                 ;;
8587             *) dflt="$lddlflags" ;;
8588         esac
8589
8590         : Only do this for gcc, since, for example, qcc has no concept
8591         : of --sysroot.
8592         if $test "X$sysroot" != X; then
8593             case "$gccversion" in
8594                 '') ;;
8595                 *)  dflt="$dflt --sysroot=$sysroot" ;;
8596             esac
8597         fi
8598
8599         : Try to guess additional flags to pick up local libraries.
8600         : Be careful not to append to a plain 'none'
8601         case "$dflt" in
8602             none) dflt='' ;;
8603         esac
8604         for thisflag in $ldflags; do
8605             case "$thisflag" in
8606                 -L*|-R*|-Wl,-R*)
8607                     case " $dflt " in
8608                         *" $thisflag "*) ;;
8609                         *) dflt="$dflt $thisflag" ;;
8610                     esac
8611                     ;;
8612             esac
8613         done
8614
8615         case "$dflt" in
8616             ''|' ') dflt='none' ;;
8617         esac
8618
8619         case "$ldflags" in
8620             *-fstack-protector-strong*)
8621                 case "$dflt" in
8622                     *-fstack-protector-strong*) ;; # Don't add it again
8623                     *) dflt="$dflt -fstack-protector-strong" ;;
8624                 esac
8625                 ;;
8626             *-fstack-protector*)
8627                 case "$dflt" in
8628                     *-fstack-protector*) ;; # Don't add it again
8629                     *) dflt="$dflt -fstack-protector" ;;
8630                 esac
8631                 ;;
8632         esac
8633
8634         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8635         . ./myread
8636         case "$ans" in
8637             none) lddlflags=' ' ;;
8638             *) lddlflags="$ans" ;;
8639         esac
8640
8641         cat <<EOM
8642
8643 Some systems may require passing special flags to $cc to indicate that
8644 the resulting executable will use dynamic linking.  To use no flags,
8645 say "none".
8646
8647 EOM
8648         case "$ccdlflags" in
8649             '') case "$osname" in
8650                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8651                     sunos)             dflt='none'   ;;
8652                     *)                 dflt='none'   ;;
8653                 esac ;;
8654             ' ') dflt='none' ;;
8655             *)   dflt="$ccdlflags" ;;
8656         esac
8657         rp="Any special flags to pass to $cc to use dynamic linking?"
8658         . ./myread
8659         case "$ans" in
8660             none) ccdlflags=' ' ;;
8661             *)    ccdlflags="$ans" ;;
8662         esac
8663         ;;
8664
8665     *)  usedl="$undef"
8666         ld='ld'
8667         dlsrc='dl_none.xs'
8668         lddlflags=''
8669         ccdlflags=''
8670         ;;
8671 esac
8672
8673 ld_can_script="$undef"
8674 case "$bin_ELF$usedl" in
8675     $define$define)
8676         # Abuse try.h and a.out names for neat cleanup
8677         $cat >try.c <<EOM
8678 void foo() {}
8679 void bar() {}
8680 EOM
8681         $cat >try.h <<EOM
8682 LIBTEST_42 {
8683  global:
8684   foo;
8685  local: *;
8686  };
8687 EOM
8688         if $cc $cccdlflags $ccdlflags $ccflags \
8689                $ldflags $lddlflags -o a.out try.c \
8690                -Wl,--version-script=try.h >/dev/null 2>&1 \
8691            &&  $test -s a.out ; then
8692             echo "ld supports scripting" >&4
8693             ld_can_script="$define"
8694         else
8695             echo "ld does not support scripting" >&4
8696         fi
8697         $rm_try
8698         ;;
8699 esac
8700
8701 : Do we want a shared libperl?
8702 also=''
8703 case "$usedl" in
8704 $undef)
8705         # No dynamic loading being used, so don't bother even to prompt.
8706         useshrplib='false'
8707         ;;
8708 *)      case "$useshrplib" in
8709         '')     case "$osname" in
8710                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8711                         dflt=y
8712                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8713                         ;;
8714                 *)      dflt=n
8715                         ;;
8716                 esac
8717                 ;;
8718         $define|true|[Yy]*)
8719                 dflt=y
8720                 ;;
8721         *)      dflt=n
8722                 ;;
8723         esac
8724         $cat << EOM
8725
8726 The perl executable is normally obtained by linking perlmain.c with
8727 libperl${_a}, any static extensions (usually just DynaLoader), and
8728 any other libraries needed on this system (such as -lm, etc.).  Since
8729 your system supports dynamic loading, it is probably possible to build
8730 a shared libperl.$so.  If you will have more than one executable linked
8731 to libperl.$so, this will significantly reduce the size of each
8732 executable, but it may have a noticeable effect on performance.  The
8733 default is probably sensible for your system.
8734 $also
8735
8736 EOM
8737         rp="Build a shared libperl.$so (y/n)"
8738         . ./myread
8739         case "$ans" in
8740         true|$define|[Yy]*)
8741                 useshrplib='true'  ;;
8742         *)      useshrplib='false' ;;
8743         esac
8744         ;;
8745 esac
8746
8747 case "$useshrplib" in
8748 true)
8749         case "$userelocatableinc" in
8750         true|define)
8751                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8752                 echo "See INSTALL for an explanation why that won't work." >&4
8753                 exit 4
8754                 ;;
8755         esac
8756         case "$libperl" in
8757         '')
8758                 # Figure out a good name for libperl.so.  Since it gets stored in
8759                 # a version-specific architecture-dependent library, the version
8760                 # number isn't really that important, except for making cc/ld happy.
8761                 #
8762                 # A name such as libperl.so.10.1
8763                 majmin="libperl.$so.$patchlevel.$subversion"
8764                 # A name such as libperl.so.100
8765                 majonly=`echo $patchlevel $subversion |
8766                         $awk '{printf "%d%02d", $1, $2}'`
8767                 majonly=libperl.$so.$majonly
8768                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8769                 # rely on figuring it out from the naming of libc.
8770                 case "${osname}${osvers}" in
8771                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8772                         dflt=libperl.$so
8773                         ;;
8774                 cygwin*) # ld links now against the dll directly
8775                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8776                         majonly=`echo $patchlevel $subversion |
8777                                 $awk '{printf "%03d%03d", $1, $2}'`
8778                         majonly=cygperl5.$majonly.$so
8779                         dflt=$majmin
8780                         ;;
8781                 *)      # Try to guess based on whether libc has major.minor.
8782                         case "$libc" in
8783                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8784                         *libc.$so.[0-9]*) dflt=$majonly ;;
8785                         *)      dflt=libperl.$so ;;
8786                         esac
8787                         ;;
8788                 esac
8789                 ;;
8790         *)      dflt=$libperl
8791                 ;;
8792         esac
8793         cat << EOM
8794
8795 I need to select a good name for the shared libperl.  If your system uses
8796 library names with major and minor numbers, then you might want something
8797 like $majmin.  Alternatively, if your system uses a single version
8798 number for shared libraries, then you might want to use $majonly.
8799 Or, your system might be quite happy with a simple libperl.$so.
8800
8801 Since the shared libperl will get installed into a version-specific
8802 architecture-dependent directory, the version number of the shared perl
8803 library probably isn't important, so the default should be o.k.
8804
8805 EOM
8806         rp='What name do you want to give to the shared libperl?'
8807         . ./myread
8808         libperl=$ans
8809         echo "Ok, I'll use $libperl"
8810         ;;
8811 *)
8812         libperl="libperl${_a}"
8813         ;;
8814 esac
8815
8816 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8817 case "$shrpdir" in
8818 '') ;;
8819 *)      $cat >&4 <<EOM
8820 WARNING:  Use of the shrpdir variable for the installation location of
8821 the shared $libperl is not supported.  It was never documented and
8822 will not work in this version.  Let me (https://github.com/Perl/perl5/issues)
8823 know of any problems this may cause.
8824
8825 EOM
8826         case "$shrpdir" in
8827         "$archlibexp/CORE")
8828                 $cat >&4 <<EOM
8829 But your current setting of $shrpdir is
8830 the default anyway, so it's harmless.
8831 EOM
8832                 ;;
8833         *)
8834                 $cat >&4 <<EOM
8835 Further, your current attempted setting of $shrpdir
8836 conflicts with the value of $archlibexp/CORE
8837 that installperl will use.
8838 EOM
8839                 ;;
8840         esac
8841         ;;
8842 esac
8843
8844 # How will the perl executable find the installed shared $libperl?
8845 # Add $xxx to ccdlflags.
8846 # If we can't figure out a command-line option, use $shrpenv to
8847 # set env LD_RUN_PATH.  The main perl makefile uses this.
8848 shrpdir=$archlibexp/CORE
8849 xxx=''
8850 tmp_shrpenv=''
8851 if "$useshrplib"; then
8852     case "$osname" in
8853         aix)
8854                 # We'll set it in Makefile.SH...
8855                 ;;
8856         solaris)
8857                 xxx="-R $shrpdir"
8858                 ;;
8859         freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8860                 xxx="-Wl,-R$shrpdir"
8861                 ;;
8862         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8863                 xxx="-Wl,-rpath,$shrpdir"
8864                 ;;
8865         hpux*)
8866                 # hpux doesn't like the default, either.
8867                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8868                 ;;
8869         cygwin)
8870                 # cygwin needs only ldlibpth
8871                 ;;
8872         *)
8873                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8874                 ;;
8875         esac
8876         case "$xxx" in
8877         '') ;;
8878         *)
8879                 # Only add $xxx if it isn't already in ccdlflags.
8880                 case " $ccdlflags " in
8881                 *" $xxx "*)     ;;
8882                 *)      ccdlflags="$ccdlflags $xxx"
8883                         cat <<EOM >&4
8884
8885 Adding $xxx to the flags
8886 passed to $ld so that the perl executable will find the
8887 installed shared $libperl.
8888
8889 EOM
8890                         ;;
8891                 esac
8892                 ;;
8893         esac
8894 fi
8895 # Fix ccdlflags in AIX for building external extensions.
8896 # (For building Perl itself bare -bE:perl.exp is needed,
8897 #  Makefile.SH takes care of this.)
8898 case "$osname" in
8899 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8900 esac
8901 # Respect a hint or command-line value.
8902 case "$shrpenv" in
8903 '') shrpenv="$tmp_shrpenv" ;;
8904 esac
8905 case "$ldlibpthname" in
8906 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8907 none)   ldlibpthname='' ;;
8908 esac
8909
8910 : determine where manual pages are on this system
8911 echo " "
8912 case "$sysman" in
8913 '')
8914         syspath='/usr/share/man/man1 /usr/man/man1'
8915         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8916         syspath="$syspath /usr/man/u_man/man1"
8917         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8918         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8919         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8920         sysman=`./loc . /usr/man/man1 $syspath`
8921         ;;
8922 esac
8923 if $test -d "$sysman"; then
8924         echo "System manual is in $sysman." >&4
8925 else
8926         echo "Could not find manual pages in source form." >&4
8927 fi
8928
8929 : determine where manual pages go
8930 set man1dir man1dir none
8931 eval $prefixit
8932 $cat <<EOM
8933
8934 $spackage has manual pages available in source form.
8935 EOM
8936 case "$nroff" in
8937 nroff)
8938         echo "However, you don't have nroff, so they're probably useless to you."
8939         case "$man1dir" in
8940         '') man1dir="none";;
8941         esac;;
8942 esac
8943 echo "If you don't want the manual sources installed, answer 'none'."
8944 case "$man1dir" in
8945 ' ') dflt=none
8946         ;;
8947 '')
8948         lookpath="$prefixexp/share/man/man1"
8949         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8950         lookpath="$lookpath $prefixexp/man/p_man/man1"
8951         lookpath="$lookpath $prefixexp/man/u_man/man1"
8952         lookpath="$lookpath $prefixexp/man/man.1"
8953         case "$sysman" in
8954         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8955         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8956         esac
8957         set dflt
8958         eval $prefixup
8959         ;;
8960 *)  dflt="$man1dir"
8961         ;;
8962 esac
8963 echo " "
8964 fn=dn+~
8965 rp="Where do the main $spackage manual pages (source) go?"
8966 . ./getfile
8967 if $test "X$man1direxp" != "X$ansexp"; then
8968         installman1dir=''
8969 fi
8970 prefixvar=man1dir
8971 . ./setprefixvar
8972
8973 case "$man1dir" in
8974 '')     man1dir=' '
8975         installman1dir='';;
8976 esac
8977
8978 : What suffix to use on installed man pages
8979
8980 case "$man1dir" in
8981 ' ')
8982         man1ext='0'
8983         ;;
8984 *)
8985         rp="What suffix should be used for the main $spackage man pages?"
8986         case "$man1ext" in
8987         '')     case "$man1dir" in
8988                 *1)  dflt=1 ;;
8989                 *1p) dflt=1p ;;
8990                 *1pm) dflt=1pm ;;
8991                 *l) dflt=l;;
8992                 *n) dflt=n;;
8993                 *o) dflt=o;;
8994                 *p) dflt=p;;
8995                 *C) dflt=C;;
8996                 *L) dflt=L;;
8997                 *L1) dflt=L1;;
8998                 *) dflt=1;;
8999                 esac
9000                 ;;
9001         *)      dflt="$man1ext";;
9002         esac
9003         . ./myread
9004         man1ext="$ans"
9005         ;;
9006 esac
9007
9008 : see if we can have long filenames
9009 echo " "
9010 first=123456789abcdef
9011 $rm -f $first
9012 if (echo hi >$first) 2>/dev/null; then
9013         if $test -f 123456789abcde; then
9014                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
9015                 val="$undef"
9016         else
9017                 echo 'You can have filenames longer than 14 characters.'>&4
9018                 val="$define"
9019         fi
9020 else
9021         $cat <<'EOM'
9022 You can't have filenames longer than 14 chars.
9023 You can't even think about them!
9024 EOM
9025         val="$undef"
9026 fi
9027 set d_flexfnam
9028 eval $setvar
9029 $rm -rf 123456789abcde*
9030
9031 : determine where library module manual pages go
9032 set man3dir man3dir none
9033 eval $prefixit
9034 $cat <<EOM
9035
9036 $spackage has manual pages for many of the library modules.
9037 EOM
9038
9039 case "$nroff" in
9040 nroff)
9041         $cat <<'EOM'
9042 However, you don't have nroff, so they're probably useless to you.
9043 EOM
9044         case "$man3dir" in
9045         '') man3dir="none";;
9046         esac;;
9047 esac
9048
9049 case "$d_flexfnam" in
9050 undef)
9051         $cat <<'EOM'
9052 However, your system can't handle the long file names like File::Basename.3.
9053 EOM
9054         case "$man3dir" in
9055         '') man3dir="none";;
9056         esac;;
9057 esac
9058
9059 echo "If you don't want the manual sources installed, answer 'none'."
9060 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9061 case "$man3dir" in
9062 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9063         if $test -d "$privlib/man/man3"; then
9064                 cat <<EOM >&4
9065
9066 WARNING:  Previous versions of perl installed man3 pages into
9067 $privlib/man/man3.  This version will suggest a
9068 new default of $dflt.
9069 EOM
9070                 tdflt=$dflt
9071                 dflt='n'
9072                 rp='Do you wish to preserve the old behavior?(y/n)'
9073                 . ./myread
9074                 case "$ans" in
9075                 y*) dflt="$privlib/man/man3" ;;
9076                 *)  dflt=$tdflt ;;
9077                 esac
9078     fi
9079         ;;
9080 *)      dflt="$man3dir" ;;
9081 esac
9082 case "$dflt" in
9083 ' ') dflt=none ;;
9084 esac
9085 echo " "
9086 fn=dn+~
9087 rp="Where do the $package library man pages (source) go?"
9088 . ./getfile
9089 prefixvar=man3dir
9090 . ./setprefixvar
9091
9092 case "$man3dir" in
9093 '')     man3dir=' '
9094         installman3dir='';;
9095 esac
9096
9097 : What suffix to use on installed man pages
9098 case "$man3dir" in
9099 ' ')
9100         man3ext='0'
9101         ;;
9102 *)
9103         rp="What suffix should be used for the $package library man pages?"
9104         case "$man3ext" in
9105         '')     case "$man3dir" in
9106                 *3)  dflt=3 ;;
9107                 *3p) dflt=3p ;;
9108                 *3pm) dflt=3pm ;;
9109                 *l) dflt=l;;
9110                 *n) dflt=n;;
9111                 *o) dflt=o;;
9112                 *p) dflt=p;;
9113                 *C) dflt=C;;
9114                 *L) dflt=L;;
9115                 *L3) dflt=L3;;
9116                 *) dflt=3;;
9117                 esac
9118                 ;;
9119         *)      dflt="$man3ext";;
9120         esac
9121         . ./myread
9122         man3ext="$ans"
9123         ;;
9124 esac
9125
9126 : see if we have to deal with yellow pages, now NIS.
9127 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9128         case "$hostcat" in
9129         nidump*) ;;
9130         *)
9131                 case "$hostcat" in
9132                 *ypcat*) dflt=y;;
9133                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9134                                 dflt=y
9135                         else
9136                                 dflt=n
9137                         fi;;
9138                 *) dflt=n;;
9139                 esac
9140                 echo " "
9141                 rp='Are you getting the hosts file via yellow pages?'
9142                 . ./myread
9143                 case "$ans" in
9144                 y*) hostcat='ypcat hosts';;
9145                 *) hostcat='cat /etc/hosts';;
9146                 esac
9147                 ;;
9148         esac
9149 fi
9150 case "$hostcat" in
9151 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9152 esac
9153 case "$groupcat" in
9154 '') test -f /etc/group && groupcat='cat /etc/group';;
9155 esac
9156 case "$passcat" in
9157 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9158 esac
9159
9160 : now get the host name
9161 echo " "
9162 echo "Figuring out host name..." >&4
9163 case "$myhostname" in
9164 '') cont=true
9165         echo 'Maybe "hostname" will work...'
9166         if tans=`sh -c hostname 2>&1` ; then
9167                 myhostname=$tans
9168                 phostname=hostname
9169                 cont=''
9170         fi
9171         ;;
9172 *) cont='';;
9173 esac
9174 if $test "$cont"; then
9175         if ./xenix; then
9176                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9177                 if tans=`cat /etc/systemid 2>&1` ; then
9178                         myhostname=$tans
9179                         phostname='cat /etc/systemid'
9180                         echo "Whadyaknow.  Xenix always was a bit strange..."
9181                         cont=''
9182                 fi
9183         elif $test -r /etc/systemid; then
9184                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9185         fi
9186 fi
9187 if $test "$cont"; then
9188         echo 'No, maybe "uuname -l" will work...'
9189         if tans=`sh -c 'uuname -l' 2>&1` ; then
9190                 myhostname=$tans
9191                 phostname='uuname -l'
9192         else
9193                 echo 'Strange.  Maybe "uname -n" will work...'
9194                 if tans=`sh -c 'uname -n' 2>&1` ; then
9195                         myhostname=$tans
9196                         phostname='uname -n'
9197                 else
9198                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9199                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9200                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9201                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9202                         else
9203                                 case "$myhostname" in
9204                                 '') echo "Does this machine have an identity crisis or something?"
9205                                         phostname='';;
9206                                 *)
9207                                         echo "Well, you said $myhostname before..."
9208                                         phostname='echo $myhostname';;
9209                                 esac
9210                         fi
9211                 fi
9212         fi
9213 fi
9214 case "$myhostname" in
9215 '') myhostname=noname ;;
9216 esac
9217 : you do not want to know about this
9218 set $myhostname
9219 myhostname=$1
9220
9221 : verify guess
9222 if $test "$myhostname" ; then
9223         dflt=y
9224         rp='Your host name appears to be "'$myhostname'".'" Right?"
9225         . ./myread
9226         case "$ans" in
9227         y*) ;;
9228         *) myhostname='';;
9229         esac
9230 fi
9231
9232 : bad guess or no guess
9233 while $test "X$myhostname" = X ; do
9234         dflt=''
9235         rp="Please type the (one word) name of your host:"
9236         . ./myread
9237         myhostname="$ans"
9238 done
9239
9240 : translate upper to lower if necessary
9241 case "$myhostname" in
9242 *[A-Z]*)
9243         echo "(Normalizing case in your host name)"
9244         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9245         ;;
9246 esac
9247
9248 case "$myhostname" in
9249 *.*)
9250         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9251         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9252         echo "(Trimming domain name from host name--host name is now $myhostname)"
9253         ;;
9254 *) case "$mydomain" in
9255         '')
9256                 {
9257                         test "X$hostcat" = "Xypcat hosts" &&
9258                         ypmatch "$myhostname" hosts 2>/dev/null |\
9259                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9260                         $test -s hosts
9261                 } || {
9262                         test "X$hostcat" != "X" &&
9263                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9264                                         /[       ]$myhostname[  . ]/p" > hosts
9265                 }
9266                 tmp_re="[       . ]"
9267                 if $test -f hosts; then
9268                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9269                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9270                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9271                                 hosts | $sort | $uniq | \
9272                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9273                         case `$echo X$dflt` in
9274                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9275                                 dflt=.
9276                                 ;;
9277                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9278                                 ;;
9279                         esac
9280                 else
9281                         echo "(I cannot locate a hosts database anywhere)"
9282                         dflt=.
9283                 fi
9284                 case "$dflt" in
9285                 .)
9286                         tans=`./loc resolv.conf X /etc /usr/etc`
9287                         if $test -f "$tans"; then
9288                                 echo "(Attempting domain name extraction from $tans)"
9289                                 dflt=.`$sed -n -e 's/   / /g' \
9290                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9291                                   -e 1q 2>/dev/null`
9292                                 case "$dflt" in
9293                                 .) dflt=.`$sed -n -e 's/        / /g' \
9294                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9295                                      -e 1q 2>/dev/null`
9296                                         ;;
9297                                 esac
9298                         fi
9299                         ;;
9300                 esac
9301                 case "$dflt" in
9302                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9303                         dflt=.`sh -c domainname 2>/dev/null`
9304                         case "$dflt" in
9305                         '') dflt='.';;
9306                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9307                         esac
9308                         ;;
9309                 esac
9310                 case "$dflt$osname" in
9311                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9312                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9313                         ;;
9314                 esac
9315                 case "$dflt" in
9316                 .) echo "(Lost all hope -- silly guess then)"
9317                         dflt='.nonet'
9318                         ;;
9319                 esac
9320                 $rm -f hosts
9321                 ;;
9322         *) dflt="$mydomain";;
9323         esac;;
9324 esac
9325 echo " "
9326 rp="What is your domain name?"
9327 . ./myread
9328 tans="$ans"
9329 case "$ans" in
9330 '') ;;
9331 .*) ;;
9332 *) tans=".$tans";;
9333 esac
9334 mydomain="$tans"
9335
9336 : translate upper to lower if necessary
9337 case "$mydomain" in
9338 *[A-Z]*)
9339         echo "(Normalizing case in your domain name)"
9340         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9341         ;;
9342 esac
9343
9344 : a little sanity check here
9345 case "$phostname" in
9346 '') ;;
9347 *)
9348         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9349         $myhostname$mydomain|$myhostname) ;;
9350         *)
9351                 case "$phostname" in
9352                 sed*)
9353                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9354                         ;;
9355                 *)
9356                         echo "(That doesn't agree with your $phostname command, by the way.)"
9357                         ;;
9358                 esac
9359         ;;
9360         esac
9361         ;;
9362 esac
9363
9364 : determine the e-mail address of the user who is running us
9365 $cat <<EOM
9366
9367 I need to get your e-mail address in Internet format if possible, i.e.
9368 something like user@host.domain. Please answer accurately since I have
9369 no easy means to double check it. The default value provided below
9370 is most probably close to reality but may not be valid from outside
9371 your organization...
9372
9373 EOM
9374 cont=x
9375 while test "$cont"; do
9376         case "$MAILDOMAIN" in
9377         '')
9378                 if $test -s /etc/mailname; then
9379                         maildomain=`$cat /etc/mailname`
9380                 else
9381                         maildomain="$myhostname$mydomain"
9382                 fi
9383                 ;;
9384         *)  maildomain="$MAILDOMAIN";;
9385         esac
9386         case "$cf_email" in
9387         '') dflt="$cf_by@$maildomain";;
9388         *)  dflt="$cf_email";;
9389         esac
9390         rp='What is your e-mail address?'
9391         . ./myread
9392         cf_email="$ans"
9393         case "$cf_email" in
9394         *@*.*) cont='' ;;
9395         *)
9396                 rp='Address does not look like an Internet one.  Use it anyway?'
9397                 case "$fastread" in
9398                 yes) dflt=y ;;
9399                 *) dflt=n ;;
9400                 esac
9401                 . ./myread
9402                 case "$ans" in
9403                 y*) cont='' ;;
9404                 *) echo " " ;;
9405                 esac
9406                 ;;
9407         esac
9408 done
9409
9410 : Ask e-mail of administrator
9411 $cat <<EOM
9412
9413 If you or somebody else will be maintaining perl at your site, please
9414 fill in the correct e-mail address here so that they may be contacted
9415 if necessary. You may enter "none" for no administrator.
9416
9417 EOM
9418 case "$perladmin" in
9419 '') dflt="$cf_email";;
9420 *) dflt="$perladmin";;
9421 esac
9422 rp='Perl administrator e-mail address'
9423 . ./myread
9424 perladmin="$ans"
9425
9426 : determine whether to use a version number suffix for installed binaries
9427 echo " "
9428 $cat <<EOM
9429 Do you want to use a version number suffix for installed binaries? This
9430 will install 'perl$version' instead of 'perl', and likewise for other
9431 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9432 to be installed side-by-side. Unless you are a developer, you probably
9433 do *not* want to do this.
9434 EOM
9435 case "$versiononly" in
9436 "$define"|[Yy]*|true) dflt='y' ;;
9437 *) dflt='n';
9438 esac
9439 rp="Do you want to use a version number suffix for installed binaries?"
9440 . ./myread
9441 case "$ans" in
9442 [yY]*)  val="$define";;
9443 *)      val="$undef" ;;
9444 esac
9445 set versiononly
9446 eval $setvar
9447
9448 case "$versiononly" in
9449 "$define") inc_version_list=''
9450            inc_version_list_init=0
9451            ;;
9452 esac
9453
9454 : figure out how to guarantee perl startup
9455 : XXX Note that this currently takes advantage of the bug that binexp ignores
9456 :     the Configure -Dinstallprefix setting, which in turn means that under
9457 :     relocatable @INC, initialinstalllocation is what binexp started as.
9458 case "$startperl" in
9459 '')
9460         case "$sharpbang" in
9461         *!)
9462                 $cat <<EOH
9463
9464 I can use the #! construct to start perl on your system. This will
9465 make startup of perl scripts faster, but may cause problems if you
9466 want to share those scripts and perl is not in a standard place
9467 ($initialinstalllocation/perl) on all your platforms. The alternative
9468 is to force a shell by starting the script with a single ':' character.
9469
9470 EOH
9471                 case "$versiononly" in
9472                 "$define")      dflt="$initialinstalllocation/perl$version";;
9473                 *)              dflt="$initialinstalllocation/perl";;
9474                 esac
9475                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9476                 . ./myread
9477                 case "$ans" in
9478                 none)   startperl=": # use perl";;
9479                 *)      startperl="#!$ans"
9480                         if $test 30 -lt `echo "$ans" | wc -c`; then
9481                                 $cat >&4 <<EOM
9482
9483 WARNING:  Some systems limit the #! command to 32 characters.
9484 If you experience difficulty running Perl scripts with #!, try
9485 installing Perl in a directory with a shorter pathname.
9486
9487 EOM
9488                         fi ;;
9489                 esac
9490                 ;;
9491         *) startperl=": # use perl"
9492                 ;;
9493         esac
9494         ;;
9495 esac
9496 echo "I'll use $startperl to start perl scripts."
9497
9498 : figure best path for perl in scripts
9499 case "$perlpath" in
9500 '')
9501         case "$versiononly" in
9502         "$define")      perlpath="$initialinstalllocation/perl$version";;
9503         *)              perlpath="$initialinstalllocation/perl";;
9504         esac
9505         case "$startperl" in
9506         *!*) ;;
9507         *)
9508                 $cat <<EOH
9509
9510 I will use the "eval 'exec'" idiom to start Perl on your system.
9511 I can use the full path of your Perl binary for this purpose, but
9512 doing so may cause problems if you want to share those scripts and
9513 Perl is not always in a standard place ($initialinstalllocation/perl).
9514
9515 EOH
9516                 dflt="$initialinstalllocation/perl"
9517                 rp="What path shall I use in \"eval 'exec'\"?"
9518                 . ./myread
9519                 perlpath="$ans"
9520                 ;;
9521         esac
9522         ;;
9523 esac
9524 case "$startperl" in
9525 *!*)    ;;
9526 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9527 esac
9528
9529 : determine where public executable scripts go
9530 set scriptdir scriptdir
9531 eval $prefixit
9532 case "$scriptdir" in
9533 '')
9534         dflt="$bin"
9535         : guess some guesses
9536         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9537         $test -d /usr/share/bin     && dflt=/usr/share/bin
9538         $test -d /usr/local/script  && dflt=/usr/local/script
9539         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9540         $test -d $prefixexp/script  && dflt=$prefixexp/script
9541         set dflt
9542         eval $prefixup
9543         ;;
9544 *)  dflt="$scriptdir"
9545         ;;
9546 esac
9547 $cat <<EOM
9548
9549 Some installations have a separate directory just for executable scripts so
9550 that they can mount it across multiple architectures but keep the scripts in
9551 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9552 Or you might just lump your scripts in with all your other executables.
9553
9554 EOM
9555 fn=d~
9556 rp='Where do you keep publicly executable scripts?'
9557 . ./getfile
9558 if $test "X$ansexp" != "X$scriptdirexp"; then
9559         installscript=''
9560 fi
9561 installscriptdir=''
9562 prefixvar=scriptdir
9563 . ./setprefixvar
9564 : A little fix up for an irregularly named variable.
9565 installscript="$installscriptdir"
9566
9567 : determine where add-on public executables go
9568 case "$sitebin" in
9569 '')     dflt=$siteprefix/bin ;;
9570 *)      dflt=$sitebin ;;
9571 esac
9572 fn=d~
9573 rp='Pathname where the add-on public executables should be installed?'
9574 . ./getfile
9575 prefixvar=sitebin
9576 . ./setprefixvar
9577
9578 : determine where add-on html pages go
9579 : There is no standard location, so try to copy the previously-selected
9580 : directory structure for the core html pages.
9581 case "$sitehtml1dir" in
9582 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9583 *)     dflt=$sitehtml1dir ;;
9584 esac
9585 case "$dflt" in
9586 ''|' ') dflt=none ;;
9587 esac
9588 fn=dn+~
9589 rp='Pathname where the site-specific html pages should be installed?'
9590 . ./getfile
9591 prefixvar=sitehtml1dir
9592 . ./setprefixvar
9593
9594 : determine where add-on library html pages go
9595 : There is no standard location, so try to copy the previously-selected
9596 : directory structure for the core html pages.
9597 case "$sitehtml3dir" in
9598 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9599 *)     dflt=$sitehtml3dir ;;
9600 esac
9601 case "$dflt" in
9602 ''|' ') dflt=none ;;
9603 esac
9604 fn=dn+~
9605 rp='Pathname where the site-specific library html pages should be installed?'
9606 . ./getfile
9607 prefixvar=sitehtml3dir
9608 . ./setprefixvar
9609
9610 : determine where add-on manual pages go
9611 case "$siteman1dir" in
9612 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9613 *)      dflt=$siteman1dir ;;
9614 esac
9615 case "$dflt" in
9616 ''|' ') dflt=none ;;
9617 esac
9618 fn=dn+~
9619 rp='Pathname where the site-specific manual pages should be installed?'
9620 . ./getfile
9621 prefixvar=siteman1dir
9622 . ./setprefixvar
9623
9624 : determine where add-on library man pages go
9625 case "$siteman3dir" in
9626 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9627 *)      dflt=$siteman3dir ;;
9628 esac
9629 case "$dflt" in
9630 ''|' ') dflt=none ;;
9631 esac
9632 fn=dn+~
9633 rp='Pathname where the site-specific library manual pages should be installed?'
9634 . ./getfile
9635 prefixvar=siteman3dir
9636 . ./setprefixvar
9637
9638 : determine where add-on public executable scripts go
9639 case "$sitescript" in
9640 '')     dflt=$siteprefix/script
9641         $test -d $dflt || dflt=$sitebin ;;
9642 *)  dflt="$sitescript" ;;
9643 esac
9644 fn=d~+
9645 rp='Pathname where add-on public executable scripts should be installed?'
9646 . ./getfile
9647 prefixvar=sitescript
9648 . ./setprefixvar
9649
9650 : see if backtrace exists
9651 set backtrace d_backtrace
9652 eval $inlibc
9653
9654 : Check if C backtrace is actually supported.
9655 case "$usecbacktrace" in
9656   "") usecbacktrace=$undef ;;
9657   [yY]*|true|$define)
9658     case "$d_backtrace" in
9659       [yY]*|true|$define)
9660         ;;
9661       *)
9662         echo "This system does not support backtrace" >&4
9663         usecbacktrace=$undef
9664         ;;
9665       esac
9666     ;;
9667   esac
9668
9669 : Check if faststdio is requested and available
9670 case "$usefaststdio" in
9671 $define|true|[yY]*|'')
9672         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9673         case "$xversion" in
9674         [68])   dflt='y' ;;
9675         *)      dflt='n' ;;
9676         esac
9677         ;;
9678 *) dflt='n';;
9679 esac
9680 cat <<EOM
9681
9682 Perl can be built to use 'fast stdio', which means using the stdio
9683 library but also directly manipulating the stdio buffers to enable
9684 faster I/O.  Using stdio is better for backward compatibility (especially
9685 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9686 interface has been preferred instead of stdio.
9687
9688 If this doesn't make any sense to you, just accept the default '$dflt'.
9689 EOM
9690 rp='Use the "fast stdio" if available?'
9691 . ./myread
9692 case "$ans" in
9693 y|Y)    val="$define" ;;
9694 *)      val="$undef" ;;
9695 esac
9696 set usefaststdio
9697 eval $setvar
9698
9699 : define an is-a-typedef? function
9700 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9701 case "$inclist" in
9702 "") inclist="sys/types.h";;
9703 esac;
9704 eval "varval=\$$var";
9705 case "$varval" in
9706 "")
9707         $rm -f temp.c;
9708         for inc in $inclist; do
9709                 echo "#include <$inc>" >>temp.c;
9710         done;
9711         echo "#ifdef $type" >> temp.c;
9712         echo "printf(\"We have $type\");" >> temp.c;
9713         echo "#endif" >> temp.c;
9714         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9715         if $contains $type temp.E >/dev/null 2>&1; then
9716                 eval "$var=\$type";
9717         else
9718                 eval "$var=\$def";
9719         fi;
9720         $rm -f temp.?;;
9721 *) eval "$var=\$varval";;
9722 esac'
9723
9724 : define an is-a-typedef? function that prompts if the type is not available.
9725 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9726 case "$inclist" in
9727 "") inclist="sys/types.h";;
9728 esac;
9729 eval "varval=\$$var";
9730 case "$varval" in
9731 "")
9732         $rm -f temp.c;
9733         for inc in $inclist; do
9734                 echo "#include <$inc>" >>temp.c;
9735         done;
9736         echo "#ifdef $type" >> temp.c;
9737         echo "printf(\"We have $type\");" >> temp.c;
9738         echo "#endif" >> temp.c;
9739         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9740         echo " " ;
9741         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9742         if $contains $type temp.E >/dev/null 2>&1; then
9743                 echo "$type found." >&4;
9744                 eval "$var=\$type";
9745         else
9746                 echo "$type NOT found." >&4;
9747                 dflt="$def";
9748                 . ./myread ;
9749                 eval "$var=\$ans";
9750         fi;
9751         $rm -f temp.?;;
9752 *) eval "$var=\$varval";;
9753 esac'
9754
9755 : see what type lseek is declared as in the kernel
9756 rp="What is the type used for lseek's offset on this system?"
9757 set off_t lseektype long stdio.h sys/types.h
9758 eval $typedef_ask
9759
9760 echo " "
9761 echo "Checking to see how big your file offsets are..." >&4
9762 $cat >try.c <<EOCP
9763 #include <sys/types.h>
9764 #include <stdio.h>
9765 int main()
9766 {
9767     printf("%d\n", (int)sizeof($lseektype));
9768     return(0);
9769 }
9770 EOCP
9771 set try
9772 if eval $compile_ok; then
9773         lseeksize=`$run ./try`
9774         echo "Your file offsets are $lseeksize bytes long."
9775 else
9776         dflt=$longsize
9777         echo " "
9778         echo "(I can't seem to compile the test program.  Guessing...)"
9779         rp="What is the size of your file offsets (in bytes)?"
9780         . ./myread
9781         lseeksize="$ans"
9782 fi
9783 $rm_try
9784
9785 : see what type file positions are declared as in the library
9786 rp="What is the type for file position used by fsetpos()?"
9787 set fpos_t fpostype long stdio.h sys/types.h
9788 eval $typedef_ask
9789
9790 : Check size for Fpos_t
9791 echo " "
9792 case "$fpostype" in
9793 *_t) zzz="$fpostype"    ;;
9794 *)   zzz="fpos_t"       ;;
9795 esac
9796 echo "Checking the size of $zzz..." >&4
9797 cat > try.c <<EOCP
9798 #include <sys/types.h>
9799 #include <stdio.h>
9800 #$i_stdlib I_STDLIB
9801 #ifdef I_STDLIB
9802 #include <stdlib.h>
9803 #endif
9804 int main() {
9805     printf("%d\n", (int)sizeof($fpostype));
9806     exit(0);
9807 }
9808 EOCP
9809 set try
9810 if eval $compile_ok; then
9811         yyy=`$run ./try`
9812         case "$yyy" in
9813         '')     fpossize=4
9814                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9815                 ;;
9816         *)      fpossize=$yyy
9817                 echo "Your $zzz is $fpossize bytes long."
9818                 ;;
9819         esac
9820 else
9821         dflt="$longsize"
9822         echo " " >&4
9823         echo "(I can't compile the test program.  Guessing...)" >&4
9824         rp="What is the size of your file positions (in bytes)?"
9825         . ./myread
9826         fpossize="$ans"
9827 fi
9828
9829 : Check for large file support
9830 # Backward compatibility (uselfs is deprecated).
9831 case "$uselfs" in
9832 "$define"|true|[yY]*)
9833         cat <<EOM >&4
9834
9835 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9836 EOM
9837         uselargefiles="$define"
9838         ;;
9839 esac
9840
9841 case "$lseeksize:$fpossize" in
9842 8:8) cat <<EOM
9843
9844 You can have files larger than 2 gigabytes.
9845 EOM
9846    val="$define" ;;
9847 *)    case "$uselargefiles" in
9848    "$undef"|false|[nN]*) dflt='n' ;;
9849    *)   dflt='y' ;;
9850    esac
9851    cat <<EOM
9852
9853 Perl can be built to understand large files (files larger than 2 gigabytes)
9854 on some systems.  To do so, Configure can be run with -Duselargefiles.
9855
9856 If this doesn't make any sense to you, just accept the default '$dflt'.
9857 EOM
9858    rp='Try to understand large files, if available?'
9859    . ./myread
9860    case "$ans" in
9861    y|Y) val="$define" ;;
9862    *)   val="$undef"  ;;
9863    esac
9864    ;;
9865 esac
9866 set uselargefiles
9867 eval $setvar
9868 : Look for a hint-file generated 'call-back-unit'.  If the
9869 : user has specified that a large files perl is to be built,
9870 : we may need to set or change some other defaults.
9871 if $test -f uselargefiles.cbu; then
9872         echo "Your platform has some specific hints regarding large file builds, using them..."
9873         . ./uselargefiles.cbu
9874 fi
9875 case "$uselargefiles" in
9876 "$define")
9877         if $test -f uselargefiles.cbu; then
9878                 echo " "
9879                 echo "Rechecking to see how big your file offsets are..." >&4
9880                 $cat >try.c <<EOCP
9881 #include <sys/types.h>
9882 #include <stdio.h>
9883 int main()
9884 {
9885     printf("%d\n", (int)sizeof($lseektype));
9886     return(0);
9887 }
9888 EOCP
9889                 set try
9890                 if eval $compile_ok; then
9891                         lseeksize=`$run ./try`
9892                         $echo "Your file offsets are now $lseeksize bytes long."
9893                 else
9894                         dflt="$lseeksize"
9895                         echo " "
9896                         echo "(I can't seem to compile the test program.  Guessing...)"
9897                         rp="What is the size of your file offsets (in bytes)?"
9898                         . ./myread
9899                         lseeksize="$ans"
9900                 fi
9901                 case "$fpostype" in
9902                 *_t) zzz="$fpostype"    ;;
9903                 *)   zzz="fpos_t"       ;;
9904                 esac
9905                 $echo $n "Rechecking the size of $zzz...$c" >&4
9906                 $cat > try.c <<EOCP
9907 #include <sys/types.h>
9908 #include <stdio.h>
9909 #$i_stdlib I_STDLIB
9910 #ifdef I_STDLIB
9911 #include <stdlib.h>
9912 #endif
9913 int main() {
9914     printf("%d\n", (int)sizeof($fpostype));
9915     return(0);
9916 }
9917 EOCP
9918                 set try
9919                 if eval $compile_ok; then
9920                         yyy=`$run ./try`
9921                         dflt="$lseeksize"
9922                         case "$yyy" in
9923                         '')     echo " "
9924                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9925                                 ;;
9926                         *)      fpossize=$yyy
9927                                 echo " $fpossize bytes." >&4
9928                                 ;;
9929                         esac
9930                 else
9931                         dflt="$fpossize"
9932                         echo " "
9933                         echo "(I can't compile the test program.  Guessing...)" >&4
9934                         rp="What is the size of your file positions (in bytes)?"
9935                         . ./myread
9936                         fpossize="$ans"
9937                 fi
9938                 $rm_try
9939         fi
9940         ;;
9941 esac
9942
9943 : Check if we want perlio
9944 useperlio="$define"
9945
9946 : Set the vendorbin variables
9947 case "$vendorprefix" in
9948 '')     d_vendorbin="$undef"
9949         vendorbin=''
9950         vendorbinexp=''
9951         ;;
9952 *)      d_vendorbin="$define"
9953         : determine where vendor-supplied executables go.
9954         case "$vendorbin" in
9955         '') dflt=$vendorprefix/bin ;;
9956         *)      dflt="$vendorbin" ;;
9957         esac
9958         fn=d~+
9959         rp='Pathname for the vendor-supplied executables directory?'
9960         . ./getfile
9961         vendorbin="$ans"
9962         vendorbinexp="$ansexp"
9963         ;;
9964 esac
9965 prefixvar=vendorbin
9966 . ./installprefix
9967
9968 : Set the vendorhtml1dir variables
9969 case "$vendorprefix" in
9970 '')     vendorhtml1dir=''
9971         vendorhtml1direxp=''
9972         ;;
9973 *)      : determine where vendor-supplied html pages go.
9974         : There is no standard location, so try to copy the previously-selected
9975         : directory structure for the core html pages.
9976         : XXX Better default suggestions would be welcome.
9977         case "$vendorhtml1dir" in
9978         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9979         *)      dflt=$vendorhtml1dir ;;
9980         esac
9981         case "$dflt" in
9982         ''|' ') dflt=none ;;
9983         esac
9984         fn=dn+~
9985         rp='Pathname for the vendor-supplied html pages?'
9986         . ./getfile
9987         vendorhtml1dir="$ans"
9988         vendorhtml1direxp="$ansexp"
9989         ;;
9990 esac
9991 : Use ' ' for none so value is preserved next time through Configure
9992 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9993 prefixvar=vendorhtml1dir
9994 . ./installprefix
9995
9996 : Set the vendorhtml3dir variables
9997 case "$vendorprefix" in
9998 '')     vendorhtml3dir=''
9999         vendorhtml3direxp=''
10000         ;;
10001 *)      : determine where vendor-supplied module html pages go.
10002         : There is no standard location, so try to copy the previously-selected
10003         : directory structure for the core html pages.
10004         : XXX Better default suggestions would be welcome.
10005         case "$vendorhtml3dir" in
10006         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10007         *)      dflt=$vendorhtml3dir ;;
10008         esac
10009         case "$dflt" in
10010         ''|' ') dflt=none ;;
10011         esac
10012         fn=dn+~
10013         rp='Pathname for the vendor-supplied html pages?'
10014         . ./getfile
10015         vendorhtml3dir="$ans"
10016         vendorhtml3direxp="$ansexp"
10017         ;;
10018 esac
10019 : Use ' ' for none so value is preserved next time through Configure
10020 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
10021 prefixvar=vendorhtml3dir
10022 . ./installprefix
10023
10024 : Set the vendorman1dir variables
10025 case "$vendorprefix" in
10026 '')     vendorman1dir=''
10027         vendorman1direxp=''
10028         ;;
10029 *)      : determine where vendor-supplied manual pages go.
10030         case "$vendorman1dir" in
10031         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10032         *)      dflt=$vendorman1dir ;;
10033         esac
10034         case "$dflt" in
10035         ''|' ') dflt=none ;;
10036         esac
10037         fn=nd~+
10038         rp='Pathname for the vendor-supplied manual section 1 pages?'
10039         . ./getfile
10040         vendorman1dir="$ans"
10041         vendorman1direxp="$ansexp"
10042         ;;
10043 esac
10044 : Use ' ' for none so value is preserved next time through Configure
10045 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10046 prefixvar=vendorman1dir
10047 . ./installprefix
10048
10049 : Set the vendorman3dir variables
10050 case "$vendorprefix" in
10051 '')     vendorman3dir=''
10052         vendorman3direxp=''
10053         ;;
10054 *)      : determine where vendor-supplied module manual pages go.
10055         case "$vendorman3dir" in
10056         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10057         *)      dflt=$vendorman3dir ;;
10058         esac
10059         case "$dflt" in
10060         ''|' ') dflt=none ;;
10061         esac
10062         fn=nd~+
10063         rp='Pathname for the vendor-supplied manual section 3 pages?'
10064         . ./getfile
10065         vendorman3dir="$ans"
10066         vendorman3direxp="$ansexp"
10067         ;;
10068 esac
10069 : Use ' ' for none so value is preserved next time through Configure
10070 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10071 prefixvar=vendorman3dir
10072 . ./installprefix
10073
10074 : Set the vendorscript variables
10075 case "$vendorprefix" in
10076 '')     d_vendorscript="$undef"
10077         vendorscript=''
10078         vendorscriptexp=''
10079         ;;
10080 *)      d_vendorscript="$define"
10081         : determine where vendor-supplied scripts go.
10082         case "$vendorscript" in
10083         '')     dflt=$vendorprefix/script
10084                 $test -d $dflt || dflt=$vendorbin ;;
10085         *)  dflt="$vendorscript" ;;
10086         esac
10087         $cat <<EOM
10088
10089 The installation process will create a directory for
10090 vendor-supplied scripts.
10091
10092 EOM
10093         fn=d~+
10094         rp='Pathname for the vendor-supplied scripts directory?'
10095         . ./getfile
10096         vendorscript="$ans"
10097         vendorscriptexp="$ansexp"
10098         ;;
10099 esac
10100 prefixvar=vendorscript
10101 . ./installprefix
10102
10103 : see if qgcvt exists
10104 set qgcvt d_qgcvt
10105 eval $inlibc
10106
10107 : Check what kind of doubles your system has
10108 $echo "Checking the kind of doubles you have..." >&4
10109 $cat >try.c <<EOP
10110 #$i_stdlib I_STDLIB
10111 #define DOUBLESIZE $doublesize
10112 #ifdef I_STDLIB
10113 #include <stdlib.h>
10114 #endif
10115 #include <stdio.h>
10116 static const double d = -0.1;
10117 int main() {
10118   unsigned const char* b = (unsigned const char*)(&d);
10119 #if DOUBLESIZE == 4
10120   if (b[0] == 0xCD && b[3] == 0xBD) {
10121     /* IEEE 754 32-bit little-endian */
10122     printf("1\n");
10123     exit(0);
10124   }
10125   if (b[0] == 0xBD && b[3] == 0xCD) {
10126     /* IEEE 754 32-bit big-endian */
10127     printf("2\n");
10128     exit(0);
10129   }
10130   if (b[0] == 0xCC && b[3] == 0xCC) {
10131     /* VAX format F, 32-bit PDP-style mixed endian. */
10132     printf("9\n");
10133     exit(0);
10134   }
10135   if (b[0] == 0xC0 && b[3] == 0x9A) {
10136     /* IBM single 32-bit */
10137     printf("12\n");
10138     exit(0);
10139   }
10140 #endif
10141 #if DOUBLESIZE == 8
10142   if (b[0] == 0x9A && b[7] == 0xBF) {
10143     /* IEEE 754 64-bit little-endian */
10144     printf("3\n");
10145     exit(0);
10146   }
10147   if (b[0] == 0xBF && b[7] == 0x9A) {
10148     /* IEEE 754 64-bit big-endian */
10149     printf("4\n");
10150     exit(0);
10151   }
10152   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10153    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10154     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10155     * 99 99 b9 bf 9a 99 99 99 */
10156     printf("7\n");
10157     exit(0);
10158   }
10159   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10160    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10161     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10162     * 99 99 99 9a bf b9 99 99 */
10163     printf("8\n");
10164     exit(0);
10165   }
10166   if (b[0] == 0xCC && b[7] == 0xCC) {
10167    /* VAX format D, 64-bit PDP-style mixed endian. */
10168     printf("10\n");
10169     exit(0);
10170   }
10171   if (b[0] == 0xD9 && b[7] == 0x99) {
10172    /* VAX format G, 64-bit PDP-style mixed endian. */
10173     printf("11\n");
10174     exit(0);
10175   }
10176   if (b[0] == 0xC0 && b[7] == 0x9A) {
10177     /* IBM double 64-bit */
10178     printf("13\n");
10179     exit(0);
10180   }
10181   if (b[0] == 0xBF && b[7] == 0xCD) {
10182     /* CRAY single 64-bit */
10183     printf("14\n");
10184     exit(0);
10185   }
10186 #endif
10187 #if DOUBLESIZE == 16
10188   if (b[0] == 0x9A && b[15] == 0xBF) {
10189     /* IEEE 754 128-bit little-endian */
10190     printf("5\n");
10191     exit(0);
10192   }
10193   if (b[0] == 0xBF && b[15] == 0x9A) {
10194     /* IEEE 754 128-bit big-endian */
10195     printf("6\n");
10196     exit(0);
10197   }
10198 #endif
10199   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10200    * Whether those environments can still build Perl is debatable. */
10201   printf("-1\n"); /* unknown */
10202   exit(0);
10203 }
10204 EOP
10205 set try
10206 if eval $compile; then
10207     doublekind=`$run ./try`
10208 else
10209     doublekind=-1
10210 fi
10211 case "$doublekind" in
10212 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10213 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10214 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10215 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10216 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10217 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10218 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10219 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10220 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10221 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10222 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10223 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10224 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10225 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10226 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10227 esac
10228 d_double_style_ieee=$undef
10229 d_double_style_vax=$undef
10230 d_double_style_ibm=$undef
10231 d_double_style_cray=$undef
10232 case "$doublekind" in
10233 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10234 9|10|11) d_double_style_vax=$define ;;
10235 12|13) d_double_style_ibm=$define ;;
10236 14) d_double_style_cray=$define ;;
10237 esac
10238 case "$d_double_style_ieee" in
10239 $define)
10240     d_double_has_inf=$define
10241     d_double_has_nan=$define
10242     d_double_has_negative_zero=$define
10243     d_double_has_subnormals=$define
10244     ;;
10245 *)
10246     d_double_has_inf=$undef
10247     d_double_has_nan=$undef
10248     d_double_has_negative_zero=$undef
10249     d_double_has_subnormals=$undef
10250     ;;
10251 esac
10252 $rm_try
10253
10254 : Check print/scan long double stuff
10255 echo " "
10256
10257 if $test X"$d_longdbl" = X"$define"; then
10258
10259 echo "Checking how to print long doubles..." >&4
10260
10261 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10262         $cat >try.c <<'EOCP'
10263 #include <sys/types.h>
10264 #include <stdio.h>
10265 int main() {
10266   double d = 123.456;
10267   printf("%.3f\n", d);
10268 }
10269 EOCP
10270         set try
10271         if eval $compile; then
10272                 yyy=`$run ./try`
10273                 case "$yyy" in
10274                 123.456)
10275                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10276                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10277                         echo "We will use %f."
10278                         ;;
10279                 esac
10280         fi
10281 fi
10282
10283 if $test X"$sPRIfldbl" = X; then
10284         $cat >try.c <<'EOCP'
10285 #include <sys/types.h>
10286 #include <stdio.h>
10287 int main() {
10288   long double d = 123.456;
10289   printf("%.3Lf\n", d);
10290 }
10291 EOCP
10292         set try
10293         if eval $compile; then
10294                 yyy=`$run ./try`
10295                 case "$yyy" in
10296                 123.456)
10297                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10298                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10299                         echo "We will use %Lf."
10300                         ;;
10301                 esac
10302         fi
10303 fi
10304
10305 if $test X"$sPRIfldbl" = X; then
10306         $cat >try.c <<'EOCP'
10307 #include <sys/types.h>
10308 #include <stdio.h>
10309 int main() {
10310   long double d = 123.456;
10311   printf("%.3llf\n", d);
10312 }
10313 EOCP
10314         set try
10315         if eval $compile; then
10316                 yyy=`$run ./try`
10317                 case "$yyy" in
10318                 123.456)
10319                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10320                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10321                         echo "We will use %llf."
10322                         ;;
10323                 esac
10324         fi
10325 fi
10326
10327 if $test X"$sPRIfldbl" = X; then
10328         $cat >try.c <<'EOCP'
10329 #include <sys/types.h>
10330 #include <stdio.h>
10331 int main() {
10332   long double d = 123.456;
10333   printf("%.3lf\n", d);
10334 }
10335 EOCP
10336         set try
10337         if eval $compile; then
10338                 yyy=`$run ./try`
10339                 case "$yyy" in
10340                 123.456)
10341                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10342                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10343                         echo "We will use %lf."
10344                         ;;
10345                 esac
10346         fi
10347 fi
10348
10349 if $test X"$sPRIfldbl" = X; then
10350         echo "Cannot figure out how to print long doubles." >&4
10351 else
10352         sSCNfldbl=$sPRIfldbl    # expect consistency
10353 fi
10354
10355 $rm_try
10356
10357 fi # d_longdbl
10358
10359 case "$sPRIfldbl" in
10360 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10361         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10362         d_SCNfldbl="$undef";
10363         ;;
10364 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10365         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10366         d_SCNfldbl="$define";
10367         ;;
10368 esac
10369
10370 : Before committing on uselongdouble, see whether that looks sane.
10371 if $test "$uselongdouble" = "$define"; then
10372     message=""
10373     echo " "
10374     echo "Checking if your long double math functions work right..." >&4
10375     $cat > try.c <<EOF
10376 #include <math.h>
10377 #include <stdio.h>
10378 int main() {
10379   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10380 }
10381 EOF
10382     case "$osname:$gccversion" in
10383     aix:)       saveccflags="$ccflags"
10384                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10385     esac
10386     set try
10387     if eval $compile_ok; then
10388       yyy=`$run ./try`
10389     fi
10390     case "$yyy" in
10391     3) echo "Your long double math functions are working correctly." >&4 ;;
10392     *) echo "Your long double math functions are broken, not using long doubles." >&4
10393        uselongdouble=$undef
10394        ;;
10395     esac
10396     $rm_try
10397     case "$osname:$gccversion" in
10398     aix:)       ccflags="$saveccflags" ;; # restore
10399     esac
10400 fi
10401
10402 : Check how to convert floats to strings.
10403
10404 if test "X$d_Gconvert" = X; then
10405
10406 echo " "
10407 echo "Checking for an efficient way to convert floats to strings."
10408 echo " " > try.c
10409 case "$uselongdouble" in
10410 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10411 esac
10412 case "$d_longdbl" in
10413 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10414 esac
10415 case "$d_PRIgldbl" in
10416 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10417 esac
10418 $cat >>try.c <<EOP
10419 #ifdef TRY_gconvert
10420 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10421 const char *myname = "gconvert";
10422 #endif
10423 #ifdef TRY_gcvt
10424 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10425 const char *myname = "gcvt";
10426 #endif
10427 #ifdef TRY_qgcvt
10428 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10429 const char *myname = "qgcvt";
10430 #define DOUBLETYPE long double
10431 #endif
10432 #ifdef TRY_sprintf
10433 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10434 #ifdef HAS_PRIgldbl
10435 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10436 #else
10437 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10438 #endif
10439 #else
10440 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10441 #endif
10442 const char *myname = "sprintf";
10443 #endif
10444
10445 #ifndef DOUBLETYPE
10446 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10447 #define DOUBLETYPE long double
10448 #else
10449 #define DOUBLETYPE double
10450 #endif
10451 #endif
10452
10453 #include <stdio.h>
10454
10455 #$i_stdlib I_STDLIB
10456 #ifdef I_STDLIB
10457 #include <stdlib.h>
10458 #endif
10459 #include <string.h>
10460
10461 void checkit(const char *expect, char *got)
10462 {
10463     if (strcmp(expect, got)) {
10464                 printf("%s oddity:  Expected %s, got %s\n",
10465                         myname, expect, got);
10466                 exit(1);
10467         }
10468 }
10469
10470 void lencheck(int expect, int got)
10471 {
10472     if (expect != got) {
10473                 printf("%s length mismatch:  Expected %d, got %d\n",
10474                         myname, expect, got);
10475                 exit(1);
10476         }
10477 }
10478
10479 int main()
10480 {
10481         char buf[64];
10482         buf[63] = '\0';
10483
10484         /* This must be 1st test on (which?) platform */
10485         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10486         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10487         checkit("0.1", buf);
10488
10489         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10490         checkit("0.01", buf);
10491
10492         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10493         checkit("0.001", buf);
10494
10495         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10496         checkit("0.0001", buf);
10497
10498         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10499         if (strlen(buf) > 5)
10500             checkit("9e-005", buf); /* for Microsoft ?? */
10501         else
10502             checkit("9e-05", buf);
10503
10504         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10505         checkit("1", buf);
10506
10507         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10508         checkit("1.1", buf);
10509
10510         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10511         checkit("1.01", buf);
10512
10513         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10514         checkit("1.001", buf);
10515
10516         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10517         checkit("1.0001", buf);
10518
10519         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10520         checkit("1.00001", buf);
10521
10522         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10523         checkit("1.000001", buf);
10524
10525         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10526         checkit("0", buf);
10527
10528         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10529         checkit("-1", buf);
10530
10531         /* Some Linux gcvt's give 1.e+5 here. */
10532         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10533         checkit("100000", buf);
10534
10535         /* Some Linux gcvt's give -1.e+5 here. */
10536         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10537         checkit("-100000", buf);
10538
10539         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10540         checkit("123.456", buf);
10541
10542         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10543         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10544         /* 34 should be enough to scare even long double
10545          * places into using the e notation. */
10546         if (strlen(buf) > 5)
10547             checkit("1e+034", buf); /* for Microsoft */
10548         else
10549             checkit("1e+34", buf);
10550
10551         /* Test for an Ubuntu/Debian bug in gcvt and qgcvt. See:        *
10552          * https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1899553 */
10553
10554         Gconvert((DOUBLETYPE)0.4, 53, 0, buf);
10555         lencheck(55, (int)strlen(buf));
10556
10557         /* For Perl, if you add additional tests here, also add them to
10558          * t/base/num.t for benefit of platforms not using Configure or
10559          * overriding d_Gconvert */
10560
10561         exit(0);
10562 }
10563 EOP
10564 : first add preferred functions to our list
10565 xxx_list=""
10566 for xxx_convert in $gconvert_preference; do
10567     case $xxx_convert in
10568     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10569     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10570     esac
10571 done
10572 : then add any others
10573 for xxx_convert in gconvert gcvt sprintf; do
10574     case "$xxx_list" in
10575     *$xxx_convert*) ;;
10576     *) xxx_list="$xxx_list $xxx_convert" ;;
10577     esac
10578 done
10579
10580 case "$d_longdbl$uselongdouble" in
10581 "$define$define")
10582     : again, add preferred functions to our list first
10583     xxx_ld_list=""
10584     for xxx_convert in $gconvert_ld_preference; do
10585         case $xxx_convert in
10586         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10587         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10588         esac
10589     done
10590     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10591     for xxx_convert in qgcvt sprintf $xxx_list; do
10592         case "$xxx_ld_list" in
10593         $xxx_convert*|*" $xxx_convert"*) ;;
10594         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10595         esac
10596     done
10597     : if sprintf cannot do long doubles, move it to the end
10598     if test "$d_PRIgldbl" != "$define"; then
10599         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10600     fi
10601     : if no qgcvt, remove it
10602     if test "$d_qgcvt" != "$define"; then
10603         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10604     fi
10605     : use the ld_list
10606     xxx_list="$xxx_ld_list"
10607     ;;
10608 esac
10609
10610 for xxx_convert in $xxx_list; do
10611         echo "Trying $xxx_convert..."
10612         $rm -f try try$_o core
10613         set try -DTRY_$xxx_convert
10614         if eval $compile; then
10615                 echo "$xxx_convert() found." >&4
10616                 if $run ./try; then
10617                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10618                         break;
10619                 else
10620                         echo "...But $xxx_convert didn't work as I expected."
10621                         xxx_convert=''
10622                 fi
10623         else
10624                 echo "$xxx_convert NOT found." >&4
10625                 xxx_convert=''
10626         fi
10627 done
10628
10629 if test X$xxx_convert = X; then
10630     echo "*** WHOA THERE!!! ***" >&4
10631     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10632     xxx_convert=sprintf
10633 fi
10634
10635 case "$xxx_convert" in
10636 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10637 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10638 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10639 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10640    "$define$define$define")
10641       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10642    "$define$define$undef")
10643       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10644    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10645    esac
10646    ;;
10647 esac
10648
10649 fi
10650 $rm_try
10651
10652 : see if _fwalk exists
10653 set fwalk d__fwalk
10654 eval $inlibc
10655
10656 : see if accept4 exists
10657 set accept4 d_accept4
10658 eval $inlibc
10659
10660 : Initialize h_fcntl
10661 h_fcntl=false
10662
10663 : Initialize h_sysfile
10664 h_sysfile=false
10665
10666 : access call always available on UNIX
10667 set access d_access
10668 eval $inlibc
10669
10670 : locate the flags for 'access()'
10671 case "$d_access" in
10672 "$define")
10673         echo " "
10674         $cat >access.c <<EOCP
10675 #include <sys/types.h>
10676 #ifdef I_FCNTL
10677 #include <fcntl.h>
10678 #endif
10679 #ifdef I_SYS_FILE
10680 #include <sys/file.h>
10681 #endif
10682 #ifdef I_UNISTD
10683 #include <unistd.h>
10684 #endif
10685 #$i_stdlib I_STDLIB
10686 #ifdef I_STDLIB
10687 #include <stdlib.h>
10688 #endif
10689 int main() {
10690         exit(R_OK);
10691 }
10692 EOCP
10693         : check sys/file.h first, no particular reason here
10694         if $test `./findhdr sys/file.h` && \
10695                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10696                 h_sysfile=true;
10697                 echo "<sys/file.h> defines the *_OK access constants." >&4
10698         elif $test `./findhdr fcntl.h` && \
10699                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10700                 h_fcntl=true;
10701                 echo "<fcntl.h> defines the *_OK access constants." >&4
10702         elif $test `./findhdr unistd.h` && \
10703                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10704                 echo "<unistd.h> defines the *_OK access constants." >&4
10705         else
10706                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10707         fi
10708         ;;
10709 esac
10710 $rm -f access*
10711
10712 : see if accessx exists
10713 set accessx d_accessx
10714 eval $inlibc
10715
10716 : see if acosh exists
10717 set acosh d_acosh
10718 eval $inlibc
10719
10720 : see if aintl exists
10721 set aintl d_aintl
10722 eval $inlibc
10723
10724 : see if alarm exists
10725 set alarm d_alarm
10726 eval $inlibc
10727
10728 : see if 64bit time functions exists
10729
10730 set ctime64 d_ctime64
10731 eval $inlibc
10732
10733 set localtime64 d_localtime64
10734 eval $inlibc
10735
10736 set gmtime64 d_gmtime64
10737 eval $inlibc
10738
10739 set mktime64 d_mktime64
10740 eval $inlibc
10741
10742 set difftime64 d_difftime64
10743 eval $inlibc
10744
10745 set asctime64 d_asctime64
10746 eval $inlibc
10747
10748 : see if POSIX threads are available
10749 set pthread.h i_pthread
10750 eval $inhdr
10751
10752 : define a function to check prototypes
10753 $cat > protochk <<EOSH
10754 $startsh
10755 cc="$cc"
10756 optimize="$optimize"
10757 ccflags="$ccflags"
10758 define="$define"
10759 rm_try="$rm_try"
10760 usethreads=$usethreads
10761 i_pthread=$i_pthread
10762 pthread_h_first=$pthread_h_first
10763 EOSH
10764
10765 $cat >> protochk <<'EOSH'
10766
10767 $rm_try
10768 foo="$1"
10769 shift
10770 while test $# -ge 2; do
10771         case "$1" in
10772                 $define) echo "#include <$2>" >> try.c ;;
10773                 literal) echo "$2" >> try.c ;;
10774         esac
10775     # Extra magic for the benefit of systems that need pthread.h
10776     # to be included early to correctly detect threadsafe functions.
10777     # Such functions must guarantee themselves, though, that the usethreads
10778     # and i_pthread have been defined, before calling protochk.
10779     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10780         echo "#include <pthread.h>" >> try.c
10781         pthread_h_done=yes
10782     fi
10783     shift 2
10784 done
10785 cat >> try.c <<'EOCP'
10786 #define _(args) args
10787 EOCP
10788 echo "$foo" >> try.c
10789 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10790 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10791 status=$?
10792 $rm_try
10793 exit $status
10794 EOSH
10795 chmod +x protochk
10796 $eunicefix protochk
10797
10798 : Define hasproto macro for Configure internal use
10799 hasproto='varname=$1; func=$2; shift; shift;
10800 while $test $# -ge 2; do
10801         case "$1" in
10802         $define) echo "#include <$2>";;
10803         literal) echo "$2" ;;
10804         esac ;
10805     shift 2;
10806 done > try.c;
10807 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10808 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10809         echo "$func() prototype found.";
10810         val="$define";
10811 else
10812         echo "$func() prototype NOT found.";
10813         val="$undef";
10814 fi;
10815 set $varname;
10816 eval $setvar;
10817 $rm_try tryout.c'
10818
10819 : see if sys/types.h has to be included
10820 set sys/types.h i_systypes
10821 eval $inhdr
10822
10823 : see if sys/select.h has to be included
10824 set sys/select.h i_sysselct
10825 eval $inhdr
10826
10827 : Define hasfield macro for Configure internal use
10828 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10829 while $test $# -ge 2; do
10830         case "$1" in
10831         $define) echo "#include <$2>";;
10832         esac ;
10833     shift 2;
10834 done > try.c;
10835 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10836 set try;
10837 if eval $compile; then
10838         val="$define";
10839 else
10840         val="$undef";
10841 fi;
10842 set $varname;
10843 eval $setvar;
10844 $rm_try'
10845
10846 : see if we should include sys/time.h
10847 echo " "
10848 i_time='define'
10849 if test "X$timeincl" = X; then
10850         echo "Testing to see if we should include <sys/time.h>." >&4
10851         $echo $n "I'm now running the test program...$c"
10852         $cat >try.c <<EOCP
10853 #include <sys/types.h>
10854 #include <time.h>
10855 #ifdef I_SYSTIME
10856 #ifdef SYSTIMEKERNEL
10857 #define KERNEL
10858 #endif
10859 #include <sys/time.h>
10860 #endif
10861 #ifdef I_SYSSELECT
10862 #include <sys/select.h>
10863 #endif
10864 #$i_stdlib I_STDLIB
10865 #ifdef I_STDLIB
10866 #include <stdlib.h>
10867 #endif
10868 int main()
10869 {
10870         struct tm foo;
10871 #ifdef S_TIMEVAL
10872         struct timeval bar;
10873 #endif
10874 #ifdef S_TIMEZONE
10875         struct timezone tzp;
10876 #endif
10877         if (foo.tm_sec == foo.tm_sec)
10878                 exit(0);
10879 #ifdef S_TIMEVAL
10880         if (bar.tv_sec == bar.tv_sec)
10881                 exit(0);
10882 #endif
10883         exit(1);
10884 }
10885 EOCP
10886         flags=''
10887         for s_timezone in '-DS_TIMEZONE' ''; do
10888         sysselect=''
10889         for s_timeval in '-DS_TIMEVAL' ''; do
10890         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10891         for i_systime in '-DI_SYSTIME' ''; do
10892                 case "$flags" in
10893                 '') $echo $n ".$c"
10894                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10895                         if eval $compile; then
10896                                 set X $i_systime $i_systimek $sysselect $s_timeval
10897                                 shift
10898                                 flags="$*"
10899                                 echo " "
10900                                 $echo $n "Succeeded with $flags$c"
10901                         fi
10902                         ;;
10903                 esac
10904         done
10905         done
10906         done
10907         done
10908         timeincl=''
10909         echo " "
10910         case "$flags" in
10911         *SYSTIMEKERNEL*) i_systimek="$define"
10912                 timeincl=`./findhdr sys/time.h`
10913                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10914         *) i_systimek="$undef";;
10915         esac
10916         case "$flags" in
10917         *I_SYSTIME*) i_systime="$define"
10918                 timeincl=`./findhdr sys/time.h`" $timeincl"
10919                 echo "We'll include <sys/time.h>." >&4;;
10920         *) i_systime="$undef";;
10921         esac
10922         $rm_try
10923 fi
10924 : see if struct tm knows about tm_zone
10925 case "$i_systime$i_time" in
10926 *$define*)
10927         echo " "
10928         echo "Checking to see if your struct tm has tm_zone field..." >&4
10929         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10930         eval $hasfield
10931         ;;
10932 *)      val="$undef"
10933         set d_tm_tm_zone
10934         eval $setvar
10935         ;;
10936 esac
10937 case "$d_tm_tm_zone" in
10938 "$define")      echo "Yes, it does."   ;;
10939 *)              echo "No, it doesn't." ;;
10940 esac
10941 : see if struct tm knows about tm_gmtoff
10942 case "$i_systime$i_time" in
10943 *$define*)
10944         echo " "
10945         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10946         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10947         eval $hasfield
10948         ;;
10949 *)      val="$undef"
10950         set d_tm_tm_gmtoff
10951         eval $setvar
10952         ;;
10953 esac
10954 case "$d_tm_tm_gmtoff" in
10955 "$define")      echo "Yes, it does."   ;;
10956 *)              echo "No, it doesn't." ;;
10957 esac
10958
10959 : see if asctime_r exists
10960 set asctime_r d_asctime_r
10961 eval $inlibc
10962 case "$d_asctime_r" in
10963 "$define")
10964         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10965         case "$d_asctime_r_proto:$usethreads" in
10966         ":define")      d_asctime_r_proto=define
10967                 set d_asctime_r_proto asctime_r $hdrs
10968                 eval $hasproto ;;
10969         *)      ;;
10970         esac
10971         case "$d_asctime_r_proto" in
10972         define)
10973         case "$asctime_r_proto" in
10974         ''|0) try='char* asctime_r(const struct tm*, char*);'
10975         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10976         esac
10977         case "$asctime_r_proto" in
10978         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10979         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10980         esac
10981         case "$asctime_r_proto" in
10982         ''|0) try='int asctime_r(const struct tm*, char*);'
10983         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10984         esac
10985         case "$asctime_r_proto" in
10986         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10987         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10988         esac
10989         case "$asctime_r_proto" in
10990         ''|0)   d_asctime_r=undef
10991                 asctime_r_proto=0
10992                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10993         * )     case "$asctime_r_proto" in
10994                 REENTRANT_PROTO*) ;;
10995                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10996                 esac
10997                 echo "Prototype: $try" ;;
10998         esac
10999         ;;
11000         *)      case "$usethreads" in
11001                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
11002                 esac
11003                 d_asctime_r=undef
11004                 asctime_r_proto=0
11005                 ;;
11006         esac
11007         ;;
11008 *)      asctime_r_proto=0
11009         ;;
11010 esac
11011
11012 : see if asinh exists
11013 set asinh d_asinh
11014 eval $inlibc
11015
11016 : see if atanh exists
11017 set atanh d_atanh
11018 eval $inlibc
11019
11020 : see if atolf exists
11021 set atolf d_atolf
11022 eval $inlibc
11023
11024 : see if atoll exists
11025 set atoll d_atoll
11026 eval $inlibc
11027
11028 : See if a file contains compiler warnings
11029 : See if a file contains compiler warnings
11030 case "$osname" in
11031   'aix')
11032         cat >compiler_warning <<EOSS
11033 # Sample for aix ('.5' indicates the column number in the line):
11034 #    "op.h", line 203.5: 1506-159 (E) Bit field type specified for op_type
11035 # Since the word 'warning' isn't present, use a fairly rigorous match of what
11036 # warning messages look like
11037 #            "    o        p        .  h   ", line    203      .   5        :   1506     -    159      (  E  )
11038 $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"
11039 EOSS
11040         compiler_warning=./compiler_warning
11041         chmod +x $compiler_warning
11042     ;;
11043      # Maybe a colon after the 'warning' would be appropriate
11044   *) compiler_warning="$contains -i warning"
11045     ;;
11046 esac
11047
11048 : Look for GCC-style attribute format
11049 case "$d_attribute_format" in
11050 '')
11051 echo " "
11052 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11053 $cat >attrib.c <<'EOCP'
11054 #include <stdio.h>
11055 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11056 EOCP
11057 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11058         if $compiler_warning attrib.out >/dev/null 2>&1; then
11059                 echo "Your C compiler doesn't support __attribute__((format))."
11060                 val="$undef"
11061         else
11062                 echo "Your C compiler supports __attribute__((format))."
11063                 val="$define"
11064         fi
11065 else
11066         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11067         val="$undef"
11068 fi
11069 ;;
11070 *) val="$d_attribute_format" ;;
11071 esac
11072 set d_attribute_format
11073 eval $setvar
11074 $rm -f attrib*
11075
11076 : Look for GCC-style attribute format with null format allowed
11077 case "$d_printf_format_null" in
11078 '') case "$d_attribute_format" in
11079     $define)
11080         echo " "
11081         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11082 $cat >attrib.c <<EOCP
11083 #include <stdio.h>
11084 #$i_stdlib I_STDLIB
11085 #ifdef I_STDLIB
11086 #include <stdlib.h>
11087 #endif
11088 #$i_inttypes I_INTTYPES
11089 #ifdef I_INTTYPES
11090 #include <inttypes.h>
11091 #endif
11092 #ifndef INTPTR_MAX
11093 #define intptr_t int
11094 #endif
11095 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11096 int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11097 int main () { exit(null_printf(NULL)); }
11098 EOCP
11099         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11100             : run the executable in case it produces a run-time warning
11101             if $run ./attrib >>attrib.out 2>&1; then
11102                 if $compiler_warning attrib.out >/dev/null 2>&1; then
11103                     echo "Your C compiler doesn't allow __printf__ format to be null."
11104                     val="$undef"
11105                 else
11106                     echo "Your C compiler allows __printf__ format to be null."
11107                     val="$define"
11108                 fi
11109             else
11110             echo "Your C compiler executable failed with __printf__ format null."
11111             val="$undef"
11112         fi
11113     else
11114         echo "Your C compiler fails with __printf__ format null."
11115         val="$undef"
11116     fi
11117     ;;
11118     *)  val="$undef" ;;
11119     esac
11120 ;;
11121 *)  val="$d_printf_format_null" ;;
11122 esac
11123 set d_printf_format_null
11124 eval $setvar
11125 $rm -f attrib*
11126
11127 : Look for GCC-style attribute malloc
11128 case "$d_attribute_malloc" in
11129 '')
11130 echo " "
11131 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11132 $cat >attrib.c <<'EOCP'
11133 #include <stdio.h>
11134 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11135 EOCP
11136 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11137         if $compiler_warning attrib.out >/dev/null 2>&1; then
11138                 echo "Your C compiler doesn't support __attribute__((malloc))."
11139                 val="$undef"
11140         else
11141                 echo "Your C compiler supports __attribute__((malloc))."
11142                 val="$define"
11143         fi
11144 else
11145         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11146         val="$undef"
11147 fi
11148 ;;
11149 *) val="$d_attribute_malloc" ;;
11150 esac
11151 set d_attribute_malloc
11152 eval $setvar
11153 $rm -f attrib*
11154
11155 : Look for GCC-style attribute nonnull
11156 case "$d_attribute_nonnull" in
11157 '')
11158 echo " "
11159 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11160 $cat >attrib.c <<'EOCP'
11161 #include <stdio.h>
11162 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11163 EOCP
11164 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11165         if $compiler_warning attrib.out >/dev/null 2>&1; then
11166                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11167                 val="$undef"
11168         else
11169                 echo "Your C compiler supports __attribute__((nonnull))."
11170                 val="$define"
11171         fi
11172 else
11173         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11174         val="$undef"
11175 fi
11176 ;;
11177 *) val="$d_attribute_nonnull" ;;
11178 esac
11179 set d_attribute_nonnull
11180 eval $setvar
11181 $rm -f attrib*
11182
11183 : Look for GCC-style attribute noreturn
11184 case "$d_attribute_noreturn" in
11185 '')
11186 echo " "
11187 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11188 $cat >attrib.c <<'EOCP'
11189 #include <stdio.h>
11190 void fall_over_dead( void ) __attribute__((noreturn));
11191 EOCP
11192 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11193         if $compiler_warning attrib.out >/dev/null 2>&1; then
11194                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11195                 val="$undef"
11196         else
11197                 echo "Your C compiler supports __attribute__((noreturn))."
11198                 val="$define"
11199         fi
11200 else
11201         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11202         val="$undef"
11203 fi
11204 ;;
11205 *) val="$d_attribute_noreturn" ;;
11206 esac
11207 set d_attribute_noreturn
11208 eval $setvar
11209 $rm -f attrib*
11210
11211 : Look for GCC-style attribute pure
11212 case "$d_attribute_pure" in
11213 '')
11214 echo " "
11215 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11216 $cat >attrib.c <<'EOCP'
11217 #include <stdio.h>
11218 int square( int n ) __attribute__((pure));
11219 EOCP
11220 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11221         if $compiler_warning attrib.out >/dev/null 2>&1; then
11222                 echo "Your C compiler doesn't support __attribute__((pure))."
11223                 val="$undef"
11224         else
11225                 echo "Your C compiler supports __attribute__((pure))."
11226                 val="$define"
11227         fi
11228 else
11229         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11230         val="$undef"
11231 fi
11232 ;;
11233 *) val="$d_attribute_pure" ;;
11234 esac
11235 set d_attribute_pure
11236 eval $setvar
11237 $rm -f attrib*
11238
11239 : Look for GCC-style attribute unused
11240 case "$d_attribute_unused" in
11241 '')
11242 echo " "
11243 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11244 $cat >attrib.c <<'EOCP'
11245 #include <stdio.h>
11246 int do_something( int dummy __attribute__((unused)), int n );
11247 EOCP
11248 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11249         if $compiler_warning attrib.out >/dev/null 2>&1; then
11250                 echo "Your C compiler doesn't support __attribute__((unused))."
11251                 val="$undef"
11252         else
11253                 echo "Your C compiler supports __attribute__((unused))."
11254                 val="$define"
11255         fi
11256 else
11257         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11258         val="$undef"
11259 fi
11260 ;;
11261 *) val="$d_attribute_unused" ;;
11262 esac
11263 set d_attribute_unused
11264 eval $setvar
11265 $rm -f attrib*
11266
11267 : Look for GCC-style attribute deprecated
11268 case "$d_attribute_deprecated" in
11269 '')
11270 echo " "
11271 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11272 $cat >attrib.c <<'EOCP'
11273 #include <stdio.h>
11274 int I_am_deprecated(void) __attribute__((deprecated));
11275 EOCP
11276 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11277         if $compiler_warning attrib.out >/dev/null 2>&1; then
11278                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11279                 val="$undef"
11280         else
11281                 echo "Your C compiler supports __attribute__((deprecated))."
11282                 val="$define"
11283         fi
11284 else
11285         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11286         val="$undef"
11287 fi
11288 ;;
11289 *) val="$d_attribute_deprecated" ;;
11290 esac
11291 set d_attribute_deprecated
11292 eval $setvar
11293 $rm -f attrib*
11294
11295 : Look for GCC-style attribute warn_unused_result
11296 case "$d_attribute_warn_unused_result" in
11297 '')
11298 echo " "
11299 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11300 $cat >attrib.c <<'EOCP'
11301 #include <stdio.h>
11302 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11303 EOCP
11304 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11305         if $compiler_warning attrib.out >/dev/null 2>&1; then
11306                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11307                 val="$undef"
11308         else
11309                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11310                 val="$define"
11311         fi
11312 else
11313         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11314         val="$undef"
11315 fi
11316 ;;
11317 *) val="$d_attribute_warn_unused_result" ;;
11318 esac
11319 set d_attribute_warn_unused_result
11320 eval $setvar
11321 $rm -f attrib*
11322
11323 : Look for GCC-style attribute always_inline
11324 case "$d_attribute_always_inline" in
11325 '')
11326 echo " "
11327 echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
11328 $cat >attrib.c <<'EOCP'
11329 #include <stdio.h>
11330 static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
11331 EOCP
11332 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11333         if $compiler_warning attrib.out >/dev/null 2>&1; then
11334                 echo "Your C compiler doesn't support __attribute__((always_inline))."
11335                 val="$undef"
11336         else
11337                 echo "Your C compiler supports __attribute__((always_inline))."
11338                 val="$define"
11339         fi
11340 else
11341         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11342         val="$undef"
11343 fi
11344 ;;
11345 *) val="$d_attribute_always_inline" ;;
11346 esac
11347 set d_attribute_always_inline
11348 eval $setvar
11349 $rm -f attrib*
11350
11351 : Look for GCC-style attribute visibility
11352 case "$d_attribute_visibility" in
11353 '')
11354 echo " "
11355 echo "Checking whether your compiler can handle __attribute__((visibility)) ..." >&4
11356 $cat >attrib.c <<'EOCP'
11357 #include <stdio.h>
11358 __attribute__((visibility("hidden"))) int I_will_be_hidden(void);
11359 EOCP
11360 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11361         if $compiler_warning attrib.out >/dev/null 2>&1; then
11362                 echo "Your C compiler doesn't support __attribute__((visibility))."
11363                 val="$undef"
11364         else
11365                 echo "Your C compiler supports __attribute__((visibility))."
11366                 val="$define"
11367         fi
11368 else
11369         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11370         val="$undef"
11371 fi
11372 ;;
11373 *) val="$d_attribute_visibility" ;;
11374 esac
11375 set d_attribute_visibility
11376 eval $setvar
11377 $rm -f attrib*
11378
11379 : see if getpgrp exists
11380 set getpgrp d_getpgrp
11381 eval $inlibc
11382
11383 case "$d_getpgrp" in
11384 "$define")
11385         echo " "
11386         echo "Checking to see which flavor of getpgrp is in use..."
11387         $cat >try.c <<EOP
11388 #include <stdio.h>
11389 #$i_unistd I_UNISTD
11390 #include <sys/types.h>
11391 #ifdef I_UNISTD
11392 #  include <unistd.h>
11393 #endif
11394 #$i_stdlib I_STDLIB
11395 #ifdef I_STDLIB
11396 #include <stdlib.h>
11397 #endif
11398 int main()
11399 {
11400         if (getuid() == 0) {
11401                 printf("(I see you are running Configure as super-user...)\n");
11402                 setuid(1);
11403         }
11404 #ifdef TRY_BSD_PGRP
11405         if (getpgrp(1) == 0)
11406                 exit(0);
11407 #else
11408         if (getpgrp() > 0)
11409                 exit(0);
11410 #endif
11411         exit(1);
11412 }
11413 EOP
11414         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11415                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11416                 val="$define"
11417         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11418                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11419                 val="$undef"
11420         else
11421                 echo "I can't seem to compile and run the test program."
11422                 if ./usg; then
11423                         xxx="a USG one, i.e. you use getpgrp()."
11424                 else
11425                         # SVR4 systems can appear rather BSD-ish.
11426                         case "$i_unistd" in
11427                         $undef)
11428                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11429                                 val="$define"
11430                                 ;;
11431                         $define)
11432                                 xxx="probably a USG one, i.e. you use getpgrp()."
11433                                 val="$undef"
11434                                 ;;
11435                         esac
11436                 fi
11437                 echo "Assuming your getpgrp is $xxx" >&4
11438         fi
11439         ;;
11440 *) val="$undef";;
11441 esac
11442 set d_bsdgetpgrp
11443 eval $setvar
11444 $rm_try
11445
11446 : see if setpgrp exists
11447 set setpgrp d_setpgrp
11448 eval $inlibc
11449
11450 case "$d_setpgrp" in
11451 "$define")
11452         echo " "
11453         echo "Checking to see which flavor of setpgrp is in use..."
11454         $cat >try.c <<EOP
11455 #include <stdio.h>
11456 #$i_unistd I_UNISTD
11457 #include <sys/types.h>
11458 #ifdef I_UNISTD
11459 #  include <unistd.h>
11460 #endif
11461 #$i_stdlib I_STDLIB
11462 #ifdef I_STDLIB
11463 #include <stdlib.h>
11464 #endif
11465 int main()
11466 {
11467         if (getuid() == 0) {
11468                 printf("(I see you are running Configure as super-user...)\n");
11469                 setuid(1);
11470         }
11471 #ifdef TRY_BSD_PGRP
11472         if (-1 == setpgrp(1, 1))
11473                 exit(0);
11474 #else
11475         if (setpgrp() != -1)
11476                 exit(0);
11477 #endif
11478         exit(1);
11479 }
11480 EOP
11481         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11482                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11483                 val="$define"
11484         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11485                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11486                 val="$undef"
11487         else
11488                 echo "(I can't seem to compile and run the test program.)"
11489                 if ./usg; then
11490                         xxx="a USG one, i.e. you use setpgrp()."
11491                 else
11492                         # SVR4 systems can appear rather BSD-ish.
11493                         case "$i_unistd" in
11494                         $undef)
11495                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11496                                 val="$define"
11497                                 ;;
11498                         $define)
11499                                 xxx="probably a USG one, i.e. you use setpgrp()."
11500                                 val="$undef"
11501                                 ;;
11502                         esac
11503                 fi
11504                 echo "Assuming your setpgrp is $xxx" >&4
11505         fi
11506         ;;
11507 *) val="$undef";;
11508 esac
11509 set d_bsdsetpgrp
11510 eval $setvar
11511 $rm_try
11512
11513 : Look for GCC-style __builtin_add_overflow
11514 case "$d_builtin_add_overflow" in
11515 '')
11516     echo " "
11517     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11518     $cat >try.c <<'EOCP'
11519 int main(void) {
11520     const unsigned int uint_max = ~0u;
11521     int target_int = 0;
11522     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11523         return 1;
11524     }
11525     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11526         return 1;
11527     }
11528     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11529         return 1;
11530     }
11531     return 0;
11532 }
11533 EOCP
11534     set try
11535     if eval $compile && $run ./try; then
11536         echo "Your C compiler supports __builtin_add_overflow."
11537         val="$define"
11538     else
11539         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11540         val="$undef"
11541     fi
11542     ;;
11543 *) val="$d_builtin_add_overflow" ;;
11544 esac
11545
11546 set d_builtin_add_overflow
11547 eval $setvar
11548 $rm_try
11549
11550 : Look for GCC-style __builtin_sub_overflow
11551 case "$d_builtin_sub_overflow" in
11552 '')
11553     echo " "
11554     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11555     $cat >try.c <<'EOCP'
11556 int main(void) {
11557     const unsigned int uint_max = ~0u;
11558     int target_int = 0;
11559     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11560         return 1;
11561     }
11562     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11563         return 1;
11564     }
11565     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11566         return 1;
11567     }
11568     return 0;
11569 }
11570 EOCP
11571     set try
11572     if eval $compile && $run ./try; then
11573         echo "Your C compiler supports __builtin_sub_overflow."
11574         val="$define"
11575     else
11576         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11577         val="$undef"
11578     fi
11579     ;;
11580 *) val="$d_builtin_sub_overflow" ;;
11581 esac
11582
11583 set d_builtin_sub_overflow
11584 eval $setvar
11585 $rm_try
11586
11587 : Look for GCC-style __builtin_mul_overflow
11588 case "$d_builtin_mul_overflow" in
11589 '')
11590     echo " "
11591     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11592     $cat >try.c <<'EOCP'
11593 int main(void) {
11594     const unsigned int uint_max = ~0u;
11595     int target_int = 0;
11596     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11597         return 1;
11598     }
11599     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11600         return 1;
11601     }
11602     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11603         return 1;
11604     }
11605     return 0;
11606 }
11607 EOCP
11608     set try
11609     if eval $compile && $run ./try; then
11610         echo "Your C compiler supports __builtin_mul_overflow."
11611         val="$define"
11612     else
11613         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11614         val="$undef"
11615     fi
11616     ;;
11617 *) val="$d_builtin_mul_overflow" ;;
11618 esac
11619
11620 set d_builtin_mul_overflow
11621 eval $setvar
11622 $rm_try
11623
11624 : Look for GCC-style __builtin_choose_expr
11625 case "$d_builtin_choose_expr" in
11626 '')
11627     echo " "
11628     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11629     $cat >try.c <<'EOCP'
11630 #include <assert.h>
11631 #include <stdlib.h>
11632 #include <stdio.h>
11633
11634 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11635
11636 int main(void) {
11637     assert( SYRINX(1) == 2112 );
11638     assert( SYRINX(1) != 5150 );
11639     assert( SYRINX(0) == 5150 );
11640     assert( SYRINX(0) != 2112 );
11641     puts( "All good!" );
11642     exit(0);
11643 }
11644
11645 EOCP
11646     set try
11647     if eval $compile && $run ./try; then
11648         echo "Your C compiler supports __builtin_choose_expr."
11649         val="$define"
11650     else
11651         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11652         val="$undef"
11653     fi
11654 ;;
11655 *) val="$d_builtin_choose_expr" ;;
11656 esac
11657
11658 set d_builtin_choose_expr
11659 eval $setvar
11660 $rm_try
11661
11662 : Look for GCC-style __builtin_expect
11663 case "$d_builtin_expect" in
11664 '')
11665     echo " "
11666     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11667     $cat >try.c <<'EOCP'
11668 int main(void) {
11669     int n = 50;
11670     if ( __builtin_expect(n, 0) ) n = 1;
11671     /* Remember shell exit code truth is 0, C truth is non-zero */
11672     return !(n == 1);
11673 }
11674 EOCP
11675     set try
11676     if eval $compile && $run ./try; then
11677         echo "Your C compiler supports __builtin_expect."
11678         val="$define"
11679     else
11680         echo "Your C compiler doesn't seem to understand __builtin_expect."
11681         val="$undef"
11682     fi
11683     ;;
11684 *) val="$d_builtin_expect" ;;
11685 esac
11686
11687 set d_builtin_expect
11688 eval $setvar
11689 $rm_try
11690
11691 : see if the Compiler supports C99 variadic macros
11692 echo "Checking for C99 variadic macros." >&4
11693 $cat >try.c <<EOCP
11694 #include <stdio.h>
11695 #include <stdarg.h>
11696
11697 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11698
11699 int main() {
11700   char buf[20];
11701   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11702   puts(buf);
11703   return 0;
11704 }
11705 EOCP
11706 set try
11707 if eval $compile && $run ./try 2>&1 >/dev/null; then
11708     case "`$run ./try`" in
11709         "123 456 789")
11710         echo "You have C99 variadic macros." >&4
11711         d_c99_variadic_macros="$define"
11712         ;;
11713         *)
11714         echo "You don't have functional C99 variadic macros." >&4
11715         d_c99_variadic_macros="$undef"
11716         ;;
11717     esac
11718 else
11719     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11720     d_c99_variadic_macros="$undef"
11721 fi
11722 $rm_try
11723
11724 : see if signal is declared as pointer to function returning int or void
11725 echo " "
11726 xxx=`./findhdr signal.h`
11727 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11728 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11729         echo "You have int (*signal())() instead of void." >&4
11730         val="$undef"
11731 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11732         echo "You have void (*signal())()." >&4
11733         val="$define"
11734 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11735         echo "You have int (*signal())() instead of void." >&4
11736         val="$undef"
11737 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11738         echo "You have void (*signal())()." >&4
11739         val="$define"
11740 else
11741         case "$d_voidsig" in
11742         '')
11743         echo "I can't determine whether signal handler returns void or int..." >&4
11744                 dflt=void
11745                 rp="What type does your signal handler return?"
11746                 . ./myread
11747                 case "$ans" in
11748                 v*) val="$define";;
11749                 *) val="$undef";;
11750                 esac;;
11751         "$define")
11752                 echo "As you already told me, signal handler returns void." >&4
11753                 val="$define"
11754                 ;;
11755         *)      echo "As you already told me, signal handler returns int." >&4
11756                 val="$undef"
11757                 ;;
11758         esac
11759 fi
11760 set d_voidsig
11761 eval $setvar
11762 case "$d_voidsig" in
11763 "$define") signal_t="void";;
11764 *) signal_t="int";;
11765 esac
11766 $rm -f $$.tmp
11767
11768 : check for ability to cast large floats to 32-bit ints.
11769 echo " "
11770 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11771 if $test "$intsize" -ge 4; then
11772         xxx=int
11773 else
11774         xxx=long
11775 fi
11776 $cat >try.c <<EOCP
11777 #include <stdio.h>
11778 #$i_stdlib I_STDLIB
11779 #ifdef I_STDLIB
11780 #include <stdlib.h>
11781 #endif
11782 #include <sys/types.h>
11783 #include <signal.h>
11784 $signal_t blech(int s) { exit(3); }
11785 int main()
11786 {
11787         $xxx i32;
11788         double f, g;
11789         int result = 0;
11790         char str[16];
11791         signal(SIGFPE, blech);
11792
11793         /* Don't let compiler optimize the test away.  Store the number
11794            in a writable string for gcc to pass to sscanf under HP-UX.
11795         */
11796         sprintf(str, "2147483647");
11797         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11798         g = 10 * f;
11799         i32  = ($xxx) g;
11800
11801         /* x86 processors will probably give 0x8000 0000, which is a
11802            sign change.  We don't want that.  We want to mimic SPARC
11803            behavior here, which is to preserve the sign and give
11804            back 0x7fff ffff.
11805         */
11806         if (i32 != ($xxx) f)
11807                 result |= 1;
11808         exit(result);
11809 }
11810 EOCP
11811 set try
11812 if eval $compile_ok; then
11813         $run ./try 2>/dev/null
11814         yyy=$?
11815 else
11816         echo "(I can't seem to compile the test program--assuming it can't)"
11817         yyy=1
11818 fi
11819 case "$yyy" in
11820 0)      val="$define"
11821         echo "Yup, it can."
11822         ;;
11823 *)      val="$undef"
11824         echo "Nope, it can't."
11825         ;;
11826 esac
11827 set d_casti32
11828 eval $setvar
11829 $rm_try
11830
11831 : check for ability to cast negative floats to unsigned
11832 echo " "
11833 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11834 $cat >try.c <<EOCP
11835 #include <stdio.h>
11836 #$i_stdlib I_STDLIB
11837 #ifdef I_STDLIB
11838 #include <stdlib.h>
11839 #endif
11840 #include <sys/types.h>
11841 #include <signal.h>
11842 $signal_t blech(int s) { exit(7); }
11843 $signal_t blech_in_list(int s) { exit(4); }
11844 unsigned long dummy_long(unsigned long p) { return p; }
11845 unsigned int dummy_int(unsigned int p) { return p; }
11846 unsigned short dummy_short(unsigned short p) { return p; }
11847 int main()
11848 {
11849         double f;
11850         unsigned long along;
11851         unsigned int aint;
11852         unsigned short ashort;
11853         int result = 0;
11854         char str[16];
11855
11856         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11857            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11858            optimized the whole file away
11859         */
11860         /* Store the number in a writable string for gcc to pass to
11861            sscanf under HP-UX.
11862         */
11863         sprintf(str, "-123");
11864         sscanf(str, "%lf", &f);  /* f = -123.; */
11865
11866         signal(SIGFPE, blech);
11867         along = (unsigned long)f;
11868         aint = (unsigned int)f;
11869         ashort = (unsigned short)f;
11870         if (along != (unsigned long)-123)
11871                 result |= 1;
11872         if (aint != (unsigned int)-123)
11873                 result |= 1;
11874         if (ashort != (unsigned short)-123)
11875                 result |= 1;
11876         sprintf(str, "1073741824.");
11877         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11878         f = f + f;
11879         along = 0;
11880         along = (unsigned long)f;
11881         if (along != 0x80000000)
11882                 result |= 2;
11883         f -= 1.;
11884         along = 0;
11885         along = (unsigned long)f;
11886         if (along != 0x7fffffff)
11887                 result |= 1;
11888         f += 2.;
11889         along = 0;
11890         along = (unsigned long)f;
11891         if (along != 0x80000001)
11892                 result |= 2;
11893         if (result)
11894                 exit(result);
11895         signal(SIGFPE, blech_in_list);
11896         sprintf(str, "123.");
11897         sscanf(str, "%lf", &f);  /* f = 123.; */
11898         along = dummy_long((unsigned long)f);
11899         aint = dummy_int((unsigned int)f);
11900         ashort = dummy_short((unsigned short)f);
11901         if (along != (unsigned long)123)
11902                 result |= 4;
11903         if (aint != (unsigned int)123)
11904                 result |= 4;
11905         if (ashort != (unsigned short)123)
11906                 result |= 4;
11907         exit(result);
11908
11909 }
11910 EOCP
11911 set try
11912 if eval $compile_ok; then
11913         $run ./try 2>/dev/null
11914         castflags=$?
11915 else
11916         echo "(I can't seem to compile the test program--assuming it can't)"
11917         castflags=7
11918 fi
11919 case "$castflags" in
11920 0)      val="$define"
11921         echo "Yup, it can."
11922         ;;
11923 *)      val="$undef"
11924         echo "Nope, it can't."
11925         ;;
11926 esac
11927 set d_castneg
11928 eval $setvar
11929 $rm_try
11930
11931 : see if cbrt exists
11932 set cbrt d_cbrt
11933 eval $inlibc
11934
11935 : see if chown exists
11936 set chown d_chown
11937 eval $inlibc
11938
11939 : see if chroot exists
11940 set chroot d_chroot
11941 eval $inlibc
11942
11943 : see if chsize exists
11944 set chsize d_chsize
11945 eval $inlibc
11946
11947 : see if class exists
11948 set class d_class
11949 eval $inlibc
11950
11951 : see if clearenv exists
11952 set clearenv d_clearenv
11953 eval $inlibc
11954
11955 : Define hasstruct macro for Configure internal use
11956 hasstruct='varname=$1; struct=$2; shift; shift;
11957 while $test $# -ge 2; do
11958         case "$1" in
11959         $define) echo "#include <$2>";;
11960         esac ;
11961     shift 2;
11962 done > try.c;
11963 echo "int main () { struct $struct foo; }" >> try.c;
11964 set try;
11965 if eval $compile; then
11966         val="$define";
11967 else
11968         val="$undef";
11969 fi;
11970 set $varname;
11971 eval $setvar;
11972 $rm_try'
11973
11974 : see whether socket exists
11975 socketlib=''
11976 sockethdr=''
11977 echo " "
11978 $echo $n "Hmm... $c" >&4
11979 if set socket val -f d_socket; eval $csym; $val; then
11980     echo "Looks like you have Berkeley networking support." >&4
11981     d_socket="$define"
11982     if set setsockopt val -f; eval $csym; $val; then
11983         d_oldsock="$undef"
11984     else
11985         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11986         d_oldsock="$define"
11987     fi
11988 else
11989     if $contains socklib libc.list >/dev/null 2>&1; then
11990         echo "Looks like you have Berkeley networking support." >&4
11991         d_socket="$define"
11992         : we will have to assume that it supports the 4.2 BSD interface
11993         d_oldsock="$undef"
11994     else
11995         echo "You don't have Berkeley networking in libc$_a..." >&4
11996         if test "X$d_socket" = "X$define"; then
11997             echo "...but you seem to believe that you have sockets." >&4
11998         else
11999             for net in net socket
12000             do
12001                 if test -f $sysroot/usr/lib/lib$net$_a; then
12002                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
12003                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
12004                     if $contains socket libc.list >/dev/null 2>&1; then
12005                         d_socket="$define"
12006                         socketlib="-l$net"
12007                         case "$net" in
12008                         net)
12009                             echo "...but the Wollongong group seems to have hacked it in." >&4
12010                             sockethdr="-I$sysroot/usr/netinclude"
12011                             ;;
12012                         esac
12013                         echo "Found Berkeley sockets interface in lib$net." >&4
12014                         if $contains setsockopt libc.list >/dev/null 2>&1; then
12015                             d_oldsock="$undef"
12016                         else
12017                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
12018                             d_oldsock="$define"
12019                         fi
12020                         break
12021                     fi
12022                 fi
12023             done
12024             if test "X$d_socket" != "X$define"; then
12025                echo "or anywhere else I see." >&4
12026                d_socket="$undef"
12027                d_oldsock="$undef"
12028             fi
12029         fi
12030     fi
12031 fi
12032
12033 : see if socketpair exists
12034 set socketpair d_sockpair
12035 eval $inlibc
12036
12037
12038 echo "Checking the availability sa_len in the sock struct ..." >&4
12039 $cat >try.c <<EOF
12040 #include <sys/types.h>
12041 #include <sys/socket.h>
12042 int main() {
12043 struct sockaddr sa;
12044 return (sa.sa_len);
12045 }
12046 EOF
12047 val="$undef"
12048 set try; if eval $compile; then
12049     val="$define"
12050 fi
12051 set d_sockaddr_sa_len; eval $setvar
12052 $rm_try
12053
12054 echo "Checking the availability struct sockaddr_in6 ..." >&4
12055 $cat >try.c <<EOF
12056 #include <sys/types.h>
12057 #include <sys/socket.h>
12058 #include <netinet/in.h>
12059 int main() {
12060 struct sockaddr_in6 sin6;
12061 return (sin6.sin6_family);
12062 }
12063 EOF
12064 val="$undef"
12065 set try; if eval $compile; then
12066     val="$define"
12067 fi
12068 set d_sockaddr_in6; eval $setvar
12069 $rm_try
12070
12071 echo "Checking the availability struct sockaddr_storage ..." >&4
12072 $cat >try.c <<EOF
12073 #include <sys/types.h>
12074 #include <sys/socket.h>
12075 #include <netinet/in.h>
12076 int main() {
12077 struct sockaddr_storage sastor;
12078 return (sastor.ss_family);
12079 }
12080 EOF
12081 val="$undef"
12082 set try; if eval $compile; then
12083     val="$define"
12084 fi
12085 set d_sockaddr_storage; eval $setvar
12086 $rm_try
12087
12088 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12089 $cat >try.c <<EOF
12090 #include <sys/types.h>
12091 #include <sys/socket.h>
12092 #include <netinet/in.h>
12093 int main() {
12094 struct sockaddr_in6 sin6;
12095 return (sin6.sin6_scope_id);
12096 }
12097 EOF
12098 val="$undef"
12099 set try; if eval $compile; then
12100     val="$define"
12101 fi
12102 set d_sin6_scope_id; eval $setvar
12103 $rm_try
12104
12105 echo "Checking the availability struct ip_mreq ..." >&4
12106 $cat >try.c <<EOF
12107 #include <sys/types.h>
12108 #include <sys/socket.h>
12109 #include <netinet/in.h>
12110 int main() {
12111 struct ip_mreq mreq;
12112 return (mreq.imr_multiaddr.s_addr);
12113 }
12114 EOF
12115 val="$undef"
12116 set try; if eval $compile; then
12117        val="$define"
12118 fi
12119 set d_ip_mreq; eval $setvar
12120 $rm_try
12121
12122 echo "Checking the availability struct ip_mreq_source ..." >&4
12123 $cat >try.c <<EOF
12124 #include <sys/types.h>
12125 #include <sys/socket.h>
12126 #include <netinet/in.h>
12127 int main() {
12128 struct ip_mreq_source mreq;
12129 return (mreq.imr_multiaddr.s_addr);
12130 }
12131 EOF
12132 val="$undef"
12133 set try; if eval $compile; then
12134        val="$define"
12135 fi
12136 set d_ip_mreq_source; eval $setvar
12137 $rm_try
12138
12139 echo "Checking the availability struct ipv6_mreq ..." >&4
12140 $cat >try.c <<EOF
12141 #include <sys/types.h>
12142 #include <sys/socket.h>
12143 #include <netinet/in.h>
12144 int main() {
12145 struct ipv6_mreq mreq;
12146 return (mreq.ipv6mr_interface);
12147 }
12148 EOF
12149 val="$undef"
12150 set try; if eval $compile; then
12151     val="$define"
12152 fi
12153 set d_ipv6_mreq; eval $setvar
12154 $rm_try
12155
12156 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12157 $cat >try.c <<EOF
12158 #include <sys/types.h>
12159 #include <sys/socket.h>
12160 #include <netinet/in.h>
12161 int main() {
12162 struct ipv6_mreq_source mreq;
12163 return (mreq.imr_multiaddr.s_addr);
12164 }
12165 EOF
12166 val="$undef"
12167 set try; if eval $compile; then
12168        val="$define"
12169 fi
12170 set d_ipv6_mreq_source; eval $setvar
12171 $rm_try
12172
12173 echo "Checking the availability of certain socket constants..." >&4
12174 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12175     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12176     $cat >try.c <<EOF
12177 #include <sys/types.h>
12178 #include <sys/socket.h>
12179 int main() {
12180     int i = $ENUM;
12181 }
12182 EOF
12183     val="$undef"
12184     set try; if eval $compile; then
12185         val="$define"
12186     fi
12187     set d_${enum}; eval $setvar
12188     $rm_try
12189 done
12190
12191 : see if this is a sys/uio.h system
12192 set sys/uio.h i_sysuio
12193 eval $inhdr
12194
12195 : Check for cmsghdr support
12196 echo " "
12197 echo "Checking to see if your system supports struct cmsghdr..." >&4
12198 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12199 eval $hasstruct
12200 case "$d_cmsghdr_s" in
12201 "$define")      echo "Yes, it does."   ;;
12202 *)              echo "No, it doesn't." ;;
12203 esac
12204
12205 : see if copysign exists
12206 set copysign d_copysign
12207 eval $inlibc
12208
12209 : see if copysignl exists
12210 set copysignl d_copysignl
12211 eval $inlibc
12212
12213 : see if crypt exists
12214 echo " "
12215 set crypt d_crypt
12216 eval $inlibc
12217 case "$d_crypt" in
12218 $define) cryptlib='' ;;
12219 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12220                 echo 'crypt() found.' >&4
12221                 val="$define"
12222                 cryptlib=''
12223         else
12224                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12225                 if $test -z "$cryptlib"; then
12226                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12227                 else
12228                         cryptlib=-lcrypt
12229                 fi
12230                 if $test -z "$cryptlib"; then
12231                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12232                 else
12233                         cryptlib=-lcrypt
12234                 fi
12235                 if $test -z "$cryptlib"; then
12236                         cryptlib=`./loc libcrypt$_a "" $libpth`
12237                 else
12238                         cryptlib=-lcrypt
12239                 fi
12240                 if $test -z "$cryptlib"; then
12241                         echo 'crypt() NOT found.' >&4
12242                         val="$undef"
12243                 else
12244                         val="$define"
12245                 fi
12246         fi
12247         set d_crypt
12248         eval $setvar
12249         ;;
12250 esac
12251
12252 : see if this is a crypt.h system
12253 set crypt.h i_crypt
12254 eval $inhdr
12255
12256 : see if crypt_r exists
12257 set crypt_r d_crypt_r
12258 eval $inlibc
12259 case "$d_crypt_r" in
12260 "$define")
12261         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12262         case "$d_crypt_r_proto:$usethreads" in
12263         ":define")      d_crypt_r_proto=define
12264                 set d_crypt_r_proto crypt_r $hdrs
12265                 eval $hasproto ;;
12266         *)      ;;
12267         esac
12268         case "$d_crypt_r_proto" in
12269         define)
12270         case "$crypt_r_proto" in
12271         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12272         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12273         esac
12274         case "$crypt_r_proto" in
12275         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12276         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12277         esac
12278         case "$crypt_r_proto" in
12279         ''|0)   d_crypt_r=undef
12280                 crypt_r_proto=0
12281                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12282         * )     case "$crypt_r_proto" in
12283                 REENTRANT_PROTO*) ;;
12284                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12285                 esac
12286                 echo "Prototype: $try" ;;
12287         esac
12288         ;;
12289         *)      case "$usethreads" in
12290                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12291                 esac
12292                 d_crypt_r=undef
12293                 crypt_r_proto=0
12294                 ;;
12295         esac
12296         ;;
12297 *)      crypt_r_proto=0
12298         ;;
12299 esac
12300
12301 : get csh whereabouts
12302 case "$csh" in
12303 'csh') val="$undef" ;;
12304 *) val="$define" ;;
12305 esac
12306 set d_csh
12307 eval $setvar
12308 : Respect a hint or command line value for full_csh.
12309 case "$full_csh" in
12310 '') full_csh=$csh ;;
12311 esac
12312
12313 : see if ctermid exists
12314 set ctermid d_ctermid
12315 eval $inlibc
12316
12317 : see if ctermid_r exists
12318 set ctermid_r d_ctermid_r
12319 eval $inlibc
12320 case "$d_ctermid_r" in
12321 "$define")
12322         hdrs="$i_systypes sys/types.h define stdio.h "
12323         case "$d_ctermid_r_proto:$usethreads" in
12324         ":define")      d_ctermid_r_proto=define
12325                 set d_ctermid_r_proto ctermid_r $hdrs
12326                 eval $hasproto ;;
12327         *)      ;;
12328         esac
12329         case "$d_ctermid_r_proto" in
12330         define)
12331         case "$ctermid_r_proto" in
12332         ''|0) try='char* ctermid_r(char*);'
12333         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12334         esac
12335         case "$ctermid_r_proto" in
12336         ''|0)   d_ctermid_r=undef
12337                 ctermid_r_proto=0
12338                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12339         * )     case "$ctermid_r_proto" in
12340                 REENTRANT_PROTO*) ;;
12341                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12342                 esac
12343                 echo "Prototype: $try" ;;
12344         esac
12345         ;;
12346         *)      case "$usethreads" in
12347                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12348                 esac
12349                 d_ctermid_r=undef
12350                 ctermid_r_proto=0
12351                 ;;
12352         esac
12353         ;;
12354 *)      ctermid_r_proto=0
12355         ;;
12356 esac
12357
12358 : see if ctime_r exists
12359 set ctime_r d_ctime_r
12360 eval $inlibc
12361 case "$d_ctime_r" in
12362 "$define")
12363         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12364         case "$d_ctime_r_proto:$usethreads" in
12365         ":define")      d_ctime_r_proto=define
12366                 set d_ctime_r_proto ctime_r $hdrs
12367                 eval $hasproto ;;
12368         *)      ;;
12369         esac
12370         case "$d_ctime_r_proto" in
12371         define)
12372         case "$ctime_r_proto" in
12373         ''|0) try='char* ctime_r(const time_t*, char*);'
12374         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12375         esac
12376         case "$ctime_r_proto" in
12377         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12378         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12379         esac
12380         case "$ctime_r_proto" in
12381         ''|0) try='int ctime_r(const time_t*, char*);'
12382         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12383         esac
12384         case "$ctime_r_proto" in
12385         ''|0) try='int ctime_r(const time_t*, char*, int);'
12386         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12387         esac
12388         case "$ctime_r_proto" in
12389         ''|0)   d_ctime_r=undef
12390                 ctime_r_proto=0
12391                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12392         * )     case "$ctime_r_proto" in
12393                 REENTRANT_PROTO*) ;;
12394                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12395                 esac
12396                 echo "Prototype: $try" ;;
12397         esac
12398         ;;
12399         *)      case "$usethreads" in
12400                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12401                 esac
12402                 d_ctime_r=undef
12403                 ctime_r_proto=0
12404                 ;;
12405         esac
12406         ;;
12407 *)      ctime_r_proto=0
12408         ;;
12409 esac
12410
12411 : see if cuserid exists
12412 set cuserid d_cuserid
12413 eval $inlibc
12414
12415 : see if dbm.h is available
12416 : see if dbmclose exists
12417 set dbmclose d_dbmclose
12418 eval $inlibc
12419
12420 case "$d_dbmclose" in
12421 $define)
12422         set dbm.h i_dbm
12423         eval $inhdr
12424         case "$i_dbm" in
12425         $define)
12426                 val="$undef"
12427                 set i_rpcsvcdbm
12428                 eval $setvar
12429                 ;;
12430         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12431                 eval $inhdr
12432                 ;;
12433         esac
12434         ;;
12435 *)      echo "We won't be including <dbm.h>"
12436         val="$undef"
12437         set i_dbm
12438         eval $setvar
12439         val="$undef"
12440         set i_rpcsvcdbm
12441         eval $setvar
12442         ;;
12443 esac
12444
12445 : see if prototype for dbminit is available
12446 echo " "
12447 set d_dbminitproto dbminit $i_dbm dbm.h
12448 eval $hasproto
12449
12450 : see if difftime exists
12451 set difftime d_difftime
12452 eval $inlibc
12453
12454 : see if this is a dirent system
12455 echo " "
12456 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12457         val="$define"
12458         echo "<dirent.h> found." >&4
12459 else
12460         val="$undef"
12461         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12462                 echo "<sys/dir.h> found." >&4
12463                 echo " "
12464         else
12465                 xinc=`./findhdr sys/ndir.h`
12466         fi
12467         echo "<dirent.h> NOT found." >&4
12468 fi
12469 set i_dirent
12470 eval $setvar
12471
12472 : Look for type of directory structure.
12473 echo " "
12474 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12475
12476 case "$direntrytype" in
12477 ''|' ')
12478         case "$i_dirent" in
12479         $define) guess1='struct dirent' ;;
12480         *) guess1='struct direct'  ;;
12481         esac
12482         ;;
12483 *)      guess1="$direntrytype"
12484         ;;
12485 esac
12486
12487 case "$guess1" in
12488 'struct dirent') guess2='struct direct' ;;
12489 *) guess2='struct dirent' ;;
12490 esac
12491
12492 if $contains "$guess1" try.c >/dev/null 2>&1; then
12493         direntrytype="$guess1"
12494         echo "Your directory entries are $direntrytype." >&4
12495 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12496         direntrytype="$guess2"
12497         echo "Your directory entries seem to be $direntrytype." >&4
12498 else
12499         echo "I don't recognize your system's directory entries." >&4
12500         rp="What type is used for directory entries on this system?"
12501         dflt="$guess1"
12502         . ./myread
12503         direntrytype="$ans"
12504 fi
12505 $rm_try
12506
12507 : see if the directory entry stores field length
12508 echo " "
12509 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12510 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12511         echo "Good, your directory entry keeps length information in d_namlen." >&4
12512         val="$define"
12513 else
12514         echo "Your directory entry does not know about the d_namlen field." >&4
12515         val="$undef"
12516 fi
12517 set d_dirnamlen
12518 eval $setvar
12519 $rm_try
12520
12521 : Look for DIR.dd_fd
12522 case "$i_dirent" in
12523 "$define")
12524     echo "Checking to see if DIR has a dd_fd member variable" >&4
12525     $cat >try.c <<EOCP
12526 #$i_stdlib I_STDLIB
12527 #ifdef I_STDLIB
12528 #include <stdlib.h>
12529 #endif
12530 #include <dirent.h>
12531
12532 int main() {
12533     DIR dir;
12534     dir.dd_fd = 1;
12535     return 0;
12536 }
12537 EOCP
12538     val=$undef
12539     set try
12540     if eval $compile; then
12541         echo "Yes, it does."
12542         val="$define"
12543     else
12544         echo "No, it does not."
12545         val="$undef"
12546     fi
12547     ;;
12548 *)
12549     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12550     val="$undef"
12551     ;;
12552 esac
12553 set d_dir_dd_fd
12554 eval $setvar
12555 $rm_try
12556
12557 : see if this is an sysdir system
12558 set sys/dir.h i_sysdir
12559 eval $inhdr
12560
12561 : see if this is an sysndir system
12562 set sys/ndir.h i_sysndir
12563 eval $inhdr
12564
12565 : Look for dirfd
12566 echo " "
12567 $cat >dirfd.c <<EOM
12568 #include <stdio.h>
12569 #$i_stdlib I_STDLIB
12570 #ifdef I_STDLIB
12571 #include <stdlib.h>
12572 #endif
12573 #$i_dirent I_DIRENT             /**/
12574 #$i_sysdir I_SYS_DIR            /**/
12575 #$i_sysndir I_SYS_NDIR          /**/
12576 #$i_systypes I_SYS_TYPES        /**/
12577 #if defined(I_SYS_TYPES)
12578 #include <sys/types.h>
12579 #endif
12580 #if defined(I_DIRENT)
12581 #include <dirent.h>
12582 #else
12583 #ifdef I_SYS_NDIR
12584 #include <sys/ndir.h>
12585 #else
12586 #ifdef I_SYS_DIR
12587 #include <sys/dir.h>
12588 #endif
12589 #endif
12590 #endif
12591 int main() {
12592         DIR *dirp = opendir(".");
12593         if (dirfd(dirp) >= 0)
12594                 exit(0);
12595         else
12596                 exit(1);
12597 }
12598 EOM
12599 val=$undef
12600 set dirfd
12601 if eval $compile; then
12602         val="$define"
12603 fi
12604 case "$val" in
12605 $define)        echo "dirfd() found." >&4       ;;
12606 *)              echo "dirfd() NOT found." >&4   ;;
12607 esac
12608 set d_dirfd
12609 eval $setvar
12610 $rm -f dirfd*
12611
12612 : see if dladdr exists
12613 set dladdr d_dladdr
12614 eval $inlibc
12615
12616 : see if dlerror exists
12617 xxx_runnm="$runnm"
12618 runnm=false
12619 set dlerror d_dlerror
12620 eval $inlibc
12621 runnm="$xxx_runnm"
12622
12623 : see if dlfcn is available
12624 set dlfcn.h i_dlfcn
12625 eval $inhdr
12626
12627 : Check what extension to use for shared libs
12628 case "$usedl" in
12629 $define|y|true)
12630         $cat << EOM
12631
12632 On a few systems, the dynamically loaded modules that perl generates and uses
12633 will need a different extension than shared libs. The default will probably
12634 be appropriate.
12635
12636 EOM
12637         case "$dlext" in
12638         '')     dflt="$so" ;;
12639         *)      dflt="$dlext" ;;
12640         esac
12641         rp='What is the extension of dynamically loaded modules'
12642         . ./myread
12643         dlext="$ans"
12644         ;;
12645 *)
12646         dlext="none"
12647         ;;
12648 esac
12649
12650 : Check if dlsym need a leading underscore
12651 echo " "
12652 val="$undef"
12653
12654 case "$dlsrc" in
12655 dl_dlopen.xs)
12656         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12657         $cat >dyna.c <<'EOM'
12658 fred () { }
12659 EOM
12660
12661 $cat >fred.c<<EOM
12662
12663 #include <stdio.h>
12664 #$i_stdlib I_STDLIB
12665 #ifdef I_STDLIB
12666 #include <stdlib.h>
12667 #endif
12668 #$i_dlfcn I_DLFCN
12669 #ifdef I_DLFCN
12670 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12671 #else
12672 #include <sys/types.h>
12673 #include <nlist.h>
12674 #include <link.h>
12675 #endif
12676
12677 extern int fred() ;
12678
12679 int main()
12680 {
12681     void * handle ;
12682     void * symbol ;
12683 #ifndef RTLD_LAZY
12684     int mode = 1 ;
12685 #else
12686     int mode = RTLD_LAZY ;
12687 #endif
12688     handle = dlopen("./dyna.$dlext", mode) ;
12689     if (handle == NULL) {
12690         printf ("1\n") ;
12691         fflush (stdout) ;
12692         exit(0);
12693     }
12694     symbol = dlsym(handle, "fred") ;
12695     if (symbol == NULL) {
12696         /* try putting a leading underscore */
12697         symbol = dlsym(handle, "_fred") ;
12698         if (symbol == NULL) {
12699             printf ("2\n") ;
12700             fflush (stdout) ;
12701             exit(0);
12702         }
12703         printf ("3\n") ;
12704     }
12705     else
12706         printf ("4\n") ;
12707     fflush (stdout) ;
12708     exit(0);
12709 }
12710 EOM
12711         : Call the object file tmp-dyna.o in case dlext=o.
12712         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12713                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12714                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12715                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12716                 xxx=`$run ./fred`
12717                 case $xxx in
12718                 1)      echo "Test program failed using dlopen." >&4
12719                         echo "Perhaps you should not use dynamic loading." >&4;;
12720                 2)      echo "Test program failed using dlsym." >&4
12721                         echo "Perhaps you should not use dynamic loading." >&4;;
12722                 3)      echo "dlsym needs a leading underscore" >&4
12723                         val="$define" ;;
12724                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12725                 esac
12726         else
12727                 echo "I can't compile and run the test program." >&4
12728                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12729         fi
12730         ;;
12731 esac
12732
12733 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12734
12735 set d_dlsymun
12736 eval $setvar
12737
12738 : see if drand48_r exists
12739 set drand48_r d_drand48_r
12740 eval $inlibc
12741 case "$d_drand48_r" in
12742 "$define")
12743         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12744         case "$d_drand48_r_proto:$usethreads" in
12745         ":define")      d_drand48_r_proto=define
12746                 set d_drand48_r_proto drand48_r $hdrs
12747                 eval $hasproto ;;
12748         *)      ;;
12749         esac
12750         case "$d_drand48_r_proto" in
12751         define)
12752         case "$drand48_r_proto" in
12753         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12754         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12755         esac
12756         case "$drand48_r_proto" in
12757         ''|0)   d_drand48_r=undef
12758                 drand48_r_proto=0
12759                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12760         * )     case "$drand48_r_proto" in
12761                 REENTRANT_PROTO*) ;;
12762                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12763                 esac
12764                 echo "Prototype: $try" ;;
12765         esac
12766         ;;
12767         *)      case "$usethreads" in
12768                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12769                 esac
12770                 d_drand48_r=undef
12771                 drand48_r_proto=0
12772                 ;;
12773         esac
12774         ;;
12775 *)      drand48_r_proto=0
12776         ;;
12777 esac
12778
12779 : see if prototype for drand48 is available
12780 echo " "
12781 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12782 eval $hasproto
12783
12784 : see if dup2 exists
12785 set dup2 d_dup2
12786 eval $inlibc
12787
12788 : see if dup3 exists
12789 set dup3 d_dup3
12790 eval $inlibc
12791
12792 : see if localeconv_l exists
12793 set localeconv_l d_localeconv_l
12794 eval $inlibc
12795
12796 : see if this is an xlocale.h system
12797 set xlocale.h i_xlocale
12798 eval $inhdr
12799
12800 : see if newlocale exists
12801 set newlocale d_newlocale
12802 eval $inlibc
12803
12804 : see if freelocale exists
12805 set freelocale d_freelocale
12806 eval $inlibc
12807
12808 : see if uselocale exists
12809 set uselocale d_uselocale
12810 eval $inlibc
12811
12812 : see if duplocale exists
12813 set duplocale d_duplocale
12814 eval $inlibc
12815
12816 : see if querylocale exists
12817 set querylocale d_querylocale
12818 eval $inlibc
12819
12820 : if we have xlocale.h, check whether it is needed
12821 case "$i_xlocale$d_newlocale$xlocale_needed" in
12822 "$define$define")
12823         echo "Checking if xlocale.h is needed..." >&4
12824         $cat >try.c <<EOF
12825 #include <locale.h>
12826 #include <stdio.h>
12827 #ifdef TRY_XLOCALE
12828 #include <xlocale.h>
12829 #endif
12830 #$d_localeconv_l HAVE_LOCALECONV_L
12831
12832 #ifdef HAVE_LOCALECONV_L
12833 struct lconv *(*lcptr)(locale_t) = localeconv_l;
12834 #endif
12835
12836 int main(void) {
12837   locale_t lc = newlocale(LC_ALL_MASK, "C", (locale_t)0);
12838
12839 #ifdef HAVE_LOCALECONV_L
12840   /* FreeBSD hides only localeconv_l() in xlocale.h */
12841   struct lconv *lcbuf = localeconv_l(lc);
12842   printf("decimal: %s\n", lcbuf->decimal_point);
12843 #endif
12844
12845   freelocale(lc);
12846   return 0;
12847 }
12848 EOF
12849         set try
12850         if eval $compile && $run ./try > /dev/null 2>&1 ; then
12851                 echo "xlocale.h isn't needed" >&4
12852                 xlocale_needed=$undef
12853         else
12854                 set try -DTRY_XLOCALE
12855                 if eval $compile && $run ./try > /dev/null 2>&1 ; then
12856                         xlocale_needed=$define
12857                         echo "xlocale.h is needed" >&4
12858                 else
12859                         echo "I can't build my test either way" >&4
12860                         xlocale_needed=$undef
12861                 fi
12862         fi
12863         $rm_try
12864         ;;
12865 *) xlocale_needed=$undef ;;
12866 esac
12867
12868 : see if eaccess exists
12869 set eaccess d_eaccess
12870 eval $inlibc
12871
12872 : see if endgrent exists
12873 set endgrent d_endgrent
12874 eval $inlibc
12875
12876 : see if this is an grp system
12877 set grp.h i_grp
12878 eval $inhdr
12879
12880 case "$i_grp" in
12881 $define)
12882         xxx=`./findhdr grp.h`
12883         $cppstdin $cppflags $cppminus < $xxx >$$.h
12884
12885         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12886                 val="$define"
12887         else
12888                 val="$undef"
12889         fi
12890         set d_grpasswd
12891         eval $setvar
12892
12893         $rm -f $$.h
12894         ;;
12895 *)
12896         val="$undef";
12897         set d_grpasswd; eval $setvar
12898         ;;
12899 esac
12900
12901 : see if endgrent_r exists
12902 set endgrent_r d_endgrent_r
12903 eval $inlibc
12904 case "$d_endgrent_r" in
12905 "$define")
12906         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12907         case "$d_endgrent_r_proto:$usethreads" in
12908         ":define")      d_endgrent_r_proto=define
12909                 set d_endgrent_r_proto endgrent_r $hdrs
12910                 eval $hasproto ;;
12911         *)      ;;
12912         esac
12913         case "$d_endgrent_r_proto" in
12914         define)
12915         case "$endgrent_r_proto" in
12916         ''|0) try='int endgrent_r(FILE**);'
12917         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12918         esac
12919         case "$endgrent_r_proto" in
12920         ''|0) try='void endgrent_r(FILE**);'
12921         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12922         esac
12923         case "$endgrent_r_proto" in
12924         ''|0)   d_endgrent_r=undef
12925                 endgrent_r_proto=0
12926                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12927         * )     case "$endgrent_r_proto" in
12928                 REENTRANT_PROTO*) ;;
12929                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12930                 esac
12931                 echo "Prototype: $try" ;;
12932         esac
12933         ;;
12934         *)      case "$usethreads" in
12935                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12936                 esac
12937                 d_endgrent_r=undef
12938                 endgrent_r_proto=0
12939                 ;;
12940         esac
12941         ;;
12942 *)      endgrent_r_proto=0
12943         ;;
12944 esac
12945
12946 : see if endhostent exists
12947 set endhostent d_endhent
12948 eval $inlibc
12949
12950 : see if this is a netdb.h system
12951 set netdb.h i_netdb
12952 eval $inhdr
12953
12954 : see if endhostent_r exists
12955 set endhostent_r d_endhostent_r
12956 eval $inlibc
12957 case "$d_endhostent_r" in
12958 "$define")
12959         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12960         case "$d_endhostent_r_proto:$usethreads" in
12961         ":define")      d_endhostent_r_proto=define
12962                 set d_endhostent_r_proto endhostent_r $hdrs
12963                 eval $hasproto ;;
12964         *)      ;;
12965         esac
12966         case "$d_endhostent_r_proto" in
12967         define)
12968         case "$endhostent_r_proto" in
12969         ''|0) try='int endhostent_r(struct hostent_data*);'
12970         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12971         esac
12972         case "$endhostent_r_proto" in
12973         ''|0) try='void endhostent_r(struct hostent_data*);'
12974         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12975         esac
12976         case "$endhostent_r_proto" in
12977         ''|0)   d_endhostent_r=undef
12978                 endhostent_r_proto=0
12979                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12980         * )     case "$endhostent_r_proto" in
12981                 REENTRANT_PROTO*) ;;
12982                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12983                 esac
12984                 echo "Prototype: $try" ;;
12985         esac
12986         ;;
12987         *)      case "$usethreads" in
12988                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12989                 esac
12990                 d_endhostent_r=undef
12991                 endhostent_r_proto=0
12992                 ;;
12993         esac
12994         ;;
12995 *)      endhostent_r_proto=0
12996         ;;
12997 esac
12998
12999 : see if endnetent exists
13000 set endnetent d_endnent
13001 eval $inlibc
13002
13003 : see if endnetent_r exists
13004 set endnetent_r d_endnetent_r
13005 eval $inlibc
13006 case "$d_endnetent_r" in
13007 "$define")
13008         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13009         case "$d_endnetent_r_proto:$usethreads" in
13010         ":define")      d_endnetent_r_proto=define
13011                 set d_endnetent_r_proto endnetent_r $hdrs
13012                 eval $hasproto ;;
13013         *)      ;;
13014         esac
13015         case "$d_endnetent_r_proto" in
13016         define)
13017         case "$endnetent_r_proto" in
13018         ''|0) try='int endnetent_r(struct netent_data*);'
13019         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
13020         esac
13021         case "$endnetent_r_proto" in
13022         ''|0) try='void endnetent_r(struct netent_data*);'
13023         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
13024         esac
13025         case "$endnetent_r_proto" in
13026         ''|0)   d_endnetent_r=undef
13027                 endnetent_r_proto=0
13028                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
13029         * )     case "$endnetent_r_proto" in
13030                 REENTRANT_PROTO*) ;;
13031                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
13032                 esac
13033                 echo "Prototype: $try" ;;
13034         esac
13035         ;;
13036         *)      case "$usethreads" in
13037                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
13038                 esac
13039                 d_endnetent_r=undef
13040                 endnetent_r_proto=0
13041                 ;;
13042         esac
13043         ;;
13044 *)      endnetent_r_proto=0
13045         ;;
13046 esac
13047
13048 : see if endprotoent exists
13049 set endprotoent d_endpent
13050 eval $inlibc
13051
13052 : see if endprotoent_r exists
13053 set endprotoent_r d_endprotoent_r
13054 eval $inlibc
13055 case "$d_endprotoent_r" in
13056 "$define")
13057         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13058         case "$d_endprotoent_r_proto:$usethreads" in
13059         ":define")      d_endprotoent_r_proto=define
13060                 set d_endprotoent_r_proto endprotoent_r $hdrs
13061                 eval $hasproto ;;
13062         *)      ;;
13063         esac
13064         case "$d_endprotoent_r_proto" in
13065         define)
13066         case "$endprotoent_r_proto" in
13067         ''|0) try='int endprotoent_r(struct protoent_data*);'
13068         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13069         esac
13070         case "$endprotoent_r_proto" in
13071         ''|0) try='void endprotoent_r(struct protoent_data*);'
13072         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13073         esac
13074         case "$endprotoent_r_proto" in
13075         ''|0)   d_endprotoent_r=undef
13076                 endprotoent_r_proto=0
13077                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13078         * )     case "$endprotoent_r_proto" in
13079                 REENTRANT_PROTO*) ;;
13080                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13081                 esac
13082                 echo "Prototype: $try" ;;
13083         esac
13084         ;;
13085         *)      case "$usethreads" in
13086                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13087                 esac
13088                 d_endprotoent_r=undef
13089                 endprotoent_r_proto=0
13090                 ;;
13091         esac
13092         ;;
13093 *)      endprotoent_r_proto=0
13094         ;;
13095 esac
13096
13097 : see if endpwent exists
13098 set endpwent d_endpwent
13099 eval $inlibc
13100
13101 : see if this is a pwd.h system
13102 set pwd.h i_pwd
13103 eval $inhdr
13104
13105 case "$i_pwd" in
13106 $define)
13107         xxx=`./findhdr pwd.h`
13108         $cppstdin $cppflags $cppminus < $xxx >$$.h
13109
13110         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13111                 val="$define"
13112         else
13113                 val="$undef"
13114         fi
13115         set d_pwquota
13116         eval $setvar
13117
13118         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13119                 val="$define"
13120         else
13121                 val="$undef"
13122         fi
13123         set d_pwage
13124         eval $setvar
13125
13126         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13127                 val="$define"
13128         else
13129                 val="$undef"
13130         fi
13131         set d_pwchange
13132         eval $setvar
13133
13134         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13135                 val="$define"
13136         else
13137                 val="$undef"
13138         fi
13139         set d_pwclass
13140         eval $setvar
13141
13142         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13143                 val="$define"
13144         else
13145                 val="$undef"
13146         fi
13147         set d_pwexpire
13148         eval $setvar
13149
13150         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13151                 val="$define"
13152         else
13153                 val="$undef"
13154         fi
13155         set d_pwcomment
13156         eval $setvar
13157
13158         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13159                 val="$define"
13160         else
13161                 val="$undef"
13162         fi
13163         set d_pwgecos
13164         eval $setvar
13165
13166         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13167                 val="$define"
13168         else
13169                 val="$undef"
13170         fi
13171         set d_pwpasswd
13172         eval $setvar
13173
13174         $rm -f $$.h
13175         ;;
13176 *)
13177         val="$undef";
13178         set d_pwquota; eval $setvar
13179         set d_pwage; eval $setvar
13180         set d_pwchange; eval $setvar
13181         set d_pwclass; eval $setvar
13182         set d_pwexpire; eval $setvar
13183         set d_pwcomment; eval $setvar
13184         set d_pwgecos; eval $setvar
13185         set d_pwpasswd; eval $setvar
13186         ;;
13187 esac
13188
13189 : see if endpwent_r exists
13190 set endpwent_r d_endpwent_r
13191 eval $inlibc
13192 case "$d_endpwent_r" in
13193 "$define")
13194         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13195         case "$d_endpwent_r_proto:$usethreads" in
13196         ":define")      d_endpwent_r_proto=define
13197                 set d_endpwent_r_proto endpwent_r $hdrs
13198                 eval $hasproto ;;
13199         *)      ;;
13200         esac
13201         case "$d_endpwent_r_proto" in
13202         define)
13203         case "$endpwent_r_proto" in
13204         ''|0) try='int endpwent_r(FILE**);'
13205         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13206         esac
13207         case "$endpwent_r_proto" in
13208         ''|0) try='void endpwent_r(FILE**);'
13209         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13210         esac
13211         case "$endpwent_r_proto" in
13212         ''|0)   d_endpwent_r=undef
13213                 endpwent_r_proto=0
13214                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13215         * )     case "$endpwent_r_proto" in
13216                 REENTRANT_PROTO*) ;;
13217                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13218                 esac
13219                 echo "Prototype: $try" ;;
13220         esac
13221         ;;
13222         *)      case "$usethreads" in
13223                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13224                 esac
13225                 d_endpwent_r=undef
13226                 endpwent_r_proto=0
13227                 ;;
13228         esac
13229         ;;
13230 *)      endpwent_r_proto=0
13231         ;;
13232 esac
13233
13234 : see if endservent exists
13235 set endservent d_endsent
13236 eval $inlibc
13237
13238 : see if endservent_r exists
13239 set endservent_r d_endservent_r
13240 eval $inlibc
13241 case "$d_endservent_r" in
13242 "$define")
13243         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13244         case "$d_endservent_r_proto:$usethreads" in
13245         ":define")      d_endservent_r_proto=define
13246                 set d_endservent_r_proto endservent_r $hdrs
13247                 eval $hasproto ;;
13248         *)      ;;
13249         esac
13250         case "$d_endservent_r_proto" in
13251         define)
13252         case "$endservent_r_proto" in
13253         ''|0) try='int endservent_r(struct servent_data*);'
13254         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13255         esac
13256         case "$endservent_r_proto" in
13257         ''|0) try='void endservent_r(struct servent_data*);'
13258         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13259         esac
13260         case "$endservent_r_proto" in
13261         ''|0)   d_endservent_r=undef
13262                 endservent_r_proto=0
13263                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13264         * )     case "$endservent_r_proto" in
13265                 REENTRANT_PROTO*) ;;
13266                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13267                 esac
13268                 echo "Prototype: $try" ;;
13269         esac
13270         ;;
13271         *)      case "$usethreads" in
13272                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13273                 esac
13274                 d_endservent_r=undef
13275                 endservent_r_proto=0
13276                 ;;
13277         esac
13278         ;;
13279 *)      endservent_r_proto=0
13280         ;;
13281 esac
13282
13283 : Locate the flags for 'open()'
13284 echo " "
13285 $cat >try.c <<EOCP
13286 #include <sys/types.h>
13287 #ifdef I_FCNTL
13288 #include <fcntl.h>
13289 #endif
13290 #ifdef I_SYS_FILE
13291 #include <sys/file.h>
13292 #endif
13293 #$i_stdlib I_STDLIB
13294 #ifdef I_STDLIB
13295 #include <stdlib.h>
13296 #endif
13297 int main() {
13298         if(O_RDONLY);
13299 #ifdef O_TRUNC
13300         exit(0);
13301 #else
13302         exit(1);
13303 #endif
13304 }
13305 EOCP
13306 : check sys/file.h first to get FREAD on Sun
13307 if $test `./findhdr sys/file.h` && \
13308                 set try -DI_SYS_FILE && eval $compile; then
13309         h_sysfile=true;
13310         echo "<sys/file.h> defines the O_* constants..." >&4
13311         if $run ./try; then
13312                 echo "and you have the 3 argument form of open()." >&4
13313                 val="$define"
13314         else
13315                 echo "but not the 3 argument form of open().  Oh, well." >&4
13316                 val="$undef"
13317         fi
13318 elif $test `./findhdr fcntl.h` && \
13319                 set try -DI_FCNTL && eval $compile; then
13320         h_fcntl=true;
13321         echo "<fcntl.h> defines the O_* constants..." >&4
13322         if $run ./try; then
13323                 echo "and you have the 3 argument form of open()." >&4
13324                 val="$define"
13325         else
13326                 echo "but not the 3 argument form of open().  Oh, well." >&4
13327                 val="$undef"
13328         fi
13329 else
13330         val="$undef"
13331         echo "I can't find the O_* constant definitions!  You got problems." >&4
13332 fi
13333 set d_open3
13334 eval $setvar
13335 $rm_try
13336
13337 : see if this is a sys/file.h system
13338 val=''
13339 set sys/file.h val
13340 eval $inhdr
13341
13342 : do we need to include sys/file.h ?
13343 case "$val" in
13344 "$define")
13345         echo " "
13346         if $h_sysfile; then
13347                 val="$define"
13348                 echo "We'll be including <sys/file.h>." >&4
13349         else
13350                 val="$undef"
13351                 echo "We won't be including <sys/file.h>." >&4
13352         fi
13353         ;;
13354 *)
13355         h_sysfile=false
13356         ;;
13357 esac
13358 set i_sysfile
13359 eval $setvar
13360
13361 : see if fcntl.h is there
13362 val=''
13363 set fcntl.h val
13364 eval $inhdr
13365
13366 : see if we can include fcntl.h
13367 case "$val" in
13368 "$define")
13369         echo " "
13370         if $h_fcntl; then
13371                 val="$define"
13372                 echo "We'll be including <fcntl.h>." >&4
13373         else
13374                 val="$undef"
13375                 if $h_sysfile; then
13376         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13377                 else
13378                         echo "We won't be including <fcntl.h>." >&4
13379                 fi
13380         fi
13381         ;;
13382 *)
13383         h_fcntl=false
13384         val="$undef"
13385         ;;
13386 esac
13387 set i_fcntl
13388 eval $setvar
13389
13390 : see if fork exists
13391 set fork d_fork
13392 eval $inlibc
13393
13394 : see if pipe exists
13395 set pipe d_pipe
13396 eval $inlibc
13397
13398 : check for non-blocking I/O stuff
13399 case "$h_sysfile" in
13400 true) echo "#include <sys/file.h>" > head.c;;
13401 *)
13402        case "$h_fcntl" in
13403        true) echo "#include <fcntl.h>" > head.c;;
13404        *) echo "#include <sys/fcntl.h>" > head.c;;
13405        esac
13406        ;;
13407 esac
13408 echo " "
13409 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13410 case "$o_nonblock" in
13411 '')
13412         $cat head.c > try.c
13413         $cat >>try.c <<EOCP
13414 #include <stdio.h>
13415 #$i_stdlib I_STDLIB
13416 #ifdef I_STDLIB
13417 #include <stdlib.h>
13418 #endif
13419 #$i_fcntl I_FCNTL
13420 #ifdef I_FCNTL
13421 #include <fcntl.h>
13422 #endif
13423 int main() {
13424 #ifdef O_NONBLOCK
13425         printf("O_NONBLOCK\n");
13426         exit(0);
13427 #endif
13428 #ifdef O_NDELAY
13429         printf("O_NDELAY\n");
13430         exit(0);
13431 #endif
13432 #ifdef FNDELAY
13433         printf("FNDELAY\n");
13434         exit(0);
13435 #endif
13436         exit(0);
13437 }
13438 EOCP
13439         set try
13440         if eval $compile_ok; then
13441                 o_nonblock=`$run ./try`
13442                 case "$o_nonblock" in
13443                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13444                 *) echo "Seems like we can use $o_nonblock.";;
13445                 esac
13446         else
13447                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13448         fi
13449         ;;
13450 *) echo "Using $hint value $o_nonblock.";;
13451 esac
13452 $rm_try
13453
13454 echo " "
13455 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13456 case "$eagain" in
13457 '')
13458         case "$d_fork:$d_pipe:$d_alarm" in
13459         define:define:define)
13460         $cat head.c > try.c
13461         $cat >>try.c <<EOCP
13462 #include <errno.h>
13463 #include <sys/types.h>
13464 #include <signal.h>
13465 #include <stdio.h>
13466 #$i_stdlib I_STDLIB
13467 #ifdef I_STDLIB
13468 #include <stdlib.h>
13469 #endif
13470 #$i_fcntl I_FCNTL
13471 #ifdef I_FCNTL
13472 #include <fcntl.h>
13473 #endif
13474 #define MY_O_NONBLOCK $o_nonblock
13475 #ifndef errno  /* XXX need better Configure test */
13476 extern int errno;
13477 #endif
13478 #$i_unistd I_UNISTD
13479 #ifdef I_UNISTD
13480 #include <unistd.h>
13481 #endif
13482 #include <string.h>
13483 $signal_t blech(int x) { exit(3); }
13484 EOCP
13485         $cat >> try.c <<'EOCP'
13486 int main()
13487 {
13488         int pd[2];
13489         int pu[2];
13490         char buf[1];
13491         char string[100];
13492         int ret;
13493
13494         ret = pipe(pd); /* Down: child -> parent */
13495         if (ret != 0)
13496                 exit(3);
13497         ret = pipe(pu); /* Up: parent -> child */
13498         if (ret != 0)
13499                 exit(3);
13500         if (0 != fork()) {
13501                 close(pd[1]);   /* Parent reads from pd[0] */
13502                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13503 #ifdef F_SETFL
13504                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13505                         exit(1);
13506 #else
13507                 exit(4);
13508 #endif
13509                 signal(SIGALRM, blech);
13510                 alarm(5);
13511                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13512                         exit(2);
13513                 sprintf(string, "%d\n", ret);
13514                 ret = write(2, string, strlen(string));
13515                 if (ret != strlen(string))
13516                         exit(3);
13517                 alarm(0);
13518 #ifdef EAGAIN
13519                 if (errno == EAGAIN) {
13520                         printf("EAGAIN\n");
13521                         goto ok;
13522                 }
13523 #endif
13524 #ifdef EWOULDBLOCK
13525                 if (errno == EWOULDBLOCK)
13526                         printf("EWOULDBLOCK\n");
13527 #endif
13528         ok:
13529                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13530                 if (ret != 1)
13531                         exit(3);
13532                 sleep(2);                               /* Give it time to close our pipe */
13533                 alarm(5);
13534                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13535                 alarm(0);
13536                 sprintf(string, "%d\n", ret);
13537                 ret = write(4, string, strlen(string));
13538                 if (ret != strlen(string))
13539                         exit(3);
13540                 exit(0);
13541         }
13542
13543         close(pd[0]);                   /* We write to pd[1] */
13544         close(pu[1]);                   /* We read from pu[0] */
13545         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13546         if (ret != 1)
13547                 exit(3);
13548         close(pd[1]);                   /* Pipe pd is now fully closed! */
13549         exit(0);                                /* Bye bye, thank you for playing! */
13550 }
13551 EOCP
13552         set try
13553         if eval $compile_ok; then
13554                 echo "$startsh" >mtry
13555                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13556                 chmod +x mtry
13557                 $run ./mtry >/dev/null 2>&1
13558                 case $? in
13559                 0) eagain=`$cat try.out`;;
13560                 1) echo "Could not perform non-blocking setting!";;
13561                 2) echo "I did a successful read() for something that was not there!";;
13562                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13563                 4) echo "Could not find F_SETFL!";;
13564                 *) echo "Something terribly wrong happened during testing.";;
13565                 esac
13566                 rd_nodata=`$cat try.ret`
13567                 echo "A read() system call with no data present returns $rd_nodata."
13568                 case "$rd_nodata" in
13569                 0|-1) ;;
13570                 *)
13571                         echo "(That's peculiar, fixing that to be -1.)"
13572                         rd_nodata=-1
13573                         ;;
13574                 esac
13575                 case "$eagain" in
13576                 '')
13577                         echo "Forcing errno EAGAIN on read() with no data available."
13578                         eagain=EAGAIN
13579                         ;;
13580                 *)
13581                         echo "Your read() sets errno to $eagain when no data is available."
13582                         ;;
13583                 esac
13584                 status=`$cat try.err`
13585                 case "$status" in
13586                 0) echo "And it correctly returns 0 to signal EOF.";;
13587                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13588                 *) echo "However, your read() returns '$status' on EOF??";;
13589                 esac
13590                 val="$define"
13591                 if test "$status" = "$rd_nodata"; then
13592                         echo "WARNING: you can't distinguish between EOF and no data!"
13593                         val="$undef"
13594                 fi
13595         else
13596                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13597                 eagain=EAGAIN
13598         fi
13599         ;;
13600         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13601                 eagain=EAGAIN
13602                 val="$define"
13603                 ;;
13604         esac
13605         set d_eofnblk
13606         eval $setvar
13607         ;;
13608 *)
13609         echo "Using $hint value $eagain."
13610         echo "Your read() returns $rd_nodata when no data is present."
13611         case "$d_eofnblk" in
13612         "$define") echo "And you can see EOF because read() returns 0.";;
13613         "$undef") echo "But you can't see EOF status from read() returned value.";;
13614         *)
13615                 echo "(Assuming you can't see EOF status from read anyway.)"
13616                 d_eofnblk=$undef
13617                 ;;
13618         esac
13619         ;;
13620 esac
13621 $rm_try head.c mtry
13622
13623 : see if erf exists
13624 set erf d_erf
13625 eval $inlibc
13626
13627 : see if erfc exists
13628 set erfc d_erfc
13629 eval $inlibc
13630
13631 : see if exp2 exists
13632 set exp2 d_exp2
13633 eval $inlibc
13634
13635 : see if expm1 exists
13636 set expm1 d_expm1
13637 eval $inlibc
13638
13639 : see if _ptr and _cnt from stdio act std
13640 echo " "
13641
13642 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13643         echo "(Looks like you have stdio.h from BSD.)"
13644         case "$stdio_ptr" in
13645         '') stdio_ptr='((fp)->_p)'
13646                 ptr_lval=$define
13647                 ;;
13648         *)      ptr_lval=$d_stdio_ptr_lval;;
13649         esac
13650         case "$stdio_cnt" in
13651         '') stdio_cnt='((fp)->_r)'
13652                 cnt_lval=$define
13653                 ;;
13654         *)      cnt_lval=$d_stdio_cnt_lval;;
13655         esac
13656         case "$stdio_base" in
13657         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13658         esac
13659         case "$stdio_bufsiz" in
13660         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13661         esac
13662 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13663         echo "(Looks like you have stdio.h from Linux.)"
13664         case "$stdio_ptr" in
13665         '') stdio_ptr='((fp)->_IO_read_ptr)'
13666                 ptr_lval=$define
13667                 ;;
13668         *)      ptr_lval=$d_stdio_ptr_lval;;
13669         esac
13670         case "$stdio_cnt" in
13671         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13672                 cnt_lval=$undef
13673                 ;;
13674         *)      cnt_lval=$d_stdio_cnt_lval;;
13675         esac
13676         case "$stdio_base" in
13677         '') stdio_base='((fp)->_IO_read_base)';;
13678         esac
13679         case "$stdio_bufsiz" in
13680         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13681         esac
13682 else
13683         case "$stdio_ptr" in
13684         '') stdio_ptr='((fp)->_ptr)'
13685                 ptr_lval=$define
13686                 ;;
13687         *)      ptr_lval=$d_stdio_ptr_lval;;
13688         esac
13689         case "$stdio_cnt" in
13690         '') stdio_cnt='((fp)->_cnt)'
13691                 cnt_lval=$define
13692                 ;;
13693         *)      cnt_lval=$d_stdio_cnt_lval;;
13694         esac
13695         case "$stdio_base" in
13696         '') stdio_base='((fp)->_base)';;
13697         esac
13698         case "$stdio_bufsiz" in
13699         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13700         esac
13701 fi
13702
13703 : test whether _ptr and _cnt really work
13704 echo "Checking how std your stdio is..." >&4
13705 $cat >try.c <<EOP
13706 #include <stdio.h>
13707 #$i_stdlib I_STDLIB
13708 #ifdef I_STDLIB
13709 #include <stdlib.h>
13710 #endif
13711 #define FILE_ptr(fp)    $stdio_ptr
13712 #define FILE_cnt(fp)    $stdio_cnt
13713 int main() {
13714         FILE *fp = fopen("try.c", "r");
13715         char c = getc(fp);
13716         if (
13717                 18 <= FILE_cnt(fp) &&
13718                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13719         )
13720                 exit(0);
13721         exit(1);
13722 }
13723 EOP
13724 val="$undef"
13725 set try
13726 if eval $compile && $to try.c; then
13727         if $run ./try; then
13728                 echo "Your stdio acts pretty std."
13729                 val="$define"
13730         else
13731                 echo "Your stdio isn't very std."
13732         fi
13733 else
13734         echo "Your stdio doesn't appear very std."
13735 fi
13736 $rm_try
13737
13738 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13739 # direct buffer manipulation no longer works.  The Configure tests
13740 # should be changed to correctly detect this, but until then,
13741 # the following check should at least let perl compile and run.
13742 # (This quick fix should be updated before 5.8.1.)
13743 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13744 # A. Dougherty, June 3, 2002.
13745 case "$d_gnulibc" in
13746 $define)
13747         case "$gnulibc_version" in
13748         2.[01]*)  ;;
13749         2.2) ;;
13750         2.2.[0-9]) ;;
13751         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13752                 val="$undef"
13753                 ;;
13754         esac
13755         ;;
13756 esac
13757 set d_stdstdio
13758 eval $setvar
13759
13760 : Can _ptr be used as an lvalue?
13761 case "$d_stdstdio$ptr_lval" in
13762 $define$define) val=$define ;;
13763 *) val=$undef ;;
13764 esac
13765 set d_stdio_ptr_lval
13766 eval $setvar
13767
13768 : Can _cnt be used as an lvalue?
13769 case "$d_stdstdio$cnt_lval" in
13770 $define$define) val=$define ;;
13771 *) val=$undef ;;
13772 esac
13773 set d_stdio_cnt_lval
13774 eval $setvar
13775
13776
13777 : test whether setting _ptr sets _cnt as a side effect
13778 d_stdio_ptr_lval_sets_cnt="$undef"
13779 d_stdio_ptr_lval_nochange_cnt="$undef"
13780 case "$d_stdio_ptr_lval$d_stdstdio" in
13781 $define$define)
13782         echo "Checking to see what happens if we set the stdio ptr..." >&4
13783 $cat >try.c <<EOP
13784 #include <stdio.h>
13785 /* Can we scream? */
13786 /* Eat dust sed :-) */
13787 /* In the buffer space, no one can hear you scream. */
13788 #$i_stdlib I_STDLIB
13789 #ifdef I_STDLIB
13790 #include <stdlib.h>
13791 #endif
13792 #define FILE_ptr(fp)    $stdio_ptr
13793 #define FILE_cnt(fp)    $stdio_cnt
13794 #include <sys/types.h>
13795 int main() {
13796         FILE *fp = fopen("try.c", "r");
13797         int c;
13798         char *ptr;
13799         size_t cnt;
13800         if (!fp) {
13801             puts("Fail even to read");
13802             exit(1);
13803         }
13804         c = getc(fp); /* Read away the first # */
13805         if (c == EOF) {
13806             puts("Fail even to read");
13807             exit(1);
13808         }
13809         if (!(
13810                 18 <= FILE_cnt(fp) &&
13811                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13812         )) {
13813                 puts("Fail even to read");
13814                 exit (1);
13815         }
13816         ptr = (char*) FILE_ptr(fp);
13817         cnt = (size_t)FILE_cnt(fp);
13818
13819         FILE_ptr(fp) += 42;
13820
13821         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13822                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13823                 exit (1);
13824         }
13825         if (FILE_cnt(fp) <= 20) {
13826                 printf ("Fail (<20 chars to test)");
13827                 exit (1);
13828         }
13829         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13830                 puts("Fail compare");
13831                 exit (1);
13832         }
13833         if (cnt == FILE_cnt(fp)) {
13834                 puts("Pass_unchanged");
13835                 exit (0);
13836         }
13837         if (FILE_cnt(fp) == (cnt - 42)) {
13838                 puts("Pass_changed");
13839                 exit (0);
13840         }
13841         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13842         return 1;
13843
13844 }
13845 EOP
13846         set try
13847         if eval $compile && $to try.c; then
13848                 case `$run ./try` in
13849                 Pass_changed)
13850                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13851                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13852                 Pass_unchanged)
13853                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13854                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13855                 Fail*)
13856                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13857                 *)
13858                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13859         esac
13860         else
13861                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13862         fi
13863         $rm_try
13864         ;;
13865 esac
13866
13867 : see if _base is also standard
13868 val="$undef"
13869 case "$d_stdstdio" in
13870 $define)
13871         $cat >try.c <<EOP
13872 #include <stdio.h>
13873 #$i_stdlib I_STDLIB
13874 #ifdef I_STDLIB
13875 #include <stdlib.h>
13876 #endif
13877 #define FILE_base(fp)   $stdio_base
13878 #define FILE_bufsiz(fp) $stdio_bufsiz
13879 int main() {
13880         FILE *fp = fopen("try.c", "r");
13881         char c = getc(fp);
13882         if (
13883                 19 <= FILE_bufsiz(fp) &&
13884                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13885         )
13886                 exit(0);
13887         exit(1);
13888 }
13889 EOP
13890         set try
13891         if eval $compile && $to try.c; then
13892                 if $run ./try; then
13893                         echo "And its _base field acts std."
13894                         val="$define"
13895                 else
13896                         echo "But its _base field isn't std."
13897                 fi
13898         else
13899                 echo "However, it seems to be lacking the _base field."
13900         fi
13901         $rm_try
13902         ;;
13903 esac
13904 set d_stdiobase
13905 eval $setvar
13906
13907 : see if fast_stdio exists
13908 val="$undef"
13909 case "$d_stdstdio:$d_stdio_ptr_lval" in
13910 "$define:$define")
13911         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13912         *$define*)
13913                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >&4
13914                 val="$define"
13915                 ;;
13916         esac
13917         ;;
13918 esac
13919 set d_faststdio
13920 eval $setvar
13921
13922 : see if fchdir exists
13923 set fchdir d_fchdir
13924 eval $inlibc
13925
13926 : see if fchmod exists
13927 set fchmod d_fchmod
13928 eval $inlibc
13929
13930 : check for openat, unlinkat, renameat, linkat, fchmodat
13931 set openat d_openat
13932 eval $inlibc
13933
13934 set unlinkat d_unlinkat
13935 eval $inlibc
13936
13937 set renameat d_renameat
13938 eval $inlibc
13939
13940 set linkat d_linkat
13941 eval $inlibc
13942
13943 set fchmodat d_fchmodat
13944 eval $inlibc
13945
13946 : see if fchown exists
13947 set fchown d_fchown
13948 eval $inlibc
13949
13950 : see if this is an fcntl system
13951 set fcntl d_fcntl
13952 eval $inlibc
13953
13954 : See if fcntl-based locking works.
13955 echo " "
13956 $cat >try.c <<EOCP
13957 #$i_stdlib I_STDLIB
13958 #ifdef I_STDLIB
13959 #include <stdlib.h>
13960 #endif
13961 #include <unistd.h>
13962 #include <fcntl.h>
13963 #include <signal.h>
13964 $signal_t blech(int x) { exit(3); }
13965 int main() {
13966 #if defined(F_SETLK) && defined(F_SETLKW)
13967      struct flock flock;
13968      int retval, fd;
13969      fd = open("try.c", O_RDONLY);
13970      flock.l_type = F_RDLCK;
13971      flock.l_whence = SEEK_SET;
13972      flock.l_start = flock.l_len = 0;
13973      signal(SIGALRM, blech);
13974      alarm(10);
13975      retval = fcntl(fd, F_SETLK, &flock);
13976      close(fd);
13977      (retval < 0 ? exit(2) : exit(0));
13978 #else
13979      exit(2);
13980 #endif
13981 }
13982 EOCP
13983 echo "Checking if fcntl-based file locking works... "
13984 case "$d_fcntl" in
13985 "$define")
13986         set try
13987         if eval $compile_ok; then
13988                 if $run ./try; then
13989                         echo "Yes, it seems to work."
13990                         val="$define"
13991                 else
13992                         echo "Nope, it didn't work."
13993                         val="$undef"
13994                         case "$?" in
13995                         3) $cat >&4 <<EOM
13996 ***
13997 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13998 *** This is (almost) impossible.
13999 *** If your NFS lock daemons are not feeling well, something like
14000 *** this may happen, please investigate.  Cannot continue, aborting.
14001 ***
14002 EOM
14003                                 exit 1
14004                                 ;;
14005                         esac
14006                 fi
14007         else
14008                 echo "I'm unable to compile the test program, so I'll assume not."
14009                 val="$undef"
14010         fi
14011         ;;
14012 *) val="$undef";
14013         echo "Nope, since you don't even have fcntl()."
14014         ;;
14015 esac
14016 set d_fcntl_can_lock
14017 eval $setvar
14018 $rm_try
14019
14020 : check for fd_set items
14021 $cat <<EOM
14022
14023 Checking to see how well your C compiler handles fd_set and friends ...
14024 EOM
14025 $cat >try.c <<EOCP
14026 #$i_stdlib I_STDLIB
14027 #ifdef I_STDLIB
14028 #include <stdlib.h>
14029 #endif
14030 #$i_systime I_SYS_TIME
14031 #$i_sysselct I_SYS_SELECT
14032 #$d_socket HAS_SOCKET
14033 #include <sys/types.h>
14034 #ifdef HAS_SOCKET
14035 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14036 #endif
14037 #ifdef I_SYS_TIME
14038 #include <sys/time.h>
14039 #endif
14040 #ifdef I_SYS_SELECT
14041 #include <sys/select.h>
14042 #endif
14043 int main() {
14044         fd_set fds;
14045
14046 #ifdef TRYBITS
14047         if(fds.fds_bits);
14048 #endif
14049
14050 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
14051         exit(0);
14052 #else
14053         exit(1);
14054 #endif
14055 }
14056 EOCP
14057 set try -DTRYBITS
14058 if eval $compile; then
14059         d_fds_bits="$define"
14060         d_fd_set="$define"
14061         echo "Well, your system knows about the normal fd_set typedef..." >&4
14062         if $run ./try; then
14063                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14064                 d_fd_macros="$define"
14065         else
14066                 $cat >&4 <<'EOM'
14067 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
14068 EOM
14069                 d_fd_macros="$undef"
14070         fi
14071 else
14072         $cat <<'EOM'
14073 Hmm, your compiler has some difficulty with fd_set.  Checking further...
14074 EOM
14075         set try
14076         if eval $compile; then
14077                 d_fds_bits="$undef"
14078                 d_fd_set="$define"
14079                 echo "Well, your system has some sort of fd_set available..." >&4
14080                 if $run ./try; then
14081                         echo "and you have the normal fd_set macros." >&4
14082                         d_fd_macros="$define"
14083                 else
14084                         $cat <<'EOM'
14085 but not the normal fd_set macros!  Gross!  More work for me...
14086 EOM
14087                         d_fd_macros="$undef"
14088                 fi
14089         else
14090         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14091                 d_fd_set="$undef"
14092                 d_fds_bits="$undef"
14093                 d_fd_macros="$undef"
14094         fi
14095 fi
14096 $rm_try
14097
14098 : see if fdclose exists
14099 set fdclose d_fdclose
14100 eval $inlibc
14101
14102 : see if fdim exists
14103 set fdim d_fdim
14104 eval $inlibc
14105
14106 : see if fegetround exists
14107 set fegetround d_fegetround
14108 eval $inlibc
14109
14110 : see if ffs exists
14111 set ffs d_ffs
14112 eval $inlibc
14113 : see if ffsl exists
14114 set ffsl d_ffsl
14115 eval $inlibc
14116
14117 : see if fgetpos exists
14118 set fgetpos d_fgetpos
14119 eval $inlibc
14120
14121 : see if finite exists
14122 set finite d_finite
14123 eval $inlibc
14124
14125 : see if finitel exists
14126 set finitel d_finitel
14127 eval $inlibc
14128
14129 : see if flock exists
14130 set flock d_flock
14131 eval $inlibc
14132
14133 : see if prototype for flock is available
14134 echo " "
14135 set d_flockproto flock $i_sysfile sys/file.h
14136 eval $hasproto
14137
14138 : see if fma exists
14139 set fma d_fma
14140 eval $inlibc
14141
14142 : see if fmax exists
14143 set fmax d_fmax
14144 eval $inlibc
14145
14146 : see if fmin exists
14147 set fmin d_fmin
14148 eval $inlibc
14149
14150 : see if fp_class exists
14151 set fp_class d_fp_class
14152 eval $inlibc
14153
14154 : check for fpclassify
14155 echo "Checking to see if you have fpclassify..." >&4
14156 $cat >try.c <<EOCP
14157 #include <math.h>
14158 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14159 EOCP
14160 set try
14161 if eval $compile; then
14162         val="$define"
14163         echo "You have fpclassify."
14164 else
14165         val="$undef"
14166         echo "You do not have fpclassify."
14167 fi
14168 $rm_try
14169 set d_fpclassify
14170 eval $setvar
14171
14172 : see if fp_classify exists
14173 set fp_classify d_fp_classify
14174 eval $inlibc
14175
14176 : see if fp_classl exists
14177 set fp_classl d_fp_classl
14178 eval $inlibc
14179
14180 : see if pathconf exists
14181 set pathconf d_pathconf
14182 eval $inlibc
14183
14184 : see if fpathconf exists
14185 set fpathconf d_fpathconf
14186 eval $inlibc
14187
14188 : see if fpclass exists
14189 set fpclass d_fpclass
14190 eval $inlibc
14191
14192 : see if fpclassl exists
14193 set fpclassl d_fpclassl
14194 eval $inlibc
14195
14196 : see if fpgetround exists
14197 set fpgetround d_fpgetround
14198 eval $inlibc
14199
14200 : check for fpos64_t
14201 echo " "
14202 echo "Checking to see if you have fpos64_t..." >&4
14203 $cat >try.c <<EOCP
14204 #include <stdio.h>
14205 int main() { fpos64_t x = 7; }
14206 EOCP
14207 set try
14208 if eval $compile; then
14209         val="$define"
14210         echo "You have fpos64_t."
14211 else
14212         val="$undef"
14213         echo "You do not have fpos64_t."
14214         case "$fpossize" in
14215         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14216         esac
14217 fi
14218 $rm_try
14219 set d_fpos64_t
14220 eval $setvar
14221
14222 : see if frexpl exists
14223 set frexpl d_frexpl
14224 eval $inlibc
14225
14226 : see if this is a sys/param system
14227 set sys/param.h i_sysparam
14228 eval $inhdr
14229
14230 : see if this is a sys/mount.h system
14231 set sys/mount.h i_sysmount
14232 eval $inhdr
14233
14234 : Check for fs_data_s
14235 echo " "
14236 echo "Checking to see if your system supports struct fs_data..." >&4
14237 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14238 eval $hasstruct
14239 case "$d_fs_data_s" in
14240 "$define")      echo "Yes, it does."   ;;
14241 *)              echo "No, it doesn't." ;;
14242 esac
14243
14244 : see if fseeko exists
14245 set fseeko d_fseeko
14246 eval $inlibc
14247 case "$longsize" in
14248 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14249 esac
14250
14251 : see if fsetpos exists
14252 set fsetpos d_fsetpos
14253 eval $inlibc
14254
14255 : see if fstatfs exists
14256 set fstatfs d_fstatfs
14257 eval $inlibc
14258
14259 : see if statvfs exists
14260 set statvfs d_statvfs
14261 eval $inlibc
14262
14263 : see if fstatvfs exists
14264 set fstatvfs d_fstatvfs
14265 eval $inlibc
14266
14267 : see if fsync exists
14268 set fsync d_fsync
14269 eval $inlibc
14270
14271 : see if ftello exists
14272 set ftello d_ftello
14273 eval $inlibc
14274 case "$longsize" in
14275 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14276 esac
14277
14278 : check for a working futimes
14279 d_futimes="$undef"
14280 echo " "
14281 echo "Checking if you have a working futimes()" >&4
14282 $cat >try.c <<EOCP
14283 #include <stdio.h>
14284 #include <stdlib.h>
14285 #include <sys/time.h>
14286 #include <errno.h>
14287 #include <fcntl.h>
14288 #include <stdlib.h>
14289
14290 int main ()
14291 {
14292     int fd, rv;
14293     fd = open ("try.c", O_RDWR);
14294     if (-1 == fd) exit (1);
14295     rv = futimes (fd, NULL);
14296     exit (rv == -1 ? errno : 0);
14297 }
14298 EOCP
14299 set try
14300 if eval $compile; then
14301     `$run ./try`
14302     rc=$?
14303     case "$rc" in
14304         0)  echo "Yes, you have" >&4
14305             d_futimes="$define"
14306             ;;
14307         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14308             ;;
14309     esac
14310 else
14311     echo "No, it does not (probably harmless)" >&4
14312 fi
14313 $rm_try
14314
14315 : look for gai_strerror
14316 echo " "
14317 $cat >try.c <<'EOCP'
14318 #include <sys/types.h>
14319 #include <sys/socket.h>
14320 #include <netdb.h>
14321 int main ()
14322 {
14323     return (gai_strerror (0) ? 0 : 1);
14324     }
14325 EOCP
14326 set try
14327 val="$undef"
14328 if eval $compile; then
14329     `$run ./try`
14330     case "$?" in
14331         0)  echo "A working gai_strerror() found." >&4
14332             val="$define" ;;
14333         *)  echo "gai_strerror() found, but it doesn't work" >&4
14334             ;;
14335         esac
14336 else
14337     echo "gai_strerror() NOT found." >&4
14338     fi
14339 set d_gai_strerror
14340 eval $setvar
14341 $rm_try
14342
14343 : see if ndbm.h is available
14344 set ndbm.h i_ndbm
14345 eval $inhdr
14346 : Compatibility location for RedHat 7.1
14347 set gdbm/ndbm.h i_gdbmndbm
14348 eval $inhdr
14349 : Compatibility location for Debian 4.0
14350 set gdbm-ndbm.h i_gdbm_ndbm
14351 eval $inhdr
14352
14353 val="$undef"
14354 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14355         : see if dbm_open exists
14356         set dbm_open d_dbm_open
14357         eval $inlibc
14358         case "$d_dbm_open" in
14359         $undef)
14360                 i_ndbm="$undef"
14361                 i_gdbmndbm="$undef"
14362                 i_gdbm_ndbm="$undef"
14363                 echo "We won't be including <ndbm.h>"
14364                 val="$undef"
14365                 ;;
14366         *) val="$define"
14367            ;;
14368         esac
14369 fi
14370 set d_ndbm
14371 eval $setvar
14372
14373 ndbm_hdr_protochk='name=$1; hdr=$2;
14374 eval "ihdr=\$""i_$name";
14375 val="$undef";
14376 if $test "$ihdr" = "$define"; then
14377         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14378         case "$d_cplusplus" in
14379         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14380         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14381         esac;
14382         case "$val" in
14383         $define) $echo "Your <$hdr> seems to have prototypes";;
14384         *) $echo "Your <$hdr> does not seem to have prototypes";;
14385         esac;
14386 fi;
14387 set "d_${name}_h_uses_prototypes";
14388 eval $setvar'
14389
14390 set ndbm ndbm.h
14391 eval $ndbm_hdr_protochk
14392 set gdbmndbm gdbm/ndbm.h
14393 eval $ndbm_hdr_protochk
14394 set gdbm_ndbm gdbm-ndbm.h
14395 eval $ndbm_hdr_protochk
14396
14397 : see if getaddrinfo exists
14398 set getaddrinfo d_getaddrinfo
14399 eval $inlibc
14400
14401 : see if getcwd exists
14402 set getcwd d_getcwd
14403 eval $inlibc
14404
14405 : check for getenv behavior
14406 case "$d_getenv_preserves_other_thread" in
14407 '')
14408 $echo "Checking to see if getenv() preserves a different thread's results" >&4
14409 $cat >try.c <<EOCP
14410 #$i_stdlib I_STDLIB
14411 #ifdef I_STDLIB
14412 #  include <stdlib.h>
14413 #endif
14414 #include <stdio.h>
14415 #include <string.h>
14416 #$i_pthread I_PTHREAD
14417 #ifdef I_PTHREAD
14418 #  include <pthread.h>
14419 #endif
14420
14421 void *
14422 thread_start(void * arg)
14423 {
14424     return (void *) getenv("HOME");
14425 }
14426
14427 int main() {
14428     char * main_buffer;
14429     char save_main_buffer[1000];
14430     pthread_t subthread;
14431     pthread_attr_t attr;
14432
14433     main_buffer = getenv("PATH");
14434
14435     /* If too large for our generous allowance, return we couldn't figure it
14436      * out. */
14437     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
14438         exit(2);
14439     }
14440
14441     strcpy(save_main_buffer, main_buffer);
14442
14443     if (pthread_attr_init(&attr) != 0) {
14444         exit(2);
14445     }
14446
14447     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
14448         exit(2);
14449     }
14450
14451     if (pthread_join(subthread, NULL) != 0) {
14452         exit(2);
14453     }
14454
14455     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
14456 }
14457 EOCP
14458 val=
14459 set try
14460 if eval $compile_ok; then
14461     $run ./try
14462     rc=$?
14463     case "$rc" in
14464         0) echo "getenv() didn't destroy another thread's buffer" >&4
14465            val=$define
14466            ;;
14467         1) echo "getenv() does destroy another thread's buffer" >&4
14468            val=$undef
14469            ;;
14470         *) echo "Couldn't determine if getenv() destroys another thread's return value (code=$rc); assuming it does" >&4
14471            val=$undef
14472            ;;
14473     esac
14474 else
14475     echo "(I can't seem to compile the test program.)" >&4
14476     echo "Assuming that your C library's getenv destroys another thread's return value." >&4
14477     val=$undef
14478 fi
14479 set d_getenv_preserves_other_thread
14480 eval $setvar
14481 $rm_try
14482 ;;
14483 esac
14484
14485 : see if getespwnam exists
14486 set getespwnam d_getespwnam
14487 eval $inlibc
14488
14489 : see if getfsstat exists
14490 set getfsstat d_getfsstat
14491 eval $inlibc
14492
14493 : see if getgrent exists
14494 set getgrent d_getgrent
14495 eval $inlibc
14496
14497 : see if getgrent_r exists
14498 set getgrent_r d_getgrent_r
14499 eval $inlibc
14500 case "$d_getgrent_r" in
14501 "$define")
14502         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14503         case "$d_getgrent_r_proto:$usethreads" in
14504         ":define")      d_getgrent_r_proto=define
14505                 set d_getgrent_r_proto getgrent_r $hdrs
14506                 eval $hasproto ;;
14507         *)      ;;
14508         esac
14509         case "$d_getgrent_r_proto" in
14510         define)
14511         case "$getgrent_r_proto" in
14512         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14513         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14514         esac
14515         case "$getgrent_r_proto" in
14516         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14517         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14518         esac
14519         case "$getgrent_r_proto" in
14520         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14521         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14522         esac
14523         case "$getgrent_r_proto" in
14524         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14525         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14526         esac
14527         case "$getgrent_r_proto" in
14528         ''|0) try='int getgrent_r(struct group*, char*, int);'
14529         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14530         esac
14531         case "$getgrent_r_proto" in
14532         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14533         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14534         esac
14535         case "$getgrent_r_proto" in
14536         ''|0)   d_getgrent_r=undef
14537                 getgrent_r_proto=0
14538                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14539         * )     case "$getgrent_r_proto" in
14540                 REENTRANT_PROTO*) ;;
14541                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14542                 esac
14543                 echo "Prototype: $try" ;;
14544         esac
14545         ;;
14546         *)      case "$usethreads" in
14547                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14548                 esac
14549                 d_getgrent_r=undef
14550                 getgrent_r_proto=0
14551                 ;;
14552         esac
14553         ;;
14554 *)      getgrent_r_proto=0
14555         ;;
14556 esac
14557
14558 : see if getgrgid_r exists
14559 set getgrgid_r d_getgrgid_r
14560 eval $inlibc
14561 case "$d_getgrgid_r" in
14562 "$define")
14563         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14564         case "$d_getgrgid_r_proto:$usethreads" in
14565         ":define")      d_getgrgid_r_proto=define
14566                 set d_getgrgid_r_proto getgrgid_r $hdrs
14567                 eval $hasproto ;;
14568         *)      ;;
14569         esac
14570         case "$d_getgrgid_r_proto" in
14571         define)
14572         case "$getgrgid_r_proto" in
14573         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14574         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14575         esac
14576         case "$getgrgid_r_proto" in
14577         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14578         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14579         esac
14580         case "$getgrgid_r_proto" in
14581         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14582         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14583         esac
14584         case "$getgrgid_r_proto" in
14585         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14586         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14587         esac
14588         case "$getgrgid_r_proto" in
14589         ''|0)   d_getgrgid_r=undef
14590                 getgrgid_r_proto=0
14591                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14592         * )     case "$getgrgid_r_proto" in
14593                 REENTRANT_PROTO*) ;;
14594                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14595                 esac
14596                 echo "Prototype: $try" ;;
14597         esac
14598         ;;
14599         *)      case "$usethreads" in
14600                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14601                 esac
14602                 d_getgrgid_r=undef
14603                 getgrgid_r_proto=0
14604                 ;;
14605         esac
14606         ;;
14607 *)      getgrgid_r_proto=0
14608         ;;
14609 esac
14610
14611 : see if getgrnam_r exists
14612 set getgrnam_r d_getgrnam_r
14613 eval $inlibc
14614 case "$d_getgrnam_r" in
14615 "$define")
14616         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14617         case "$d_getgrnam_r_proto:$usethreads" in
14618         ":define")      d_getgrnam_r_proto=define
14619                 set d_getgrnam_r_proto getgrnam_r $hdrs
14620                 eval $hasproto ;;
14621         *)      ;;
14622         esac
14623         case "$d_getgrnam_r_proto" in
14624         define)
14625         case "$getgrnam_r_proto" in
14626         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14627         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14628         esac
14629         case "$getgrnam_r_proto" in
14630         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14631         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14632         esac
14633         case "$getgrnam_r_proto" in
14634         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14635         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14636         esac
14637         case "$getgrnam_r_proto" in
14638         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14639         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14640         esac
14641         case "$getgrnam_r_proto" in
14642         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14643         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14644         esac
14645         case "$getgrnam_r_proto" in
14646         ''|0)   d_getgrnam_r=undef
14647                 getgrnam_r_proto=0
14648                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14649         * )     case "$getgrnam_r_proto" in
14650                 REENTRANT_PROTO*) ;;
14651                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14652                 esac
14653                 echo "Prototype: $try" ;;
14654         esac
14655         ;;
14656         *)      case "$usethreads" in
14657                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14658                 esac
14659                 d_getgrnam_r=undef
14660                 getgrnam_r_proto=0
14661                 ;;
14662         esac
14663         ;;
14664 *)      getgrnam_r_proto=0
14665         ;;
14666 esac
14667
14668 : see if gethostbyaddr exists
14669 set gethostbyaddr d_gethbyaddr
14670 eval $inlibc
14671
14672 : see if gethostbyname exists
14673 set gethostbyname d_gethbyname
14674 eval $inlibc
14675
14676 : see if gethostent exists
14677 set gethostent d_gethent
14678 eval $inlibc
14679
14680 : see how we will look up host name
14681 echo " "
14682 call=''
14683 if set gethostname val -f d_gethname; eval $csym; $val; then
14684         echo 'gethostname() found.' >&4
14685         d_gethname="$define"
14686         call=gethostname
14687 fi
14688 if set uname val -f d_uname; eval $csym; $val; then
14689         if ./xenix; then
14690                 $cat <<'EOM'
14691 uname() was found, but you're running xenix, and older versions of xenix
14692 have a broken uname(). If you don't really know whether your xenix is old
14693 enough to have a broken system call, use the default answer.
14694
14695 EOM
14696                 dflt=y
14697                 case "$d_uname" in
14698                 "$define") dflt=n;;
14699                 esac
14700                 rp='Is your uname() broken?'
14701                 . ./myread
14702                 case "$ans" in
14703                 n*) d_uname="$define"; call=uname;;
14704                 esac
14705         else
14706                 echo 'uname() found.' >&4
14707                 d_uname="$define"
14708                 case "$call" in
14709                 '') call=uname ;;
14710                 esac
14711         fi
14712 fi
14713 case "$d_gethname" in
14714 '') d_gethname="$undef";;
14715 esac
14716 case "$d_uname" in
14717 '') d_uname="$undef";;
14718 esac
14719 case "$d_uname$d_gethname" in
14720 *define*)
14721         dflt=n
14722         cat <<EOM
14723
14724 Every now and then someone has a $call() that lies about the hostname
14725 but can't be fixed for political or economic reasons.  If you wish, I can
14726 pretend $call() isn't there and maybe compute hostname at run-time
14727 thanks to the '$phostname' command.
14728
14729 EOM
14730         rp="Shall I ignore $call() from now on?"
14731         . ./myread
14732         case "$ans" in
14733         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14734         esac;;
14735 esac
14736 case "$phostname" in
14737 '') aphostname='';;
14738 *) case "$aphostname" in
14739         /*) ;;
14740         *) set X $phostname
14741                 shift
14742                 file=$1
14743                 shift
14744                 file=`./loc $file $file $pth`
14745                 aphostname=`echo $file $*`
14746                 ;;
14747         esac
14748         ;;
14749 esac
14750 case "$d_uname$d_gethname" in
14751 *define*) ;;
14752 *)
14753         case "$phostname" in
14754         '')
14755                 echo "There will be no way for $package to get your hostname." >&4;;
14756         *)
14757         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14758                 ;;
14759         esac;;
14760 esac
14761 case "$d_phostname" in
14762 '') d_phostname="$undef";;
14763 esac
14764
14765 : see if gethostbyaddr_r exists
14766 set gethostbyaddr_r d_gethostbyaddr_r
14767 eval $inlibc
14768 case "$d_gethostbyaddr_r" in
14769 "$define")
14770         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14771         case "$d_gethostbyaddr_r_proto:$usethreads" in
14772         ":define")      d_gethostbyaddr_r_proto=define
14773                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14774                 eval $hasproto ;;
14775         *)      ;;
14776         esac
14777         case "$d_gethostbyaddr_r_proto" in
14778         define)
14779         case "$gethostbyaddr_r_proto" in
14780         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14781         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14782         esac
14783         case "$gethostbyaddr_r_proto" in
14784         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14785         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14786         esac
14787         case "$gethostbyaddr_r_proto" in
14788         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14789         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14790         esac
14791         case "$gethostbyaddr_r_proto" in
14792         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14793         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14794         esac
14795         case "$gethostbyaddr_r_proto" in
14796         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14797         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14798         esac
14799         case "$gethostbyaddr_r_proto" in
14800         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14801         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14802         esac
14803         case "$gethostbyaddr_r_proto" in
14804         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14805         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14806         esac
14807         case "$gethostbyaddr_r_proto" in
14808         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14809         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14810         esac
14811         case "$gethostbyaddr_r_proto" in
14812         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14813         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14814         esac
14815         case "$gethostbyaddr_r_proto" in
14816         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14817         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14818         esac
14819         case "$gethostbyaddr_r_proto" in
14820         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14821         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14822         esac
14823         case "$gethostbyaddr_r_proto" in
14824         ''|0)   d_gethostbyaddr_r=undef
14825                 gethostbyaddr_r_proto=0
14826                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14827         * )     case "$gethostbyaddr_r_proto" in
14828                 REENTRANT_PROTO*) ;;
14829                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14830                 esac
14831                 echo "Prototype: $try" ;;
14832         esac
14833         ;;
14834         *)      case "$usethreads" in
14835                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14836                 esac
14837                 d_gethostbyaddr_r=undef
14838                 gethostbyaddr_r_proto=0
14839                 ;;
14840         esac
14841         ;;
14842 *)      gethostbyaddr_r_proto=0
14843         ;;
14844 esac
14845
14846 : see if gethostbyname_r exists
14847 set gethostbyname_r d_gethostbyname_r
14848 eval $inlibc
14849 case "$d_gethostbyname_r" in
14850 "$define")
14851         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14852         case "$d_gethostbyname_r_proto:$usethreads" in
14853         ":define")      d_gethostbyname_r_proto=define
14854                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14855                 eval $hasproto ;;
14856         *)      ;;
14857         esac
14858         case "$d_gethostbyname_r_proto" in
14859         define)
14860         case "$gethostbyname_r_proto" in
14861         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14862         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14863         esac
14864         case "$gethostbyname_r_proto" in
14865         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14866         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14867         esac
14868         case "$gethostbyname_r_proto" in
14869         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14870         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14871         esac
14872         case "$gethostbyname_r_proto" in
14873         ''|0)   d_gethostbyname_r=undef
14874                 gethostbyname_r_proto=0
14875                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14876         * )     case "$gethostbyname_r_proto" in
14877                 REENTRANT_PROTO*) ;;
14878                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14879                 esac
14880                 echo "Prototype: $try" ;;
14881         esac
14882         ;;
14883         *)      case "$usethreads" in
14884                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14885                 esac
14886                 d_gethostbyname_r=undef
14887                 gethostbyname_r_proto=0
14888                 ;;
14889         esac
14890         ;;
14891 *)      gethostbyname_r_proto=0
14892         ;;
14893 esac
14894
14895 : see if gethostent_r exists
14896 set gethostent_r d_gethostent_r
14897 eval $inlibc
14898 case "$d_gethostent_r" in
14899 "$define")
14900         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14901         case "$d_gethostent_r_proto:$usethreads" in
14902         ":define")      d_gethostent_r_proto=define
14903                 set d_gethostent_r_proto gethostent_r $hdrs
14904                 eval $hasproto ;;
14905         *)      ;;
14906         esac
14907         case "$d_gethostent_r_proto" in
14908         define)
14909         case "$gethostent_r_proto" in
14910         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14911         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14912         esac
14913         case "$gethostent_r_proto" in
14914         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14915         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14916         esac
14917         case "$gethostent_r_proto" in
14918         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14919         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14920         esac
14921         case "$gethostent_r_proto" in
14922         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14923         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14924         esac
14925         case "$gethostent_r_proto" in
14926         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14927         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14928         esac
14929         case "$gethostent_r_proto" in
14930         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14931         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14932         esac
14933         case "$gethostent_r_proto" in
14934         ''|0)   d_gethostent_r=undef
14935                 gethostent_r_proto=0
14936                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14937         * )     case "$gethostent_r_proto" in
14938                 REENTRANT_PROTO*) ;;
14939                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14940                 esac
14941                 echo "Prototype: $try" ;;
14942         esac
14943         ;;
14944         *)      case "$usethreads" in
14945                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14946                 esac
14947                 d_gethostent_r=undef
14948                 gethostent_r_proto=0
14949                 ;;
14950         esac
14951         ;;
14952 *)      gethostent_r_proto=0
14953         ;;
14954 esac
14955
14956 : see if prototypes for various gethostxxx netdb.h functions are available
14957 echo " "
14958 set d_gethostprotos gethostent $i_netdb netdb.h
14959 eval $hasproto
14960
14961 : see if getitimer exists
14962 set getitimer d_getitimer
14963 eval $inlibc
14964
14965 : see if getlogin exists
14966 set getlogin d_getlogin
14967 eval $inlibc
14968
14969 : see if getlogin_r exists
14970 set getlogin_r d_getlogin_r
14971 eval $inlibc
14972 case "$d_getlogin_r" in
14973 "$define")
14974         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14975         case "$d_getlogin_r_proto:$usethreads" in
14976         ":define")      d_getlogin_r_proto=define
14977                 set d_getlogin_r_proto getlogin_r $hdrs
14978                 eval $hasproto ;;
14979         *)      ;;
14980         esac
14981         case "$d_getlogin_r_proto" in
14982         define)
14983         case "$getlogin_r_proto" in
14984         ''|0) try='int getlogin_r(char*, size_t);'
14985         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14986         esac
14987         case "$getlogin_r_proto" in
14988         ''|0) try='int getlogin_r(char*, int);'
14989         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14990         esac
14991         case "$getlogin_r_proto" in
14992         ''|0) try='char* getlogin_r(char*, size_t);'
14993         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14994         esac
14995         case "$getlogin_r_proto" in
14996         ''|0) try='char* getlogin_r(char*, int);'
14997         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14998         esac
14999         case "$getlogin_r_proto" in
15000         ''|0)   d_getlogin_r=undef
15001                 getlogin_r_proto=0
15002                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
15003         * )     case "$getlogin_r_proto" in
15004                 REENTRANT_PROTO*) ;;
15005                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
15006                 esac
15007                 echo "Prototype: $try" ;;
15008         esac
15009         ;;
15010         *)      case "$usethreads" in
15011                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
15012                 esac
15013                 d_getlogin_r=undef
15014                 getlogin_r_proto=0
15015                 ;;
15016         esac
15017         ;;
15018 *)      getlogin_r_proto=0
15019         ;;
15020 esac
15021
15022 : see if getmnt exists
15023 set getmnt d_getmnt
15024 eval $inlibc
15025
15026 : see if getmntent exists
15027 set getmntent d_getmntent
15028 eval $inlibc
15029
15030 : see if getnameinfo exists
15031 set getnameinfo d_getnameinfo
15032 eval $inlibc
15033
15034 : see if getnetbyaddr exists
15035 set getnetbyaddr d_getnbyaddr
15036 eval $inlibc
15037
15038 : see if getnetbyname exists
15039 set getnetbyname d_getnbyname
15040 eval $inlibc
15041
15042 : see if getnetent exists
15043 set getnetent d_getnent
15044 eval $inlibc
15045
15046 : see if getnetbyaddr_r exists
15047 set getnetbyaddr_r d_getnetbyaddr_r
15048 eval $inlibc
15049 case "$d_getnetbyaddr_r" in
15050 "$define")
15051         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15052         case "$d_getnetbyaddr_r_proto:$usethreads" in
15053         ":define")      d_getnetbyaddr_r_proto=define
15054                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
15055                 eval $hasproto ;;
15056         *)      ;;
15057         esac
15058         case "$d_getnetbyaddr_r_proto" in
15059         define)
15060         case "$getnetbyaddr_r_proto" in
15061         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
15062         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
15063         esac
15064         case "$getnetbyaddr_r_proto" in
15065         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
15066         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
15067         esac
15068         case "$getnetbyaddr_r_proto" in
15069         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
15070         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
15071         esac
15072         case "$getnetbyaddr_r_proto" in
15073         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
15074         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
15075         esac
15076         case "$getnetbyaddr_r_proto" in
15077         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
15078         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
15079         esac
15080         case "$getnetbyaddr_r_proto" in
15081         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
15082         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
15083         esac
15084         case "$getnetbyaddr_r_proto" in
15085         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
15086         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
15087         esac
15088         case "$getnetbyaddr_r_proto" in
15089         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
15090         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
15091         esac
15092         case "$getnetbyaddr_r_proto" in
15093         ''|0)   d_getnetbyaddr_r=undef
15094                 getnetbyaddr_r_proto=0
15095                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
15096         * )     case "$getnetbyaddr_r_proto" in
15097                 REENTRANT_PROTO*) ;;
15098                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
15099                 esac
15100                 echo "Prototype: $try" ;;
15101         esac
15102         ;;
15103         *)      case "$usethreads" in
15104                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
15105                 esac
15106                 d_getnetbyaddr_r=undef
15107                 getnetbyaddr_r_proto=0
15108                 ;;
15109         esac
15110         ;;
15111 *)      getnetbyaddr_r_proto=0
15112         ;;
15113 esac
15114
15115 : see if getnetbyname_r exists
15116 set getnetbyname_r d_getnetbyname_r
15117 eval $inlibc
15118 case "$d_getnetbyname_r" in
15119 "$define")
15120         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15121         case "$d_getnetbyname_r_proto:$usethreads" in
15122         ":define")      d_getnetbyname_r_proto=define
15123                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
15124                 eval $hasproto ;;
15125         *)      ;;
15126         esac
15127         case "$d_getnetbyname_r_proto" in
15128         define)
15129         case "$getnetbyname_r_proto" in
15130         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
15131         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
15132         esac
15133         case "$getnetbyname_r_proto" in
15134         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
15135         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
15136         esac
15137         case "$getnetbyname_r_proto" in
15138         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
15139         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
15140         esac
15141         case "$getnetbyname_r_proto" in
15142         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
15143         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
15144         esac
15145         case "$getnetbyname_r_proto" in
15146         ''|0)   d_getnetbyname_r=undef
15147                 getnetbyname_r_proto=0
15148                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
15149         * )     case "$getnetbyname_r_proto" in
15150                 REENTRANT_PROTO*) ;;
15151                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
15152                 esac
15153                 echo "Prototype: $try" ;;
15154         esac
15155         ;;
15156         *)      case "$usethreads" in
15157                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
15158                 esac
15159                 d_getnetbyname_r=undef
15160                 getnetbyname_r_proto=0
15161                 ;;
15162         esac
15163         ;;
15164 *)      getnetbyname_r_proto=0
15165         ;;
15166 esac
15167
15168 : see if getnetent_r exists
15169 set getnetent_r d_getnetent_r
15170 eval $inlibc
15171 case "$d_getnetent_r" in
15172 "$define")
15173         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15174         case "$d_getnetent_r_proto:$usethreads" in
15175         ":define")      d_getnetent_r_proto=define
15176                 set d_getnetent_r_proto getnetent_r $hdrs
15177                 eval $hasproto ;;
15178         *)      ;;
15179         esac
15180         case "$d_getnetent_r_proto" in
15181         define)
15182         case "$getnetent_r_proto" in
15183         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15184         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15185         esac
15186         case "$getnetent_r_proto" in
15187         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15188         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15189         esac
15190         case "$getnetent_r_proto" in
15191         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15192         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15193         esac
15194         case "$getnetent_r_proto" in
15195         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15196         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15197         esac
15198         case "$getnetent_r_proto" in
15199         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15200         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15201         esac
15202         case "$getnetent_r_proto" in
15203         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15204         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15205         esac
15206         case "$getnetent_r_proto" in
15207         ''|0)   d_getnetent_r=undef
15208                 getnetent_r_proto=0
15209                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15210         * )     case "$getnetent_r_proto" in
15211                 REENTRANT_PROTO*) ;;
15212                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15213                 esac
15214                 echo "Prototype: $try" ;;
15215         esac
15216         ;;
15217         *)      case "$usethreads" in
15218                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15219                 esac
15220                 d_getnetent_r=undef
15221                 getnetent_r_proto=0
15222                 ;;
15223         esac
15224         ;;
15225 *)      getnetent_r_proto=0
15226         ;;
15227 esac
15228
15229 : see if prototypes for various getnetxxx netdb.h functions are available
15230 echo " "
15231 set d_getnetprotos getnetent $i_netdb netdb.h
15232 eval $hasproto
15233
15234 : see if getpagesize exists
15235 set getpagesize d_getpagsz
15236 eval $inlibc
15237
15238 : Optional checks for getprotobyname and getprotobynumber
15239
15240 : see if getprotobyname exists
15241 set getprotobyname d_getpbyname
15242 eval $inlibc
15243
15244 : see if getprotobynumber exists
15245 set getprotobynumber d_getpbynumber
15246 eval $inlibc
15247
15248 : see if getprotoent exists
15249 set getprotoent d_getpent
15250 eval $inlibc
15251
15252 : see if getpgid exists
15253 set getpgid d_getpgid
15254 eval $inlibc
15255
15256 : see if getpgrp2 exists
15257 set getpgrp2 d_getpgrp2
15258 eval $inlibc
15259
15260 : see if getppid exists
15261 set getppid d_getppid
15262 eval $inlibc
15263
15264 : see if getpriority exists
15265 set getpriority d_getprior
15266 eval $inlibc
15267
15268 : see if getprotobyname_r exists
15269 set getprotobyname_r d_getprotobyname_r
15270 eval $inlibc
15271 case "$d_getprotobyname_r" in
15272 "$define")
15273         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15274         case "$d_getprotobyname_r_proto:$usethreads" in
15275         ":define")      d_getprotobyname_r_proto=define
15276                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15277                 eval $hasproto ;;
15278         *)      ;;
15279         esac
15280         case "$d_getprotobyname_r_proto" in
15281         define)
15282         case "$getprotobyname_r_proto" in
15283         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15284         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15285         esac
15286         case "$getprotobyname_r_proto" in
15287         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15288         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15289         esac
15290         case "$getprotobyname_r_proto" in
15291         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15292         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15293         esac
15294         case "$getprotobyname_r_proto" in
15295         ''|0)   d_getprotobyname_r=undef
15296                 getprotobyname_r_proto=0
15297                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15298         * )     case "$getprotobyname_r_proto" in
15299                 REENTRANT_PROTO*) ;;
15300                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15301                 esac
15302                 echo "Prototype: $try" ;;
15303         esac
15304         ;;
15305         *)      case "$usethreads" in
15306                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15307                 esac
15308                 d_getprotobyname_r=undef
15309                 getprotobyname_r_proto=0
15310                 ;;
15311         esac
15312         ;;
15313 *)      getprotobyname_r_proto=0
15314         ;;
15315 esac
15316
15317 : see if getprotobynumber_r exists
15318 set getprotobynumber_r d_getprotobynumber_r
15319 eval $inlibc
15320 case "$d_getprotobynumber_r" in
15321 "$define")
15322         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15323         case "$d_getprotobynumber_r_proto:$usethreads" in
15324         ":define")      d_getprotobynumber_r_proto=define
15325                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15326                 eval $hasproto ;;
15327         *)      ;;
15328         esac
15329         case "$d_getprotobynumber_r_proto" in
15330         define)
15331         case "$getprotobynumber_r_proto" in
15332         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15333         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15334         esac
15335         case "$getprotobynumber_r_proto" in
15336         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15337         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15338         esac
15339         case "$getprotobynumber_r_proto" in
15340         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15341         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15342         esac
15343         case "$getprotobynumber_r_proto" in
15344         ''|0)   d_getprotobynumber_r=undef
15345                 getprotobynumber_r_proto=0
15346                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15347         * )     case "$getprotobynumber_r_proto" in
15348                 REENTRANT_PROTO*) ;;
15349                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15350                 esac
15351                 echo "Prototype: $try" ;;
15352         esac
15353         ;;
15354         *)      case "$usethreads" in
15355                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15356                 esac
15357                 d_getprotobynumber_r=undef
15358                 getprotobynumber_r_proto=0
15359                 ;;
15360         esac
15361         ;;
15362 *)      getprotobynumber_r_proto=0
15363         ;;
15364 esac
15365
15366 : see if getprotoent_r exists
15367 set getprotoent_r d_getprotoent_r
15368 eval $inlibc
15369 case "$d_getprotoent_r" in
15370 "$define")
15371         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15372         case "$d_getprotoent_r_proto:$usethreads" in
15373         ":define")      d_getprotoent_r_proto=define
15374                 set d_getprotoent_r_proto getprotoent_r $hdrs
15375                 eval $hasproto ;;
15376         *)      ;;
15377         esac
15378         case "$d_getprotoent_r_proto" in
15379         define)
15380         case "$getprotoent_r_proto" in
15381         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15382         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15383         esac
15384         case "$getprotoent_r_proto" in
15385         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15386         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15387         esac
15388         case "$getprotoent_r_proto" in
15389         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15390         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15391         esac
15392         case "$getprotoent_r_proto" in
15393         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15394         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15395         esac
15396         case "$getprotoent_r_proto" in
15397         ''|0)   d_getprotoent_r=undef
15398                 getprotoent_r_proto=0
15399                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15400         * )     case "$getprotoent_r_proto" in
15401                 REENTRANT_PROTO*) ;;
15402                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15403                 esac
15404                 echo "Prototype: $try" ;;
15405         esac
15406         ;;
15407         *)      case "$usethreads" in
15408                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15409                 esac
15410                 d_getprotoent_r=undef
15411                 getprotoent_r_proto=0
15412                 ;;
15413         esac
15414         ;;
15415 *)      getprotoent_r_proto=0
15416         ;;
15417 esac
15418
15419 : see if prototypes for various getprotoxxx netdb.h functions are available
15420 echo " "
15421 set d_getprotoprotos getprotoent $i_netdb netdb.h
15422 eval $hasproto
15423
15424 : see if getprpwnam exists
15425 set getprpwnam d_getprpwnam
15426 eval $inlibc
15427
15428 : see if getpwent exists
15429 set getpwent d_getpwent
15430 eval $inlibc
15431
15432 : see if getpwent_r exists
15433 set getpwent_r d_getpwent_r
15434 eval $inlibc
15435 case "$d_getpwent_r" in
15436 "$define")
15437         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15438         case "$d_getpwent_r_proto:$usethreads" in
15439         ":define")      d_getpwent_r_proto=define
15440                 set d_getpwent_r_proto getpwent_r $hdrs
15441                 eval $hasproto ;;
15442         *)      ;;
15443         esac
15444         case "$d_getpwent_r_proto" in
15445         define)
15446         case "$getpwent_r_proto" in
15447         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15448         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15449         esac
15450         case "$getpwent_r_proto" in
15451         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15452         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15453         esac
15454         case "$getpwent_r_proto" in
15455         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15456         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15457         esac
15458         case "$getpwent_r_proto" in
15459         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15460         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15461         esac
15462         case "$getpwent_r_proto" in
15463         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15464         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15465         esac
15466         case "$getpwent_r_proto" in
15467         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15468         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15469         esac
15470         case "$getpwent_r_proto" in
15471         ''|0)   d_getpwent_r=undef
15472                 getpwent_r_proto=0
15473                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15474         * )     case "$getpwent_r_proto" in
15475                 REENTRANT_PROTO*) ;;
15476                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15477                 esac
15478                 echo "Prototype: $try" ;;
15479         esac
15480         ;;
15481         *)      case "$usethreads" in
15482                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15483                 esac
15484                 d_getpwent_r=undef
15485                 getpwent_r_proto=0
15486                 ;;
15487         esac
15488         ;;
15489 *)      getpwent_r_proto=0
15490         ;;
15491 esac
15492
15493 : see if getpwnam_r exists
15494 set getpwnam_r d_getpwnam_r
15495 eval $inlibc
15496 case "$d_getpwnam_r" in
15497 "$define")
15498         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15499         case "$d_getpwnam_r_proto:$usethreads" in
15500         ":define")      d_getpwnam_r_proto=define
15501                 set d_getpwnam_r_proto getpwnam_r $hdrs
15502                 eval $hasproto ;;
15503         *)      ;;
15504         esac
15505         case "$d_getpwnam_r_proto" in
15506         define)
15507         case "$getpwnam_r_proto" in
15508         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15509         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15510         esac
15511         case "$getpwnam_r_proto" in
15512         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15513         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15514         esac
15515         case "$getpwnam_r_proto" in
15516         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15517         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15518         esac
15519         case "$getpwnam_r_proto" in
15520         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15521         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15522         esac
15523         case "$getpwnam_r_proto" in
15524         ''|0)   d_getpwnam_r=undef
15525                 getpwnam_r_proto=0
15526                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15527         * )     case "$getpwnam_r_proto" in
15528                 REENTRANT_PROTO*) ;;
15529                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15530                 esac
15531                 echo "Prototype: $try" ;;
15532         esac
15533         ;;
15534         *)      case "$usethreads" in
15535                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15536                 esac
15537                 d_getpwnam_r=undef
15538                 getpwnam_r_proto=0
15539                 ;;
15540         esac
15541         ;;
15542 *)      getpwnam_r_proto=0
15543         ;;
15544 esac
15545
15546 : see if getpwuid_r exists
15547 set getpwuid_r d_getpwuid_r
15548 eval $inlibc
15549 case "$d_getpwuid_r" in
15550 "$define")
15551         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15552         case "$d_getpwuid_r_proto:$usethreads" in
15553         ":define")      d_getpwuid_r_proto=define
15554                 set d_getpwuid_r_proto getpwuid_r $hdrs
15555                 eval $hasproto ;;
15556         *)      ;;
15557         esac
15558         case "$d_getpwuid_r_proto" in
15559         define)
15560         case "$getpwuid_r_proto" in
15561         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15562         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15563         esac
15564         case "$getpwuid_r_proto" in
15565         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15566         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15567         esac
15568         case "$getpwuid_r_proto" in
15569         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15570         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15571         esac
15572         case "$getpwuid_r_proto" in
15573         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15574         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15575         esac
15576         case "$getpwuid_r_proto" in
15577         ''|0)   d_getpwuid_r=undef
15578                 getpwuid_r_proto=0
15579                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15580         * )     case "$getpwuid_r_proto" in
15581                 REENTRANT_PROTO*) ;;
15582                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15583                 esac
15584                 echo "Prototype: $try" ;;
15585         esac
15586         ;;
15587         *)      case "$usethreads" in
15588                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15589                 esac
15590                 d_getpwuid_r=undef
15591                 getpwuid_r_proto=0
15592                 ;;
15593         esac
15594         ;;
15595 *)      getpwuid_r_proto=0
15596         ;;
15597 esac
15598
15599 : Optional checks for getsbyname and getsbyport
15600
15601 : see if getservbyname exists
15602 set getservbyname d_getsbyname
15603 eval $inlibc
15604
15605 : see if getservbyport exists
15606 set getservbyport d_getsbyport
15607 eval $inlibc
15608
15609 : see if getservent exists
15610 set getservent d_getsent
15611 eval $inlibc
15612
15613 : see if getservbyname_r exists
15614 set getservbyname_r d_getservbyname_r
15615 eval $inlibc
15616 case "$d_getservbyname_r" in
15617 "$define")
15618         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15619         case "$d_getservbyname_r_proto:$usethreads" in
15620         ":define")      d_getservbyname_r_proto=define
15621                 set d_getservbyname_r_proto getservbyname_r $hdrs
15622                 eval $hasproto ;;
15623         *)      ;;
15624         esac
15625         case "$d_getservbyname_r_proto" in
15626         define)
15627         case "$getservbyname_r_proto" in
15628         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15629         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15630         esac
15631         case "$getservbyname_r_proto" in
15632         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15633         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15634         esac
15635         case "$getservbyname_r_proto" in
15636         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15637         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15638         esac
15639         case "$getservbyname_r_proto" in
15640         ''|0)   d_getservbyname_r=undef
15641                 getservbyname_r_proto=0
15642                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15643         * )     case "$getservbyname_r_proto" in
15644                 REENTRANT_PROTO*) ;;
15645                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15646                 esac
15647                 echo "Prototype: $try" ;;
15648         esac
15649         ;;
15650         *)      case "$usethreads" in
15651                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15652                 esac
15653                 d_getservbyname_r=undef
15654                 getservbyname_r_proto=0
15655                 ;;
15656         esac
15657         ;;
15658 *)      getservbyname_r_proto=0
15659         ;;
15660 esac
15661
15662 : see if getservbyport_r exists
15663 set getservbyport_r d_getservbyport_r
15664 eval $inlibc
15665 case "$d_getservbyport_r" in
15666 "$define")
15667         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15668         case "$d_getservbyport_r_proto:$usethreads" in
15669         ":define")      d_getservbyport_r_proto=define
15670                 set d_getservbyport_r_proto getservbyport_r $hdrs
15671                 eval $hasproto ;;
15672         *)      ;;
15673         esac
15674         case "$d_getservbyport_r_proto" in
15675         define)
15676         case "$getservbyport_r_proto" in
15677         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15678         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15679         esac
15680         case "$getservbyport_r_proto" in
15681         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15682         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15683         esac
15684         case "$getservbyport_r_proto" in
15685         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15686         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15687         esac
15688         case "$getservbyport_r_proto" in
15689         ''|0)   d_getservbyport_r=undef
15690                 getservbyport_r_proto=0
15691                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15692         * )     case "$getservbyport_r_proto" in
15693                 REENTRANT_PROTO*) ;;
15694                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15695                 esac
15696                 echo "Prototype: $try" ;;
15697         esac
15698         ;;
15699         *)      case "$usethreads" in
15700                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15701                 esac
15702                 d_getservbyport_r=undef
15703                 getservbyport_r_proto=0
15704                 ;;
15705         esac
15706         ;;
15707 *)      getservbyport_r_proto=0
15708         ;;
15709 esac
15710
15711 : see if getservent_r exists
15712 set getservent_r d_getservent_r
15713 eval $inlibc
15714 case "$d_getservent_r" in
15715 "$define")
15716         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15717         case "$d_getservent_r_proto:$usethreads" in
15718         ":define")      d_getservent_r_proto=define
15719                 set d_getservent_r_proto getservent_r $hdrs
15720                 eval $hasproto ;;
15721         *)      ;;
15722         esac
15723         case "$d_getservent_r_proto" in
15724         define)
15725         case "$getservent_r_proto" in
15726         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15727         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15728         esac
15729         case "$getservent_r_proto" in
15730         ''|0) try='int getservent_r(struct servent*, char*, int);'
15731         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15732         esac
15733         case "$getservent_r_proto" in
15734         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15735         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15736         esac
15737         case "$getservent_r_proto" in
15738         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15739         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15740         esac
15741         case "$getservent_r_proto" in
15742         ''|0)   d_getservent_r=undef
15743                 getservent_r_proto=0
15744                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15745         * )     case "$getservent_r_proto" in
15746                 REENTRANT_PROTO*) ;;
15747                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15748                 esac
15749                 echo "Prototype: $try" ;;
15750         esac
15751         ;;
15752         *)      case "$usethreads" in
15753                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15754                 esac
15755                 d_getservent_r=undef
15756                 getservent_r_proto=0
15757                 ;;
15758         esac
15759         ;;
15760 *)      getservent_r_proto=0
15761         ;;
15762 esac
15763
15764 : see if prototypes for various getservxxx netdb.h functions are available
15765 echo " "
15766 set d_getservprotos getservent $i_netdb netdb.h
15767 eval $hasproto
15768
15769 : see if getspnam exists
15770 set getspnam d_getspnam
15771 eval $inlibc
15772
15773 : see if this is a shadow.h system
15774 set shadow.h i_shadow
15775 eval $inhdr
15776
15777 : see if getspnam_r exists
15778 set getspnam_r d_getspnam_r
15779 eval $inlibc
15780 case "$d_getspnam_r" in
15781 "$define")
15782         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15783         case "$d_getspnam_r_proto:$usethreads" in
15784         ":define")      d_getspnam_r_proto=define
15785                 set d_getspnam_r_proto getspnam_r $hdrs
15786                 eval $hasproto ;;
15787         *)      ;;
15788         esac
15789         case "$d_getspnam_r_proto" in
15790         define)
15791         case "$getspnam_r_proto" in
15792         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15793         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15794         esac
15795         case "$getspnam_r_proto" in
15796         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15797         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15798         esac
15799         case "$getspnam_r_proto" in
15800         ''|0)   d_getspnam_r=undef
15801                 getspnam_r_proto=0
15802                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15803         * )     case "$getspnam_r_proto" in
15804                 REENTRANT_PROTO*) ;;
15805                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15806                 esac
15807                 echo "Prototype: $try" ;;
15808         esac
15809         ;;
15810         *)      case "$usethreads" in
15811                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15812                 esac
15813                 d_getspnam_r=undef
15814                 getspnam_r_proto=0
15815                 ;;
15816         esac
15817         ;;
15818 *)      getspnam_r_proto=0
15819         ;;
15820 esac
15821
15822 : see if gettimeofday or ftime exists
15823 set gettimeofday d_gettimeod
15824 eval $inlibc
15825 case "$d_gettimeod" in
15826 "$undef")
15827         set ftime d_ftime 
15828         eval $inlibc
15829         ;;
15830 *)
15831         val="$undef"; set d_ftime; eval $setvar
15832         ;;
15833 esac
15834 case "$d_gettimeod$d_ftime" in
15835 "$undef$undef")
15836         echo " "
15837         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15838         ;;
15839 esac
15840
15841 : see if gmtime_r exists
15842 set gmtime_r d_gmtime_r
15843 eval $inlibc
15844 case "$d_gmtime_r" in
15845 "$define")
15846         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15847         case "$d_gmtime_r_proto:$usethreads" in
15848         ":define")      d_gmtime_r_proto=define
15849                 set d_gmtime_r_proto gmtime_r $hdrs
15850                 eval $hasproto ;;
15851         *)      ;;
15852         esac
15853         case "$d_gmtime_r_proto" in
15854         define)
15855         case "$gmtime_r_proto" in
15856         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15857         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15858         esac
15859         case "$gmtime_r_proto" in
15860         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15861         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15862         esac
15863         case "$gmtime_r_proto" in
15864         ''|0)   d_gmtime_r=undef
15865                 gmtime_r_proto=0
15866                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15867         * )     case "$gmtime_r_proto" in
15868                 REENTRANT_PROTO*) ;;
15869                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15870                 esac
15871                 echo "Prototype: $try" ;;
15872         esac
15873         ;;
15874         *)      case "$usethreads" in
15875                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15876                 esac
15877                 d_gmtime_r=undef
15878                 gmtime_r_proto=0
15879                 ;;
15880         esac
15881         ;;
15882 *)      gmtime_r_proto=0
15883         ;;
15884 esac
15885
15886 : see if hasmntopt exists
15887 set hasmntopt d_hasmntopt
15888 eval $inlibc
15889
15890 : see if this is a netinet/in.h or sys/in.h system
15891 set netinet/in.h i_niin sys/in.h i_sysin
15892 eval $inhdr
15893
15894 : see if arpa/inet.h has to be included
15895 set arpa/inet.h i_arpainet
15896 eval $inhdr
15897
15898 : see if htonl --and friends-- exists
15899 val=''
15900 set htonl val
15901 eval $inlibc
15902
15903 : Maybe they are macros.
15904 case "$val" in
15905 $undef)
15906         $cat >htonl.c <<EOM
15907 #include <stdio.h>
15908 #include <sys/types.h>
15909 #$i_niin I_NETINET_IN
15910 #$i_sysin I_SYS_IN
15911 #$i_arpainet I_ARPA_INET
15912 #ifdef I_NETINET_IN
15913 #include <netinet/in.h>
15914 #endif
15915 #ifdef I_SYS_IN
15916 #include <sys/in.h>
15917 #endif
15918 #ifdef I_ARPA_INET
15919 #include <arpa/inet.h>
15920 #endif
15921 #ifdef htonl
15922 printf("Defined as a macro.");
15923 #endif
15924 EOM
15925         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15926         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15927                 val="$define"
15928                 echo "But it seems to be defined as a macro." >&4
15929         fi
15930         $rm -f htonl.?
15931         ;;
15932 esac
15933 set d_htonl
15934 eval $setvar
15935
15936 : see if hypot exists
15937 set hypot d_hypot
15938 eval $inlibc
15939
15940 : see if ilogb exists
15941 set ilogb d_ilogb
15942 eval $inlibc
15943
15944 : see if ilogbl exists
15945 set ilogbl d_ilogbl
15946 eval $inlibc
15947
15948 : check whether inet_aton exists
15949 set inet_aton d_inetaton
15950 eval $inlibc
15951
15952 : see if inet_ntop exists
15953 set inet_ntop d_inetntop
15954 eval $inlibc
15955
15956 : see if inet_pton exists
15957 set inet_pton d_inetpton
15958 eval $inlibc
15959
15960 : Look for isascii
15961 echo " "
15962 $cat >isascii.c <<EOCP
15963 #include <stdio.h>
15964 #include <ctype.h>
15965 #$i_stdlib I_STDLIB
15966 #ifdef I_STDLIB
15967 #include <stdlib.h>
15968 #endif
15969 int main() {
15970         int c = 'A';
15971         if (isascii(c))
15972                 exit(0);
15973         else
15974                 exit(1);
15975 }
15976 EOCP
15977 set isascii
15978 if eval $compile; then
15979         echo "isascii() found." >&4
15980         val="$define"
15981 else
15982         echo "isascii() NOT found." >&4
15983         val="$undef"
15984 fi
15985 set d_isascii
15986 eval $setvar
15987 $rm -f isascii*
15988
15989 : Look for isblank
15990 echo " "
15991 $cat >isblank.c <<'EOCP'
15992 #include <stdio.h>
15993 #include <ctype.h>
15994 int main() {
15995         int c = ' ';
15996         if (isblank(c))
15997                 return 0 ;
15998         else
15999                 return 1 ;
16000 }
16001 EOCP
16002 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
16003         echo "isblank() found." >&4
16004         val="$define"
16005 else
16006         echo "isblank() NOT found." >&4
16007         val="$undef"
16008 fi
16009 set d_isblank
16010 eval $setvar
16011 $rm -f isblank*
16012
16013 : check for isfinite
16014 echo "Checking to see if you have isfinite..." >&4
16015 $cat >try.c <<EOCP
16016 #include <math.h>
16017 int main() { return isfinite(0.0); }
16018 EOCP
16019 set try
16020 if eval $compile; then
16021         val="$define"
16022         echo "You have isfinite."
16023 else
16024         val="$undef"
16025         echo "You do not have isfinite."
16026 fi
16027 $rm_try
16028 set d_isfinite
16029 eval $setvar
16030
16031 : see if isfinitel exists
16032 set isfinitel d_isfinitel
16033 eval $inlibc
16034
16035 : check for isinf
16036 echo "Checking to see if you have isinf..." >&4
16037 $cat >try.c <<EOCP
16038 #include <math.h>
16039 int main() { return isinf(0.0); }
16040 EOCP
16041 set try
16042 if eval $compile; then
16043         val="$define"
16044         echo "You have isinf."
16045 else
16046         val="$undef"
16047         echo "You do not have isinf."
16048 fi
16049 $rm_try
16050 set d_isinf
16051 eval $setvar
16052
16053 : see if isinfl exists
16054 set isinfl d_isinfl
16055 eval $inlibc
16056
16057 : check for isless
16058 echo "Checking to see if you have isless..." >&4
16059 $cat >try.c <<EOCP
16060 #include <math.h>
16061 int main() { return isless(2.0, 1.0); }
16062 EOCP
16063 set try
16064 if eval $compile; then
16065         val="$define"
16066         echo "You have isless."
16067 else
16068         val="$undef"
16069         echo "You do not have isless."
16070 fi
16071 $rm_try
16072 set d_isless
16073 eval $setvar
16074
16075 : check for isnan
16076 echo "Checking to see if you have isnan..." >&4
16077 $cat >try.c <<EOCP
16078 #include <math.h>
16079 int main() { return isnan(0.0); }
16080 EOCP
16081 set try
16082 if eval $compile; then
16083         val="$define"
16084         echo "You have isnan."
16085 else
16086         val="$undef"
16087         echo "You do not have isnan."
16088 fi
16089 $rm_try
16090 set d_isnan
16091 eval $setvar
16092
16093 : see if isnanl exists
16094 set isnanl d_isnanl
16095 eval $inlibc
16096
16097 : check for isnormal
16098 echo "Checking to see if you have isnormal..." >&4
16099 $cat >try.c <<EOCP
16100 #include <math.h>
16101 int main() { return isnormal(0.0); }
16102 EOCP
16103 set try
16104 if eval $compile; then
16105         val="$define"
16106         echo "You have isnormal."
16107 else
16108         val="$undef"
16109         echo "You do not have isnormal."
16110 fi
16111 $rm_try
16112 set d_isnormal
16113 eval $setvar
16114
16115 : see if j0 exists
16116 set j0 d_j0
16117 eval $inlibc
16118
16119 : see if j0l exists
16120 set j0l d_j0l
16121 eval $inlibc
16122
16123 : see if killpg exists
16124 set killpg d_killpg
16125 eval $inlibc
16126
16127 : see if localeconv exists
16128 set localeconv d_locconv
16129 eval $inlibc
16130
16131 : see if libc has the POSIX.1-2008 currency locale rules
16132 case "$d_locconv:$d_lc_monetary_2008" in
16133 $define:)
16134         $cat >try.c <<EOCP
16135 #include <locale.h>
16136 int main() {
16137         struct lconv *lc = localeconv();
16138         char int_p_cs_precedes = lc->int_p_cs_precedes;
16139         return 0;
16140 }
16141 EOCP
16142         set try
16143         if eval $compile; then
16144                 d_lc_monetary_2008="$define"
16145         else
16146                 d_lc_monetary_2008="$undef"
16147         fi;
16148         $rm_try
16149         ;;
16150 esac
16151
16152 : see if lchown exists
16153 echo " "
16154 $cat > try.c <<EOCP
16155 #include <pwd.h>
16156 #include <stdio.h>
16157 #include <stdlib.h>
16158 #$i_unistd      I_UNISTD
16159 #ifdef I_UNISTD
16160 #  include <unistd.h>
16161 #endif
16162 int main(int argc, char *argv[])
16163 {
16164    if (lchown("./try.c", -1, getgid()) == -1) {
16165        exit(EXIT_FAILURE);
16166    }
16167    exit(EXIT_SUCCESS);
16168 }
16169 EOCP
16170 set try
16171 if eval $compile && ./try; then
16172     $echo "lchown() found." >&4
16173     val="$define"
16174 else
16175     $echo "lchown() NOT found." >&4
16176     val="$undef"
16177 fi
16178 set d_lchown
16179 eval $setvar
16180 $rm_try
16181
16182 : See if number of significant digits in a double precision number is known
16183 echo " "
16184 $cat >ldbl_dig.c <<EOM
16185 #include <limits.h>
16186 #include <float.h>
16187 #ifdef LDBL_DIG
16188 printf("Contains LDBL_DIG");
16189 #endif
16190 EOM
16191 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16192 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16193         echo "LDBL_DIG found." >&4
16194         val="$define"
16195 else
16196         echo "LDBL_DIG NOT found." >&4
16197         val="$undef"
16198 fi
16199 $rm -f ldbl_dig.?
16200 set d_ldbl_dig
16201 eval $setvar
16202
16203 : see if lgamma exists
16204 set lgamma d_lgamma
16205 eval $inlibc
16206
16207 : see if lgamma_r exists
16208 set lgamma_r d_lgamma_r
16209 eval $inlibc
16210
16211 : check to see if math.h defines _LIB_VERSION
16212 d_libm_lib_version="$undef"
16213 echo " "
16214 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16215 $cat >try.c <<EOCP
16216 #include <unistd.h>
16217 #include <math.h>
16218 int main (int argc, char *argv[])
16219 {
16220     printf ("%d\n", _LIB_VERSION);
16221     return (0);
16222     } /* main */
16223 EOCP
16224 set try
16225 if eval $compile; then
16226     foo=`$run ./try`
16227     echo "Yes, it does ($foo)" >&4
16228     d_libm_lib_version="$define"
16229 else
16230     echo "No, it does not (probably harmless)" >&4
16231     fi
16232 $rm_try
16233
16234 : see if link exists
16235 set link d_link
16236 eval $inlibc
16237
16238 : see if llrint exists
16239 set llrint d_llrint
16240 eval $inlibc
16241
16242 : see if llrintl exists
16243 set llrintl d_llrintl
16244 eval $inlibc
16245
16246 : see if llround exists
16247 set llround d_llround
16248 eval $inlibc
16249
16250 : see if llroundl exists
16251 set llroundl d_llroundl
16252 eval $inlibc
16253
16254 : see if localtime_r exists
16255 set localtime_r d_localtime_r
16256 eval $inlibc
16257 case "$d_localtime_r" in
16258 "$define")
16259         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16260         case "$d_localtime_r_proto:$usethreads" in
16261         ":define")      d_localtime_r_proto=define
16262                 set d_localtime_r_proto localtime_r $hdrs
16263                 eval $hasproto ;;
16264         *)      ;;
16265         esac
16266         case "$d_localtime_r_proto" in
16267         define)
16268         case "$localtime_r_proto" in
16269         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16270         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16271         esac
16272         case "$localtime_r_proto" in
16273         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16274         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16275         esac
16276         case "$localtime_r_proto" in
16277         ''|0)   d_localtime_r=undef
16278                 localtime_r_proto=0
16279                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16280         * )     case "$localtime_r_proto" in
16281                 REENTRANT_PROTO*) ;;
16282                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16283                 esac
16284                 echo "Prototype: $try" ;;
16285         esac
16286         ;;
16287         *)      case "$usethreads" in
16288                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16289                 esac
16290                 d_localtime_r=undef
16291                 localtime_r_proto=0
16292                 ;;
16293         esac
16294         ;;
16295 *)      localtime_r_proto=0
16296         ;;
16297 esac
16298
16299 : see if localtime_r calls tzset
16300 case "$localtime_r_proto" in
16301 REENTRANT_PROTO*)
16302         $cat >try.c <<EOCP
16303 /*  Does our libc's localtime_r call tzset ?
16304  *  return 0 if so, 1 otherwise.
16305  */
16306 #$i_systypes    I_SYS_TYPES
16307 #$i_unistd      I_UNISTD
16308 #$i_time        I_TIME
16309 #$i_stdlib      I_STDLIB
16310 #$i_malloc      I_MALLOC
16311 #ifdef I_SYS_TYPES
16312 #  include <sys/types.h>
16313 #endif
16314 #ifdef I_UNISTD
16315 #  include <unistd.h>
16316 #endif
16317 #ifdef I_TIME
16318 #  include <time.h>
16319 #endif
16320 #ifdef I_STDLIB
16321 #include <stdlib.h>
16322 #endif
16323 #include <string.h>
16324 #ifdef I_MALLOC
16325 #  include <malloc.h>
16326 #endif
16327 int main()
16328 {
16329     int result = 0;
16330     time_t t = time(0L);
16331     char w_tz[]="TZ" "=GMT+5",
16332          e_tz[]="TZ" "=GMT-5",
16333         *tz_e = (char*)malloc(16),
16334         *tz_w = (char*)malloc(16);
16335     struct tm tm_e, tm_w;
16336     memset(&tm_e,'\0',sizeof(struct tm));
16337     memset(&tm_w,'\0',sizeof(struct tm));
16338     strcpy(tz_e,e_tz);
16339     strcpy(tz_w,w_tz);
16340
16341     putenv(tz_e);
16342     localtime_r(&t, &tm_e);
16343
16344     putenv(tz_w);
16345     localtime_r(&t, &tm_w);
16346
16347     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16348         result = 1;
16349
16350     free(tz_e);free(tz_w);
16351     return result;
16352 }
16353 EOCP
16354         set try
16355         if eval $compile; then
16356             if $run ./try; then
16357                 d_localtime_r_needs_tzset=undef;
16358             else
16359                 d_localtime_r_needs_tzset=define;
16360             fi;
16361         else
16362             d_localtime_r_needs_tzset=undef;
16363         fi;
16364      ;;
16365   *)
16366      d_localtime_r_needs_tzset=undef;
16367      ;;
16368 esac
16369 $rm_try
16370
16371 : see if lockf exists
16372 set lockf d_lockf
16373 eval $inlibc
16374
16375 : see if log1p exists
16376 set log1p d_log1p
16377 eval $inlibc
16378
16379 : see if log2 exists
16380 set log2 d_log2
16381 eval $inlibc
16382
16383 : see if logb exists
16384 set logb d_logb
16385 eval $inlibc
16386
16387 : see if lrint exists
16388 set lrint d_lrint
16389 eval $inlibc
16390
16391 : see if lrintl exists
16392 set lrintl d_lrintl
16393 eval $inlibc
16394
16395 : see if lround exists
16396 set lround d_lround
16397 eval $inlibc
16398
16399 : see if lroundl exists
16400 set lroundl d_lroundl
16401 eval $inlibc
16402
16403 : see if prototype for lseek is available
16404 echo " "
16405 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16406 eval $hasproto
16407
16408 : see if lstat exists
16409 set lstat d_lstat
16410 eval $inlibc
16411
16412 : see if madvise exists
16413 set madvise d_madvise
16414 eval $inlibc
16415
16416 : see if malloc_size exists
16417 set malloc_size d_malloc_size
16418 eval $inlibc
16419
16420 : see if malloc_size_good exists
16421 set malloc_good_size d_malloc_good_size
16422 eval $inlibc
16423
16424 : see if malloc_usable_size exists
16425 set malloc_usable_size d_malloc_usable_size
16426 eval $inlibc
16427
16428 : see if mblen exists
16429 set mblen d_mblen
16430 eval $inlibc
16431
16432 : see if mbrlen exists
16433 set mbrlen d_mbrlen
16434 eval $inlibc
16435
16436 : see if mbrtowc exists
16437 set mbrtowc d_mbrtowc
16438 eval $inlibc
16439
16440 : see if mbstowcs exists
16441 set mbstowcs d_mbstowcs
16442 eval $inlibc
16443
16444 : see if mbtowc exists
16445 set mbtowc d_mbtowc
16446 eval $inlibc
16447
16448 : see if memmem exists
16449 : We need both a prototype in string.h and the symbol in libc.
16450 echo " "
16451 d_memmem_proto=''
16452 xx1="#$d_gnulibc HAS_GNULIBC"
16453 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16454 xx3='#   define _GNU_SOURCE'
16455 xx4='#endif'
16456 set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16457 eval $hasproto
16458 case "$d_memmem_proto" in
16459     define) # see if memmem exists
16460         set memmem d_memmem
16461         eval $inlibc
16462         ;;
16463     *)  val=$undef
16464         set d_memmem
16465         eval $setvar
16466         ;;
16467 esac
16468
16469 : see if memrchr exists
16470 : We need both a prototype in string.h and the symbol in libc.
16471 echo " "
16472 d_memrchr_proto=''
16473 xx1="#$d_gnulibc HAS_GNULIBC"
16474 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16475 xx3='#   define _GNU_SOURCE'
16476 xx4='#endif'
16477 set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16478 eval $hasproto
16479 case "$d_memrchr_proto" in
16480     define) # see if memrchr exists
16481         set memrchr d_memrchr
16482         eval $inlibc
16483         ;;
16484     *)  val=$undef
16485         set d_memrchr
16486         eval $setvar
16487         ;;
16488 esac
16489
16490 : see if mkdir exists
16491 set mkdir d_mkdir
16492 eval $inlibc
16493
16494 : see if mkdtemp exists
16495 set mkdtemp d_mkdtemp
16496 eval $inlibc
16497
16498 : see if mkfifo exists
16499 set mkfifo d_mkfifo
16500 eval $inlibc
16501
16502 : see if mkostemp exists
16503 set mkostemp d_mkostemp
16504 eval $inlibc
16505
16506 : see if mkstemp exists
16507 set mkstemp d_mkstemp
16508 eval $inlibc
16509
16510 : see if mkstemps exists
16511 set mkstemps d_mkstemps
16512 eval $inlibc
16513
16514 : see if mktime exists
16515 set mktime d_mktime
16516 eval $inlibc
16517
16518 : see if sys/mman.h has to be included
16519 set sys/mman.h i_sysmman
16520 eval $inhdr
16521
16522 : see if mmap exists
16523 set mmap d_mmap
16524 eval $inlibc
16525 : see what shmat returns
16526 : default to something harmless
16527 mmaptype='void *'
16528 case "$i_sysmman$d_mmap" in
16529 "$define$define")
16530         $cat >mmap.c <<'END'
16531 #include <sys/mman.h>
16532 void *mmap();
16533 END
16534         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16535                 mmaptype='void *'
16536         else
16537                 mmaptype='caddr_t'
16538         fi
16539         echo "and it returns ($mmaptype)." >&4
16540         ;;
16541 esac
16542
16543 : see if sqrtl exists
16544 set sqrtl d_sqrtl
16545 eval $inlibc
16546
16547 : see if scalbnl exists
16548 set scalbnl d_scalbnl
16549 eval $inlibc
16550
16551 : see if truncl exists
16552 set truncl d_truncl
16553 eval $inlibc
16554
16555 : see if modfl exists
16556 set modfl d_modfl
16557 eval $inlibc
16558
16559 : see if prototype for modfl is available
16560 echo " "
16561 set d_modflproto modfl define math.h
16562 eval $hasproto
16563
16564 if $test "$uselongdouble" = "$define"; then
16565     message=""
16566     if $test "$d_sqrtl" != "$define"; then
16567         message="$message sqrtl"
16568     fi
16569     if $test "$d_modfl" != "$define"; then
16570         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16571             echo "You have both truncl and copysignl, so I can emulate modfl."
16572         else
16573             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16574                 echo "You have both aintl and copysignl, so I can emulate modfl."
16575             else
16576                 message="$message modfl"
16577             fi
16578         fi
16579     fi
16580     if $test "$d_frexpl" != "$define"; then
16581         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16582             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16583         else
16584             message="$message frexpl"
16585         fi
16586     fi
16587     if $test "$d_ldexpl" != "$define"; then
16588         message="$message ldexpl"
16589     fi
16590
16591     if $test "$message" != ""; then
16592         $cat <<EOM >&4
16593
16594 *** You requested the use of long doubles but you do not seem to have
16595 *** the following mathematical functions needed for long double support:
16596 ***    $message
16597 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16598 *** Cannot continue, aborting.
16599
16600 EOM
16601
16602         exit 1
16603     fi
16604 fi
16605
16606 : see if mprotect exists
16607 set mprotect d_mprotect
16608 eval $inlibc
16609
16610 : see if msgctl exists
16611 set msgctl d_msgctl
16612 eval $inlibc
16613
16614 : see if msgget exists
16615 set msgget d_msgget
16616 eval $inlibc
16617
16618 : see if msgsnd exists
16619 set msgsnd d_msgsnd
16620 eval $inlibc
16621
16622 : see if msgrcv exists
16623 set msgrcv d_msgrcv
16624 eval $inlibc
16625
16626 : see how much of the 'msg*(2)' library is present.
16627 h_msg=true
16628 echo " "
16629 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16630 *"$undef"*) h_msg=false;;
16631 esac
16632 case "$osname" in
16633 freebsd)
16634     case "`ipcs 2>&1`" in
16635     "SVID messages"*"not configured"*)
16636         echo "Your $osname does not have the msg*(2) configured." >&4
16637         h_msg=false
16638         val="$undef"
16639         set msgctl d_msgctl
16640         eval $setvar
16641         set msgget d_msgget
16642         eval $setvar
16643         set msgsnd d_msgsnd
16644         eval $setvar
16645         set msgrcv d_msgrcv
16646         eval $setvar
16647         ;;
16648     esac
16649     ;;
16650 esac
16651 : we could also check for sys/ipc.h ...
16652 if $h_msg && $test `./findhdr sys/msg.h`; then
16653         echo "You have the full msg*(2) library." >&4
16654         val="$define"
16655 else
16656         echo "You don't have the full msg*(2) library." >&4
16657         val="$undef"
16658 fi
16659 set d_msg
16660 eval $setvar
16661
16662 : Check for msghdr_s
16663 echo " "
16664 echo "Checking to see if your system supports struct msghdr..." >&4
16665 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16666 eval $hasstruct
16667 case "$d_msghdr_s" in
16668 "$define")      echo "Yes, it does."   ;;
16669 *)              echo "No, it doesn't." ;;
16670 esac
16671
16672 : see if msync exists
16673 set msync d_msync
16674 eval $inlibc
16675
16676 : see if munmap exists
16677 set munmap d_munmap
16678 eval $inlibc
16679
16680 : see if nan exists
16681 set nan d_nan
16682 eval $inlibc
16683
16684 : see if nanosleep exists
16685 set nanosleep d_nanosleep
16686 eval $inlibc
16687
16688 : see if nearbyint exists
16689 set nearbyint d_nearbyint
16690 eval $inlibc
16691
16692 : see if nextafter exists
16693 set nextafter d_nextafter
16694 eval $inlibc
16695
16696 : see if nexttoward exists
16697 set nexttoward d_nexttoward
16698 eval $inlibc
16699
16700 : see if nice exists
16701 set nice d_nice
16702 eval $inlibc
16703
16704 : see if this is a langinfo.h system
16705 set langinfo.h i_langinfo
16706 eval $inhdr
16707
16708 : see if nl_langinfo exists
16709 set nl_langinfo d_nl_langinfo
16710 eval $inlibc
16711
16712 : see if locale.h is available
16713 set locale.h i_locale
16714 eval $inhdr
16715
16716 : check for nl_langinfo_l item
16717 $cat <<EOM
16718
16719 Checking to see if you have nl_langinfo_l(), and that it is thread-safe
16720 EOM
16721 $cat >try.c <<EOCP
16722 #$i_stdlib I_STDLIB
16723 #ifdef I_STDLIB
16724 #  include <stdlib.h>
16725 #endif
16726 #include <string.h>
16727 #$i_langinfo I_LANGINFO
16728 #ifdef I_LANGINFO
16729 #  include <langinfo.h>
16730 #endif
16731 #$i_pthread I_PTHREAD
16732 #ifdef I_PTHREAD
16733 #  include <pthread.h>
16734 #endif
16735 #$i_locale I_LOCALE
16736 #ifdef I_LOCALE
16737 #  include <locale.h>
16738 #endif
16739
16740 void *
16741 thread_start(void * arg)
16742 {
16743     nl_langinfo(RADIXCHAR);
16744 }
16745
16746 int main() {
16747     char * main_buffer;
16748     char save_main_buffer[1000];
16749     pthread_t subthread;
16750     pthread_attr_t attr;
16751
16752     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
16753
16754     /* If too large for our generous allowance, just assume we don't have
16755      * it. */
16756     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
16757         exit(1);
16758     }
16759
16760     strcpy(save_main_buffer, main_buffer);
16761
16762     if (pthread_attr_init(&attr) != 0) {
16763         exit(1);
16764     }
16765
16766     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
16767         exit(1);
16768     }
16769
16770     if (pthread_join(subthread, NULL) != 0) {
16771         exit(1);
16772     }
16773
16774     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
16775 }
16776 EOCP
16777 case "$usethreads" in
16778     define)
16779         set try
16780         if eval $compile; then
16781             echo "Your system has nl_langinfo_l()..." >&4
16782             d_nl_langinfo_l="$define"
16783             echo "$d_nl_langinfo_l" >&4
16784             if $run ./try; then
16785                 echo "and it is thread-safe (just as I'd hoped)." >&4
16786                 d_thread_safe_nl_langinfo_l="$define"
16787                 echo "$d_thread_safe_nl_langinfo_l" >&4
16788             else
16789                 echo "but it isn't thread-safe." >&4
16790             fi
16791         else
16792             echo "your system does not have nl_langinfo_l()" >&4
16793         fi
16794         ;;
16795     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
16796 esac
16797 if test X"$d_nl_langinfo_l" = X; then
16798         d_nl_langinfo_l="$undef"
16799 fi
16800 if test X"$d_thread_safe_nl_langinfo_l" = X; then
16801         d_thread_safe_nl_langinfo_l="$undef"
16802 fi
16803 $rm_try
16804
16805 : Look for non 'int'-sized bitfields
16806 case "$d_non_int_bitfields" in
16807 '')
16808 echo " " >&4
16809 echo "Checking whether your compiler can handle struct bitfields that aren't 'int' or 'unsigned int' ..." >&4
16810 $cat >try.c <<'EOCP'
16811 #include <stdio.h>
16812 struct foo {
16813     unsigned char byte:1;
16814     unsigned short halfword:1;
16815 } bar;
16816 EOCP
16817 if $cc $ccflags -c try.c >try.out 2>&1 ; then
16818         if $compiler_warning try.out >/dev/null 2>&1; then
16819                 echo "Your C compiler doesn't support struct bitfields that aren't 'int' or 'unsigned int'." >&4
16820                 val="$undef"
16821         else
16822                 echo "Your C compiler supports struct bitfields besides 'int' and 'unsigned int'." >&4
16823                 val="$define"
16824         fi
16825 else
16826         echo "Your C compiler doesn't seem to understand struct bitfields that aren't 'int' or 'unsigned int' at all." >&4
16827         val="$undef"
16828 fi
16829 ;;
16830 *) val="$d_non_int_bitfields" ;;
16831 esac
16832 set d_non_int_bitfields
16833 eval $setvar
16834 $rm_try
16835
16836 : see if this is a quadmath.h system
16837 set quadmath.h i_quadmath
16838 eval $inhdr
16839
16840 : Check basic sizes
16841 echo " "
16842 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16843
16844 case "$use64bitint:$d_quad:$quadtype" in
16845 define:define:?*)
16846         ivtype="$quadtype"
16847         uvtype="$uquadtype"
16848         ivsize=8
16849         uvsize=8
16850         ;;
16851 *)      ivtype="long"
16852         uvtype="unsigned long"
16853         ivsize=$longsize
16854         uvsize=$longsize
16855         ;;
16856 esac
16857
16858 case "$uselongdouble:$d_longdbl" in
16859 define:define)
16860         nvtype="long double"
16861         nvsize=$longdblsize
16862         ;;
16863 *)      nvtype=double
16864         nvsize=$doublesize
16865         ;;
16866 esac
16867
16868 case "$usequadmath:$i_quadmath" in
16869 define:define)
16870   nvtype="__float128"
16871   nvsize=16
16872   case "$libs" in
16873   *quadmath*) ;;
16874   *) $cat <<EOM >&4
16875
16876 *** You requested the use of the quadmath library, but you
16877 *** do not seem to have the quadmath library installed.
16878 *** Cannot continue, aborting.
16879 EOM
16880     exit 1
16881     ;;
16882   esac
16883   ;;
16884 define:*) $cat <<EOM >&4
16885
16886 *** You requested the use of the quadmath library, but you
16887 *** do not seem to have the required header, <quadmath.h>.
16888 EOM
16889   case "$gccversion" in
16890   [23].*|4.[0-5]*)
16891    $cat <<EOM >&4
16892 *** Your gcc looks a bit old:
16893 *** $gccversion
16894 EOM
16895     ;;
16896   '')
16897    $cat <<EOM >&4
16898 *** You are not running a gcc.
16899 EOM
16900     ;;
16901   esac
16902   $cat <<EOM >&4
16903 *** For the quadmath library you need at least gcc 4.6.
16904 *** Cannot continue, aborting.
16905 EOM
16906   exit 1
16907   ;;
16908 esac
16909
16910 $echo "(IV will be "$ivtype", $ivsize bytes)"
16911 $echo "(UV will be "$uvtype", $uvsize bytes)"
16912 $echo "(NV will be "$nvtype", $nvsize bytes)"
16913
16914 $cat >try.c <<EOCP
16915 #$i_inttypes I_INTTYPES
16916 #ifdef I_INTTYPES
16917 #include <inttypes.h>
16918 #endif
16919 #include <stdio.h>
16920 int main() {
16921 #ifdef INT8
16922    int8_t i =  INT8_MAX;
16923   uint8_t u = UINT8_MAX;
16924   printf("int8_t\n");
16925 #endif
16926 #ifdef INT16
16927    int16_t i =  INT16_MAX;
16928   uint16_t u = UINT16_MAX;
16929   printf("int16_t\n");
16930 #endif
16931 #ifdef INT32
16932    int32_t i =  INT32_MAX;
16933   uint32_t u = UINT32_MAX;
16934   printf("int32_t\n");
16935 #endif
16936 }
16937 EOCP
16938
16939 i8type="signed char"
16940 u8type="unsigned char"
16941 i8size=1
16942 u8size=1
16943
16944 case "$i16type" in
16945 '')     case "$shortsize" in
16946         2)      i16type=short
16947                 u16type="unsigned short"
16948                 i16size=$shortsize
16949                 u16size=$shortsize
16950                 ;;
16951         esac
16952         ;;
16953 esac
16954 case "$i16type" in
16955 '')     set try -DINT16
16956         if eval $compile; then
16957                 case "`$run ./try`" in
16958                 int16_t)
16959                         i16type=int16_t
16960                         u16type=uint16_t
16961                         i16size=2
16962                         u16size=2
16963                         ;;
16964                 esac
16965         fi
16966         ;;
16967 esac
16968 case "$i16type" in
16969 '')     if $test $shortsize -ge 2; then
16970                 i16type=short
16971                 u16type="unsigned short"
16972                 i16size=$shortsize
16973                 u16size=$shortsize
16974         fi
16975         ;;
16976 esac
16977
16978 case "$i32type" in
16979 '')     case "$longsize" in
16980         4)      i32type=long
16981                 u32type="unsigned long"
16982                 i32size=$longsize
16983                 u32size=$longsize
16984                 ;;
16985         *)      case "$intsize" in
16986                 4)      i32type=int
16987                         u32type="unsigned int"
16988                         i32size=$intsize
16989                         u32size=$intsize
16990                         ;;
16991                 esac
16992                 ;;
16993         esac
16994         ;;
16995 esac
16996 case "$i32type" in
16997 '')     set try -DINT32
16998         if eval $compile; then
16999                 case "`$run ./try`" in
17000                 int32_t)
17001                         i32type=int32_t
17002                         u32type=uint32_t
17003                         i32size=4
17004                         u32size=4
17005                         ;;
17006                 esac
17007         fi
17008         ;;
17009 esac
17010 case "$i32type" in
17011 '')     if $test $intsize -ge 4; then
17012                 i32type=int
17013                 u32type="unsigned int"
17014                 i32size=$intsize
17015                 u32size=$intsize
17016         fi
17017         ;;
17018 esac
17019
17020 case "$i64type" in
17021 '')     case "$d_quad:$quadtype" in
17022         define:?*)
17023                 i64type="$quadtype"
17024                 u64type="$uquadtype"
17025                 i64size=8
17026                 u64size=8
17027                 ;;
17028         esac
17029         ;;
17030 esac
17031
17032 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
17033 $cat <<EOP >try.c
17034 #include <stdio.h>
17035 #$i_stdlib I_STDLIB
17036 #ifdef I_STDLIB
17037 #include <stdlib.h>
17038 #endif
17039 #$i_inttypes I_INTTYPES
17040 #ifdef I_INTTYPES
17041 #include <inttypes.h>
17042 #endif
17043 #include <sys/types.h>
17044 #include <signal.h>
17045 #ifdef SIGFPE
17046 /* volatile so that the compiler has to store it out to memory */
17047 volatile int bletched = 0;
17048 $signal_t blech(int s) { bletched = 1; }
17049 #endif
17050 int main() {
17051     $uvtype u = 0;
17052     $nvtype d;
17053     int     n = 8 * $uvsize;
17054     int     i;
17055 #ifdef SIGFPE
17056     signal(SIGFPE, blech);
17057 #endif
17058
17059     for (i = 0; i < n; i++) {
17060       u = u << 1 | ($uvtype)1;
17061       d = ($nvtype)u;
17062       if (($uvtype)d != u)
17063         break;
17064       if (d <= 0)
17065         break;
17066       d = ($nvtype)(u - 1);
17067       if (($uvtype)d != (u - 1))
17068         break;
17069 #ifdef SIGFPE
17070       if (bletched)
17071         break;
17072 #endif
17073     }
17074     printf("%d\n", ((i == n) ? -n : i));
17075     exit(0);
17076 }
17077 EOP
17078 set try
17079
17080 d_nv_preserves_uv="$undef"
17081 if eval $compile; then
17082         nv_preserves_uv_bits="`$run ./try`"
17083 fi
17084 case "$nv_preserves_uv_bits" in
17085 \-[1-9]*)
17086         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
17087         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  >&4
17088         d_nv_preserves_uv="$define"
17089         ;;
17090 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  >&4
17091         d_nv_preserves_uv="$undef" ;;
17092 *)      $echo "Can't figure out how many bits your NVs preserve." >&4
17093         nv_preserves_uv_bits="0" ;;
17094 esac
17095 $rm_try
17096
17097 $echo "Checking to find the largest integer value your NVs can hold..." >&4
17098 $cat <<EOP >try.c
17099 #include <stdio.h>
17100
17101 typedef $nvtype NV;
17102
17103 int
17104 main() {
17105   NV value = 2;
17106   int count = 1;
17107
17108   while(count < 256) {
17109     /* volatile so that the compiler has to store it out to memory */
17110     volatile NV up = value + 1.0;
17111     volatile NV negated = -value;
17112     volatile NV down = negated - 1.0;
17113     volatile NV got_up = up - value;
17114     int up_good = got_up == 1.0;
17115     int got_down = down - negated;
17116     int down_good = got_down == -1.0;
17117
17118     if (down_good != up_good) {
17119       fprintf(stderr,
17120               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
17121               up_good, (double) got_up, down_good, (double) got_down,
17122               count, (double) value);
17123       return 1;
17124     }
17125     if (!up_good) {
17126       while (1) {
17127         if (count > 8) {
17128           count -= 8;
17129           fputs("256.0", stdout);
17130         } else {
17131           count--;
17132           fputs("2.0", stdout);
17133         }
17134         if (!count) {
17135           puts("");
17136           return 0;
17137         }
17138         fputs("*", stdout);
17139       }
17140     }
17141     value *= 2;
17142     ++count;
17143   }
17144   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
17145           count, (double) value);
17146   return 1;
17147 }
17148 EOP
17149 set try
17150
17151 nv_overflows_integers_at='0'
17152 if eval $compile; then
17153     xxx="`$run ./try`"
17154     case "$?" in
17155         0)
17156             case "$xxx" in
17157                 2*)  cat >&4 <<EOM
17158 The largest integer your NVs can preserve is equal to $xxx
17159 EOM
17160                     nv_overflows_integers_at="$xxx"
17161                     ;;
17162                 *)  cat >&4 <<EOM
17163 Cannot determine the largest integer value your NVs can hold, unexpected output
17164 '$xxx'
17165 EOM
17166                     ;;
17167             esac
17168             ;;
17169         *)  cat >&4 <<EOM
17170 Cannot determine the largest integer value your NVs can hold
17171 EOM
17172             ;;
17173     esac
17174 fi
17175 $rm_try
17176
17177 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
17178 $cat <<EOP >try.c
17179 #include <stdio.h>
17180 #$i_stdlib I_STDLIB
17181 #ifdef I_STDLIB
17182 #include <stdlib.h>
17183 #endif
17184 #include <string.h>
17185 #include <sys/types.h>
17186 #include <signal.h>
17187 #ifdef SIGFPE
17188 /* volatile so that the compiler has to store it out to memory */
17189 volatile int bletched = 0;
17190 $signal_t blech(int s) { bletched = 1; }
17191 #endif
17192
17193 int checkit($nvtype d, const char *where) {
17194     void *v = &d;
17195     unsigned char *p = (unsigned char *)v;
17196     unsigned char *end = p + sizeof(d);
17197     int fail = 0;
17198
17199     while (p < end)
17200         fail += *p++;
17201
17202     if (!fail)
17203         return 0;
17204
17205     p = (unsigned char *)v;
17206     printf("No - %s: 0x", where);
17207     while (p < end)
17208         printf ("%02X", *p++);
17209     printf("\n");
17210     return 1;
17211 }
17212
17213 int main(int argc, char **argv) {
17214     $nvtype d = 0.0;
17215     int fail = 0;
17216     fail += checkit(d, "0.0");
17217
17218     /* The compiler shouldn't be assuming that bletched is 0  */
17219     d = bletched;
17220
17221     fail += checkit(d, "bleched");
17222
17223 #ifdef SIGFPE
17224     signal(SIGFPE, blech);
17225 #endif
17226
17227     /* Paranoia - the compiler should have no way of knowing that ANSI says
17228        that argv[argc] will always be NULL.  Actually, if it did assume this it
17229        would be buggy, as this is C and main() can be called from elsewhere in
17230        the program.  */
17231     d = argv[argc] ? 1 : 0;
17232
17233     if (d) {
17234         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17235     }
17236
17237     fail += checkit(d, "ternary");
17238
17239     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17240
17241     if (d != 0.0) {
17242         printf("No - memset doesn't give 0.0\n");
17243         /* This might just blow up:  */
17244         printf("(gives %g)\n", d);
17245         return 1;
17246     }
17247
17248 #ifdef SIGFPE
17249     if (bletched) {
17250         printf("No - something bleched\n");
17251         return 1;
17252     }
17253 #endif
17254     if (fail) {
17255       printf("No - %d fail(s)\n", fail);
17256       return 1;
17257     }
17258     printf("Yes\n");
17259     return 0;
17260 }
17261 EOP
17262 set try
17263
17264 d_nv_zero_is_allbits_zero="$undef"
17265 if eval $compile; then
17266     xxx="`$run ./try`"
17267     case "$?" in
17268         0)
17269             case "$xxx" in
17270                 Yes)  cat >&4 <<EOM
17271 0.0 is represented as all bits zero in memory
17272 EOM
17273                     d_nv_zero_is_allbits_zero="$define"
17274                     ;;
17275                 *)  cat >&4 <<EOM
17276 0.0 is not represented as all bits zero in memory
17277 EOM
17278                     d_nv_zero_is_allbits_zero="$undef"
17279                     ;;
17280             esac
17281             ;;
17282         *)  cat >&4 <<EOM
17283 0.0 is not represented as all bits zero in memory
17284 EOM
17285             d_nv_zero_is_allbits_zero="$undef"
17286             ;;
17287     esac
17288 fi
17289 $rm_try
17290
17291 : check for off64_t
17292 echo " "
17293 echo "Checking to see if you have off64_t..." >&4
17294 $cat >try.c <<EOCP
17295 #include <sys/types.h>
17296 #include <unistd.h>
17297 int main() { off64_t x = 7; }
17298 EOCP
17299 set try
17300 if eval $compile; then
17301         val="$define"
17302         echo "You have off64_t."
17303 else
17304         val="$undef"
17305         echo "You do not have off64_t."
17306         case "$lseeksize" in
17307         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17308         esac
17309 fi
17310 $rm_try
17311 set d_off64_t
17312 eval $setvar
17313
17314 : how to create joinable pthreads
17315 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17316         echo " "
17317         echo "Checking what constant to use for creating joinable pthreads..." >&4
17318         $cat >try.c <<'EOCP'
17319 #include <pthread.h>
17320 int main() {
17321     int detachstate = JOINABLE;
17322 }
17323 EOCP
17324         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17325         if eval $compile; then
17326                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17327                 val="$undef" # Yes, undef.
17328                 set d_old_pthread_create_joinable
17329                 eval $setvar
17330                 val=""
17331                 set old_pthread_create_joinable
17332                 eval $setvar
17333         else
17334                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17335                 if eval $compile; then
17336                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17337                         val="$define"
17338                         set d_old_pthread_create_joinable
17339                         eval $setvar
17340                         val=PTHREAD_CREATE_UNDETACHED
17341                         set old_pthread_create_joinable
17342                         eval $setvar
17343                 else
17344                         set try -DJOINABLE=__UNDETACHED
17345                         if eval $compile; then
17346                                 echo "You seem to use __UNDETACHED." >&4
17347                                 val="$define"
17348                                 set d_old_pthread_create_joinable
17349                                 eval $setvar
17350                                 val=__UNDETACHED
17351                                 set old_pthread_create_joinable
17352                                 eval $setvar
17353                         else
17354                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17355                                 val="$define"
17356                                 set d_old_pthread_create_joinable
17357                                 eval $setvar
17358                                 val=0
17359                                 set old_pthread_create_joinable
17360                                 eval $setvar
17361                         fi
17362                 fi
17363         fi
17364         $rm_try
17365 else
17366     d_old_pthread_create_joinable="$undef"
17367     old_pthread_create_joinable=""
17368 fi
17369
17370 : see if pause exists
17371 set pause d_pause
17372 eval $inlibc
17373
17374 : see if pipe2 exists
17375 set pipe2 d_pipe2
17376 eval $inlibc
17377
17378 : see if poll exists
17379 set poll d_poll
17380 eval $inlibc
17381
17382 : see if prctl exists
17383 set prctl d_prctl
17384 eval $inlibc
17385
17386 : see if prctl supports PR_SET_NAME
17387 d_prctl_set_name=$undef
17388 case $d_prctl in
17389     $define)
17390         $cat >try.c <<EOM
17391 #ifdef __ANDROID__
17392 #include <unistd.h>
17393 #endif
17394 #include <sys/prctl.h>
17395
17396 int main (int argc, char *argv[])
17397 {
17398     return (prctl (PR_SET_NAME, "Test"));
17399     } /* main */
17400 EOM
17401         set try
17402         if eval $compile_ok && $run ./try; then
17403             echo "Your prctl (PR_SET_NAME, ...) works"
17404             d_prctl_set_name=$define
17405             fi
17406         $rm_try
17407         ;;
17408     esac
17409
17410 : see if readlink exists
17411 set readlink d_readlink
17412 eval $inlibc
17413
17414 : Check if there is a /proc symlink to the abs path of
17415 : the executing program.  We will honor hints of d_procselfexe=$undef
17416 : or procselfexe being non-empty, otherwise will try to determine both
17417 : if we have readlink.
17418 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17419 : referenced, and AmigaOS does not have a proc filesystem anyway.
17420 echo " "
17421 val="$undef"
17422 if $test "X$d_procselfexe" = Xundef; then
17423         procselfexe=''
17424 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17425         val="$define"
17426 elif $test "X$d_readlink" = Xdefine; then
17427         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17428         : and it feels more tidy to avoid an extra level of symlink
17429         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17430         while test $# -gt 0; do
17431             type=$1; try=$2
17432             shift; shift
17433             if $issymlink $try; then
17434                 $ls -l $try > reflect
17435                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17436                     echo "You have $type-like $try."
17437                     procselfexe='"'$try'"'
17438                     val="$define"
17439                     : This will break out of the loop
17440                     set X; shift
17441                 fi
17442             fi
17443         done
17444 fi
17445 $rm -f reflect
17446 set d_procselfexe
17447 eval $setvar
17448
17449 : backward compatibility for d_hvfork
17450 if test X$d_hvfork != X; then
17451         d_vfork="$d_hvfork"
17452         d_hvfork=''
17453 fi
17454 : see if there is a vfork
17455 val=''
17456 set vfork val
17457 eval $inlibc
17458
17459 d_pseudofork=$undef
17460
17461 : Ok, but do we want to use it. vfork is reportedly unreliable in
17462 : perl on Solaris 2.x, and probably elsewhere.
17463 case "$val" in
17464 $define)
17465         echo " "
17466         case "$usevfork" in
17467         false) dflt='n';;
17468         *) dflt='y';;
17469         esac
17470         cat <<'EOM'
17471
17472 Perl can only use a vfork() that doesn't suffer from strict
17473 restrictions on calling functions or modifying global data in
17474 the child.  For example, glibc-2.1 contains such a vfork()
17475 that is unsuitable.  If your system provides a proper fork()
17476 call, chances are that you do NOT want perl to use vfork().
17477
17478 EOM
17479         rp="Do you still want to use vfork()?"
17480         . ./myread
17481         case "$ans" in
17482         y|Y) ;;
17483         *)
17484                 echo "Ok, we won't use vfork()."
17485                 val="$undef"
17486                 ;;
17487         esac
17488         ;;
17489 esac
17490 set d_vfork
17491 eval $setvar
17492 case "$d_vfork" in
17493 $define) usevfork='true';;
17494 *) usevfork='false';;
17495 esac
17496
17497 : see whether the pthread_atfork exists
17498 $cat >try.c <<EOP
17499 #include <pthread.h>
17500 #include <stdio.h>
17501 int main() {
17502 #ifdef  PTHREAD_ATFORK
17503         pthread_atfork(NULL,NULL,NULL);
17504 #endif
17505 }
17506 EOP
17507
17508 : see if pthread_atfork exists
17509 set try -DPTHREAD_ATFORK
17510 if eval $compile; then
17511     val="$define"
17512 else
17513     val="$undef"
17514 fi
17515 case "$usethreads" in
17516 $define)
17517         case "$val" in
17518         $define) echo 'pthread_atfork found.' >&4        ;;
17519         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17520         esac
17521 esac
17522 set d_pthread_atfork
17523 eval $setvar
17524
17525 : see if pthread_attr_setscope exists
17526 set pthread_attr_setscope d_pthread_attr_setscope
17527 eval $inlibc
17528
17529 : see whether the various POSIXish _yields exist
17530 $cat >try.c <<EOP
17531 #include <pthread.h>
17532 #include <stdio.h>
17533 int main() {
17534 #ifdef SCHED_YIELD
17535         sched_yield();
17536 #else
17537 #ifdef PTHREAD_YIELD
17538         pthread_yield();
17539 #else
17540 #ifdef PTHREAD_YIELD_NULL
17541         pthread_yield(NULL);
17542 #endif
17543 #endif
17544 #endif
17545 }
17546 EOP
17547 : see if sched_yield exists
17548 set try -DSCHED_YIELD
17549 if eval $compile; then
17550     val="$define"
17551     sched_yield='sched_yield()'
17552 else
17553     val="$undef"
17554 fi
17555 case "$usethreads" in
17556 $define)
17557         case "$val" in
17558         $define) echo 'sched_yield() found.' >&4        ;;
17559         *)       echo 'sched_yield() NOT found.' >&4    ;;
17560         esac
17561 esac
17562 set d_sched_yield
17563 eval $setvar
17564
17565 : see if pthread_yield exists
17566 set try -DPTHREAD_YIELD
17567 if eval $compile; then
17568     val="$define"
17569     case "$sched_yield" in
17570     '') sched_yield='pthread_yield()' ;;
17571     esac
17572 else
17573     set try -DPTHREAD_YIELD_NULL
17574     if eval $compile; then
17575         val="$define"
17576         case "$sched_yield" in
17577         '') sched_yield='pthread_yield(NULL)' ;;
17578         esac
17579     else
17580         val="$undef"
17581     fi
17582 fi
17583 case "$usethreads" in
17584 $define)
17585         case "$val" in
17586         $define) echo 'pthread_yield() found.' >&4      ;;
17587         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17588         esac
17589         ;;
17590 esac
17591 set d_pthread_yield
17592 eval $setvar
17593 case "$sched_yield" in
17594 '') sched_yield=undef ;;
17595 esac
17596 $rm_try
17597
17598 : check for ptrdiff_t
17599 echo " "
17600 echo "Checking to see if you have ptrdiff_t..." >&4
17601 $cat >try.c <<EOCP
17602 #include <stddef.h>
17603 int main() { ptrdiff_t x = 7; }
17604 EOCP
17605 set try
17606 if eval $compile; then
17607         val="$define"
17608         echo "You have ptrdiff_t."
17609 else
17610         val="$undef"
17611         echo "You do not have ptrdiff_t."
17612 fi
17613 $rm_try
17614 set d_ptrdiff_t
17615 eval $setvar
17616
17617 : see if random_r exists
17618 set random_r d_random_r
17619 eval $inlibc
17620 case "$d_random_r" in
17621 "$define")
17622         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17623         case "$d_random_r_proto:$usethreads" in
17624         ":define")      d_random_r_proto=define
17625                 set d_random_r_proto random_r $hdrs
17626                 eval $hasproto ;;
17627         *)      ;;
17628         esac
17629         case "$d_random_r_proto" in
17630         define)
17631         case "$random_r_proto" in
17632         ''|0) try='int random_r(int*, struct random_data*);'
17633         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17634         esac
17635         case "$random_r_proto" in
17636         ''|0) try='int random_r(long*, struct random_data*);'
17637         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17638         esac
17639         case "$random_r_proto" in
17640         ''|0) try='int random_r(struct random_data*, int32_t*);'
17641         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17642         esac
17643         case "$random_r_proto" in
17644         ''|0)   d_random_r=undef
17645                 random_r_proto=0
17646                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17647         * )     case "$random_r_proto" in
17648                 REENTRANT_PROTO*) ;;
17649                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17650                 esac
17651                 echo "Prototype: $try" ;;
17652         esac
17653         ;;
17654         *)      case "$usethreads" in
17655                 define) echo "random_r has no prototype, not using it." >&4 ;;
17656                 esac
17657                 d_random_r=undef
17658                 random_r_proto=0
17659                 ;;
17660         esac
17661         ;;
17662 *)      random_r_proto=0
17663         ;;
17664 esac
17665
17666 : see if readdir and friends exist
17667 set readdir d_readdir
17668 eval $inlibc
17669 set seekdir d_seekdir
17670 eval $inlibc
17671 set telldir d_telldir
17672 eval $inlibc
17673 set rewinddir d_rewinddir
17674 eval $inlibc
17675
17676 : see if readdir64_r exists
17677 set readdir64_r d_readdir64_r
17678 eval $inlibc
17679 case "$d_readdir64_r" in
17680 "$define")
17681         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17682         case "$d_readdir64_r_proto:$usethreads" in
17683         ":define")      d_readdir64_r_proto=define
17684                 set d_readdir64_r_proto readdir64_r $hdrs
17685                 eval $hasproto ;;
17686         *)      ;;
17687         esac
17688         case "$d_readdir64_r_proto" in
17689         define)
17690         case "$readdir64_r_proto" in
17691         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17692         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17693         esac
17694         case "$readdir64_r_proto" in
17695         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17696         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17697         esac
17698         case "$readdir64_r_proto" in
17699         ''|0)   d_readdir64_r=undef
17700                 readdir64_r_proto=0
17701                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17702         * )     case "$readdir64_r_proto" in
17703                 REENTRANT_PROTO*) ;;
17704                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17705                 esac
17706                 echo "Prototype: $try" ;;
17707         esac
17708         ;;
17709         *)      case "$usethreads" in
17710                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17711                 esac
17712                 d_readdir64_r=undef
17713                 readdir64_r_proto=0
17714                 ;;
17715         esac
17716         ;;
17717 *)      readdir64_r_proto=0
17718         ;;
17719 esac
17720
17721 : see if readdir_r exists
17722 set readdir_r d_readdir_r
17723 eval $inlibc
17724 case "$d_readdir_r" in
17725 "$define")
17726         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17727         case "$d_readdir_r_proto:$usethreads" in
17728         ":define")      d_readdir_r_proto=define
17729                 set d_readdir_r_proto readdir_r $hdrs
17730                 eval $hasproto ;;
17731         *)      ;;
17732         esac
17733         case "$d_readdir_r_proto" in
17734         define)
17735         case "$readdir_r_proto" in
17736         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17737         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17738         esac
17739         case "$readdir_r_proto" in
17740         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17741         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17742         esac
17743         case "$readdir_r_proto" in
17744         ''|0)   d_readdir_r=undef
17745                 readdir_r_proto=0
17746                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17747         * )     case "$readdir_r_proto" in
17748                 REENTRANT_PROTO*) ;;
17749                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17750                 esac
17751                 echo "Prototype: $try" ;;
17752         esac
17753         ;;
17754         *)      case "$usethreads" in
17755                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17756                 esac
17757                 d_readdir_r=undef
17758                 readdir_r_proto=0
17759                 ;;
17760         esac
17761         ;;
17762 *)      readdir_r_proto=0
17763         ;;
17764 esac
17765
17766 : see if readv exists
17767 set readv d_readv
17768 eval $inlibc
17769
17770 : see if recvmsg exists
17771 set recvmsg d_recvmsg
17772 eval $inlibc
17773
17774 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17775 echo " "
17776 if set regcomp val -f d_regcomp; eval $csym; $val; then
17777         echo 'regcomp() found.' >&4
17778         d_regcomp="$define"
17779         d_regcmp="$undef"
17780         d_re_comp="$undef"
17781 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17782         echo 'regcmp() found.' >&4
17783         d_regcmp="$define"
17784         d_regcomp="$undef"
17785         d_re_comp="$undef"
17786 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17787         echo 're_comp() found, assuming re_exec() also exists.' >&4
17788         d_re_comp="$define"
17789         d_regcomp="$undef"
17790         d_regcmp="$undef"
17791 else
17792         $cat >&4 <<EOM
17793 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17794 EOM
17795         d_regcmp="$undef"
17796         d_re_comp="$undef"
17797         d_regcomp="$undef"
17798 fi
17799
17800 : see if remainder exists
17801 set remainder d_remainder
17802 eval $inlibc
17803
17804 : see if remquo exists
17805 set remquo d_remquo
17806 eval $inlibc
17807
17808 : see if rename exists
17809 set rename d_rename
17810 eval $inlibc
17811
17812 : see if rint exists
17813 set rint d_rint
17814 eval $inlibc
17815
17816 : see if rmdir exists
17817 set rmdir d_rmdir
17818 eval $inlibc
17819
17820 : see if round exists
17821 set round d_round
17822 eval $inlibc
17823
17824 : see if prototype for sbrk is available
17825 echo " "
17826 set d_sbrkproto sbrk $i_unistd unistd.h
17827 eval $hasproto
17828
17829 : see if scalbn exists
17830 set scalbn d_scalbn
17831 eval $inlibc
17832
17833 : see if select exists
17834 set select d_select
17835 eval $inlibc
17836
17837 : see if semctl exists
17838 set semctl d_semctl
17839 eval $inlibc
17840
17841 : see if semget exists
17842 set semget d_semget
17843 eval $inlibc
17844
17845 : see if semop exists
17846 set semop d_semop
17847 eval $inlibc
17848
17849 : see how much of the 'sem*(2)' library is present.
17850 h_sem=true
17851 echo " "
17852 case "$d_semctl$d_semget$d_semop" in
17853 *"$undef"*) h_sem=false;;
17854 esac
17855 case "$osname" in
17856 freebsd)
17857     case "`ipcs 2>&1`" in
17858     "SVID messages"*"not configured"*)
17859         echo "Your $osname does not have the sem*(2) configured." >&4
17860         h_sem=false
17861         val="$undef"
17862         set semctl d_semctl
17863         eval $setvar
17864         set semget d_semget
17865         eval $setvar
17866         set semop d_semop
17867         eval $setvar
17868         ;;
17869     esac
17870     ;;
17871 esac
17872 : we could also check for sys/ipc.h ...
17873 if $h_sem && $test `./findhdr sys/sem.h`; then
17874         echo "You have the full sem*(2) library." >&4
17875         val="$define"
17876 else
17877         echo "You don't have the full sem*(2) library." >&4
17878         val="$undef"
17879 fi
17880 set d_sem
17881 eval $setvar
17882
17883 : see whether sys/sem.h defines union semun
17884 echo " "
17885 $cat > try.c <<'END'
17886 #include <sys/types.h>
17887 #include <sys/ipc.h>
17888 #include <sys/sem.h>
17889 int main () { union semun semun; semun.buf = 0; }
17890 END
17891 set try
17892 if eval $compile; then
17893     echo "You have union semun in <sys/sem.h>." >&4
17894     val="$define"
17895 else
17896     echo "You do not have union semun in <sys/sem.h>." >&4
17897     val="$undef"
17898 fi
17899 $rm_try
17900 set d_union_semun
17901 eval $setvar
17902
17903 : see how to do semctl IPC_STAT
17904 case "$d_sem" in
17905 $define)
17906     echo " "
17907     $cat > tryh.h <<END
17908 #ifndef S_IRUSR
17909 #   ifdef S_IREAD
17910 #       define S_IRUSR S_IREAD
17911 #       define S_IWUSR S_IWRITE
17912 #       define S_IXUSR S_IEXEC
17913 #   else
17914 #       define S_IRUSR 0400
17915 #       define S_IWUSR 0200
17916 #       define S_IXUSR 0100
17917 #   endif
17918 #   define S_IRGRP (S_IRUSR>>3)
17919 #   define S_IWGRP (S_IWUSR>>3)
17920 #   define S_IXGRP (S_IXUSR>>3)
17921 #   define S_IROTH (S_IRUSR>>6)
17922 #   define S_IWOTH (S_IWUSR>>6)
17923 #   define S_IXOTH (S_IXUSR>>6)
17924 #endif
17925 #ifndef S_IRWXU
17926 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17927 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17928 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17929 #endif
17930 END
17931     : see whether semctl IPC_STAT can use union semun
17932     case "$d_semctl_semun" in
17933     '')
17934       val="$undef"
17935       $cat > try.c <<END
17936 #include <sys/types.h>
17937 #include <sys/ipc.h>
17938 #include <sys/sem.h>
17939 #include <sys/stat.h>
17940 #include <stdio.h>
17941 #include <errno.h>
17942 #include "tryh.h"
17943 #ifndef errno
17944 extern int errno;
17945 #endif
17946 #$d_union_semun HAS_UNION_SEMUN
17947 int main() {
17948     union semun
17949 #ifndef HAS_UNION_SEMUN
17950     {
17951         int val;
17952         struct semid_ds *buf;
17953         unsigned short *array;
17954     }
17955 #endif
17956     arg;
17957     int sem, st;
17958
17959 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17960     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17961     if (sem > -1) {
17962         struct semid_ds argbuf;
17963         arg.buf = &argbuf;
17964 #       ifdef IPC_STAT
17965         st = semctl(sem, 0, IPC_STAT, arg);
17966         if (st == 0)
17967             printf("semun\n");
17968         else
17969 #       endif /* IPC_STAT */
17970             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17971 #       ifdef IPC_RMID
17972         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17973 #       endif /* IPC_RMID */
17974             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17975     } else
17976 #endif /* IPC_PRIVATE && ... */
17977         printf("semget failed: errno = %d\n", errno);
17978   return 0;
17979 }
17980 END
17981       set try
17982       if eval $compile; then
17983           xxx=`$run ./try`
17984           case "$xxx" in
17985           semun) val="$define" ;;
17986           esac
17987       fi
17988       $rm_try
17989       set d_semctl_semun
17990       eval $setvar
17991       ;;
17992     esac
17993     case "$d_semctl_semun" in
17994     $define)
17995         echo "You can use union semun for semctl IPC_STAT." >&4
17996         also='also'
17997         ;;
17998     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17999         also=''
18000         ;;
18001     esac
18002
18003     : see whether semctl IPC_STAT can use struct semid_ds pointer
18004     case "$d_semctl_semid_ds" in
18005     '')
18006       val="$undef"
18007       $cat > try.c <<'END'
18008 #include <sys/types.h>
18009 #include <sys/ipc.h>
18010 #include <sys/sem.h>
18011 #include <sys/stat.h>
18012 #include "tryh.h"
18013 #include <stdio.h>
18014 #include <errno.h>
18015 #ifndef errno
18016 extern int errno;
18017 #endif
18018 int main() {
18019     union semun
18020 #ifndef HAS_UNION_SEMUN
18021     {
18022         int val;
18023         struct semid_ds *buf;
18024         unsigned short *array;
18025     }
18026 #endif
18027     arg;
18028     struct semid_ds argbuf;
18029     int sem, st;
18030
18031 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18032     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18033     if (sem > -1) {
18034         arg.buf = &argbuf;
18035 #       ifdef IPC_STAT
18036         st = semctl(sem, 0, IPC_STAT, arg);
18037         if (st == 0)
18038             printf("semid_ds\n");
18039         else
18040 #       endif /* IPC_STAT */
18041             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18042 #       ifdef IPC_RMID
18043         if (semctl(sem, 0, IPC_RMID, arg) != 0)
18044 #       endif /* IPC_RMID */
18045             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18046     } else
18047 #endif /* IPC_PRIVATE && ... */
18048         printf("semget failed: errno = %d\n", errno);
18049
18050     return 0;
18051 }
18052 END
18053       set try
18054       if eval $compile; then
18055           xxx=`$run ./try`
18056           case "$xxx" in
18057           semid_ds) val="$define" ;;
18058           esac
18059       fi
18060       $rm_try
18061       set d_semctl_semid_ds
18062       eval $setvar
18063       ;;
18064     esac
18065     case "$d_semctl_semid_ds" in
18066     $define)
18067         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18068         ;;
18069     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18070         ;;
18071     esac
18072     ;;
18073 *)  val="$undef"
18074
18075     # We do not have the full sem*(2) library, so assume we can not
18076     # use either.
18077
18078     set d_semctl_semun
18079     eval $setvar
18080
18081     set d_semctl_semid_ds
18082     eval $setvar
18083     ;;
18084 esac
18085 $rm_try tryh.h
18086
18087 : see if sendmsg exists
18088 set sendmsg d_sendmsg
18089 eval $inlibc
18090
18091 : see if setegid exists
18092 set setegid d_setegid
18093 eval $inlibc
18094
18095 : see if setenv exists
18096 set setenv d_setenv
18097 eval $inlibc
18098
18099 : see if seteuid exists
18100 set seteuid d_seteuid
18101 eval $inlibc
18102
18103 : see if setgrent exists
18104 set setgrent d_setgrent
18105 eval $inlibc
18106
18107 : see if setgrent_r exists
18108 set setgrent_r d_setgrent_r
18109 eval $inlibc
18110 case "$d_setgrent_r" in
18111 "$define")
18112         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18113         case "$d_setgrent_r_proto:$usethreads" in
18114         ":define")      d_setgrent_r_proto=define
18115                 set d_setgrent_r_proto setgrent_r $hdrs
18116                 eval $hasproto ;;
18117         *)      ;;
18118         esac
18119         case "$d_setgrent_r_proto" in
18120         define)
18121         case "$setgrent_r_proto" in
18122         ''|0) try='int setgrent_r(FILE**);'
18123         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18124         esac
18125         case "$setgrent_r_proto" in
18126         ''|0) try='void setgrent_r(FILE**);'
18127         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18128         esac
18129         case "$setgrent_r_proto" in
18130         ''|0)   d_setgrent_r=undef
18131                 setgrent_r_proto=0
18132                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18133         * )     case "$setgrent_r_proto" in
18134                 REENTRANT_PROTO*) ;;
18135                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18136                 esac
18137                 echo "Prototype: $try" ;;
18138         esac
18139         ;;
18140         *)      case "$usethreads" in
18141                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18142                 esac
18143                 d_setgrent_r=undef
18144                 setgrent_r_proto=0
18145                 ;;
18146         esac
18147         ;;
18148 *)      setgrent_r_proto=0
18149         ;;
18150 esac
18151
18152 : see if sethostent exists
18153 set sethostent d_sethent
18154 eval $inlibc
18155
18156 : see if sethostent_r exists
18157 set sethostent_r d_sethostent_r
18158 eval $inlibc
18159 case "$d_sethostent_r" in
18160 "$define")
18161         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18162         case "$d_sethostent_r_proto:$usethreads" in
18163         ":define")      d_sethostent_r_proto=define
18164                 set d_sethostent_r_proto sethostent_r $hdrs
18165                 eval $hasproto ;;
18166         *)      ;;
18167         esac
18168         case "$d_sethostent_r_proto" in
18169         define)
18170         case "$sethostent_r_proto" in
18171         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18172         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18173         esac
18174         case "$sethostent_r_proto" in
18175         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18176         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18177         esac
18178         case "$sethostent_r_proto" in
18179         ''|0)   d_sethostent_r=undef
18180                 sethostent_r_proto=0
18181                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18182         * )     case "$sethostent_r_proto" in
18183                 REENTRANT_PROTO*) ;;
18184                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18185                 esac
18186                 echo "Prototype: $try" ;;
18187         esac
18188         ;;
18189         *)      case "$usethreads" in
18190                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18191                 esac
18192                 d_sethostent_r=undef
18193                 sethostent_r_proto=0
18194                 ;;
18195         esac
18196         ;;
18197 *)      sethostent_r_proto=0
18198         ;;
18199 esac
18200
18201 : see if setitimer exists
18202 set setitimer d_setitimer
18203 eval $inlibc
18204
18205 : see if setlinebuf exists
18206 set setlinebuf d_setlinebuf
18207 eval $inlibc
18208
18209 : see if this system has wctype.h
18210 set wctype.h i_wctype
18211 eval $inhdr
18212
18213 : see if towupper exists
18214 set towupper d_towupper
18215 eval $inlibc
18216
18217 : check for setlocale function and behavior
18218 case "$d_setlocale" in
18219 '')
18220 $cat >&4 <<EOM
18221
18222 Checking to see if you have setlocale() and its behavior
18223 EOM
18224 $cat >try.c <<EOCP
18225 #include <stdlib.h>
18226 #include <string.h>
18227 #$i_locale I_LOCALE
18228 #ifdef I_LOCALE
18229 #  include <locale.h>
18230 #endif
18231 #$i_wctype I_WCTYPE
18232 #ifdef I_WCTYPE
18233 #  include <wctype.h>
18234 #endif
18235
18236 int main() {
18237     const char * invalid_name = "\a";   /* This is really invalid! */
18238     int accepts_any_locale_name = 0;
18239     int has_C_UTF8 = 0;
18240     unsigned char bad_setlocale = 255;
18241
18242     /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
18243      * disabled.  It's hard to imagine an instance where meaningful locale
18244      * handling could be done without LC_CTYPE */
18245     const char *  name = setlocale(LC_CTYPE, "C");
18246
18247     if (name == NULL || strcmp(name, "C") != 0) {
18248         exit(bad_setlocale);
18249     }
18250
18251     name = setlocale(LC_CTYPE, invalid_name);
18252     if (name != NULL) {
18253
18254         /* Let it pass if it accepts the name but gives back one of the C
18255          * locales */
18256         if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
18257             accepts_any_locale_name = 1;
18258         }
18259     }
18260
18261     name = setlocale(LC_CTYPE, "C.UTF-8");
18262     if (name != NULL) {
18263         unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
18264
18265 #$d_towupper HAS_TOWUPPER
18266 #ifdef HAS_TOWUPPER
18267
18268         /* We assume that if the machine doesn't have the C99 towupper, it
18269          * doesn't have C.UTF-8, even if we successfully changed locales to
18270          * include it.  This seems safer even on platforms that didn't accept
18271          * the really invalid name */
18272
18273         if (towupper(y_with_diaeresis) == 0x178) {
18274             has_C_UTF8 = 1;
18275         }
18276
18277 #endif
18278
18279     }
18280
18281 #if 0
18282
18283     /* Currently unused code to determine if LC_ALL with disparate values uses
18284      * category = value pairs or positional, and to determine the separator
18285      * between the categories.  We could add code so that if the separator were
18286      * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
18287      * every possible ASCII separator would fit in the 5 bits available in the
18288      * exit code.  This would not be true in EBCDIC.  And then if LC_ALL is
18289      * positional, we probably would want to know the order of the categories.
18290      * Using a file between the C program and the shell script would really be
18291      * require to do that */
18292 #ifdef LC_ALL
18293
18294     unsigned char min_separator = ' ' - 1;
18295     unsigned char separator = min_separator;
18296     int uses_name_value_pair_names = 0;
18297
18298     name = setlocale(LC_ALL, "C");
18299     if (name == NULL || strcmp(name, "C") != 0) {
18300         exit(bad_setlocale);
18301     }
18302
18303     if (has_C_UTF8) {
18304         char * pos;
18305
18306         name = setlocale(LC_CTYPE, "C.UTF-8");
18307         if (name == NULL) {
18308             exit(bad_setlocale);
18309         }
18310         name = setlocale(LC_ALL, NULL);
18311         if (name == NULL) {
18312             exit(bad_setlocale);
18313         }
18314
18315         pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
18316         if (pos != NULL) {
18317             uses_name_value_pair_names = 1;
18318             if (pos == name) {
18319                 separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
18320             }
18321             else {
18322                 separator = *(pos - 1);
18323             }
18324         }
18325         else {
18326             pos = strstr(name, "C.UTF-8");
18327             if (pos == NULL) {
18328                 /* bad */
18329             }
18330             else if (pos == name) {
18331                 separator = name[sizeof("C.UTF-8") - 1];
18332             }
18333             else {
18334                 separator = *(pos - 1);
18335             }
18336         }
18337     }
18338
18339 #endif
18340 #endif
18341
18342     exit( 0 /* (separator - min_separator) << 3
18343         | uses_name_value_pair_names      << 2
18344           */
18345         | has_C_UTF8                      << 1
18346         | accepts_any_locale_name);
18347
18348 }
18349 EOCP
18350 val=
18351 set d_setlocale
18352 eval $setvar
18353 case $d_setlocale in
18354     $undef) d_setlocale_accepts_any_locale_name="$undef"
18355             d_has_C_UTF8="false"
18356             ;;
18357     *) set try
18358        if eval $compile; then
18359            echo "Your system has setlocale()..." >&4
18360            $run ./try
18361            case $? in
18362                0) echo "and it seems sane; you don't have a C.UTF-8 locale" >&4
18363                   d_setlocale="$define"
18364                   d_setlocale_accepts_any_locale_name="$undef"
18365                   d_has_C_UTF8="false"
18366                   ;;
18367                1) echo "and it seems sane, but accepts any locale name as valid" >&4
18368                   d_setlocale="$define"
18369                   d_setlocale_accepts_any_locale_name="$define"
18370                   d_has_C_UTF8="false"
18371                   ;;
18372                2) echo "and it seems sane; you have a C.UTF-8 locale" >&4
18373                   d_setlocale="$define"
18374                   d_setlocale_accepts_any_locale_name="$undef"
18375                   d_has_C_UTF8="true"
18376                   ;;
18377                3) echo "and it seems sane, but accepts any locale name as valid" >&4
18378                   d_setlocale="$define"
18379                   d_setlocale_accepts_any_locale_name="$define"
18380                   d_has_C_UTF8="true"
18381                   ;;
18382                *) echo "but it doesn't seem to work, so we won't use it." >&4
18383                   d_setlocale="$undef"
18384                   d_setlocale_accepts_any_locale_name="$undef"
18385                   d_has_C_UTF8="false"
18386                   ;;
18387            esac
18388        else
18389            echo "your system does not have setlocale()" >&4
18390            d_setlocale="$undef"
18391            d_setlocale_accepts_any_locale_name="$undef"
18392            d_has_C_UTF8="false"
18393        fi
18394 esac
18395 $rm_try
18396 ;;
18397 *) val="$d_setlocale"
18398     set d_setlocale
18399     eval $setvar
18400     case "$d_setlocale" in
18401         $undef) echo "There may be other ways to set the locale on your system, so we need to ask:" >&4
18402         ;;
18403     esac
18404     rp="Does your system have the C.UTF-8 locale?"
18405     dflt=n
18406     . ./myread
18407     case "$ans" in
18408         [Yy]*) d_has_C_UTF8="true"
18409                c_utf8_locale=" or C.UTF-8"
18410                ;;
18411         *)     d_has_C_UTF8="false"
18412                c_utf8_locale=""
18413                ;;
18414     esac
18415     case "$d_setlocale" in
18416         $define)
18417             rp="When you set your locale to something besides C$c_utf8_locale, does it do so, or just pretend to?" >&4
18418             dflt=n
18419             . ./myread
18420             case "$ans" in
18421                 true|[Yy]*)
18422                    d_setlocale_accepts_any_locale_name="$undef"
18423                    ;;
18424                 *) d_setlocale_accepts_any_locale_name="$define"
18425                    ;;
18426             esac
18427             ;;
18428         *) d_setlocale_accepts_any_locale_name="$undef"
18429            ;;
18430     esac
18431 esac
18432
18433 : see if setlocale_r exists
18434 set setlocale_r d_setlocale_r
18435 eval $inlibc
18436 case "$d_setlocale_r" in
18437 "$define")
18438         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18439         case "$d_setlocale_r_proto:$usethreads" in
18440         ":define")      d_setlocale_r_proto=define
18441                 set d_setlocale_r_proto setlocale_r $hdrs
18442                 eval $hasproto ;;
18443         *)      ;;
18444         esac
18445         case "$d_setlocale_r_proto" in
18446         define)
18447         case "$setlocale_r_proto" in
18448         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18449         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18450         esac
18451         case "$setlocale_r_proto" in
18452         ''|0)   d_setlocale_r=undef
18453                 setlocale_r_proto=0
18454                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18455         * )     case "$setlocale_r_proto" in
18456                 REENTRANT_PROTO*) ;;
18457                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18458                 esac
18459                 echo "Prototype: $try" ;;
18460         esac
18461         ;;
18462         *)      case "$usethreads" in
18463                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18464                 esac
18465                 d_setlocale_r=undef
18466                 setlocale_r_proto=0
18467                 ;;
18468         esac
18469         ;;
18470 *)      setlocale_r_proto=0
18471         ;;
18472 esac
18473
18474 : see if setnetent exists
18475 set setnetent d_setnent
18476 eval $inlibc
18477
18478 : see if setnetent_r exists
18479 set setnetent_r d_setnetent_r
18480 eval $inlibc
18481 case "$d_setnetent_r" in
18482 "$define")
18483         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18484         case "$d_setnetent_r_proto:$usethreads" in
18485         ":define")      d_setnetent_r_proto=define
18486                 set d_setnetent_r_proto setnetent_r $hdrs
18487                 eval $hasproto ;;
18488         *)      ;;
18489         esac
18490         case "$d_setnetent_r_proto" in
18491         define)
18492         case "$setnetent_r_proto" in
18493         ''|0) try='int setnetent_r(int, struct netent_data*);'
18494         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18495         esac
18496         case "$setnetent_r_proto" in
18497         ''|0) try='void setnetent_r(int, struct netent_data*);'
18498         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18499         esac
18500         case "$setnetent_r_proto" in
18501         ''|0)   d_setnetent_r=undef
18502                 setnetent_r_proto=0
18503                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18504         * )     case "$setnetent_r_proto" in
18505                 REENTRANT_PROTO*) ;;
18506                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18507                 esac
18508                 echo "Prototype: $try" ;;
18509         esac
18510         ;;
18511         *)      case "$usethreads" in
18512                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18513                 esac
18514                 d_setnetent_r=undef
18515                 setnetent_r_proto=0
18516                 ;;
18517         esac
18518         ;;
18519 *)      setnetent_r_proto=0
18520         ;;
18521 esac
18522
18523 : see if setprotoent exists
18524 set setprotoent d_setpent
18525 eval $inlibc
18526
18527 : see if setpgid exists
18528 set setpgid d_setpgid
18529 eval $inlibc
18530
18531 : see if setpgrp2 exists
18532 set setpgrp2 d_setpgrp2
18533 eval $inlibc
18534
18535 : see if setpriority exists
18536 set setpriority d_setprior
18537 eval $inlibc
18538
18539 : see if setproctitle exists
18540 set setproctitle d_setproctitle
18541 eval $inlibc
18542
18543 : see if setprotoent_r exists
18544 set setprotoent_r d_setprotoent_r
18545 eval $inlibc
18546 case "$d_setprotoent_r" in
18547 "$define")
18548         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18549         case "$d_setprotoent_r_proto:$usethreads" in
18550         ":define")      d_setprotoent_r_proto=define
18551                 set d_setprotoent_r_proto setprotoent_r $hdrs
18552                 eval $hasproto ;;
18553         *)      ;;
18554         esac
18555         case "$d_setprotoent_r_proto" in
18556         define)
18557         case "$setprotoent_r_proto" in
18558         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18559         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18560         esac
18561         case "$setprotoent_r_proto" in
18562         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18563         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18564         esac
18565         case "$setprotoent_r_proto" in
18566         ''|0)   d_setprotoent_r=undef
18567                 setprotoent_r_proto=0
18568                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18569         * )     case "$setprotoent_r_proto" in
18570                 REENTRANT_PROTO*) ;;
18571                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18572                 esac
18573                 echo "Prototype: $try" ;;
18574         esac
18575         ;;
18576         *)      case "$usethreads" in
18577                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18578                 esac
18579                 d_setprotoent_r=undef
18580                 setprotoent_r_proto=0
18581                 ;;
18582         esac
18583         ;;
18584 *)      setprotoent_r_proto=0
18585         ;;
18586 esac
18587
18588 : see if setpwent exists
18589 set setpwent d_setpwent
18590 eval $inlibc
18591
18592 : see if setpwent_r exists
18593 set setpwent_r d_setpwent_r
18594 eval $inlibc
18595 case "$d_setpwent_r" in
18596 "$define")
18597         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18598         case "$d_setpwent_r_proto:$usethreads" in
18599         ":define")      d_setpwent_r_proto=define
18600                 set d_setpwent_r_proto setpwent_r $hdrs
18601                 eval $hasproto ;;
18602         *)      ;;
18603         esac
18604         case "$d_setpwent_r_proto" in
18605         define)
18606         case "$setpwent_r_proto" in
18607         ''|0) try='int setpwent_r(FILE**);'
18608         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18609         esac
18610         case "$setpwent_r_proto" in
18611         ''|0) try='void setpwent_r(FILE**);'
18612         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18613         esac
18614         case "$setpwent_r_proto" in
18615         ''|0)   d_setpwent_r=undef
18616                 setpwent_r_proto=0
18617                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18618         * )     case "$setpwent_r_proto" in
18619                 REENTRANT_PROTO*) ;;
18620                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18621                 esac
18622                 echo "Prototype: $try" ;;
18623         esac
18624         ;;
18625         *)      case "$usethreads" in
18626                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18627                 esac
18628                 d_setpwent_r=undef
18629                 setpwent_r_proto=0
18630                 ;;
18631         esac
18632         ;;
18633 *)      setpwent_r_proto=0
18634         ;;
18635 esac
18636
18637 : see if setregid exists
18638 set setregid d_setregid
18639 eval $inlibc
18640 set setresgid d_setresgid
18641 eval $inlibc
18642
18643 : see if setreuid exists
18644 set setreuid d_setreuid
18645 eval $inlibc
18646 set setresuid d_setresuid
18647 eval $inlibc
18648
18649 : see if setrgid exists
18650 set setrgid d_setrgid
18651 eval $inlibc
18652
18653 : see if setruid exists
18654 set setruid d_setruid
18655 eval $inlibc
18656
18657 : see if setservent exists
18658 set setservent d_setsent
18659 eval $inlibc
18660
18661 : see if setservent_r exists
18662 set setservent_r d_setservent_r
18663 eval $inlibc
18664 case "$d_setservent_r" in
18665 "$define")
18666         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18667         case "$d_setservent_r_proto:$usethreads" in
18668         ":define")      d_setservent_r_proto=define
18669                 set d_setservent_r_proto setservent_r $hdrs
18670                 eval $hasproto ;;
18671         *)      ;;
18672         esac
18673         case "$d_setservent_r_proto" in
18674         define)
18675         case "$setservent_r_proto" in
18676         ''|0) try='int setservent_r(int, struct servent_data*);'
18677         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18678         esac
18679         case "$setservent_r_proto" in
18680         ''|0) try='void setservent_r(int, struct servent_data*);'
18681         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18682         esac
18683         case "$setservent_r_proto" in
18684         ''|0)   d_setservent_r=undef
18685                 setservent_r_proto=0
18686                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18687         * )     case "$setservent_r_proto" in
18688                 REENTRANT_PROTO*) ;;
18689                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18690                 esac
18691                 echo "Prototype: $try" ;;
18692         esac
18693         ;;
18694         *)      case "$usethreads" in
18695                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18696                 esac
18697                 d_setservent_r=undef
18698                 setservent_r_proto=0
18699                 ;;
18700         esac
18701         ;;
18702 *)      setservent_r_proto=0
18703         ;;
18704 esac
18705
18706 : see if setsid exists
18707 set setsid d_setsid
18708 eval $inlibc
18709
18710 : see if setvbuf exists
18711 set setvbuf d_setvbuf
18712 eval $inlibc
18713
18714 : see if shmctl exists
18715 set shmctl d_shmctl
18716 eval $inlibc
18717
18718 : see if shmget exists
18719 set shmget d_shmget
18720 eval $inlibc
18721
18722 : see if shmat exists
18723 set shmat d_shmat
18724 eval $inlibc
18725 : see what shmat returns
18726 case "$d_shmat" in
18727 "$define")
18728         $cat >shmat.c <<'END'
18729 #include <sys/shm.h>
18730 void *shmat();
18731 END
18732         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18733                 shmattype='void *'
18734         else
18735                 shmattype='char *'
18736         fi
18737         echo "and it returns ($shmattype)." >&4
18738         : see if a prototype for shmat is available
18739         xxx=`./findhdr sys/shm.h`
18740         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18741         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18742                 val="$define"
18743         else
18744                 val="$undef"
18745         fi
18746         $rm -f shmat.[co]
18747         ;;
18748 *)
18749         val="$undef"
18750         ;;
18751 esac
18752 set d_shmatprototype
18753 eval $setvar
18754
18755 : see if shmdt exists
18756 set shmdt d_shmdt
18757 eval $inlibc
18758
18759 : see how much of the 'shm*(2)' library is present.
18760 h_shm=true
18761 echo " "
18762 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18763 *"$undef"*) h_shm=false;;
18764 esac
18765 case "$osname" in
18766 freebsd)
18767     case "`ipcs 2>&1`" in
18768     "SVID shared memory"*"not configured"*)
18769         echo "Your $osname does not have the shm*(2) configured." >&4
18770         h_shm=false
18771         val="$undef"
18772         set shmctl d_shmctl
18773         eval $setvar
18774         set shmget d_shmget
18775         eval $setvar
18776         set shmat d_shmat
18777         eval $setvar
18778         set shmdt d_shmdt
18779         eval $setvar
18780         ;;
18781     esac
18782     ;;
18783 esac
18784 : we could also check for sys/ipc.h ...
18785 if $h_shm && $test `./findhdr sys/shm.h`; then
18786         echo "You have the full shm*(2) library." >&4
18787         val="$define"
18788 else
18789         echo "You don't have the full shm*(2) library." >&4
18790         val="$undef"
18791 fi
18792 set d_shm
18793 eval $setvar
18794
18795 : see if we have sigaction
18796 echo " "
18797 if set sigaction val -f d_sigaction; eval $csym; $val; then
18798         echo 'sigaction() found.' >&4
18799         $cat > try.c <<EOP
18800 #include <stdio.h>
18801 #include <sys/types.h>
18802 #include <signal.h>
18803 #$i_stdlib I_STDLIB
18804 #ifdef I_STDLIB
18805 #include <stdlib.h>
18806 #endif
18807 int main()
18808 {
18809     struct sigaction act, oact;
18810     act.sa_flags = 0;
18811     oact.sa_handler = 0;
18812     /* so that act and oact are used */
18813     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18814 }
18815 EOP
18816         set try
18817         if eval $compile_ok; then
18818                 val="$define"
18819         else
18820                 echo "But you don't seem to have a usable struct sigaction." >&4
18821                 val="$undef"
18822         fi
18823 else
18824         echo 'sigaction NOT found.' >&4
18825         val="$undef"
18826 fi
18827 set d_sigaction; eval $setvar
18828 $rm_try
18829
18830 : see what type pids are declared as in the kernel
18831 rp="What is the type of process ids on this system?"
18832 set pid_t pidtype int stdio.h sys/types.h
18833 eval $typedef_ask
18834
18835 : see what type uids are declared as in the kernel
18836 echo " "
18837 echo "Looking for the type for user ids returned by getuid()."
18838 set uid_t uidtype xxx stdio.h sys/types.h
18839 eval $typedef
18840 case "$uidtype" in
18841 xxx)
18842         xxx=`./findhdr sys/user.h`
18843         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18844         case $1 in
18845         unsigned) dflt="$1 $2" ;;
18846         *) dflt="$1" ;;
18847         esac
18848         ;;
18849 *) dflt="$uidtype";;
18850 esac
18851 case "$uidtype" in
18852 uid_t)  echo "uid_t found." ;;
18853 *)      rp="What is the type for user ids returned by getuid()?"
18854         . ./myread
18855         uidtype="$ans"
18856         ;;
18857 esac
18858
18859 : Define hasfield_t macro for Configure internal use
18860 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18861 while $test $# -ge 2; do
18862     case "$1" in
18863         $define) echo "#include <$2>";;
18864     esac ;
18865     shift 2;
18866 done > try.c;
18867 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18868 set try;
18869 if eval $compile; then
18870         val="$define";
18871 else
18872         val="$undef";
18873 fi;
18874 set $varname;
18875 eval $setvar;
18876 $rm_try'
18877
18878 : see what siginfo fields we have
18879 case "$d_sigaction" in
18880 "$define")
18881         echo "Checking if your siginfo_t has si_errno field...">&4
18882         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18883         eval $hasfield_t;
18884
18885         echo "Checking if your siginfo_t has si_pid field...">&4
18886         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18887         eval $hasfield_t;
18888
18889         echo "Checking if your siginfo_t has si_uid field...">&4
18890         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18891         eval $hasfield_t;
18892
18893         echo "Checking if your siginfo_t has si_addr field...">&4
18894         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18895         eval $hasfield_t;
18896
18897         echo "Checking if your siginfo_t has si_status field...">&4
18898         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18899         eval $hasfield_t;
18900
18901         echo "Checking if your siginfo_t has si_band field...">&4
18902         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18903         eval $hasfield_t;
18904
18905         echo "Checking if your siginfo_t has si_value field...">&4
18906         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18907         eval $hasfield_t;
18908
18909         echo "Checking if your siginfo_t has si_fd field...">&4
18910         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18911         eval $hasfield_t;
18912
18913         ;;
18914 *)
18915         d_siginfo_si_errno="$undef"
18916         d_siginfo_si_pid="$undef"
18917         d_siginfo_si_uid="$undef"
18918         d_siginfo_si_addr="$undef"
18919         d_siginfo_si_status="$undef"
18920         d_siginfo_si_band="$undef"
18921         d_siginfo_si_value="$undef"
18922         d_siginfo_si_fd="$undef"
18923         ;;
18924 esac
18925
18926 : see if this is a sunmath.h system
18927 set sunmath.h i_sunmath
18928 eval $inhdr
18929
18930 : see if signbit exists
18931 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18932 $cat >try.c <<EOCP
18933 #$i_sunmath I_SUNMATH
18934 #include <math.h>
18935 #ifdef I_SUNMATH  /* Solaris special math library */
18936 #  include <sunmath.h>
18937 #endif
18938 #define NV $nvtype
18939 int main(int argc, char **argv)
18940 {
18941     NV x = 0.0;
18942     NV y = -1.0;
18943     if ((signbit(x) == 0) && (signbit(y) != 0))
18944         return 0;
18945     else
18946         return 1;
18947 }
18948 EOCP
18949 val="$undef"
18950 set try
18951 if eval $compile; then
18952     if $run ./try; then
18953         $echo "Yes." >&4
18954         val="$define"
18955     else
18956         $echo "Signbit seems to be available, but doesn't work as I expected."
18957         $echo "I won't use it." >&4
18958         val="$undef"
18959     fi
18960 else
18961     $echo "Nope." >&4
18962     dflt="$undef"
18963 fi
18964 set d_signbit
18965 eval $setvar
18966 $rm_try
18967
18968 : see if sigprocmask exists
18969 set sigprocmask d_sigprocmask
18970 eval $inlibc
18971
18972 : see if sigsetjmp exists
18973 echo " "
18974 case "$d_sigsetjmp" in
18975 '')
18976         $cat >try.c <<EOP
18977 #include <setjmp.h>
18978 #$i_stdlib I_STDLIB
18979 #ifdef I_STDLIB
18980 #include <stdlib.h>
18981 #endif
18982 sigjmp_buf env;
18983 int set = 1;
18984 int main()
18985 {
18986         if (sigsetjmp(env,1))
18987                 exit(set);
18988         set = 0;
18989         siglongjmp(env, 1);
18990         exit(1);
18991 }
18992 EOP
18993         set try
18994         if eval $compile; then
18995                 if $run ./try >/dev/null 2>&1; then
18996                         echo "POSIX sigsetjmp found." >&4
18997                         val="$define"
18998                 else
18999                         $cat >&4 <<EOM
19000 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
19001 I'll ignore them.
19002 EOM
19003                         val="$undef"
19004                 fi
19005         else
19006                 echo "sigsetjmp not found." >&4
19007                 val="$undef"
19008         fi
19009         ;;
19010 *) val="$d_sigsetjmp"
19011         case "$d_sigsetjmp" in
19012         $define) echo "POSIX sigsetjmp found." >&4;;
19013         $undef) echo "sigsetjmp not found." >&4;;
19014         esac
19015         ;;
19016 esac
19017 set d_sigsetjmp
19018 eval $setvar
19019 $rm_try
19020
19021 : see if snprintf exists
19022 set snprintf d_snprintf
19023 eval $inlibc
19024
19025 : see if vsnprintf exists
19026 set vsnprintf d_vsnprintf
19027 eval $inlibc
19028
19029 case "$d_snprintf-$d_vsnprintf" in
19030 "$define-$define")
19031     $cat <<EOM
19032 Checking whether your snprintf() and vsnprintf() work okay...
19033 EOM
19034     $cat >try.c <<'EOCP'
19035 /* v?snprintf testing logic courtesy of Russ Allbery.
19036  * According to C99:
19037  * - if the buffer is too short it still must be \0-terminated
19038  * - if the buffer is too short the potentially required length
19039  *   must be returned and not -1
19040  * - if the buffer is NULL the potentially required length
19041  *   must be returned and not -1 or core dump
19042  */
19043 #include <stdio.h>
19044 #include <stdarg.h>
19045
19046 char buf[2];
19047
19048 int test (char *format, ...)
19049 {
19050     va_list args;
19051     int count;
19052
19053     va_start (args, format);
19054     count = vsnprintf (buf, sizeof buf, format, args);
19055     va_end (args);
19056     return count;
19057 }
19058
19059 int main ()
19060 {
19061     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
19062              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
19063 }
19064 EOCP
19065     set try
19066     if eval $compile; then
19067         `$run ./try`
19068         case "$?" in
19069         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
19070         *) cat <<EOM >&4
19071 Your snprintf() and snprintf() don't seem to be working okay.
19072 EOM
19073            d_snprintf="$undef"
19074            d_vsnprintf="$undef"
19075            ;;
19076         esac
19077     else
19078         echo "(I can't seem to compile the test program--assuming they don't)"
19079         d_snprintf="$undef"
19080         d_vsnprintf="$undef"
19081     fi
19082     $rm_try
19083     ;;
19084 esac
19085
19086 : see if sockatmark exists
19087 set sockatmark d_sockatmark
19088 eval $inlibc
19089
19090 : see if prototype for sockatmark is available
19091 echo " "
19092 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
19093 eval $hasproto
19094
19095 : see if socks5_init exists
19096 set socks5_init d_socks5_init
19097 eval $inlibc
19098
19099 : see if srand48_r exists
19100 set srand48_r d_srand48_r
19101 eval $inlibc
19102 case "$d_srand48_r" in
19103 "$define")
19104         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19105         case "$d_srand48_r_proto:$usethreads" in
19106         ":define")      d_srand48_r_proto=define
19107                 set d_srand48_r_proto srand48_r $hdrs
19108                 eval $hasproto ;;
19109         *)      ;;
19110         esac
19111         case "$d_srand48_r_proto" in
19112         define)
19113         case "$srand48_r_proto" in
19114         ''|0) try='int srand48_r(long, struct drand48_data*);'
19115         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
19116         esac
19117         case "$srand48_r_proto" in
19118         ''|0)   d_srand48_r=undef
19119                 srand48_r_proto=0
19120                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
19121         * )     case "$srand48_r_proto" in
19122                 REENTRANT_PROTO*) ;;
19123                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
19124                 esac
19125                 echo "Prototype: $try" ;;
19126         esac
19127         ;;
19128         *)      case "$usethreads" in
19129                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
19130                 esac
19131                 d_srand48_r=undef
19132                 srand48_r_proto=0
19133                 ;;
19134         esac
19135         ;;
19136 *)      srand48_r_proto=0
19137         ;;
19138 esac
19139
19140 : see if srandom_r exists
19141 set srandom_r d_srandom_r
19142 eval $inlibc
19143 case "$d_srandom_r" in
19144 "$define")
19145         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19146         case "$d_srandom_r_proto:$usethreads" in
19147         ":define")      d_srandom_r_proto=define
19148                 set d_srandom_r_proto srandom_r $hdrs
19149                 eval $hasproto ;;
19150         *)      ;;
19151         esac
19152         case "$d_srandom_r_proto" in
19153         define)
19154         case "$srandom_r_proto" in
19155         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
19156         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
19157         esac
19158         case "$srandom_r_proto" in
19159         ''|0)   d_srandom_r=undef
19160                 srandom_r_proto=0
19161                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
19162         * )     case "$srandom_r_proto" in
19163                 REENTRANT_PROTO*) ;;
19164                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
19165                 esac
19166                 echo "Prototype: $try" ;;
19167         esac
19168         ;;
19169         *)      case "$usethreads" in
19170                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
19171                 esac
19172                 d_srandom_r=undef
19173                 srandom_r_proto=0
19174                 ;;
19175         esac
19176         ;;
19177 *)      srandom_r_proto=0
19178         ;;
19179 esac
19180
19181 : see if prototype for setresgid is available
19182 echo " "
19183 set d_sresgproto setresgid $i_unistd unistd.h
19184 eval $hasproto
19185
19186 : see if prototype for setresuid is available
19187 echo " "
19188 set d_sresuproto setresuid $i_unistd unistd.h
19189 eval $hasproto
19190
19191 : see if stat exists
19192 set stat d_stat
19193 eval $inlibc
19194
19195 : see if sys/stat.h is available
19196 set sys/stat.h i_sysstat
19197 eval $inhdr
19198
19199 : see if stat knows about block sizes
19200 echo " "
19201 echo "Checking to see if your struct stat has st_blocks field..." >&4
19202 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19203 eval $hasfield
19204
19205 : see if this is a sys/vfs.h system
19206 set sys/vfs.h i_sysvfs
19207 eval $inhdr
19208
19209 : see if this is a sys/statfs.h system
19210 set sys/statfs.h i_sysstatfs
19211 eval $inhdr
19212
19213 : Check for statfs_s
19214 echo " "
19215 echo "Checking to see if your system supports struct statfs..." >&4
19216 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
19217 eval $hasstruct
19218 case "$d_statfs_s" in
19219 "$define")      echo "Yes, it does."   ;;
19220 *)              echo "No, it doesn't." ;;
19221 esac
19222
19223 : see if struct statfs knows about f_flags
19224 case "$d_statfs_s" in
19225 define)
19226         echo " "
19227         echo "Checking to see if your struct statfs has f_flags field..." >&4
19228         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
19229         eval $hasfield
19230         ;;
19231 *)      val="$undef"
19232         set d_statfs_f_flags
19233         eval $setvar
19234         ;;
19235 esac
19236 case "$d_statfs_f_flags" in
19237 "$define")      echo "Yes, it does."   ;;
19238 *)              echo "No, it doesn't." ;;
19239 esac
19240
19241 : see what flavor, if any, of static inline is supported
19242 echo " "
19243 echo "Checking to see if your system supports static inline..."
19244 $cat > try.c <<'EOCP'
19245 #include <stdlib.h>
19246 extern int f_via_a(int x);
19247 extern int f_via_b(int x);
19248 int main(int argc, char **argv)
19249 {
19250     int y;
19251
19252     y = f_via_a(0);
19253 #ifdef USE_B
19254     y = f_via_b(0);
19255 #endif
19256     if (y == 42) {
19257         return EXIT_SUCCESS;
19258     }
19259     else {
19260         return EXIT_FAILURE;
19261     }
19262 }
19263 EOCP
19264 $cat > a.c <<'EOCP'
19265 static INLINE int f(int x) {
19266     int y;
19267     y = x + 42;
19268     return y;
19269 }
19270
19271 int f_via_a(int x)
19272 {
19273     return f(x);
19274 }
19275 EOCP
19276 $cat > b.c <<'EOCP'
19277 extern int f(int x);
19278
19279 int f_via_b(int x)
19280 {
19281     return f(x);
19282 }
19283 EOCP
19284
19285 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19286 case "$perl_static_inline" in
19287 '')     # Check the various possibilities, and break out on success.
19288         # For gcc, prefer __inline__, which will still permit
19289         # cflags.SH to add in -ansi.
19290         case "$gccversion" in
19291                 '') xxx="inline __inline__ __inline _inline";;
19292                 *)  xxx="__inline__ inline __inline _inline";;
19293         esac
19294         for inline in $xxx; do
19295                 set try -DINLINE=$inline a.c
19296                 if eval $compile && $run ./try; then
19297                         # Now make sure there is no external linkage of static
19298                         # functions
19299                         set try -DINLINE=$inline -DUSE_B a.c b.c
19300                         if eval $compile && $run ./try; then
19301                                 $echo "Your compiler supports static $inline, " >&4
19302                                 $echo "but it also creates an external definition," >&4
19303                                 $echo "so I won't use it." >&4
19304                                 val=$undef
19305                         else
19306                                 $echo "Your compiler supports static $inline." >&4
19307                                 val=$define
19308                                 perl_static_inline="static $inline";
19309                                 break;
19310                         fi
19311                 else
19312                         $echo "Your compiler does NOT support static $inline." >&4
19313                         val="$undef"
19314                 fi
19315         done
19316         ;;
19317 *inline*) # Some variant of inline exists.
19318         echo "Keeping your $hint value of $perl_static_inline."
19319         val=$define
19320         ;;
19321 static)  # No inline capabilities
19322         echo "Keeping your $hint value of $perl_static_inline."
19323         val=$undef
19324         ;;
19325 *)  # Unrecognized previous value -- blindly trust the supplied
19326         # value and hope it makes sense.  Use old value for
19327         # d_static_inline, if there is one.
19328         echo "Keeping your $hint value of $perl_static_inline."
19329         case "$d_static_inline" in
19330                 '') val=$define ;;
19331                 *)  val=$d_static_inline ;;
19332         esac
19333         ;;
19334 esac
19335 # Fallback to plain 'static' if nothing worked.
19336 case "$perl_static_inline" in
19337 '')
19338         perl_static_inline="static"
19339         val=$undef
19340         ;;
19341 esac
19342 set d_static_inline
19343 eval $setvar
19344 $rm -f a.[co] b.[co]
19345 $rm_try
19346
19347 : Check stream access
19348 $cat >&4 <<EOM
19349 Checking how to access stdio streams by file descriptor number...
19350 EOM
19351 case "$stdio_stream_array" in
19352 '')     $cat >try.c <<EOCP
19353 #include <stdio.h>
19354 int main() {
19355   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19356     printf("yes\n");
19357 }
19358 EOCP
19359         for s in _iob __iob __sF
19360         do
19361                 set try -DSTDIO_STREAM_ARRAY=$s
19362                 if eval $compile; then
19363                         case "`$run ./try`" in
19364                         yes)    stdio_stream_array=$s; break ;;
19365                         esac
19366                 fi
19367         done
19368         $rm_try
19369 esac
19370 case "$stdio_stream_array" in
19371 '')     $cat >&4 <<EOM
19372 I can't figure out how to access stdio streams by file descriptor number.
19373 EOM
19374         d_stdio_stream_array="$undef"
19375         ;;
19376 *)      $cat >&4 <<EOM
19377 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19378 EOM
19379         d_stdio_stream_array="$define"
19380         ;;
19381 esac
19382
19383 : see if strcoll exists
19384 set strcoll d_strcoll
19385 eval $inlibc
19386
19387 : see if strerror_l exists
19388 set strerror_l d_strerror_l
19389 eval $inlibc
19390
19391 : see if strerror_r exists
19392 set strerror_r d_strerror_r
19393 eval $inlibc
19394 case "$d_strerror_r" in
19395 "$define")
19396         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
19397         case "$d_strerror_r_proto:$usethreads" in
19398         ":define")      d_strerror_r_proto=define
19399                 set d_strerror_r_proto strerror_r $hdrs
19400                 eval $hasproto ;;
19401         *)      ;;
19402         esac
19403         case "$d_strerror_r_proto" in
19404         define)
19405         case "$strerror_r_proto" in
19406         ''|0) try='int strerror_r(int, char*, size_t);'
19407         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19408         esac
19409         case "$strerror_r_proto" in
19410         ''|0) try='int strerror_r(int, char*, int);'
19411         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19412         esac
19413         case "$strerror_r_proto" in
19414         ''|0) try='char* strerror_r(int, char*, size_t);'
19415         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19416         esac
19417         case "$strerror_r_proto" in
19418         ''|0)   d_strerror_r=undef
19419                 strerror_r_proto=0
19420                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19421         * )     case "$strerror_r_proto" in
19422                 REENTRANT_PROTO*) ;;
19423                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19424                 esac
19425                 echo "Prototype: $try" ;;
19426         esac
19427         ;;
19428         *)      case "$usethreads" in
19429                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19430                 esac
19431                 d_strerror_r=undef
19432                 strerror_r_proto=0
19433                 ;;
19434         esac
19435         ;;
19436 *)      strerror_r_proto=0
19437         ;;
19438 esac
19439
19440 : see if strftime exists
19441 set strftime d_strftime
19442 eval $inlibc
19443
19444 : see if strlcat exists
19445 : We need both a prototype in string.h and the symbol in libc.
19446 echo " "
19447 d_strlcat_proto=''
19448 xx1="#$d_gnulibc HAS_GNULIBC"
19449 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19450 xx3='#   define _GNU_SOURCE'
19451 xx4='#endif'
19452 set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19453 eval $hasproto
19454 case "$d_strlcat_proto" in
19455     define) # see if strlcat exists
19456         set strlcat d_strlcat
19457         eval $inlibc
19458         ;;
19459     *)  val=$undef
19460         set d_strlcat
19461         eval $setvar
19462         ;;
19463 esac
19464
19465 : see if strlcpy exists
19466 : We need both a prototype in string.h and the symbol in libc.
19467 echo " "
19468 d_strlcpy_proto=''
19469 xx1="#$d_gnulibc HAS_GNULIBC"
19470 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19471 xx3='#   define _GNU_SOURCE'
19472 xx4='#endif'
19473 set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19474 eval $hasproto
19475 case "$d_strlcpy_proto" in
19476     define) # see if strlcpy exists
19477         set strlcpy d_strlcpy
19478         eval $inlibc
19479         ;;
19480     *)  val=$undef
19481         set d_strlcpy
19482         eval $setvar
19483         ;;
19484 esac
19485
19486 : see if strnlen exists
19487 set strnlen d_strnlen
19488 eval $inlibc
19489
19490 : see if strtod exists
19491 set strtod d_strtod
19492 eval $inlibc
19493
19494 : see if strtod_l exists
19495 set strtod_l d_strtod_l
19496 eval $inlibc
19497
19498 : see if strtol exists
19499 set strtol d_strtol
19500 eval $inlibc
19501
19502 : see if strtold exists
19503 set strtold d_strtold
19504 eval $inlibc
19505
19506 : see if strtold_l exists
19507 set strtold_l d_strtold_l
19508 eval $inlibc
19509
19510 : see if strtoll exists
19511 set strtoll d_strtoll
19512 eval $inlibc
19513
19514 case "$d_longlong-$d_strtoll" in
19515 "$define-$define")
19516         $cat <<EOM
19517 Checking whether your strtoll() works okay...
19518 EOM
19519         $cat >try.c <<'EOCP'
19520 #include <errno.h>
19521 #ifdef __hpux
19522 #define strtoll __strtoll
19523 #endif
19524 #ifdef __EMX__
19525 #define strtoll _strtoll
19526 #endif
19527 #include <stdio.h>
19528 #include <stdlib.h>
19529 static int bad = 0;
19530 void check(const char *s, long long ell, int een) {
19531         long long gll;
19532         errno = 0;
19533         gll = strtoll(s, 0, 10);
19534         if (!((gll == ell) && (errno == een)))
19535                 bad++;
19536 }
19537 int main() {
19538         check(" 1",                                      1LL, 0);
19539         check(" 0",                                      0LL, 0);
19540         check("-1",                                     -1LL, 0);
19541         check("-9223372036854775808", -9223372036854775808LL, 0);
19542         check("-9223372036854775808", -9223372036854775808LL, 0);
19543         check(" 9223372036854775807",  9223372036854775807LL, 0);
19544         check("-9223372036854775808", -9223372036854775808LL, 0);
19545         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19546         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19547         if (!bad)
19548                 printf("ok\n");
19549 }
19550 EOCP
19551         set try
19552         if eval $compile; then
19553                 yyy=`$run ./try`
19554                 case "$yyy" in
19555                 ok) echo "Your strtoll() seems to be working okay." ;;
19556                 *) cat <<EOM >&4
19557 Your strtoll() doesn't seem to be working okay.
19558 EOM
19559                    d_strtoll="$undef"
19560                    ;;
19561                 esac
19562         else
19563                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19564                 d_strtoll="$undef"
19565         fi
19566         ;;
19567 esac
19568
19569 : see if strtoq exists
19570 set strtoq d_strtoq
19571 eval $inlibc
19572
19573 : see if strtoul exists
19574 set strtoul d_strtoul
19575 eval $inlibc
19576
19577 case "$d_strtoul" in
19578 "$define")
19579         $cat <<EOM
19580 Checking whether your strtoul() works okay...
19581 EOM
19582         $cat >try.c <<'EOCP'
19583 #include <stdlib.h>
19584 #include <errno.h>
19585 #include <stdio.h>
19586 static int bad = 0;
19587 void check(const char *s, unsigned long eul, int een) {
19588         unsigned long gul;
19589         errno = 0;
19590         gul = strtoul(s, 0, 10);
19591         if (!((gul == eul) && (errno == een)))
19592                 bad++;
19593 }
19594 int main() {
19595         check(" 1", 1L, 0);
19596         check(" 0", 0L, 0);
19597 EOCP
19598         case "$longsize" in
19599         8)
19600             $cat >>try.c <<'EOCP'
19601         check("18446744073709551615", 18446744073709551615UL, 0);
19602         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19603 #if 0 /* strtoul() for /^-/ strings is undefined. */
19604         check("-1", 18446744073709551615UL, 0);
19605         check("-18446744073709551614", 2, 0);
19606         check("-18446744073709551615", 1, 0);
19607         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19608         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19609 #endif
19610 EOCP
19611                 ;;
19612         4)
19613                     $cat >>try.c <<'EOCP'
19614         check("4294967295", 4294967295UL, 0);
19615         check("4294967296", 4294967295UL, ERANGE);
19616 #if 0 /* strtoul() for /^-/ strings is undefined. */
19617         check("-1", 4294967295UL, 0);
19618         check("-4294967294", 2, 0);
19619         check("-4294967295", 1, 0);
19620         check("-4294967296", 4294967295UL, ERANGE);
19621         check("-4294967297", 4294967295UL, ERANGE);
19622 #endif
19623 EOCP
19624                 ;;
19625         *)
19626 : Should we write these tests to be more portable by sprintf-ing
19627 : ~0 and then manipulating that char string as input for strtol?
19628                 ;;
19629         esac
19630         $cat >>try.c <<'EOCP'
19631         if (!bad)
19632                 printf("ok\n");
19633         return 0;
19634 }
19635 EOCP
19636         set try
19637         if eval $compile; then
19638                 case "`$run ./try`" in
19639                 ok) echo "Your strtoul() seems to be working okay." ;;
19640                 *) cat <<EOM >&4
19641 Your strtoul() doesn't seem to be working okay.
19642 EOM
19643                    d_strtoul="$undef"
19644                    ;;
19645                 esac
19646         else
19647                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19648                 d_strtoul="$undef"
19649         fi
19650         ;;
19651 esac
19652
19653 : see if strtoull exists
19654 set strtoull d_strtoull
19655 eval $inlibc
19656
19657 case "$d_longlong-$d_strtoull" in
19658 "$define-$define")
19659         $cat <<EOM
19660 Checking whether your strtoull() works okay...
19661 EOM
19662         $cat >try.c <<'EOCP'
19663 #include <stdlib.h>
19664 #include <errno.h>
19665 #ifdef __hpux
19666 #define strtoull __strtoull
19667 #endif
19668 #include <stdio.h>
19669 static int bad = 0;
19670 void check(const char *s, long long eull, int een) {
19671         long long gull;
19672         errno = 0;
19673         gull = strtoull(s, 0, 10);
19674         if (!((gull == eull) && (errno == een)))
19675                 bad++;
19676 }
19677 int main() {
19678         check(" 1",                                        1LL, 0);
19679         check(" 0",                                        0LL, 0);
19680         check("18446744073709551615",  18446744073709551615ULL, 0);
19681         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19682 #if 0 /* strtoull() for /^-/ strings is undefined. */
19683         check("-1",                    18446744073709551615ULL, 0);
19684         check("-18446744073709551614",                     2LL, 0);
19685         check("-18446744073709551615",                     1LL, 0);
19686         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19687         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19688 #endif
19689         if (!bad)
19690                 printf("ok\n");
19691 }
19692 EOCP
19693         set try
19694         if eval $compile; then
19695                 case "`$run ./try`" in
19696                 ok) echo "Your strtoull() seems to be working okay." ;;
19697                 *) cat <<EOM >&4
19698 Your strtoull() doesn't seem to be working okay.
19699 EOM
19700                    d_strtoull="$undef"
19701                    ;;
19702                 esac
19703         else
19704                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19705                 d_strtoull="$undef"
19706         fi
19707         ;;
19708 esac
19709
19710 : see if strtouq exists
19711 set strtouq d_strtouq
19712 eval $inlibc
19713
19714 case "$d_strtouq" in
19715 "$define")
19716         $cat <<EOM
19717 Checking whether your strtouq() works okay...
19718 EOM
19719         $cat >try.c <<'EOCP'
19720 #include <stdlib.h>
19721 #include <errno.h>
19722 #include <stdio.h>
19723 static int bad = 0;
19724 void check(const char *s, unsigned long long eull, int een) {
19725         unsigned long long gull;
19726         errno = 0;
19727         gull = strtouq(s, 0, 10);
19728         if (!((gull == eull) && (errno == een)))
19729                 bad++;
19730 }
19731 int main() {
19732         check(" 1",                                        1LL, 0);
19733         check(" 0",                                        0LL, 0);
19734         check("18446744073709551615",  18446744073709551615ULL, 0);
19735         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19736 #if 0 /* strtouq() for /^-/ strings is undefined. */
19737         check("-1",                    18446744073709551615ULL, 0);
19738         check("-18446744073709551614",                     2LL, 0);
19739         check("-18446744073709551615",                     1LL, 0);
19740         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19741         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19742 #endif
19743         if (!bad)
19744                 printf("ok\n");
19745         return 0;
19746 }
19747 EOCP
19748         set try
19749         if eval $compile; then
19750                 case "`$run ./try`" in
19751                 ok) echo "Your strtouq() seems to be working okay." ;;
19752                 *) cat <<EOM >&4
19753 Your strtouq() doesn't seem to be working okay.
19754 EOM
19755                    d_strtouq="$undef"
19756                    ;;
19757                 esac
19758         else
19759                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19760                 d_strtouq="$undef"
19761         fi
19762         ;;
19763 esac
19764
19765 : see if strxfrm exists
19766 set strxfrm d_strxfrm
19767 eval $inlibc
19768
19769 : see if strxfrm_l exists
19770 set strxfrm_l d_strxfrm_l
19771 eval $inlibc
19772
19773 : see if symlink exists
19774 set symlink d_symlink
19775 eval $inlibc
19776
19777 : see if syscall exists
19778 set syscall d_syscall
19779 eval $inlibc
19780
19781 : see if prototype for syscall is available
19782 echo " "
19783 set d_syscallproto syscall $i_unistd unistd.h
19784 eval $hasproto
19785
19786 : see if sysconf exists
19787 set sysconf d_sysconf
19788 eval $inlibc
19789
19790 : see if sys_errlist[] exists
19791 echo " "
19792 if test "X$d_syserrlst" = X; then
19793         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19794                 echo "You have sys_errlist[], so we could roll our own strerror."
19795                 d_syserrlst="$define"
19796         else
19797                 echo "You don't have sys_errlist[], so strerror() is welcome."
19798                 d_syserrlst="$undef"
19799         fi
19800 fi
19801
19802 : see if system exists
19803 set system d_system
19804 eval $inlibc
19805
19806 : see if tcgetpgrp exists
19807 set tcgetpgrp d_tcgetpgrp
19808 eval $inlibc
19809
19810 : see if tcsetpgrp exists
19811 set tcsetpgrp d_tcsetpgrp
19812 eval $inlibc
19813
19814 : see if prototype for telldir is available
19815 echo " "
19816 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19817 eval $hasproto
19818
19819 : see if tgamma exists
19820 set tgamma d_tgamma
19821 eval $inlibc
19822
19823 : see what flavor, if any, of thread local storage is supported
19824 echo " "
19825 echo "Checking to see if your system supports C11 thread local storage..."
19826 $cat > try.c <<'EOCP'
19827 #include <stdio.h>
19828 #include <stdlib.h>
19829 #include <pthread.h>
19830
19831 static int plus_one = 1;
19832 static int minus_one = -1;
19833
19834 PROBE_MACRO int *minion;
19835
19836 int callback (const void *a, const void *b) {
19837     int val_a = *minion * *(const int *)a;
19838     int val_b = *minion * *(const int *)b;
19839     return val_a < val_b ? -1 : val_a > val_b;
19840 }
19841
19842 #define SIZE 8
19843
19844 void *thread_function(void *arg) {
19845     /* thread local variables should start zeroed in each thread. */
19846     if (minion != NULL) {
19847         fprintf(stderr, "__thread variable started with %p, should be NULL\n",
19848                 minion);
19849         exit(2);
19850     }
19851     minion = &minus_one;
19852
19853     int array[SIZE];
19854     unsigned int i;
19855     for (i = 0; i < SIZE; ++i) {
19856         /* "Hash randomisation" - this array isn't in sorted order: */
19857         array[i ^ 5] = i * i;
19858     }
19859
19860     qsort(array, SIZE, sizeof(int), callback);
19861
19862     int bad = 0;
19863     for (i = 0; i < SIZE; ++i) {
19864         int want = (SIZE - 1 - i) * (SIZE - 1 - i);
19865         int have = array[i];
19866         if (want != have) {
19867             ++bad;
19868             fprintf(stderr, "array[%u] - want %i, have %i\n", i, want, have);
19869         }
19870     }
19871     if (bad)
19872         exit(3);
19873
19874     return NULL;
19875 }
19876
19877 int main(int argc, char **argv) {
19878     if (minion != NULL) {
19879         fprintf(stderr, "__thread variable started with %p, should be NULL\n",
19880                 minion);
19881         exit(4);
19882     }
19883
19884     minion = &plus_one;
19885
19886     pthread_t tid;
19887     int result = pthread_create(&tid, NULL, thread_function, NULL);
19888     if (result) {
19889         fprintf(stderr, "pthread_create failed (%d)\n", result);
19890         exit(5);
19891     }
19892
19893     result = pthread_join(tid, NULL);
19894     if (result) {
19895         fprintf(stderr, "pthread_join failed (%d)\n", result);
19896         exit(6);
19897     }
19898
19899     if (minion == NULL) {
19900         fprintf(stderr, "__thread variable should not be NULL\n");
19901         exit(7);
19902     }
19903     if (!(minion == &plus_one && *minion == 1)) {
19904         fprintf(stderr, "__thread variable should be %d @ %p, not %d @ %p\n",
19905                 1, &plus_one, *minion, minion);
19906         exit(8);
19907     }
19908
19909     return 0;
19910 }
19911 EOCP
19912
19913 # Respect a hint (or previous) value for perl_thread_local, if there is one.
19914 case "$perl_thread_local" in
19915 '')     # Check the various possibilities, and break out on success.
19916         for thread_local in _Thread_local __thread; do
19917                 set try -DPROBE_MACRO=$thread_local
19918                 if eval $compile && $run ./try; then
19919                         $echo "Your compiler supports $thread_local." >&4
19920                         val=$define
19921                         perl_thread_local="$thread_local";
19922                         break;
19923                 fi
19924                 $echo "Your compiler does NOT support $thread_local." >&4
19925                 val="$undef"
19926         done
19927         ;;
19928 *thread*|*Thread*) # Some variant of thread local exists.
19929         echo "Keeping your $hint value of $perl_thread_local."
19930         val=$define
19931         ;;
19932 *)  # Unrecognized previous value -- blindly trust the supplied
19933         # value and hope it makes sense.  Use old value for
19934         # d_thread_local, if there is one.
19935         echo "Keeping your $hint value of $perl_thread_local."
19936         case "$d_thread_local" in
19937                 '') val=$define ;;
19938                 *)  val=$d_thread_local ;;
19939         esac
19940         ;;
19941 esac
19942 set d_thread_local
19943 eval $setvar
19944 $rm_try
19945
19946 : see if time exists
19947 echo " "
19948 if test "X$d_time" = X -o X"$timetype" = X; then
19949     if set time val -f d_time; eval $csym; $val; then
19950                 echo 'time() found.' >&4
19951                 val="$define"
19952                 rp="What is the type returned by time() on this system?"
19953                 set time_t timetype long stdio.h sys/types.h
19954                 eval $typedef_ask
19955     else
19956                 echo 'time() not found, hope that will do.' >&4
19957                 val="$undef"
19958                 timetype='int';
19959     fi
19960     set d_time
19961     eval $setvar
19962 fi
19963
19964 : see if timegm exists
19965 set timegm d_timegm
19966 eval $inlibc
19967
19968 : see if this is a sys/times.h system
19969 set sys/times.h i_systimes
19970 eval $inhdr
19971
19972 : see if times exists
19973 echo " "
19974 if set times val -f d_times; eval $csym; $val; then
19975         echo 'times() found.' >&4
19976         d_times="$define"
19977         inc=''
19978         case "$i_systimes" in
19979         "$define") inc='sys/times.h';;
19980         esac
19981         rp="What is the type returned by times() on this system?"
19982         set clock_t clocktype long stdio.h sys/types.h $inc
19983         eval $typedef_ask
19984 else
19985         echo 'times() NOT found, hope that will do.' >&4
19986         d_times="$undef"
19987         clocktype='int'
19988 fi
19989
19990 : see if tmpnam_r exists
19991 set tmpnam_r d_tmpnam_r
19992 eval $inlibc
19993 case "$d_tmpnam_r" in
19994 "$define")
19995         hdrs="$i_systypes sys/types.h define stdio.h "
19996         case "$d_tmpnam_r_proto:$usethreads" in
19997         ":define")      d_tmpnam_r_proto=define
19998                 set d_tmpnam_r_proto tmpnam_r $hdrs
19999                 eval $hasproto ;;
20000         *)      ;;
20001         esac
20002         case "$d_tmpnam_r_proto" in
20003         define)
20004         case "$tmpnam_r_proto" in
20005         ''|0) try='char* tmpnam_r(char*);'
20006         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
20007         esac
20008         case "$tmpnam_r_proto" in
20009         ''|0)   d_tmpnam_r=undef
20010                 tmpnam_r_proto=0
20011                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
20012         * )     case "$tmpnam_r_proto" in
20013                 REENTRANT_PROTO*) ;;
20014                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
20015                 esac
20016                 echo "Prototype: $try" ;;
20017         esac
20018         ;;
20019         *)      case "$usethreads" in
20020                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
20021                 esac
20022                 d_tmpnam_r=undef
20023                 tmpnam_r_proto=0
20024                 ;;
20025         esac
20026         ;;
20027 *)      tmpnam_r_proto=0
20028         ;;
20029 esac
20030
20031 : see if towlower exists
20032 set towlower d_towlower
20033 eval $inlibc
20034
20035 : see if trunc exists
20036 set trunc d_trunc
20037 eval $inlibc
20038
20039 : see if truncate exists
20040 set truncate d_truncate
20041 eval $inlibc
20042
20043 : see if ttyname_r exists
20044 set ttyname_r d_ttyname_r
20045 eval $inlibc
20046 case "$d_ttyname_r" in
20047 "$define")
20048         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
20049         case "$d_ttyname_r_proto:$usethreads" in
20050         ":define")      d_ttyname_r_proto=define
20051                 set d_ttyname_r_proto ttyname_r $hdrs
20052                 eval $hasproto ;;
20053         *)      ;;
20054         esac
20055         case "$d_ttyname_r_proto" in
20056         define)
20057         case "$ttyname_r_proto" in
20058         ''|0) try='int ttyname_r(int, char*, size_t);'
20059         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
20060         esac
20061         case "$ttyname_r_proto" in
20062         ''|0) try='int ttyname_r(int, char*, int);'
20063         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
20064         esac
20065         case "$ttyname_r_proto" in
20066         ''|0) try='char* ttyname_r(int, char*, int);'
20067         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
20068         esac
20069         case "$ttyname_r_proto" in
20070         ''|0)   d_ttyname_r=undef
20071                 ttyname_r_proto=0
20072                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
20073         * )     case "$ttyname_r_proto" in
20074                 REENTRANT_PROTO*) ;;
20075                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
20076                 esac
20077                 echo "Prototype: $try" ;;
20078         esac
20079         ;;
20080         *)      case "$usethreads" in
20081                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
20082                 esac
20083                 d_ttyname_r=undef
20084                 ttyname_r_proto=0
20085                 ;;
20086         esac
20087         ;;
20088 *)      ttyname_r_proto=0
20089         ;;
20090 esac
20091
20092 : see if tzname[] exists
20093 echo " "
20094 if set tzname val -a d_tzname; eval $csym; $val; then
20095         val="$define"
20096         echo 'tzname[] found.' >&4
20097 else
20098         val="$undef"
20099         echo 'tzname[] NOT found.' >&4
20100 fi
20101 set d_tzname
20102 eval $setvar
20103
20104 : Check if is a multiplatform env
20105 case "$osname" in
20106 darwin) multiarch="$define" ;;
20107 esac
20108 case "$multiarch" in
20109 ''|[nN]*) multiarch="$undef" ;;
20110 esac
20111
20112 : check for ordering of bytes in a UV
20113 echo " "
20114 case "$multiarch" in
20115 *$define*)
20116         $cat <<EOM
20117 You seem to be doing a multiarchitecture build,
20118 skipping the byteorder check.
20119
20120 EOM
20121         byteorder='ffff'
20122         ;;
20123 *)
20124         case "$byteorder" in
20125         '')
20126                 $cat <<'EOM'
20127 In the following, larger digits indicate more significance.  A big-endian
20128 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
20129 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
20130 machines may have weird orders like 3412.  A Cray will report 87654321,
20131 an Alpha will report 12345678. If the test program works the default is
20132 probably right.
20133 I'm now running the test program...
20134 EOM
20135                 $cat >try.c <<EOCP
20136 #include <stdio.h>
20137 #$i_stdlib I_STDLIB
20138 #ifdef I_STDLIB
20139 #include <stdlib.h>
20140 #endif
20141 #$i_inttypes I_INTTYPES
20142 #ifdef I_INTTYPES
20143 #include <inttypes.h>
20144 #endif
20145 #include <sys/types.h>
20146 typedef $uvtype UV;
20147 int main()
20148 {
20149         int i;
20150         union {
20151                 UV l;
20152                 char c[$uvsize];
20153         } u;
20154
20155         if ($uvsize > 4)
20156                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
20157         else
20158                 u.l = (UV)0x04030201;
20159         for (i = 0; i < $uvsize; i++)
20160                 printf("%c", u.c[i]+'0');
20161         printf("\n");
20162         exit(0);
20163 }
20164 EOCP
20165                 xxx_prompt=y
20166                 set try
20167                 if eval $compile && $run ./try > /dev/null; then
20168                         dflt=`$run ./try`
20169                         case "$dflt" in
20170                         [1-4][1-4][1-4][1-4]|12345678|87654321)
20171                                 echo "(The test program ran ok.)"
20172                                 echo "byteorder=$dflt"
20173                                 xxx_prompt=n
20174                         ;;
20175                         ????|????????) echo "(The test program ran ok.)" ;;
20176                         *) echo "(The test program didn't run right for some reason.)" ;;
20177                         esac
20178                 else
20179                         dflt='4321'
20180                         cat <<'EOM'
20181 (I can't seem to compile the test program.  Guessing big-endian...)
20182 EOM
20183                 fi
20184                 case "$xxx_prompt" in
20185                 y)
20186                         rp="What is the order of bytes in $uvtype?"
20187                         . ./myread
20188                         byteorder="$ans"
20189                         ;;
20190                 *)      byteorder=$dflt
20191                         ;;
20192                 esac
20193                 ;;
20194         esac
20195         $rm_try
20196         ;;
20197 esac
20198
20199 : Checking 32bit alignedness
20200 $cat <<EOM
20201
20202 Checking to see whether you can access character data unalignedly...
20203 EOM
20204 case "$d_u32align" in
20205 '')   $cat >try.c <<EOCP
20206 #include <stdio.h>
20207 #$i_stdlib I_STDLIB
20208 #ifdef I_STDLIB
20209 #include <stdlib.h>
20210 #endif
20211 #define U32 $u32type
20212 #define BYTEORDER 0x$byteorder
20213 #define U8 $u8type
20214 #include <signal.h>
20215 #ifdef SIGBUS
20216 $signal_t bletch(int s) { exit(4); }
20217 #endif
20218 int main() {
20219 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
20220     volatile U8 buf[8];
20221     volatile U32 *up;
20222     int i;
20223
20224     if (sizeof(U32) != 4) {
20225         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
20226         exit(1);
20227     }
20228
20229     fflush(stdout);
20230
20231 #ifdef SIGBUS
20232     signal(SIGBUS, bletch);
20233 #endif
20234
20235     buf[0] = 0;
20236     buf[1] = 0;
20237     buf[2] = 0;
20238     buf[3] = 1;
20239     buf[4] = 0;
20240     buf[5] = 0;
20241     buf[6] = 0;
20242     buf[7] = 1;
20243
20244     for (i = 0; i < 4; i++) {
20245         up = (U32*)(buf + i);
20246         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
20247                (*up == 1 << (8*(3-i)))  /* little-endian */
20248               )
20249            )
20250         {
20251             printf("read failed (%x)\n", *up);
20252             exit(2);
20253         }
20254     }
20255
20256     /* write test */
20257     for (i = 0; i < 4; i++) {
20258         up = (U32*)(buf + i);
20259         *up = 0xBeef;
20260         if (*up != 0xBeef) {
20261             printf("write failed (%x)\n", *up);
20262             exit(3);
20263         }
20264     }
20265
20266     exit(0);
20267 #else
20268     printf("1\n");
20269     exit(1);
20270 #endif
20271     return 0;
20272 }
20273 EOCP
20274 set try
20275 if eval $compile_ok; then
20276         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
20277         $run ./try 2>&1 >/dev/null
20278         case "$?" in
20279         0)      cat >&4 <<EOM
20280 You can access character data pretty unalignedly.
20281 EOM
20282                 d_u32align="$undef"
20283                 ;;
20284         *)      cat >&4 <<EOM
20285 It seems that you must access character data in an aligned manner.
20286 EOM
20287                 d_u32align="$define"
20288                 ;;
20289         esac
20290 else
20291         rp='Can you access character data at unaligned addresses?'
20292         dflt='n'
20293         . ./myread
20294         case "$ans" in
20295         [yY]*)  d_u32align="$undef"  ;;
20296         *)      d_u32align="$define" ;;
20297         esac
20298 fi
20299 $rm_try
20300 ;;
20301 esac
20302
20303 : see if ualarm exists
20304 set ualarm d_ualarm
20305 eval $inlibc
20306
20307 : see if umask exists
20308 set umask d_umask
20309 eval $inlibc
20310
20311 : see if unordered exists
20312 set unordered d_unordered
20313 eval $inlibc
20314
20315 : see if unsetenv exists
20316 set unsetenv d_unsetenv
20317 eval $inlibc
20318
20319 : see if usleep exists
20320 set usleep d_usleep
20321 eval $inlibc
20322
20323 : see if prototype for usleep is available
20324 echo " "
20325 set d_usleepproto usleep $i_unistd unistd.h
20326 eval $hasproto
20327
20328 : see if ustat exists
20329 set ustat d_ustat
20330 eval $inlibc
20331
20332 : see if closedir exists
20333 set closedir d_closedir
20334 eval $inlibc
20335
20336 case "$d_closedir" in
20337 "$define")
20338         echo " "
20339         echo "Checking whether closedir() returns a status..." >&4
20340         cat > try.c <<EOM
20341 #$i_dirent I_DIRENT             /**/
20342 #$i_sysdir I_SYS_DIR            /**/
20343 #$i_sysndir I_SYS_NDIR          /**/
20344 #$i_systypes I_SYS_TYPES        /**/
20345
20346 #if defined(I_SYS_TYPES)
20347 #include <sys/types.h>
20348 #endif
20349 #if defined(I_DIRENT)
20350 #include <dirent.h>
20351 #else
20352 #ifdef I_SYS_NDIR
20353 #include <sys/ndir.h>
20354 #else
20355 #ifdef I_SYS_DIR
20356 #include <sys/dir.h>
20357 #endif
20358 #endif
20359 #endif
20360 int main() { return closedir(opendir(".")); }
20361 EOM
20362         set try
20363         if eval $compile_ok; then
20364                 if $run ./try > /dev/null 2>&1 ; then
20365                         echo "Yes, it does."
20366                         val="$undef"
20367                 else
20368                         echo "No, it doesn't."
20369                         val="$define"
20370                 fi
20371         else
20372                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20373                 val="$define"
20374         fi
20375         ;;
20376 *)
20377         val="$undef";
20378         ;;
20379 esac
20380 set d_void_closedir
20381 eval $setvar
20382 $rm_try
20383
20384 : see if there is a wait4
20385 set wait4 d_wait4
20386 eval $inlibc
20387
20388 : see if waitpid exists
20389 set waitpid d_waitpid
20390 eval $inlibc
20391
20392 : see if wcrtomb exists
20393 set wcrtomb d_wcrtomb
20394 eval $inlibc
20395
20396 : look for wcscmp
20397 echo " "
20398 $cat >try.c <<'EOCP'
20399 #include <stdio.h>
20400 #include <wchar.h>
20401 int main ()
20402 {
20403     wchar_t *s = L" ";
20404     return (wcscmp (s, s) ? 1 : 0);
20405     }
20406 EOCP
20407 set try
20408 val="$undef"
20409 if eval $compile; then
20410     `$run ./try`
20411     case "$?" in
20412         0)  echo "A working wcscmp() found." >&4
20413             val="$define" ;;
20414         *)  echo "wcscmp() found, but it doesn't work" >&4
20415             ;;
20416         esac
20417 else
20418     echo "wcscmp() NOT found." >&4
20419     fi
20420 set d_wcscmp
20421 eval $setvar
20422 $rm_try
20423
20424 : see if wcstombs exists
20425 set wcstombs d_wcstombs
20426 eval $inlibc
20427
20428 : look for wcsxfrm
20429 echo " "
20430 $cat >try.c <<'EOCP'
20431 #include <errno.h>
20432 #include <wchar.h>
20433 int main ()
20434 {
20435     wchar_t dst[4], *src = L" ";
20436     errno = 0;
20437     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20438     }
20439 EOCP
20440 set try
20441 val="$undef"
20442 if eval $compile; then
20443     `$run ./try`
20444     case "$?" in
20445         0)  echo "A working wcsxfrm() found." >&4
20446             val="$define" ;;
20447         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20448             ;;
20449         esac
20450 else
20451     echo "wcsxfrm() NOT found." >&4
20452     fi
20453 set d_wcsxfrm
20454 eval $setvar
20455 $rm_try
20456
20457 : see if wctomb exists
20458 set wctomb d_wctomb
20459 eval $inlibc
20460
20461 : see if writev exists
20462 set writev d_writev
20463 eval $inlibc
20464
20465 : check for alignment requirements
20466 echo " "
20467 case "$alignbytes" in
20468     '') echo "Checking alignment constraints..." >&4
20469         $cat >try.c <<EOCP
20470 #include <stdio.h>
20471 struct foobar {
20472     char foo;
20473     $nvtype bar;
20474 } try_algn;
20475 int main()
20476 {
20477     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20478     return(0);
20479 }
20480 EOCP
20481         set try
20482         if eval $compile_ok; then
20483             dflt=`$run ./try`
20484         else
20485             dflt='8'
20486             echo "(I can't seem to compile the test program...)"
20487         fi
20488         case "$multiarch" in
20489             *$define*)
20490                 : The usual safe value is 8, but Darwin with -Duselongdouble
20491                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20492                 : Configure to pick a larger value if needed.
20493                 if $test "$dflt" -lt 8; then
20494                     dflt='8'
20495                     echo "Setting alignment to 8 for multiarch support.">&4
20496                 fi
20497                 ;;
20498         esac
20499         ;;
20500     *) dflt="$alignbytes"
20501         ;;
20502 esac
20503 rp="Doubles must be aligned on a how-many-byte boundary?"
20504 . ./myread
20505 alignbytes="$ans"
20506 $rm_try
20507
20508 : set the base revision
20509 baserev=5.0
20510
20511 : length of character in bytes. Is always 1, otherwise it is not C
20512 : This used to be a test using sizeof
20513 charsize=1
20514
20515 : Check for the number of bits in a character
20516 case "$charbits" in
20517 '')     echo "Checking how long a character is (in bits)..." >&4
20518         $cat >try.c <<EOCP
20519 #include <stdio.h>
20520 int main ()
20521 {
20522     int n;
20523     unsigned char c;
20524     for (c = 1, n = 0; c; c <<= 1, n++) ;
20525     printf ("%d\n", n);
20526     return (0);
20527     }
20528 EOCP
20529         set try
20530         if eval $compile_ok; then
20531                 dflt=`$run ./try`
20532         else
20533                 dflt='8'
20534                 echo "(I can't seem to compile the test program.  Guessing...)"
20535         fi
20536         ;;
20537 *)
20538         dflt="$charbits"
20539         ;;
20540 esac
20541 rp="What is the length of a character (in bits)?"
20542 . ./myread
20543 charbits="$ans"
20544 $rm_try
20545 case "$charbits" in
20546 8)      ;;
20547 *)      cat >&4 << EOM
20548 Your system has an unsigned character size of $charbits bits, which
20549 is rather unusual (normally it is 8 bits).  Perl likely will not work
20550 correctly on your system, with subtle bugs in various places.
20551 EOM
20552         rp='Do you really want to continue?'
20553         dflt='n'
20554         . ./myread
20555         case "$ans" in
20556                 [yY])   echo >&4 "Okay, continuing."    ;;
20557                 *)      exit 1                          ;;
20558         esac
20559 esac
20560
20561 : how do we concatenate cpp tokens here?
20562 echo " "
20563 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20564 $cat >cpp_stuff.c <<'EOCP'
20565 #define RCAT(a,b)a/**/b
20566 #define ACAT(a,b)a ## b
20567 RCAT(Rei,ser)
20568 ACAT(Cir,cus)
20569 EOCP
20570 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20571 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20572         echo "Oh!  Smells like ANSI's been here." >&4
20573         echo "We can catify or stringify, separately or together!"
20574         cpp_stuff=42
20575 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20576         echo "Ah, yes!  The good old days!" >&4
20577         echo "However, in the good old days we don't know how to stringify and"
20578         echo "catify at the same time."
20579         cpp_stuff=1
20580 else
20581         $cat >&4 <<EOM
20582 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20583 You're going to have to edit the values of CAT[2-5] in config.h...
20584 EOM
20585         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20586 fi
20587 $rm -f cpp_stuff.*
20588
20589 : see if this is a db.h system
20590 set db.h i_db
20591 eval $inhdr
20592
20593 case "$i_db" in
20594 $define)
20595         : Check db version.
20596         echo " "
20597         echo "Checking Berkeley DB version ..." >&4
20598         $cat >try.c <<EOCP
20599 #include <sys/types.h>
20600 #include <stdio.h>
20601 #$i_stdlib I_STDLIB
20602 #ifdef I_STDLIB
20603 #include <stdlib.h>
20604 #endif
20605 #include <db.h>
20606 int main(int argc, char *argv[])
20607 {
20608 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20609     int Major, Minor, Patch ;
20610     unsigned long Version ;
20611     (void)db_version(&Major, &Minor, &Patch) ;
20612     if (argc == 2) {
20613         printf("%d %d %d %d %d %d\n",
20614                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20615                Major, Minor, Patch);
20616         exit(0);
20617     }
20618     printf("You have Berkeley DB Version 2 or greater.\n");
20619
20620     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20621                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20622     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20623                 Major, Minor, Patch) ;
20624
20625     /* check that db.h & libdb are compatible */
20626     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20627         printf("db.h and libdb are incompatible.\n") ;
20628         exit(3);
20629     }
20630
20631     printf("db.h and libdb are compatible.\n") ;
20632
20633     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20634                 + DB_VERSION_PATCH ;
20635
20636     /* needs to be >= 2.3.4 */
20637     if (Version < 2003004) {
20638     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20639         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20640         exit(2);
20641     }
20642
20643     exit(0);
20644 #else
20645 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20646     if (argc == 2) {
20647         printf("1 0 0\n");
20648         exit(0);
20649     }
20650     printf("You have Berkeley DB Version 1.\n");
20651     exit(0);    /* DB version < 2: the coast is clear. */
20652 #else
20653     exit(1);    /* <db.h> not Berkeley DB? */
20654 #endif
20655 #endif
20656 }
20657 EOCP
20658         set try
20659         if eval $compile_ok && $run ./try; then
20660                 echo 'Looks OK.' >&4
20661                 set `$run ./try 1`
20662                 db_version_major=$1
20663                 db_version_minor=$2
20664                 db_version_patch=$3
20665         else
20666                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20667                 i_db=$undef
20668                 case " $libs " in
20669                 *"-ldb "*)
20670                         : Remove db from list of libraries to use
20671                         echo "Removing unusable -ldb from library list" >&4
20672                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20673                         shift
20674                         libs="$*"
20675                         echo "libs = $libs" >&4
20676                         ;;
20677                 esac
20678         fi
20679         $rm_try
20680         ;;
20681 esac
20682
20683 case "$i_db" in
20684 define)
20685         : Check the return type needed for hash
20686         echo " "
20687         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20688         $cat >try.c <<EOCP
20689 #include <sys/types.h>
20690 #include <db.h>
20691
20692 #ifndef DB_VERSION_MAJOR
20693 u_int32_t hash_cb (const void* ptr, size_t size)
20694 {
20695         return 0;
20696 }
20697 HASHINFO info;
20698 int main()
20699 {
20700         info.hash = hash_cb;
20701 }
20702 #endif
20703 EOCP
20704         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20705                 if $compiler_warning try.out >>/dev/null 2>&1 ; then
20706                         db_hashtype='int'
20707                 else
20708                         db_hashtype='u_int32_t'
20709                 fi
20710         else
20711                 : XXX Maybe we should just give up here.
20712                 db_hashtype=u_int32_t
20713                 $cat try.out >&4
20714                 echo "Help:  I can't seem to compile the db test program." >&4
20715                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20716         fi
20717         $rm_try
20718         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20719         ;;
20720 *)      db_hashtype=u_int32_t
20721         ;;
20722 esac
20723 case "$i_db" in
20724 define)
20725         : Check the return type needed for prefix
20726         echo " "
20727         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20728         cat >try.c <<EOCP
20729 #include <sys/types.h>
20730 #include <db.h>
20731
20732 #ifndef DB_VERSION_MAJOR
20733 size_t prefix_cb (const DBT *key1, const DBT *key2)
20734 {
20735         return 0;
20736 }
20737 BTREEINFO info;
20738 int main()
20739 {
20740         info.prefix = prefix_cb;
20741 }
20742 #endif
20743 EOCP
20744         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20745                 if $compiler_warning try.out >>/dev/null 2>&1 ; then
20746                         db_prefixtype='int'
20747                 else
20748                         db_prefixtype='size_t'
20749                 fi
20750         else
20751                 db_prefixtype='size_t'
20752                 : XXX Maybe we should just give up here.
20753                 $cat try.out >&4
20754                 echo "Help:  I can't seem to compile the db test program." >&4
20755                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20756         fi
20757         $rm_try
20758         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20759         ;;
20760 *)      db_prefixtype='size_t'
20761         ;;
20762 esac
20763
20764 : Include . in @INC
20765 $cat <<EOM
20766
20767 Historically Perl has provided a final fallback of the current working
20768 directory '.' when searching for a library. This, however, can lead to
20769 problems when a Perl program which loads optional modules is called from
20770 a shared directory. This can lead to executing unexpected code.
20771
20772 EOM
20773
20774 # When changing to exclude by default:
20775 case "$default_inc_excludes_dot" in
20776     $undef|false|[nN]*) dflt="n" ;;
20777     *)                  dflt="y" ;;
20778 esac
20779 # To turn exclude off by default:
20780 #case "$default_inc_excludes_dot" in
20781 #    $define|true|[yY]*) dflt="y" ;;
20782 #    *)                  dflt="n" ;;
20783 #esac
20784
20785 rp='Exclude '.' from @INC by default? '
20786 . ./myread
20787 case "$ans" in
20788     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20789     *)          default_inc_excludes_dot="$define" ;;
20790 esac
20791
20792 : Check what kind of inf/nan your system has
20793 $echo "Checking the kind of infinities and nans you have..." >&4
20794 $echo "(The following tests may crash.  That's okay.)" >&4
20795 $cat >try.c <<EOP
20796 #define DOUBLESIZE $doublesize
20797 #$d_longdbl HAS_LONG_DOUBLE
20798 #ifdef HAS_LONG_DOUBLE
20799 #define LONG_DOUBLESIZE $longdblsize
20800 #define LONG_DOUBLEKIND $longdblkind
20801 #endif
20802 #include <math.h>
20803 #include <string.h>
20804 #include <stdio.h>
20805 /* Note that whether the sign bit is on or off
20806  * for NaN depends on the CPU/FPU, and possibly
20807  * can be affected by the build toolchain.
20808  *
20809  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20810  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20811  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20812  * (respectively) as opposed to the more usual
20813  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20814  *
20815  * Pre-IEEE-754 floating point format do not even have inf/nan support
20816  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20817  * to even mention, causing immediate SIGFPE or equivalent: this is
20818  * the case with VAX floating point, for example.
20819  */
20820 static void bytes(void *v, unsigned int n) {
20821   unsigned char *p = (unsigned char *)v;
20822   int i;
20823   for (i = 0; i < n; i++) {
20824     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20825   }
20826 }
20827 int main(int argc, char *argv[]) {
20828    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20829     * because some compilers are 'smart' and not only warn but refuse to
20830     * compile such 'illegal' values. */
20831    double dinf = exp(1e9);
20832    double dnan = sqrt(-1.0);
20833 #ifdef HAS_LONG_DOUBLE
20834    long double ldinf = (long double)exp(1e9);
20835    long double ldnan = (long double)sqrt(-1.0);
20836 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20837 /* the 80-bit long doubles might have garbage in their excess bytes */
20838     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20839     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20840 # endif
20841 #endif
20842   if (argc == 2) {
20843     switch (argv[1][0]) {
20844     case '1': bytes(&dinf, sizeof(dinf)); break;
20845     case '2': bytes(&dnan, sizeof(dnan)); break;
20846 #ifdef HAS_LONG_DOUBLE
20847     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20848     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20849 #endif
20850     }
20851   }
20852   return 0;
20853 }
20854 EOP
20855 set try
20856 if eval $compile; then
20857     doubleinfbytes=`$run ./try 1`
20858     doublenanbytes=`$run ./try 2`
20859     case "$d_longdbl" in
20860     $define)
20861       longdblinfbytes=`$run ./try 3`
20862       longdblnanbytes=`$run ./try 4`
20863       ;;
20864     esac
20865 else
20866     # Defaults in case the above test program failed.
20867     case "$doublekind" in
20868     1) # IEEE 754 32-bit LE
20869        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20870        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20871        ;;
20872     2) # IEEE 754 32-bit BE
20873        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20874        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20875        ;;
20876     3) # IEEE 754 64-bit LE
20877        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20878        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20879        ;;
20880     4) # IEEE 754 64-bit BE
20881        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20882        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20883        ;;
20884     5) # IEEE 754 128-bit LE
20885        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20886        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20887        ;;
20888     6) # IEEE 754 128-bit BE
20889        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20890        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20891        ;;
20892     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20893        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20894        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20895        ;;
20896     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20897        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20898        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20899        ;;
20900     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20901        doubleinfbytes=$undef
20902        doublenanbytes=$undef
20903        ;;
20904     *) # No idea.
20905        doubleinfbytes=$undef
20906        doublenanbytes=$undef
20907        ;;
20908     esac
20909     case "$longdblkind" in
20910     1) # IEEE 754 128-bit LE
20911        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20912        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20913        ;;
20914     2) # IEEE 754 128-bit BE
20915        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20916        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20917        ;;
20918     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20919        case "$longdblsize" in
20920        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20921            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20922            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20923            ;;
20924        16) # x86_64
20925            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20926            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20927            ;;
20928        *)  # No idea.
20929            longdblinfbytes=$undef
20930            longdblnanbytes=$undef
20931        ;;
20932        esac
20933        ;;
20934     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20935        case "$longdblsize" in
20936        12) # 32-bit system
20937            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20938            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20939            ;;
20940        16) # 64-bit system
20941            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20942            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20943            ;;
20944        *)  # No idea.
20945            longdblinfbytes=$undef
20946            longdblnanbytes=$undef
20947        ;;
20948        esac
20949        ;;
20950     5) # 128-bit LE-LE "double double"
20951        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20952        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20953        ;;
20954     6) # 128-bit BE-BE "double double"
20955        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20956        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20957        ;;
20958     7) # 128-bit LE-BE "double double"
20959        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20960        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20961        ;;
20962     8) # 128-bit BE-LE "double double"
20963        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20964        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20965        ;;
20966     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20967        longdblinfbytes=$undef
20968        longdblnanbytes=$undef
20969        ;;
20970     *) # No idea.
20971        longdblinfbytes=$undef
20972        longdblnanbytes=$undef
20973        ;;
20974     esac
20975 fi
20976 # In case the program crashed the values are empty, turn them undef.
20977 case "$doubleinfbytes" in
20978 '') doubleinfbytes=$undef ;;
20979 esac
20980 case "$doublenanbytes" in
20981 '') doublenanbytes=$undef ;;
20982 esac
20983 case "$longdblinfbytes" in
20984 '') longdblinfbytes=$undef ;;
20985 esac
20986 case "$longdblnanbytes" in
20987 '') longdblnanbytes=$undef ;;
20988 esac
20989 $rm_try
20990
20991 : Check the length of the double mantissa
20992 $echo "Checking how many mantissa bits your doubles have..." >&4
20993 $cat >try.c <<EOP
20994 #$i_sunmath I_SUNMATH
20995 #include <float.h>
20996 #ifdef I_SUNMATH
20997 # include <sunmath.h>
20998 #endif
20999 #ifdef DBL_MANT_DIG
21000 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
21001 #endif
21002 #include <stdio.h>
21003 int main(int argc, char *argv[]) {
21004 #ifdef BITS
21005   printf("%d\n", BITS);
21006 #endif
21007   return 0;
21008 }
21009 EOP
21010 set try
21011 if eval $compile; then
21012     doublemantbits=`$run ./try`
21013 else
21014     doublemantbits="$undef"
21015 fi
21016 $rm_try
21017
21018 : Check the length of the longdouble mantissa
21019 $echo "Checking how many mantissa bits your long doubles have..." >&4
21020 $cat >try.c <<EOP
21021 #$i_sunmath I_SUNMATH
21022 #include <float.h>
21023 #ifdef I_SUNMATH
21024 # include <sunmath.h>
21025 #endif
21026 #$d_longdbl HAS_LONG_DOUBLE
21027 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
21028 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
21029 /* This format has no implicit bit.  Beware, however, that for
21030  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
21031  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
21032  * and the top bit must have been one since 387, zero is plain invalid.
21033  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
21034 #  define BITS LDBL_MANT_DIG
21035 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
21036 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
21037  * reason e.g. Irix thinks 107.  But in any case, we want only
21038  * the number of real bits, the implicit bits are of no interest.  */
21039 #  define BITS 2 * (DBL_MANT_DIG - 1)
21040 # else
21041 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
21042 # endif
21043 #endif
21044 #include <stdio.h>
21045 int main(int argc, char *argv[]) {
21046 #ifdef BITS
21047   printf("%d\n", BITS);
21048 #endif
21049   return 0;
21050 }
21051 EOP
21052 set try
21053 if eval $compile; then
21054     longdblmantbits=`$run ./try`
21055 else
21056     longdblmantbits="$undef"
21057 fi
21058 $rm_try
21059
21060 : Check the length of the NV mantissa
21061 $echo "Checking how many mantissa bits your NVs have..." >&4
21062 if test "X$usequadmath" = "X$define"; then
21063   nvmantbits=112 # 128-1-15
21064 else
21065   if test "X$nvsize" = "X$doublesize"; then
21066     nvmantbits="$doublemantbits"
21067   else
21068      if test "X$nvsize" = "X$longdblsize"; then
21069        nvmantbits="$longdblmantbits"
21070      else
21071        nvmantbits="$undef"
21072      fi
21073   fi
21074 fi
21075
21076 : How can we generate normalized random numbers ?
21077 echo " "
21078 echo "Using our internal random number implementation..." >&4
21079
21080 case "$ccflags" in
21081 *-Dmy_rand=*|*-Dmy_srand=*)
21082         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
21083         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
21084         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
21085         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
21086         ;;
21087 esac
21088
21089 randfunc=Perl_drand48
21090 drand01="Perl_drand48()"
21091 seedfunc="Perl_drand48_init"
21092 randbits=48
21093 randseedtype=U32
21094
21095 : Probe whether dtrace builds an object, as newer Illumos requires an input
21096 : object file that uses at least one of the probes defined in the .d file
21097 case "$usedtrace" in
21098 $define)
21099     case "$dtracexnolibs" in
21100     $define|true|[yY]*)
21101         dtracexnolibs=$define
21102         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
21103         ;;
21104     ' '|'')
21105         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
21106              dtracexnolibs=$define
21107              echo "Your dtrace accepts -xnolibs"
21108         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
21109              dtracexnolibs=$undef
21110              echo "Your dtrace doesn't accept -xnolibs"
21111         else
21112              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
21113              exit 1
21114         fi
21115         ;;
21116     *)
21117         dtracexnolibs=$undef
21118         $dtrace -h -s ../perldtrace.d -o perldtrace.h
21119         ;;
21120     esac
21121     case $dtracexnolibs in
21122     $define) xnolibs=-xnolibs ;;
21123     *) xnolibs= ;;
21124     esac
21125
21126     case "$dtraceobject" in
21127     $define|true|[yY]*)
21128         dtraceobject=$define
21129         ;;
21130     ' '|'')
21131         $cat >try.c <<EOM
21132 #include "perldtrace.h"
21133 int main(void) {
21134     PERL_LOADED_FILE("dummy");
21135     return 0;
21136 }
21137 EOM
21138         dtraceobject=$undef
21139         if $cc -c -o try.o $optimize $ccflags try.c \
21140                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
21141                 dtraceobject=$define
21142             echo "Your dtrace builds an object file"
21143         fi
21144         ;;
21145     *) dtraceobject=$undef ;;
21146     esac
21147     $rm_try perldtrace.o perldtrace.h
21148 esac
21149
21150 : Determine if this is an EBCDIC system
21151 echo " "
21152 echo "Determining whether or not we are on an EBCDIC system..." >&4
21153 $cat >try.c <<'EOM'
21154 int main()
21155 {
21156   if ('M'==0xd4) return 0;
21157   return 1;
21158 }
21159 EOM
21160
21161 val=$undef
21162 set try
21163 if eval $compile_ok; then
21164         if $run ./try; then
21165                 echo "You seem to speak EBCDIC." >&4
21166                 val="$define"
21167         else
21168                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
21169         fi
21170 else
21171         echo "I'm unable to compile the test program." >&4
21172         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
21173 fi
21174 $rm_try
21175 set ebcdic
21176 eval $setvar
21177
21178 : Check how to flush
21179 echo " "
21180 $cat >&4 <<EOM
21181 Checking how to flush all pending stdio output...
21182 EOM
21183 # I only know how to find the first 32 possibly open files on SunOS.
21184 # See also hints/sunos_4_1.sh and util.c  --AD
21185 case "$osname" in
21186 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
21187 esac
21188 $cat >>try.c <<EOCP
21189 #include <stdio.h>
21190 #$i_stdlib I_STDLIB
21191 #ifdef I_STDLIB
21192 #include <stdlib.h>
21193 #endif
21194 #$i_unistd I_UNISTD
21195 #ifdef I_UNISTD
21196 # include <unistd.h>
21197 #endif
21198 #$d_sysconf HAS_SYSCONF
21199 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
21200 #ifdef HAS_STDIO_STREAM_ARRAY
21201 # define STDIO_STREAM_ARRAY $stdio_stream_array
21202 #endif
21203 int main() {
21204   FILE* p;
21205   unlink("try.out");
21206   p = fopen("try.out", "w");
21207 #ifdef TRY_FPUTC
21208   fputc('x', p);
21209 #else
21210 # ifdef TRY_FPRINTF
21211   fprintf(p, "x");
21212 # endif
21213 #endif
21214 #ifdef TRY_FFLUSH_NULL
21215   fflush(NULL);
21216 #endif
21217 #ifdef TRY_FFLUSH_ALL
21218   {
21219     long open_max = -1;
21220 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
21221     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
21222 # else
21223 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
21224     open_max = sysconf(_SC_OPEN_MAX);
21225 #  else
21226 #   ifdef FOPEN_MAX
21227     open_max = FOPEN_MAX;
21228 #   else
21229 #    ifdef OPEN_MAX
21230     open_max = OPEN_MAX;
21231 #    else
21232 #     ifdef _NFILE
21233     open_max = _NFILE;
21234 #     endif
21235 #    endif
21236 #   endif
21237 #  endif
21238 # endif
21239 # ifdef HAS_STDIO_STREAM_ARRAY
21240     if (open_max > 0) {
21241       long i;
21242       for (i = 0; i < open_max; i++)
21243             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
21244                 STDIO_STREAM_ARRAY[i]._file < open_max &&
21245                 STDIO_STREAM_ARRAY[i]._flag)
21246                 fflush(&STDIO_STREAM_ARRAY[i]);
21247     }
21248   }
21249 # endif
21250 #endif
21251   _exit(42);
21252 }
21253 EOCP
21254 : first we have to find out how _not_ to flush
21255 $to try.c
21256 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
21257     output=''
21258     set try -DTRY_FPUTC
21259     if eval $compile; then
21260             $run ./try 2>/dev/null
21261             code="$?"
21262             $from try.out
21263             if $test ! -s try.out -a "X$code" = X42; then
21264                 output=-DTRY_FPUTC
21265             fi
21266     fi
21267     case "$output" in
21268     '')
21269             set try -DTRY_FPRINTF
21270             if eval $compile; then
21271                     $run ./try 2>/dev/null
21272                     code="$?"
21273                     $from try.out
21274                     if $test ! -s try.out -a "X$code" = X42; then
21275                         output=-DTRY_FPRINTF
21276                     fi
21277             fi
21278         ;;
21279     esac
21280 fi
21281 : check for fflush NULL behavior
21282 case "$fflushNULL" in
21283 '')     set try -DTRY_FFLUSH_NULL $output
21284         if eval $compile; then
21285                 $run ./try 2>/dev/null
21286                 code="$?"
21287                 $from try.out
21288                 if $test -s try.out -a "X$code" = X42; then
21289                         fflushNULL="`$cat try.out`"
21290                 else
21291                         if $test "X$code" != X42; then
21292                                 $cat >&4 <<EOM
21293 (If this test failed, don't worry, we'll try another method shortly.)
21294 EOM
21295                         fi
21296                 fi
21297         fi
21298         $rm -f core try.core core.try.*
21299         case "$fflushNULL" in
21300         x)      $cat >&4 <<EOM
21301 Your fflush(NULL) works okay for output streams.
21302 Let's see if it clobbers input pipes...
21303 EOM
21304 # As of mid-March 2000 all versions of Solaris appear to have a stdio
21305 # bug that improperly flushes the input end of pipes.  So we avoid the
21306 # autoflush on fork/system/exec support for now. :-(
21307 $cat >tryp.c <<EOCP
21308 #include <stdio.h>
21309 int
21310 main(int argc, char **argv)
21311 {
21312     char buf[1024];
21313     int i;
21314     char *bp = buf;
21315     while (1) {
21316         while ((i = getc(stdin)) != -1
21317                && (*bp++ = i) != '\n'
21318                && bp < &buf[1024])
21319         /* DO NOTHING */ ;
21320         *bp = '\0';
21321         fprintf(stdout, "%s", buf);
21322         fflush(NULL);
21323         if (i == -1)
21324             return 0;
21325         bp = buf;
21326     }
21327 }
21328 EOCP
21329                 fflushNULL="$define"
21330                 set tryp
21331                 if eval $compile; then
21332                     $rm -f tryp.out
21333                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
21334                     if $test "X$targethost" != X; then
21335                         $to tryp.c
21336                         $to tryp
21337                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21338                     else
21339                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21340                     fi
21341                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
21342                        $cat >&4 <<EOM
21343 fflush(NULL) seems to behave okay with input streams.
21344 EOM
21345                         fflushNULL="$define"
21346                     else
21347                         $cat >&4 <<EOM
21348 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
21349 EOM
21350                         fflushNULL="$undef"
21351                     fi
21352                 fi
21353                 $rm -f core tryp.c tryp.core core.tryp.*
21354                 ;;
21355         '')     $cat >&4 <<EOM
21356 Your fflush(NULL) isn't working (contrary to ANSI C).
21357 EOM
21358                 fflushNULL="$undef"
21359                 ;;
21360         *)      $cat >&4 <<EOM
21361 Cannot figure out whether your fflush(NULL) works or not.
21362 I'm assuming it doesn't (contrary to ANSI C).
21363 EOM
21364                 fflushNULL="$undef"
21365                 ;;
21366         esac
21367         ;;
21368 $define|true|[yY]*)
21369         fflushNULL="$define"
21370         ;;
21371 *)
21372         fflushNULL="$undef"
21373         ;;
21374 esac
21375 : check explicit looping only if NULL did not work, and if the pipe
21376 : bug does not show up on an explicit flush too
21377 case "$fflushNULL" in
21378 "$undef")
21379         $cat >tryp.c <<EOCP
21380 #include <stdio.h>
21381 int
21382 main(int argc, char **argv)
21383 {
21384     char buf[1024];
21385     int i;
21386     char *bp = buf;
21387     while (1) {
21388         while ((i = getc(stdin)) != -1
21389                && (*bp++ = i) != '\n'
21390                && bp < &buf[1024])
21391         /* DO NOTHING */ ;
21392         *bp = '\0';
21393         fprintf(stdout, "%s", buf);
21394         fflush(stdin);
21395         if (i == -1)
21396             return 0;
21397         bp = buf;
21398     }
21399 }
21400 EOCP
21401         set tryp
21402         if eval $compile; then
21403             $rm -f tryp.out
21404             if $test "X$targethost" != X; then
21405                 $to tryp.c
21406                 $to tryp
21407                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21408             else
21409                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21410             fi
21411             if cmp tryp.c tryp.out >/dev/null 2>&1; then
21412                $cat >&4 <<EOM
21413 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21414 EOM
21415                 : now check for fflushall behaviour
21416                 case "$fflushall" in
21417                 '')     set try -DTRY_FFLUSH_ALL $output
21418                         if eval $compile; then
21419                                 $cat >&4 <<EOM
21420 (Now testing the other method--but note that this also may fail.)
21421 EOM
21422                                 $run ./try 2>/dev/null
21423                                 code=$?
21424                                 $from try.out
21425                                 if $test -s try.out -a "X$code" = X42; then
21426                                         fflushall="`$cat try.out`"
21427                                 fi
21428                         fi
21429                         $rm_try
21430                         case "$fflushall" in
21431                         x)      $cat >&4 <<EOM
21432 Whew. Flushing explicitly all the stdio streams works.
21433 EOM
21434                                 fflushall="$define"
21435                                 ;;
21436                         '')     $cat >&4 <<EOM
21437 Sigh. Flushing explicitly all the stdio streams doesn't work.
21438 EOM
21439                                 fflushall="$undef"
21440                                 ;;
21441                         *)      $cat >&4 <<EOM
21442 Cannot figure out whether flushing stdio streams explicitly works or not.
21443 I'm assuming it doesn't.
21444 EOM
21445                                 fflushall="$undef"
21446                                 ;;
21447                         esac
21448                         ;;
21449                 "$define"|true|[yY]*)
21450                         fflushall="$define"
21451                         ;;
21452                 *)
21453                         fflushall="$undef"
21454                         ;;
21455                 esac
21456             else
21457                 $cat >&4 <<EOM
21458 All is futile.  Even fflush(stdin) clobbers input pipes!
21459 EOM
21460                 fflushall="$undef"
21461             fi
21462         else
21463             fflushall="$undef"
21464         fi
21465         $rm -f core tryp.c tryp.core core.tryp.*
21466         ;;
21467 *)      fflushall="$undef"
21468         ;;
21469 esac
21470
21471 case "$fflushNULL$fflushall" in
21472 undefundef)
21473         $cat <<EOM
21474 OK, I give up.  I cannot figure out how to flush pending stdio output.
21475 We won't be flushing handles at all before fork/exec/popen.
21476 EOM
21477         ;;
21478 esac
21479 $rm_try tryp
21480
21481 : Store the full pathname to the ar program for use in the C program
21482 : Respect a hint or command line value for full_ar.
21483 case "$full_ar" in
21484 '') full_ar=$ar ;;
21485 esac
21486
21487 : Store the full pathname to the sed program for use in the C program
21488 full_sed=$sed
21489
21490 : see what type gids are declared as in the kernel
21491 echo " "
21492 echo "Looking for the type for group ids returned by getgid()."
21493 set gid_t gidtype xxx stdio.h sys/types.h
21494 eval $typedef
21495 case "$gidtype" in
21496 xxx)
21497         xxx=`./findhdr sys/user.h`
21498         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21499         case $1 in
21500         unsigned) dflt="$1 $2" ;;
21501         *) dflt="$1" ;;
21502         esac
21503         ;;
21504 *) dflt="$gidtype";;
21505 esac
21506 case "$gidtype" in
21507 gid_t) echo "gid_t found." ;;
21508 *)      rp="What is the type for group ids returned by getgid()?"
21509         . ./myread
21510         gidtype="$ans"
21511         ;;
21512 esac
21513
21514 : Check the size of GID
21515 echo " "
21516 case "$gidtype" in
21517 *_t) zzz="$gidtype"     ;;
21518 *)   zzz="gid"          ;;
21519 esac
21520 echo "Checking the size of $zzz..." >&4
21521 cat > try.c <<EOCP
21522 #include <sys/types.h>
21523 #include <stdio.h>
21524 #$i_stdlib I_STDLIB
21525 #ifdef I_STDLIB
21526 #include <stdlib.h>
21527 #endif
21528 int main() {
21529     printf("%d\n", (int)sizeof($gidtype));
21530     exit(0);
21531 }
21532 EOCP
21533 set try
21534 if eval $compile_ok; then
21535         yyy=`$run ./try`
21536         case "$yyy" in
21537         '')     gidsize=4
21538                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21539                 ;;
21540         *)      gidsize=$yyy
21541                 echo "Your $zzz is $gidsize bytes long."
21542                 ;;
21543         esac
21544 else
21545         gidsize=4
21546         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21547 fi
21548
21549 : Check if GID is signed
21550 echo " "
21551 case "$gidtype" in
21552 *_t) zzz="$gidtype"     ;;
21553 *)   zzz="gid"          ;;
21554 esac
21555 echo "Checking the sign of $zzz..." >&4
21556 cat > try.c <<EOCP
21557 #include <sys/types.h>
21558 #include <stdio.h>
21559 int main() {
21560         $gidtype foo = -1;
21561         if (foo < 0)
21562                 printf("-1\n");
21563         else
21564                 printf("1\n");
21565 }
21566 EOCP
21567 set try
21568 if eval $compile; then
21569         yyy=`$run ./try`
21570         case "$yyy" in
21571         '')     gidsign=1
21572                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21573                 ;;
21574         *)      gidsign=$yyy
21575                 case "$gidsign" in
21576                  1) echo "Your $zzz is unsigned." ;;
21577                 -1) echo "Your $zzz is signed."   ;;
21578                 esac
21579                 ;;
21580         esac
21581 else
21582         gidsign=1
21583         echo "(I can't compile the test program--guessing unsigned.)" >&4
21584 fi
21585
21586 : Check 64bit sizes
21587 echo " "
21588
21589 if $test X"$quadtype" != X; then
21590
21591 echo "Checking how to print 64-bit integers..." >&4
21592
21593 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21594         $cat >try.c <<'EOCP'
21595 #include <sys/types.h>
21596 #include <stdio.h>
21597 int main() {
21598   int q = 12345678901;
21599   printf("%ld\n", q);
21600 }
21601 EOCP
21602         set try
21603         if eval $compile; then
21604                 yyy=`$run ./try`
21605                 case "$yyy" in
21606                 12345678901)
21607                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21608                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21609                         echo "We will use %d."
21610                         ;;
21611                 esac
21612         fi
21613 fi
21614
21615 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21616         $cat >try.c <<'EOCP'
21617 #include <sys/types.h>
21618 #include <stdio.h>
21619 int main() {
21620   long q = 12345678901;
21621   printf("%ld\n", q);
21622 }
21623 EOCP
21624         set try
21625         if eval $compile; then
21626                 yyy=`$run ./try`
21627                 case "$yyy" in
21628                 12345678901)
21629                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21630                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21631                         echo "We will use %ld."
21632                         ;;
21633                 esac
21634         fi
21635 fi
21636
21637 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21638         $cat >try.c <<'EOCP'
21639 #include <sys/types.h>
21640 #include <inttypes.h>
21641 #include <stdio.h>
21642 int main() {
21643   int64_t q = 12345678901;
21644   printf("%" PRId64 "\n", q);
21645 }
21646 EOCP
21647         set try
21648         if eval $compile; then
21649                 yyy=`$run ./try`
21650                 case "$yyy" in
21651                 12345678901)
21652                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21653                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIX64;
21654                         echo "We will use the C9X style."
21655                         ;;
21656                 esac
21657         fi
21658 fi
21659
21660 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21661         $cat >try.c <<EOCP
21662 #include <sys/types.h>
21663 #include <stdio.h>
21664 int main() {
21665   $quadtype q = 12345678901;
21666   printf("%Ld\n", q);
21667 }
21668 EOCP
21669         set try
21670         if eval $compile; then
21671                 yyy=`$run ./try`
21672                 case "$yyy" in
21673                 12345678901)
21674                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21675                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21676                         echo "We will use %Ld."
21677                         ;;
21678                 esac
21679         fi
21680 fi
21681
21682 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21683         $cat >try.c <<'EOCP'
21684 #include <sys/types.h>
21685 #include <stdio.h>
21686 int main() {
21687   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21688   printf("%lld\n", q);
21689 }
21690 EOCP
21691         set try
21692         if eval $compile; then
21693                 yyy=`$run ./try`
21694                 case "$yyy" in
21695                 12345678901)
21696                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21697                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21698                         echo "We will use the %lld style."
21699                         ;;
21700                 esac
21701         fi
21702 fi
21703
21704 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21705         $cat >try.c <<EOCP
21706 #include <sys/types.h>
21707 #include <stdio.h>
21708 int main() {
21709   $quadtype q = 12345678901;
21710   printf("%qd\n", q);
21711 }
21712 EOCP
21713         set try
21714         if eval $compile; then
21715                 yyy=`$run ./try`
21716                 case "$yyy" in
21717                 12345678901)
21718                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21719                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21720                         echo "We will use %qd."
21721                         ;;
21722                 esac
21723         fi
21724 fi
21725
21726 if $test X"$sPRId64" = X; then
21727         echo "Cannot figure out how to print 64-bit integers." >&4
21728 fi
21729 $rm_try
21730
21731 fi
21732
21733 case "$sPRId64" in
21734 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21735         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21736         ;;
21737 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21738         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21739         ;;
21740 esac
21741
21742 : Check format strings for internal types
21743 echo " "
21744 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21745
21746 if $test X"$ivsize" = X8; then
21747         ivdformat="$sPRId64"
21748         uvuformat="$sPRIu64"
21749         uvoformat="$sPRIo64"
21750         uvxformat="$sPRIx64"
21751         uvXUformat="$sPRIXU64"
21752 else
21753         if $test X"$ivsize" = X"$longsize"; then
21754                 ivdformat='"ld"'
21755                 uvuformat='"lu"'
21756                 uvoformat='"lo"'
21757                 uvxformat='"lx"'
21758                 uvXUformat='"lX"'
21759         else
21760                 if $test X"$ivsize" = X"$intsize"; then
21761                         ivdformat='"d"'
21762                         uvuformat='"u"'
21763                         uvoformat='"o"'
21764                         uvxformat='"x"'
21765                         uvXUformat='"X"'
21766                 else
21767                         : far out
21768                         if $test X"$ivsize" = X"$shortsize"; then
21769                                 ivdformat='"hd"'
21770                                 uvuformat='"hu"'
21771                                 uvoformat='"ho"'
21772                                 uvxformat='"hx"'
21773                                 uvXUformat='"hX"'
21774                         fi
21775                 fi
21776         fi
21777 fi
21778
21779 if $test X"$usequadmath" = X"$define"; then
21780     nveformat='"Qe"'
21781     nvfformat='"Qf"'
21782     nvgformat='"Qg"'
21783     nvEUformat='"QE"'
21784     nvFUformat='"QF"'
21785     nvGUformat='"QG"'
21786 else
21787     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21788         nveformat="$sPRIeldbl"
21789         nvfformat="$sPRIfldbl"
21790         nvgformat="$sPRIgldbl"
21791         nvEUformat="$sPRIEUldbl"
21792         nvFUformat="$sPRIFUldbl"
21793         nvGUformat="$sPRIGUldbl"
21794     else
21795         nveformat='"e"'
21796         nvfformat='"f"'
21797         nvgformat='"g"'
21798         nvEUformat='"E"'
21799         nvFUformat='"F"'
21800         nvGUformat='"G"'
21801     fi
21802 fi
21803
21804 case "$ivdformat" in
21805 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21806     exit 1
21807     ;;
21808 esac
21809
21810 : Check format string for GID
21811
21812 echo " "
21813 $echo "Checking the format string to be used for gids..." >&4
21814
21815 case "$gidsign" in
21816 -1)     if $test X"$gidsize" = X"$ivsize"; then
21817                 gidformat="$ivdformat"
21818         else
21819                 if $test X"$gidsize" = X"$longsize"; then
21820                         gidformat='"ld"'
21821                 else
21822                         if $test X"$gidsize" = X"$intsize"; then
21823                                 gidformat='"d"'
21824                         else
21825                                 if $test X"$gidsize" = X"$shortsize"; then
21826                                         gidformat='"hd"'
21827                                 fi
21828                         fi
21829                 fi
21830         fi
21831         ;;
21832 *)      if $test X"$gidsize" = X"$uvsize"; then
21833                 gidformat="$uvuformat"
21834         else
21835                 if $test X"$gidsize" = X"$longsize"; then
21836                         gidformat='"lu"'
21837                 else
21838                         if $test X"$gidsize" = X"$intsize"; then
21839                                 gidformat='"u"'
21840                         else
21841                                 if $test X"$gidsize" = X"$shortsize"; then
21842                                         gidformat='"hu"'
21843                                 fi
21844                         fi
21845                 fi
21846         fi
21847         ;;
21848 esac
21849
21850 : see if getgroups exists
21851 set getgroups d_getgrps
21852 eval $inlibc
21853
21854 : see if setgroups exists
21855 set setgroups d_setgrps
21856 eval $inlibc
21857
21858 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21859 echo " "
21860 case "$d_getgrps$d_setgrps" in
21861 *define*)
21862         case "$groupstype" in
21863         '') dflt="$gidtype" ;;
21864         *)  dflt="$groupstype" ;;
21865         esac
21866         $cat <<EOM
21867 What type of pointer is the second argument to getgroups() and setgroups()?
21868 Usually this is the same as group ids, $gidtype, but not always.
21869
21870 EOM
21871         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21872         . ./myread
21873         groupstype="$ans"
21874         ;;
21875 *)  groupstype="$gidtype";;
21876 esac
21877
21878 : check whether make sets MAKE
21879 echo " "
21880 echo "Checking if your $make program sets \$(MAKE)..." >&4
21881 case "$make_set_make" in
21882 '')
21883         $sed 's/^X //' > testmake.mak << 'EOF'
21884 Xall:
21885 X       @echo 'maketemp="$(MAKE)"'
21886 EOF
21887         case "`$make -f testmake.mak 2>/dev/null`" in
21888         *maketemp=*) make_set_make='#' ;;
21889         *)      make_set_make="MAKE=$make" ;;
21890         esac
21891         $rm -f testmake.mak
21892         ;;
21893 esac
21894 case "$make_set_make" in
21895 '#') echo "Yup, it does.";;
21896 *) echo "Nope, it doesn't.";;
21897 esac
21898
21899 : see what type is used for mode_t
21900 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21901 set mode_t modetype int stdio.h sys/types.h
21902 eval $typedef_ask
21903
21904 : see if we need va_copy
21905 echo " "
21906 $cat >try.c <<EOCP
21907 #include <stdarg.h>
21908 #include <stdio.h>
21909 #include <stdlib.h>
21910 #include <signal.h>
21911
21912 int
21913 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21914 {
21915   return vfprintf(f, fmt, *valp);
21916 }
21917
21918 int
21919 myvfprintf(FILE *f, const  char *fmt, va_list val)
21920 {
21921   return ivfprintf(f, fmt, &val);
21922 }
21923
21924 int
21925 myprintf(char *fmt, ...)
21926 {
21927   va_list val;
21928   va_start(val, fmt);
21929   return myvfprintf(stdout, fmt, val);
21930 }
21931
21932 int
21933 main(int ac, char **av)
21934 {
21935   signal(SIGSEGV, exit);
21936 #ifdef SIGBUS
21937   signal(SIGBUS,  exit);
21938 #endif
21939
21940   myprintf("%s%cs all right, then\n", "that", '\'');
21941   exit(0);
21942 }
21943 EOCP
21944 set try
21945 if eval $compile && $run ./try 2>&1 >/dev/null; then
21946         case "`$run ./try`" in
21947         "that's all right, then")
21948                 okay=yes
21949                 ;;
21950         esac
21951 fi
21952 case "$okay" in
21953 yes)    echo "It seems that you don't need va_copy()." >&4
21954         need_va_copy="$undef"
21955         ;;
21956 *)      echo "It seems that va_copy() or similar will be needed." >&4
21957         need_va_copy="$define"
21958         ;;
21959 esac
21960 $rm_try
21961
21962 : see what type is used for size_t
21963 rp="What is the type used for the length parameter for string functions?"
21964 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21965 eval $typedef_ask
21966
21967 : check for type of arguments to gethostbyaddr.
21968 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21969         case "$d_gethbyaddr" in
21970         $define)
21971                 $cat <<EOM
21972
21973 Checking to see what type of arguments are accepted by gethostbyaddr().
21974 EOM
21975                 hdrs="$define sys/types.h
21976                         $d_socket sys/socket.h
21977                         $i_niin netinet/in.h
21978                         $i_netdb netdb.h
21979                         $i_unistd unistd.h"
21980                 : The first arg can 'char *' or 'void *'
21981                 : The second arg is some of integral type
21982                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21983                         for yyy in size_t long int; do
21984                                 case "$netdb_host_type" in
21985                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21986                                         if ./protochk "$try" $hdrs; then
21987                                                 echo "Your system accepts $xxx for the first arg."
21988                                                 echo "...and $yyy for the second arg."
21989                                                 netdb_host_type="$xxx"
21990                                                 netdb_hlen_type="$yyy"
21991                                         fi
21992                                         ;;
21993                                 esac
21994                         done
21995                 done
21996                 : In case none of those worked, prompt the user.
21997                 case "$netdb_host_type" in
21998                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21999                         dflt='char *'
22000                         . ./myread
22001                         netdb_host_type=$ans
22002                         rp='What is the type for the 2nd argument to gethostbyaddr?'
22003                         dflt="$sizetype"
22004                         . ./myread
22005                         netdb_hlen_type=$ans
22006                         ;;
22007                 esac
22008                 ;;
22009         *)      : no gethostbyaddr, so pick harmless defaults
22010                 netdb_host_type='char *'
22011                 netdb_hlen_type="$sizetype"
22012                 ;;
22013         esac
22014         # Remove the "const" if needed. -- but then we'll have a
22015         # prototype clash!
22016         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
22017 fi
22018
22019 : check for type of argument to gethostbyname.
22020 if test "X$netdb_name_type" = X ; then
22021         case "$d_gethbyname" in
22022         $define)
22023                 $cat <<EOM
22024
22025 Checking to see what type of argument is accepted by gethostbyname().
22026 EOM
22027                 hdrs="$define sys/types.h
22028                         $d_socket sys/socket.h
22029                         $i_niin netinet/in.h
22030                         $i_netdb netdb.h
22031                         $i_unistd unistd.h"
22032                 for xxx in "const char *" "char *"; do
22033                         case "$netdb_name_type" in
22034                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
22035                                 if ./protochk "$try" $hdrs; then
22036                                         echo "Your system accepts $xxx."
22037                                         netdb_name_type="$xxx"
22038                                 fi
22039                                 ;;
22040                         esac
22041                 done
22042                 : In case none of those worked, prompt the user.
22043                 case "$netdb_name_type" in
22044                 '')     rp='What is the type for the 1st argument to gethostbyname?'
22045                         dflt='char *'
22046                         . ./myread
22047                         netdb_name_type=$ans
22048                         ;;
22049                 esac
22050                 ;;
22051         *)      : no gethostbyname, so pick harmless default
22052                 netdb_name_type='char *'
22053                 ;;
22054         esac
22055 fi
22056
22057 : check for type of 1st argument to getnetbyaddr.
22058 if test "X$netdb_net_type" = X ; then
22059         case "$d_getnbyaddr" in
22060         $define)
22061                 $cat <<EOM
22062
22063 Checking to see what type of 1st argument is accepted by getnetbyaddr().
22064 EOM
22065                 hdrs="$define sys/types.h
22066                         $d_socket sys/socket.h
22067                         $i_niin netinet/in.h
22068                         $i_netdb netdb.h
22069                         $i_unistd unistd.h"
22070                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
22071                         case "$netdb_net_type" in
22072                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
22073                                 if ./protochk "$try" $hdrs; then
22074                                         echo "Your system accepts $xxx."
22075                                         netdb_net_type="$xxx"
22076                                 fi
22077                                 ;;
22078                         esac
22079                 done
22080                 : In case none of those worked, prompt the user.
22081                 case "$netdb_net_type" in
22082                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
22083                         dflt='long'
22084                         . ./myread
22085                         netdb_net_type=$ans
22086                         ;;
22087                 esac
22088                 ;;
22089         *)      : no getnetbyaddr, so pick harmless default
22090                 netdb_net_type='long'
22091                 ;;
22092         esac
22093 fi
22094 : locate the preferred pager for this system
22095 fn=f/
22096 case "$pager" in
22097 '')
22098         dflt=''
22099         case "$pg" in
22100         /*) dflt=$pg;;
22101         [a-zA-Z]:/*) dflt=$pg;;
22102         esac
22103         case "$more" in
22104         /*) dflt=$more;;
22105         [a-zA-Z]:/*) dflt=$more;;
22106         esac
22107         case "$less" in
22108         /*) dflt=$less;;
22109         [a-zA-Z]:/*) dflt=$less;;
22110         esac
22111         case "$dflt" in
22112         '') dflt=/usr/ucb/more;;
22113         esac
22114         ;;
22115 *)      dflt="$pager"
22116         ;;
22117 esac
22118 fn="f/($dflt)"
22119 echo " "
22120 rp='What pager is used on your system?'
22121 . ./getfile
22122 pager="$ans"
22123
22124 : see if ar generates random libraries by itself
22125 echo " "
22126 echo "Checking how to generate random libraries on your machine..." >&4
22127 echo 'int bar1() { return bar2(); }' > bar1.c
22128 echo 'int bar2() { return 2; }' > bar2.c
22129 $cat > foo.c <<EOP
22130 #$i_stdlib I_STDLIB
22131 #ifdef I_STDLIB
22132 #include <stdlib.h>
22133 #endif
22134 int main() { printf("%d\n", bar1()); exit(0); }
22135 EOP
22136 $cc $ccflags -c bar1.c >/dev/null 2>&1
22137 $cc $ccflags -c bar2.c >/dev/null 2>&1
22138 $cc $ccflags -c foo.c >/dev/null 2>&1
22139 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
22140 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22141         $run ./foobar >/dev/null 2>&1; then
22142         echo "$ar appears to generate random libraries itself."
22143         orderlib=false
22144         if [ "X$ranlib" = "X" ]; then
22145             ranlib=":"
22146         fi
22147 elif $ar s bar$_a >/dev/null 2>&1 &&
22148         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22149         $run ./foobar >/dev/null 2>&1; then
22150                 echo "a table of contents needs to be added with '$ar s'."
22151                 orderlib=false
22152                 ranlib="$ar s"
22153 elif $ar ts bar$_a >/dev/null 2>&1 &&
22154         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22155         $run ./foobar >/dev/null 2>&1; then
22156                 echo "a table of contents needs to be added with '$ar ts'."
22157                 orderlib=false
22158                 ranlib="$ar ts"
22159 else
22160         case "$ranlib" in
22161         :) ranlib='';;
22162         '')
22163                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
22164                 $test -f $ranlib || ranlib=''
22165                 ;;
22166         esac
22167         if $test -n "$ranlib"; then
22168                 echo "your system has '$ranlib'; we'll use that."
22169                 orderlib=false
22170         else
22171                 echo "your system doesn't seem to support random libraries"
22172                 echo "so we'll use lorder and tsort to order the libraries."
22173                 orderlib=true
22174                 ranlib=":"
22175         fi
22176 fi
22177 $rm -f foo* bar*
22178
22179 : Check the max offset that gmtime and localtime accept
22180 echo "Checking max offsets that gmtime () accepts"
22181
22182 case "$sGMTIME_min/$sGMTIME_max" in
22183     0/0|/)
22184         $cat >try.c <<EOCP
22185 #include <sys/types.h>
22186 #include <stdio.h>
22187 #include <time.h>
22188
22189 int i;
22190 struct tm *tmp;
22191 time_t pt;
22192
22193 void gm_check (time_t t, int min_year, int max_year)
22194 {
22195     tmp = gmtime (&t);
22196     if ( tmp == NULL ||
22197         /* Check tm_year overflow */
22198          tmp->tm_year < min_year || tmp->tm_year > max_year)
22199         tmp = NULL;
22200     else
22201         pt = t;
22202     } /* gm_check */
22203
22204 int check_max ()
22205 {
22206     tmp = NULL;
22207     pt  = 0;
22208 #ifdef MAXLONG
22209     gm_check (MAXLONG, 69, 0x7fffffff);
22210 #endif
22211     if (tmp == NULL || tmp->tm_year < 0) {
22212         for (i = 63; i >= 0; i--) {
22213             time_t x = pt | ((time_t)1 << i);
22214             if (x < 0 || x < pt) continue;
22215             gm_check (x, 69, 0x7fffffff);
22216             }
22217         }
22218     printf ("sGMTIME_max=%ld\n", pt);
22219     return (0);
22220     } /* check_max */
22221
22222 int check_min ()
22223 {
22224     tmp = NULL;
22225     pt  = 0;
22226 #ifdef MINLONG
22227     gm_check (MINLONG, -1900, 70);
22228 #endif
22229     if (tmp == NULL) {
22230         for (i = 36; i >= 0; i--) {
22231             time_t x = pt - ((time_t)1 << i);
22232             if (x > 0) continue;
22233             gm_check (x, -1900, 70);
22234             }
22235         }
22236     printf ("sGMTIME_min=%ld\n", pt);
22237     return (0);
22238     } /* check_min */
22239
22240 int main (int argc, char *argv[])
22241 {
22242     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
22243     check_max ();
22244     check_min ();
22245     return (0);
22246     } /* main */
22247 EOCP
22248         set try
22249         if eval $compile; then
22250             eval `$run ./try 2>/dev/null`
22251         else
22252             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
22253             fi
22254         $rm_try
22255         ;;
22256     esac
22257
22258 echo "Checking max offsets that localtime () accepts"
22259
22260 case "$sLOCALTIME_min/$sLOCALTIME_max" in
22261     0/0|/)
22262         $cat >try.c <<EOCP
22263 #include <sys/types.h>
22264 #include <stdio.h>
22265 #include <time.h>
22266
22267 int i;
22268 struct tm *tmp;
22269 time_t pt;
22270
22271 void local_check (time_t t, int min_year, int max_year)
22272 {
22273     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
22274         tmp = NULL;
22275     else
22276         tmp = localtime (&t);
22277     if ( tmp == NULL ||
22278         /* Check tm_year overflow */
22279          tmp->tm_year < min_year || tmp->tm_year > max_year)
22280         tmp = NULL;
22281     else
22282         pt = t;
22283     } /* local_check */
22284
22285 int check_max ()
22286 {
22287     tmp = NULL;
22288     pt  = 0;
22289 #ifdef MAXLONG
22290     local_check (MAXLONG, 69, 0x7fffffff);
22291 #endif
22292     if (tmp == NULL || tmp->tm_year < 0) {
22293         for (i = 63; i >= 0; i--) {
22294             time_t x = pt | ((time_t)1 << i);
22295             if (x < 0 || x < pt) continue;
22296             local_check (x, 69, 0x7fffffff);
22297             }
22298         }
22299     printf ("sLOCALTIME_max=%ld\n", pt);
22300     return (0);
22301    } /* check_max */
22302
22303 int check_min ()
22304 {
22305     tmp = NULL;
22306     pt  = 0;
22307 #ifdef MINLONG
22308     local_check (MINLONG, -1900, 70);
22309 #endif
22310     if (tmp == NULL) {
22311         for (i = 36; i >= 0; i--) {
22312             time_t x = pt - ((time_t)1 << i);
22313             if (x > 0) continue;
22314             local_check (x, -1900, 70);
22315             }
22316         }
22317     printf ("sLOCALTIME_min=%ld\n", pt);
22318     return (0);
22319     } /* check_min */
22320
22321 int main (int argc, char *argv[])
22322 {
22323     check_max ();
22324     check_min ();
22325     return (0);
22326     } /* main */
22327 EOCP
22328         set try
22329         if eval $compile; then
22330             eval `$run ./try 2>/dev/null`
22331         else
22332             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
22333             fi
22334         $rm_try
22335         ;;
22336     esac
22337
22338 : check for type of arguments to select.
22339 case "$selecttype" in
22340 '') case "$d_select" in
22341         $define)
22342                 echo " "
22343                 $cat <<EOM
22344 Checking to see what type of arguments are accepted by select().
22345 EOM
22346                 hdrs="$define sys/types.h
22347                         $i_systime sys/time.h
22348                         $i_sysselct sys/select.h
22349                         $d_socket sys/socket.h"
22350                 : The first arg can be int, unsigned, or size_t
22351                 : The last arg may or may not be 'const'
22352                 val=''
22353                 : void pointer has been seen but using that
22354                 : breaks the selectminbits test
22355                 for xxx in 'fd_set *' 'int *'; do
22356                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
22357                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
22358                                         case "$val" in
22359                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
22360                                                 if ./protochk "$try" $hdrs; then
22361                                                         echo "Your system accepts $xxx."
22362                                                         val="$xxx"
22363                                                 fi
22364                                                 ;;
22365                                         esac
22366                                 done
22367                         done
22368                 done
22369                 case "$val" in
22370                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22371                         case "$d_fd_set" in
22372                                 $define) dflt="fd_set *" ;;
22373                                 *)              dflt="int *" ;;
22374                         esac
22375                         . ./myread
22376                         val=$ans
22377                         ;;
22378                 esac
22379                 selecttype="$val"
22380                 ;;
22381         *)      : no select, so pick a harmless default
22382                 selecttype='int *'
22383                 ;;
22384         esac
22385         ;;
22386 esac
22387
22388 : check for the select 'width'
22389 case "$selectminbits" in
22390 '') safebits=`expr $ptrsize \* 8`
22391     case "$d_select" in
22392         $define)
22393                 $cat <<EOM
22394
22395 Checking to see on how many bits at a time your select() operates...
22396 EOM
22397                 $cat >try.c <<EOCP
22398 #include <sys/types.h>
22399 #$i_time I_TIME
22400 #$i_systime I_SYS_TIME
22401 #$i_systimek I_SYS_TIME_KERNEL
22402 #ifdef I_TIME
22403 #   include <time.h>
22404 #endif
22405 #ifdef I_SYS_TIME
22406 #   ifdef I_SYS_TIME_KERNEL
22407 #       define KERNEL
22408 #   endif
22409 #   include <sys/time.h>
22410 #   ifdef I_SYS_TIME_KERNEL
22411 #       undef KERNEL
22412 #   endif
22413 #endif
22414 #$i_sysselct I_SYS_SELECT
22415 #ifdef I_SYS_SELECT
22416 #include <sys/select.h>
22417 #endif
22418 #$d_socket HAS_SOCKET
22419 #ifdef HAS_SOCKET
22420 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22421 #endif
22422 #include <stdio.h>
22423 #$i_stdlib I_STDLIB
22424 #ifdef I_STDLIB
22425 #include <stdlib.h>
22426 #endif
22427 $selecttype b;
22428 #define S sizeof(*(b))
22429 #define MINBITS 64
22430 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22431 #define NBITS  (NBYTES * 8)
22432 int main() {
22433     char *s = (char *)malloc(NBYTES);
22434     struct timeval t;
22435     int i;
22436     FILE* fp;
22437     int fd;
22438
22439     if (!s)
22440         exit(1);
22441     fclose(stdin);
22442     fp = fopen("try.c", "r");
22443     if (fp == 0)
22444       exit(2);
22445     fd = fileno(fp);
22446     if (fd < 0)
22447       exit(3);
22448     b = ($selecttype)s;
22449     for (i = 0; i < NBITS; i++)
22450         FD_SET(i, b);
22451     t.tv_sec  = 0;
22452     t.tv_usec = 0;
22453     select(fd + 1, b, 0, 0, &t);
22454     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22455     free(s);
22456     printf("%d\n", i + 1);
22457     return 0;
22458 }
22459 EOCP
22460                 set try
22461                 if eval $compile_ok; then
22462                         selectminbits=`$run ./try 2>/dev/null`
22463                         case "$selectminbits" in
22464                         '')     cat >&4 <<EOM
22465 Cannot figure out on how many bits at a time your select() operates.
22466 I'll play safe and guess it is $safebits bits.
22467 EOM
22468                                 selectminbits=$safebits
22469                                 bits="$safebits bits"
22470                                 ;;
22471                         1)      bits="1 bit" ;;
22472                         *)      bits="$selectminbits bits" ;;
22473                         esac
22474                         echo "Your select() operates on $bits at a time." >&4
22475                 else
22476                         rp='What is the minimum number of bits your select() operates on?'
22477                         case "$byteorder" in
22478                         12345678)       dflt=64 ;;
22479                         1234)           dflt=32 ;;
22480                         *)              dflt=1  ;;
22481                         esac
22482                         . ./myread
22483                         val=$ans
22484                         selectminbits="$val"
22485                 fi
22486                 $rm_try
22487                 ;;
22488         *)      : no select, so pick a harmless default
22489                 selectminbits=$safebits
22490                 ;;
22491         esac
22492         ;;
22493 esac
22494
22495 : Trace out the files included by signal.h, then look for SIGxxx names.
22496 case "$sig_num_init" in
22497 '')
22498 if [ "X$fieldn" = X ]; then
22499         : Just make some guesses.  We check them later.
22500         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22501 else
22502         xxx=`echo '#include <signal.h>' |
22503         $cppstdin $cppminus $cppflags 2>/dev/null |
22504         $grep '^[       ]*#.*include' |
22505         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22506                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22507 fi
22508 xxxfiles=''
22509 for xx in $xxx /dev/null ; do
22510         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22511 done
22512 case "$xxxfiles" in
22513 '')     xxxfiles=`./findhdr signal.h` ;;
22514 esac
22515 xxx=`awk '
22516 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22517         print substr($2, 4, 20)
22518 }
22519 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22520         print substr($3, 4, 20)
22521 }' $xxxfiles`
22522 : Append some common names just in case the awk scan failed.
22523 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22524 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22525 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22526 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22527 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22528
22529 : generate a few handy files for later
22530 $cat > signal.c <<EOCP
22531 #include <sys/types.h>
22532 #include <signal.h>
22533 #$i_stdlib I_STDLIB
22534 #ifdef I_STDLIB
22535 #include <stdlib.h>
22536 #endif
22537 #include <stdio.h>
22538 int main() {
22539
22540 /* Strange style to avoid deeply-nested #if/#else/#endif */
22541 #ifndef NSIG
22542 #  ifdef _NSIG
22543 #    define NSIG (_NSIG)
22544 #  endif
22545 #endif
22546
22547 #ifndef NSIG
22548 #  ifdef SIGMAX
22549 #    define NSIG (SIGMAX+1)
22550 #  endif
22551 #endif
22552
22553 #ifndef NSIG
22554 #  ifdef SIG_MAX
22555 #    define NSIG (SIG_MAX+1)
22556 #  endif
22557 #endif
22558
22559 #ifndef NSIG
22560 #  ifdef _SIG_MAX
22561 #    define NSIG (_SIG_MAX+1)
22562 #  endif
22563 #endif
22564
22565 #ifndef NSIG
22566 #  ifdef MAXSIG
22567 #    define NSIG (MAXSIG+1)
22568 #  endif
22569 #endif
22570
22571 #ifndef NSIG
22572 #  ifdef MAX_SIG
22573 #    define NSIG (MAX_SIG+1)
22574 #  endif
22575 #endif
22576
22577 #ifndef NSIG
22578 #  ifdef SIGARRAYSIZE
22579 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22580 #  endif
22581 #endif
22582
22583 #ifndef NSIG
22584 #  ifdef _sys_nsig
22585 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22586 #  endif
22587 #endif
22588
22589 /* Default to some arbitrary number that's big enough to get most
22590    of the common signals.
22591 */
22592 #ifndef NSIG
22593 #    define NSIG 50
22594 #endif
22595
22596 printf("NSIG %d\n", NSIG);
22597
22598 #ifndef JUST_NSIG
22599
22600 EOCP
22601
22602 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22603 {
22604         printf "#ifdef SIG"; printf $1; printf "\n"
22605         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22606         printf $1; printf ");\n"
22607         printf "#endif\n"
22608 }
22609 END {
22610         printf "#endif /* JUST_NSIG */\n";
22611         printf "exit(0);\n}\n";
22612 }
22613 ' >>signal.c
22614 $cat >signal.awk <<'EOP'
22615 BEGIN { ndups = 0 }
22616 $1 ~ /^NSIG$/ { nsig = $2 }
22617 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22618     if ($2 > maxsig) { maxsig = $2 }
22619     if (sig_name[$2]) {
22620         dup_name[ndups] = $1
22621         dup_num[ndups] = $2
22622         ndups++
22623     }
22624     else {
22625         sig_name[$2] = $1
22626         sig_num[$2] = $2
22627     }
22628 }
22629 END {
22630     if (nsig == 0) {
22631         nsig = maxsig + 1
22632     }
22633     printf("NSIG %d\n", nsig);
22634     for (n = 1; n < nsig; n++) {
22635         if (sig_name[n]) {
22636             printf("%s %d\n", sig_name[n], sig_num[n])
22637         }
22638         else {
22639             printf("NUM%d %d\n", n, n)
22640         }
22641     }
22642     for (n = 0; n < ndups; n++) {
22643         printf("%s %d\n", dup_name[n], dup_num[n])
22644     }
22645 }
22646 EOP
22647 $cat >signal_cmd <<EOS
22648 $startsh
22649 if $test -s signal.lst; then
22650     echo "Using your existing signal.lst file"
22651         exit 0
22652 fi
22653 xxx="$xxx"
22654 EOS
22655 $cat >>signal_cmd <<'EOS'
22656
22657 set signal
22658 if eval $compile_ok; then
22659         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22660                 $uniq | $awk -f signal.awk >signal.lst
22661 else
22662         echo "(I can't seem be able to compile the whole test program)" >&4
22663         echo "(I'll try it in little pieces.)" >&4
22664         set signal -DJUST_NSIG
22665         if eval $compile_ok; then
22666                 $run ./signal$_exe > signal.nsg
22667                 $cat signal.nsg
22668         else
22669                 echo "I can't seem to figure out how many signals you have." >&4
22670                 echo "Guessing 50." >&4
22671                 echo 'NSIG 50' > signal.nsg
22672         fi
22673         : Now look at all the signal names, one at a time.
22674         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22675                 $cat > signal.c <<EOCP
22676 #include <sys/types.h>
22677 #include <signal.h>
22678 #include <stdio.h>
22679 int main() {
22680 printf("$xx %d\n", SIG${xx});
22681 return 0;
22682 }
22683 EOCP
22684                 set signal
22685                 if eval $compile; then
22686                         echo "SIG${xx} found."
22687                         $run ./signal$_exe  >> signal.ls1
22688                 else
22689                         echo "SIG${xx} NOT found."
22690                 fi
22691         done
22692         if $test -s signal.ls1; then
22693                 $cat signal.nsg signal.ls1 |
22694                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22695         fi
22696
22697 fi
22698 if $test -s signal.lst; then
22699         :
22700 else
22701         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22702         echo 'kill -l' >signal
22703         set X `csh -f <signal`
22704         $rm -f signal
22705         shift
22706         case $# in
22707         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22708         esac
22709         echo $@ | $tr ' ' $trnl | \
22710             $awk '{ printf "%s %d\n", $1, ++s; }
22711                   END { printf "NSIG %d\n", ++s }' >signal.lst
22712 fi
22713 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22714 EOS
22715 chmod a+x signal_cmd
22716 $eunicefix signal_cmd
22717 ;;
22718 esac
22719
22720 : generate list of signal names
22721 case "$sig_num_init" in
22722 '')
22723 echo " "
22724 case "$sig_name_init" in
22725 '') doinit=yes ;;
22726 *)  case "$sig_num_init" in
22727     ''|*,*) doinit=yes ;;
22728     esac ;;
22729 esac
22730 case "$doinit" in
22731 yes)
22732         echo "Generating a list of signal names and numbers..." >&4
22733         . ./signal_cmd
22734         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22735         sig_name=`$awk 'BEGIN { printf "ZERO " }
22736                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22737         sig_num=`$awk  'BEGIN { printf "0 " }
22738                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22739         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22740                              !/^NSIG/   { printf "\"%s\", ", $1 }
22741                              END        { printf "0\n" }' signal.lst`
22742         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22743                              !/^NSIG/   { printf "%d, ", $2}
22744                              END        { printf "0\n"}' signal.lst`
22745         ;;
22746 esac
22747 echo "The following $sig_count signals are available:"
22748 echo " "
22749 echo $sig_name | $awk \
22750 'BEGIN { linelen = 0 }
22751 {
22752         for (i = 1; i <= NF; i++) {
22753                 name = "SIG" $i " "
22754                 linelen = linelen + length(name)
22755                 if (linelen > 70) {
22756                         printf "\n"
22757                         linelen = length(name)
22758                 }
22759                 printf "%s", name
22760         }
22761         printf "\n"
22762 }'
22763 sig_size=`echo $sig_name | awk '{print NF}'`
22764 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22765 ;;
22766 esac
22767
22768 : Check size of size
22769 echo " "
22770 case "$sizetype" in
22771 *_t) zzz="$sizetype"    ;;
22772 *)   zzz="filesize"     ;;
22773 esac
22774 echo "Checking the size of $zzz..." >&4
22775 cat > try.c <<EOCP
22776 #include <sys/types.h>
22777 #include <stdio.h>
22778 #$i_stdlib I_STDLIB
22779 #ifdef I_STDLIB
22780 #include <stdlib.h>
22781 #endif
22782 int main() {
22783     printf("%d\n", (int)sizeof($sizetype));
22784     exit(0);
22785 }
22786 EOCP
22787 set try
22788 if eval $compile_ok; then
22789         yyy=`$run ./try`
22790         case "$yyy" in
22791         '')     sizesize=4
22792                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22793                 ;;
22794         *)      sizesize=$yyy
22795                 echo "Your $zzz size is $sizesize bytes."
22796                 ;;
22797         esac
22798 else
22799         sizesize=4
22800         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22801 fi
22802
22803 : check for socklen_t
22804 echo " "
22805 echo "Checking to see if you have socklen_t..." >&4
22806 $cat >try.c <<EOCP
22807 #include <sys/types.h>
22808 #$d_socket HAS_SOCKET
22809 #ifdef HAS_SOCKET
22810 #include <sys/socket.h>
22811 #endif
22812 int main() { socklen_t x = 16; }
22813 EOCP
22814 set try
22815 if eval $compile; then
22816         val="$define"
22817         echo "You have socklen_t."
22818 else
22819         val="$undef"
22820         echo "You do not have socklen_t."
22821         case "$sizetype" in
22822         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22823         esac
22824 fi
22825 $rm_try
22826 set d_socklen_t
22827 eval $setvar
22828
22829 : see if this is a socks.h system
22830 set socks.h i_socks
22831 eval $inhdr
22832
22833 : check for type of the size argument to socket calls
22834 case "$d_socket" in
22835 "$define")
22836         $cat <<EOM
22837
22838 Checking to see what type is the last argument of accept().
22839 EOM
22840         yyy=''
22841         case "$d_socklen_t" in
22842         "$define") yyy="$yyy socklen_t"
22843         esac
22844         yyy="$yyy $sizetype int long unsigned"
22845         for xxx in $yyy; do
22846                 case "$socksizetype" in
22847                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22848                         case "$usesocks" in
22849                         "$define")
22850                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22851                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22852                                         socksizetype="$xxx"
22853                                 fi
22854                                 ;;
22855                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22856                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22857                                         socksizetype="$xxx"
22858                                 fi
22859                                 ;;
22860                         esac
22861                         ;;
22862                 esac
22863         done
22864 : In case none of those worked, prompt the user.
22865         case "$socksizetype" in
22866         '')     rp='What is the type for socket address structure sizes?'
22867                 dflt='int'
22868                 . ./myread
22869                 socksizetype=$ans
22870                 ;;
22871         esac
22872         ;;
22873 *)      : no sockets, so pick relatively harmless default
22874         socksizetype='int'
22875         ;;
22876 esac
22877
22878 : see what type is used for signed size_t
22879 set ssize_t ssizetype int stdio.h sys/types.h
22880 eval $typedef
22881 dflt="$ssizetype"
22882 $cat > try.c <<EOM
22883 #include <stdio.h>
22884 #$i_stdlib I_STDLIB
22885 #ifdef I_STDLIB
22886 #include <stdlib.h>
22887 #endif
22888 #include <sys/types.h>
22889 #define Size_t $sizetype
22890 #define SSize_t $dflt
22891 int main()
22892 {
22893         if (sizeof(Size_t) == sizeof(SSize_t))
22894                 printf("$dflt\n");
22895         else if (sizeof(Size_t) == sizeof(int))
22896                 printf("int\n");
22897         else
22898                 printf("long\n");
22899         exit(0);
22900 }
22901 EOM
22902 echo " "
22903 set try
22904 if eval $compile_ok && $run ./try > /dev/null; then
22905         ssizetype=`$run ./try`
22906         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22907 else
22908         $cat >&4 <<EOM
22909 Help! I can't compile and run the ssize_t test program: please enlighten me!
22910 (This is probably a misconfiguration in your system or libraries, and
22911 you really ought to fix it.  Still, I'll try anyway.)
22912
22913 I need a type that is the same size as $sizetype, but is guaranteed to
22914 be signed.  Common values are ssize_t, int and long.
22915
22916 EOM
22917         rp="What signed type is the same size as $sizetype?"
22918         . ./myread
22919         ssizetype="$ans"
22920 fi
22921 $rm_try
22922
22923 : Check the size of st_dev
22924 $echo " "
22925 $echo "Checking the size of st_dev..." >&4
22926 $cat > try.c <<EOCP
22927 #include <sys/stat.h>
22928 #include <stdio.h>
22929 #$i_stdlib I_STDLIB
22930 #ifdef I_STDLIB
22931 #include <stdlib.h>
22932 #endif
22933 int main() {
22934     struct stat st;
22935     printf("%d\n", (int)sizeof(st.st_dev));
22936     exit(0);
22937 }
22938 EOCP
22939 set try
22940 if eval $compile_ok; then
22941         val=`$run ./try`
22942         case "$val" in
22943         '')     st_dev_size=4
22944                 $echo "(I can't execute the test program--guessing $st_dev_size.)" >&4
22945                 ;;
22946         *)      st_dev_size=$val
22947                 $echo "Your st_dev is $st_dev_size bytes long."
22948                 ;;
22949         esac
22950 else
22951         st_dev_size=4
22952         $echo "(I can't compile the test program--guessing $st_dev_size.)" >&4
22953 fi
22954 $rm_try
22955
22956 : Check if st_dev is signed
22957 $echo " "
22958 $echo "Checking the sign of st_dev..." >&4
22959 $cat > try.c <<EOCP
22960 #include <sys/stat.h>
22961 #include <stdio.h>
22962 int main() {
22963         struct stat foo;
22964         foo.st_dev = -1;
22965         if (foo.st_dev < 0)
22966                 printf("-1\n");
22967         else
22968                 printf("1\n");
22969 }
22970 EOCP
22971 set try
22972 if eval $compile; then
22973         val=`$run ./try`
22974         case "$val" in
22975         '')     st_dev_sign=1
22976                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22977                 ;;
22978         *)      st_dev_sign=$val
22979                 case "$st_dev_sign" in
22980                  1) $echo "Your st_dev is unsigned." ;;
22981                 -1) $echo "Your st_dev is signed."   ;;
22982                 esac
22983                 ;;
22984         esac
22985 else
22986         st_dev_sign=1
22987         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22988 fi
22989 $rm_try
22990
22991 : Check the size of st_ino
22992 $echo " "
22993 $echo "Checking the size of st_ino..." >&4
22994 $cat > try.c <<EOCP
22995 #include <sys/stat.h>
22996 #include <stdio.h>
22997 #$i_stdlib I_STDLIB
22998 #ifdef I_STDLIB
22999 #include <stdlib.h>
23000 #endif
23001 int main() {
23002     struct stat st;
23003     printf("%d\n", (int)sizeof(st.st_ino));
23004     exit(0);
23005 }
23006 EOCP
23007 set try
23008 if eval $compile_ok; then
23009         val=`$run ./try`
23010         case "$val" in
23011         '')     st_ino_size=4
23012                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
23013                 ;;
23014         *)      st_ino_size=$val
23015                 $echo "Your st_ino is $st_ino_size bytes long."
23016                 ;;
23017         esac
23018 else
23019         st_ino_size=4
23020         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
23021 fi
23022 $rm_try
23023
23024 : Check if st_ino is signed
23025 $echo " "
23026 $echo "Checking the sign of st_ino..." >&4
23027 $cat > try.c <<EOCP
23028 #include <sys/stat.h>
23029 #include <stdio.h>
23030 int main() {
23031         struct stat foo;
23032         foo.st_ino = -1;
23033         if (foo.st_ino < 0)
23034                 printf("-1\n");
23035         else
23036                 printf("1\n");
23037 }
23038 EOCP
23039 set try
23040 if eval $compile; then
23041         val=`$run ./try`
23042         case "$val" in
23043         '')     st_ino_sign=1
23044                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
23045                 ;;
23046         *)      st_ino_sign=$val
23047                 case "$st_ino_sign" in
23048                  1) $echo "Your st_ino is unsigned." ;;
23049                 -1) $echo "Your st_ino is signed."   ;;
23050                 esac
23051                 ;;
23052         esac
23053 else
23054         st_ino_sign=1
23055         $echo "(I can't compile the test program--guessing unsigned.)" >&4
23056 fi
23057 $rm_try
23058
23059 : see what type of char stdio uses.
23060 echo " "
23061 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
23062 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
23063         echo "Your stdio uses unsigned chars." >&4
23064         stdchar="unsigned char"
23065 else
23066         echo "Your stdio uses signed chars." >&4
23067         stdchar="char"
23068 fi
23069 $rm -f stdioh
23070
23071 : Check size of UID
23072 echo " "
23073 case "$uidtype" in
23074 *_t) zzz="$uidtype"     ;;
23075 *)   zzz="uid"          ;;
23076 esac
23077 echo "Checking the size of $zzz..." >&4
23078 cat > try.c <<EOCP
23079 #include <sys/types.h>
23080 #include <stdio.h>
23081 #$i_stdlib I_STDLIB
23082 #ifdef I_STDLIB
23083 #include <stdlib.h>
23084 #endif
23085 int main() {
23086     printf("%d\n", (int)sizeof($uidtype));
23087     exit(0);
23088 }
23089 EOCP
23090 set try
23091 if eval $compile_ok; then
23092         yyy=`$run ./try`
23093         case "$yyy" in
23094         '')     uidsize=4
23095                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
23096                 ;;
23097         *)      uidsize=$yyy
23098                 echo "Your $zzz is $uidsize bytes long."
23099                 ;;
23100         esac
23101 else
23102         uidsize=4
23103         echo "(I can't compile the test program--guessing $uidsize.)" >&4
23104 fi
23105
23106 : Check if UID is signed
23107 echo " "
23108 case "$uidtype" in
23109 *_t) zzz="$uidtype"     ;;
23110 *)   zzz="uid"          ;;
23111 esac
23112 echo "Checking the sign of $zzz..." >&4
23113 cat > try.c <<EOCP
23114 #include <sys/types.h>
23115 #include <stdio.h>
23116 int main() {
23117         $uidtype foo = -1;
23118         if (foo < 0)
23119                 printf("-1\n");
23120         else
23121                 printf("1\n");
23122 }
23123 EOCP
23124 set try
23125 if eval $compile; then
23126         yyy=`$run ./try`
23127         case "$yyy" in
23128         '')     uidsign=1
23129                 echo "(I can't execute the test program--guessing unsigned.)" >&4
23130                 ;;
23131         *)      uidsign=$yyy
23132                 case "$uidsign" in
23133                  1) echo "Your $zzz is unsigned." ;;
23134                 -1) echo "Your $zzz is signed."   ;;
23135                 esac
23136                 ;;
23137         esac
23138 else
23139         uidsign=1
23140         echo "(I can't compile the test program--guessing unsigned.)" >&4
23141 fi
23142
23143 : Check format string for UID
23144 echo " "
23145 $echo "Checking the format string to be used for uids..." >&4
23146
23147 case "$uidsign" in
23148 -1)     if $test X"$uidsize" = X"$ivsize"; then
23149                 uidformat="$ivdformat"
23150         else
23151                 if $test X"$uidsize" = X"$longsize"; then
23152                         uidformat='"ld"'
23153                 else
23154                         if $test X"$uidsize" = X"$intsize"; then
23155                                 uidformat='"d"'
23156                         else
23157                                 if $test X"$uidsize" = X"$shortsize"; then
23158                                         uidformat='"hd"'
23159                                 fi
23160                         fi
23161                 fi
23162         fi
23163         ;;
23164 *)      if $test X"$uidsize" = X"$uvsize"; then
23165                 uidformat="$uvuformat"
23166         else
23167                 if $test X"$uidsize" = X"$longsize"; then
23168                         uidformat='"lu"'
23169                 else
23170                         if $test X"$uidsize" = X"$intsize"; then
23171                                 uidformat='"u"'
23172                         else
23173                                 if $test X"$uidsize" = X"$shortsize"; then
23174                                         uidformat='"hu"'
23175                                 fi
23176                         fi
23177                 fi
23178         fi
23179         ;;
23180 esac
23181
23182 : Ask about strict by default.
23183 case "$usedefaultstrict" in
23184     $define|true|[Yy]*)
23185        dflt="y"
23186        ;;
23187     *)
23188        dflt="n"
23189        ;;
23190     esac
23191
23192 cat <<EOM
23193
23194 EXPERIMENTAL: Perl can now be built with strict on by default when not
23195 invoked with -e or -E. This is a diagnostic tool for development.
23196
23197 Unless you are familiar with this feature, you should probably answer 'no'.
23198
23199 EOM
23200
23201 rp='Would you like to build perl with strict enabled by default?'
23202 . ./myread
23203 case "$ans" in
23204 y|Y) val="$define" ;;
23205 *)   val="$undef"  ;;
23206 esac
23207 set usedefaultstrict
23208 eval $setvar
23209
23210 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
23211 echo " "
23212 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
23213 $cat >try.c <<'EOM'
23214 /* Intentionally a long probe as I'd like to sanity check that the exact
23215    approach is going to work, as thinking it will work, but only having it
23216    part working at runtime is worse than not having it.  */
23217
23218 #include <sys/types.h>
23219 #include <sys/sysctl.h>
23220 #include <sys/param.h>
23221 #include <stdio.h>
23222 #include <string.h>
23223 #include <stdlib.h>
23224 #include <unistd.h>
23225
23226 int
23227 main(int argc, char **argv) {
23228     char *buffer;
23229     char *argv_leaf = strrchr(argv[0], '/');
23230     char *buffer_leaf;
23231     size_t size = 0;
23232     int mib[4];
23233
23234     mib[0] = CTL_KERN;
23235     mib[1] = KERN_PROC;
23236     mib[2] = KERN_PROC_PATHNAME;
23237     mib[3] = -1;
23238
23239     if (!argv_leaf) {
23240         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23241         return 1;
23242     }
23243
23244     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
23245         perror("sysctl");
23246         return 2;
23247     }
23248
23249     if (size < strlen(argv_leaf) + 1) {
23250         fprintf(stderr, "size %lu is too short for a path\n",
23251                 (unsigned long) size);
23252         return 3;
23253     }
23254
23255     if (size > MAXPATHLEN * MAXPATHLEN) {
23256         fprintf(stderr, "size %lu is too long for a path\n",
23257                 (unsigned long) size);
23258         return 4;
23259     }
23260
23261     buffer = (char *)malloc(size);
23262     if (!buffer) {
23263         perror("malloc");
23264         return 5;
23265     }
23266
23267     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
23268         perror("sysctl");
23269         return 6;
23270     }
23271
23272     if (strlen(buffer) + 1 != size) {
23273         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
23274                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
23275         return 7;
23276     }
23277
23278
23279     if (*buffer != '/') {
23280         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
23281         return 8;
23282     }
23283
23284     if (strstr(buffer, "/./")) {
23285         fprintf(stderr, "Contains /./: '%s'\n", buffer);
23286         return 9;
23287     }
23288
23289     if (strstr(buffer, "/../")) {
23290         fprintf(stderr, "Contains /../: '%s'\n", buffer);
23291         return 10;
23292     }
23293
23294     buffer_leaf = strrchr(buffer, '/');
23295     if (strcmp(buffer_leaf, argv_leaf) != 0) {
23296         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
23297         return 11;
23298     }
23299
23300     free(buffer);
23301
23302     return 0;
23303 }
23304 EOM
23305
23306 val=$undef
23307 set try
23308 if eval $compile; then
23309         if $run ./try; then
23310                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
23311                 val="$define"
23312         else
23313                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
23314                 val="$undef"
23315         fi
23316 else
23317         echo "I'm unable to compile the test program." >&4
23318         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
23319         val="$undef"
23320 fi
23321 $rm_try
23322 set usekernprocpathname
23323 eval $setvar
23324
23325 : Determine if we can use _NSGetExecutablePath to find executing program
23326 echo " "
23327 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
23328 $cat >try.c <<'EOM'
23329 /* Intentionally a long probe as I'd like to sanity check that the exact
23330    approach is going to work, as thinking it will work, but only having it
23331    part working at runtime is worse than not having it.  */
23332 #include <mach-o/dyld.h>
23333 #include <stdio.h>
23334 #include <stdlib.h>
23335 #include <sys/param.h>
23336 #include <string.h>
23337
23338 int
23339 main(int argc, char **argv) {
23340     char buf[1];
23341     uint32_t size = sizeof(buf);
23342     int result;
23343     char *buffer;
23344     char *tidied;
23345     char *argv_leaf = strrchr(argv[0], '/');
23346     char *tidied_leaf;
23347
23348     if (!argv_leaf) {
23349         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23350         return 1;
23351     }
23352
23353     _NSGetExecutablePath(buf, &size);
23354     if (size > MAXPATHLEN * MAXPATHLEN) {
23355         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
23356                 (unsigned int) size);
23357         return 2;
23358     }
23359
23360     buffer = (char *)malloc(size);
23361     if (!buffer) {
23362         perror("malloc");
23363         return 3;
23364     }
23365
23366     result = _NSGetExecutablePath(buffer, &size);
23367     if (result != 0) {
23368         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
23369                 result, (unsigned int) size);
23370         return 4;
23371     }
23372
23373     tidied = realpath(buffer, NULL);
23374     if (!tidied) {
23375         perror("realpath");
23376         return 5;
23377     }
23378
23379     free(buffer);
23380
23381     if (*tidied != '/') {
23382         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
23383         return 6;
23384     }
23385
23386     if (strstr(tidied, "/./")) {
23387         fprintf(stderr, "Contains /./: '%s'\n", tidied);
23388         return 7;
23389     }
23390
23391     if (strstr(tidied, "/../")) {
23392         fprintf(stderr, "Contains /../: '%s'\n", tidied);
23393         return 8;
23394     }
23395
23396     tidied_leaf = strrchr(tidied, '/');
23397     if (strcmp(tidied_leaf, argv_leaf) != 0) {
23398         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
23399         return 9;
23400     }
23401
23402     free(tidied);
23403
23404     return 0;
23405 }
23406 EOM
23407
23408 val=$undef
23409 set try
23410 if eval $compile; then
23411         if $run ./try; then
23412                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
23413                 val="$define"
23414         else
23415                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23416         fi
23417 else
23418         echo "I'm unable to compile the test program." >&4
23419         echo "I'll assume no _NSGetExecutablePath here." >&4
23420 fi
23421 $rm_try
23422 set usensgetexecutablepath
23423 eval $setvar
23424
23425 : Check if site customization support was requested
23426 case "$usesitecustomize" in
23427     $define|true|[Yy]*)
23428         usesitecustomize="$define"
23429         ;;
23430     *)
23431         usesitecustomize="$undef"
23432         ;;
23433     esac
23434
23435 : determine compiler compiler
23436 case "$yacc" in
23437 '')
23438         dflt=yacc;;
23439 *)
23440         dflt="$yacc";;
23441 esac
23442 echo " "
23443 comp='yacc'
23444 if $test -f "$byacc$_exe"; then
23445         dflt="$byacc"
23446         comp="byacc or $comp"
23447 fi
23448 if $test -f "$bison$_exe"; then
23449         comp="$comp or bison -y"
23450 fi
23451 rp="Which compiler compiler ($comp) shall I use?"
23452 . ./myread
23453 yacc="$ans"
23454 case "$yacc" in
23455 *bis*)
23456         case "$yacc" in
23457         *-y*) ;;
23458         *)
23459                 yacc="$yacc -y"
23460                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23461                 ;;
23462         esac
23463         ;;
23464 esac
23465
23466 : see if this is a bfd.h system
23467 set bfd.h i_bfd
23468 eval $inhdr
23469
23470 : see if this is an execinfo.h system
23471 set execinfo.h i_execinfo
23472 eval $inhdr
23473
23474 : see if this is a fenv.h system
23475 set fenv.h i_fenv
23476 eval $inhdr
23477
23478 : see if this is a fp.h system
23479 set fp.h i_fp
23480 eval $inhdr
23481
23482 : see if this is a fp_class.h system
23483 set fp_class.h i_fp_class
23484 eval $inhdr
23485
23486 : see if gdbm.h is available
23487 set gdbm.h t_gdbm
23488 eval $inhdr
23489 case "$t_gdbm" in
23490 $define)
23491         : see if gdbm_open exists
23492         set gdbm_open d_gdbm_open
23493         eval $inlibc
23494         case "$d_gdbm_open" in
23495         $undef)
23496                 t_gdbm="$undef"
23497                 echo "We won't be including <gdbm.h>"
23498                 ;;
23499         esac
23500         ;;
23501 esac
23502 val="$t_gdbm"
23503 set i_gdbm
23504 eval $setvar
23505
23506 : see if this is a ieeefp.h system
23507 case "$i_ieeefp" in
23508 '' ) set ieeefp.h i_ieeefp
23509      eval $inhdr
23510      ;;
23511 esac
23512
23513 : see if this is a libutil.h system
23514 set libutil.h i_libutil
23515 eval $inhdr
23516
23517 : see if mach cthreads are available
23518 if test "X$usethreads" = "X$define"; then
23519         set mach/cthreads.h i_machcthr
23520         eval $inhdr
23521 else
23522         i_machcthr="$undef"
23523 fi
23524
23525 : see if this is a mntent.h system
23526 set mntent.h i_mntent
23527 eval $inhdr
23528
23529 : see if net/errno.h is available
23530 val=''
23531 set net/errno.h val
23532 eval $inhdr
23533
23534 : Unfortunately, it causes problems on some systems.  Arrgh.
23535 case "$val" in
23536 $define)
23537         cat > try.c <<'EOM'
23538 #include <stdio.h>
23539 #include <errno.h>
23540 #include <net/errno.h>
23541 int func()
23542 {
23543         return ENOTSOCK;
23544 }
23545 EOM
23546         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23547                 echo "We'll be including <net/errno.h>." >&4
23548         else
23549                 echo "We won't be including <net/errno.h>." >&4
23550                 val="$undef"
23551         fi
23552         $rm_try
23553         ;;
23554 esac
23555 set i_neterrno
23556 eval $setvar
23557
23558 : see if netinet/tcp.h is available
23559 set netinet/tcp.h i_netinettcp
23560 eval $inhdr
23561
23562 : see if this is a poll.h system
23563 set poll.h i_poll
23564 eval $inhdr
23565
23566 : see if this is a prot.h system
23567 set prot.h i_prot
23568 eval $inhdr
23569
23570 : Preprocessor symbols
23571 echo " "
23572 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23573 $cat <<'EOSH' > Cppsym.know
23574 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23575 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23576 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23577 arch_pwr ardent ARM ARM32 atarist att386 att3b
23578 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23579 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23580 byteorder byte_order
23581 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23582 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23583 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23584 ELF encore EPI EXTENSIONS
23585 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23586 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23587 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23588 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23589 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
23590 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23591 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23592 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23593 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23594 ksr1
23595 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23596 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23597 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23598 luna88k Lynx
23599 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23600 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23601 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23602 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23603 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23604 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23605 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23606 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23607 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23608 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23609 ns32000 ns32016 ns32332 ns32k nsc32000
23610 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23611 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23612 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23613 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23614 QK_USER QNX
23615 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23616 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23617 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23618 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23619 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23620 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23621 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23622 SYSV4 SYSV5 sysV68 sysV88
23623 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23624 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23625 tower32_800 tower32_850 tss
23626 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23627 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23628 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23629 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23630 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23631 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23632 uxpm uxps
23633 vax venix VMESA vms
23634 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23635 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23636 z8000 zarch
23637 EOSH
23638 # Maybe put other stuff here too.
23639 ./tr '-' '_' <<EOSH >>Cppsym.know
23640 $osname
23641 EOSH
23642 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23643 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23644 $cat Cppsym.know > Cppsym.c
23645 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23646 $rm -f Cppsym.a Cppsym.b Cppsym.c
23647 cat <<EOSH > Cppsym
23648 $startsh
23649 if $test \$# -gt 0; then
23650     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23651     if $test -s Cppsym.got; then
23652         $rm -f Cppsym.got
23653         exit 0
23654     fi
23655     $rm -f Cppsym.got
23656     exit 1
23657 else
23658     $tr " " "$trnl" | ./Cppsym.try
23659     exit 0
23660 fi
23661 EOSH
23662 chmod +x Cppsym
23663 $eunicefix Cppsym
23664 cat <<EOSH > Cppsym.try
23665 $startsh
23666 cat <<'EOCP' > try.c
23667 #include <stdio.h>
23668 #if cpp_stuff == 1
23669 #define STRINGIFY(a)    "a"
23670 #endif
23671 #if cpp_stuff == 42
23672 #define StGiFy(a)  #a
23673 #define STRINGIFY(a)    StGiFy(a)
23674 #endif
23675 #if $cpp_stuff != 1 && $cpp_stuff != 42
23676 #   include "Bletch: How does this C preprocessor stringify macros?"
23677 #endif
23678 int main() {
23679 EOCP
23680 $awk \\
23681 EOSH
23682 cat <<'EOSH' >> Cppsym.try
23683 'length($1) > 0 {
23684     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23685     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23686     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23687     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23688 }' >> try.c
23689 echo 'return 0;}' >> try.c
23690 EOSH
23691 cat <<EOSH >> Cppsym.try
23692 ccflags="$ccflags"
23693 case "$osname-$gccversion" in
23694 irix-) ccflags="\$ccflags -woff 1178" ;;
23695 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23696 esac
23697 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23698 EOSH
23699 chmod +x Cppsym.try
23700 $eunicefix Cppsym.try
23701 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23702 : Add in any Linux cpp "predefined macros":
23703 case "$osname::$gccversion" in
23704   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23705     tHdrH=_tmpHdr
23706     rm -f $tHdrH'.h' $tHdrH
23707     touch $tHdrH'.h'
23708     # Filter out macro arguments, such as Linux's __INT8_C(c)
23709     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23710        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23711        if [ -s $tHdrH'_cppsym.real' ]; then
23712           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23713        fi
23714     fi
23715     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23716   ;;
23717 esac
23718 : now check the C compiler for additional symbols
23719 postprocess_cc_v=''
23720 case "$osname" in
23721 aix) postprocess_cc_v="|$tr , ' '" ;;
23722 esac
23723 $cat >ccsym <<EOS
23724 $startsh
23725 $cat >tmp.c <<EOF
23726 extern int foo;
23727 EOF
23728 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23729 do
23730         case "\$i" in
23731         -D*) echo "\$i" | $sed 's/^-D//';;
23732         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23733         esac
23734 done
23735 $rm_try
23736 EOS
23737 postprocess_cc_v=''
23738 chmod +x ccsym
23739 $eunicefix ccsym
23740 ./ccsym > ccsym1.raw
23741 if $test -s ccsym1.raw; then
23742     $sort ccsym1.raw | $uniq >ccsym.raw
23743 else
23744     mv ccsym1.raw ccsym.raw
23745 fi
23746
23747 $awk '/\=/ { print $0; next }
23748         { print $0"=1" }' ccsym.raw >ccsym.list
23749 $comm -13 Cppsym.true ccsym.list >ccsym.own
23750 $comm -12 Cppsym.true ccsym.list >ccsym.com
23751 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23752 also=''
23753 if $test -z ccsym.raw; then
23754         echo "Your C compiler doesn't seem to define any symbols!" >&4
23755         echo " "
23756         echo "However, your C preprocessor defines the following symbols:"
23757         $cat Cppsym.true
23758         ccsymbols=''
23759         cppsymbols=`$cat Cppsym.true`
23760         cppsymbols=`echo $cppsymbols`
23761         cppccsymbols="$cppsymbols"
23762 else
23763         if $test -s ccsym.com; then
23764                 echo "Your C compiler and pre-processor define these symbols:"
23765                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23766                 also='also '
23767                 symbols='ones'
23768                 cppccsymbols=`$cat ccsym.com`
23769                 cppccsymbols=`echo $cppccsymbols`
23770                 $test "$silent" || sleep 1
23771         fi
23772         if $test -s ccsym.cpp; then
23773                 $test "$also" && echo " "
23774                 echo "Your C pre-processor ${also}defines the following symbols:"
23775                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23776                 also='further '
23777                 cppsymbols=`$cat ccsym.cpp`
23778                 cppsymbols=`echo $cppsymbols`
23779                 $test "$silent" || sleep 1
23780         fi
23781         if $test -s ccsym.own; then
23782                 $test "$also" && echo " "
23783                 echo "Your C compiler ${also}defines the following cpp symbols:"
23784                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23785                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23786                 ccsymbols=`$cat ccsym.own`
23787                 ccsymbols=`echo $ccsymbols`
23788                 $test "$silent" || sleep 1
23789         fi
23790 fi
23791
23792 : add -D_FORTIFY_SOURCE if feasible and not already there
23793 case "$gccversion" in
23794 [456789].*|[1-9][0-9]*) case "$optimize$ccflags" in
23795         *-O*)   case "$ccflags$cppsymbols" in
23796                 *_FORTIFY_SOURCE=*) # Don't add it again.
23797                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23798                         ;;
23799                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23800                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23801                         ;;
23802                 esac
23803                 ;;
23804         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23805                 ;;
23806         esac
23807         ;;
23808 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23809         ;;
23810 esac
23811
23812 : script used to emit important warnings
23813 cat >warn <<EOS
23814 $startsh
23815 if test \$# -gt 0; then
23816         echo "\$@" >msg
23817 else
23818         cat >msg
23819 fi
23820 echo "*** WARNING:" >&4
23821 sed -e 's/^/*** /' <msg >&4
23822 echo "*** " >&4
23823 cat msg >>config.msg
23824 echo " " >>config.msg
23825 rm -f msg
23826 EOS
23827 chmod +x warn
23828 $eunicefix warn
23829
23830 : see if this is a termio system
23831 val="$undef"
23832 val2="$undef"
23833 val3="$undef"
23834 if $test `./findhdr termios.h`; then
23835     set tcsetattr i_termios
23836     eval $inlibc
23837     val3="$i_termios"
23838 fi
23839 echo " "
23840 case "$val3" in
23841     "$define") echo "You have POSIX termios.h... good!" >&4;;
23842     *)  if ./Cppsym pyr; then
23843             case "`$run /bin/universe`" in
23844                 ucb) if $test `./findhdr sgtty.h`; then
23845                         val2="$define"
23846                         echo "<sgtty.h> found." >&4
23847                     else
23848                         echo "System is pyramid with BSD universe."
23849                         ./warn "<sgtty.h> not found--you could have problems."
23850                     fi;;
23851                 *)  if $test `./findhdr termio.h`; then
23852                         val="$define"
23853                         echo "<termio.h> found." >&4
23854                     else
23855                         echo "System is pyramid with USG universe."
23856                         ./warn "<termio.h> not found--you could have problems."
23857                     fi;;
23858             esac
23859         elif ./usg; then
23860             if $test `./findhdr termio.h`; then
23861                 echo "<termio.h> found." >&4
23862                 val="$define"
23863             elif $test `./findhdr sgtty.h`; then
23864                 echo "<sgtty.h> found." >&4
23865                 val2="$define"
23866             else
23867                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23868             fi
23869         else
23870             if $test `./findhdr sgtty.h`; then
23871                 echo "<sgtty.h> found." >&4
23872                 val2="$define"
23873             elif $test `./findhdr termio.h`; then
23874                 echo "<termio.h> found." >&4
23875                 val="$define"
23876             else
23877                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23878             fi
23879         fi;;
23880 esac
23881 set i_termio; eval $setvar
23882 val=$val2; set i_sgtty; eval $setvar
23883 val=$val3; set i_termios; eval $setvar
23884
23885 : see if stdbool is available
23886 : we want a real compile instead of Inhdr because some Solaris systems
23887 : have stdbool.h, but it can only be used if the compiler indicates it
23888 : is sufficiently c99-compliant.
23889 echo " "
23890 $cat >try.c <<EOCP
23891 #include <stdio.h>
23892 #include <stdbool.h>
23893 int func(bool x)
23894 {
23895     return x ? 1 : 0;
23896 }
23897 int main(int argc, char **argv)
23898 {
23899     return func(0);
23900 }
23901 EOCP
23902 set try
23903 if eval $compile; then
23904         echo "<stdbool.h> found." >&4
23905         val="$define"
23906 else
23907         echo "<stdbool.h> NOT found." >&4
23908         val="$undef"
23909 fi
23910 $rm_try
23911 set i_stdbool
23912 eval $setvar
23913
23914 : see if stdint is available
23915 set stdint.h i_stdint
23916 eval $inhdr
23917
23918 : see if sys/access.h is available
23919 set sys/access.h i_sysaccess
23920 eval $inhdr
23921
23922 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23923 set sys/filio.h i_sysfilio
23924 eval $inhdr
23925 echo " "
23926 if $test `./findhdr sys/ioctl.h`; then
23927         val="$define"
23928         echo '<sys/ioctl.h> found.' >&4
23929 else
23930         val="$undef"
23931         if $test $i_sysfilio = "$define"; then
23932             echo '<sys/ioctl.h> NOT found.' >&4
23933         else
23934                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23935                 $test $i_termio = "$define" && xxx="termio.h"
23936                 $test $i_termios = "$define" && xxx="termios.h"
23937 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23938         fi
23939 fi
23940 set i_sysioctl
23941 eval $setvar
23942
23943 : see if socket ioctl defs are in sys/sockio.h
23944 echo " "
23945 xxx=`./findhdr sys/sockio.h`
23946 if $test "$xxx"; then
23947         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23948                 val="$define"
23949                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23950         else
23951                 val="$undef"
23952                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23953         fi
23954 else
23955         val="$undef"
23956         $cat <<EOM
23957 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23958 EOM
23959 fi
23960 set i_syssockio
23961 eval $setvar
23962
23963 : see if this is a syslog.h system
23964 set syslog.h i_syslog
23965 eval $inhdr
23966
23967 : see if this is a sys/mode.h system
23968 set sys/mode.h i_sysmode
23969 eval $inhdr
23970
23971 : see if there is a sys/poll.h file
23972 set sys/poll.h i_syspoll
23973 eval $inhdr
23974
23975 : see if sys/resource.h has to be included
23976 set sys/resource.h i_sysresrc
23977 eval $inhdr
23978
23979 : see if sys/security.h is available
23980 set sys/security.h i_syssecrt
23981 eval $inhdr
23982
23983 : see if this is a sys/statvfs.h system
23984 set sys/statvfs.h i_sysstatvfs
23985 eval $inhdr
23986
23987 : see if this is a sys/un.h system
23988 set sys/un.h i_sysun
23989 eval $inhdr
23990
23991 : see if this is a sys/utsname.h system
23992 set sys/utsname.h i_sysutsname
23993 eval $inhdr
23994
23995 : see if this is a syswait system
23996 set sys/wait.h i_syswait
23997 eval $inhdr
23998
23999 : see if this is a ustat.h system
24000 set ustat.h i_ustat
24001 eval $inhdr
24002
24003 : see if this is an utime system
24004 set utime.h i_utime
24005 eval $inhdr
24006
24007 : see if this is a vfork system
24008 case "$d_vfork" in
24009 "$define")
24010         set vfork.h i_vfork
24011         eval $inhdr
24012         ;;
24013 *)
24014         i_vfork="$undef"
24015         ;;
24016 esac
24017
24018 : see if wchar.h is present
24019 set wchar.h i_wchar
24020 eval $inhdr
24021
24022 : Check extensions
24023 echo " "
24024 echo "Looking for extensions..." >&4
24025 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
24026 : contain old or inaccurate or duplicate values.
24027 nonxs_extensions=''
24028 xs_extensions=''
24029 : We do not use find because it might not be available.
24030 : We do not just use MANIFEST because the user may have dropped
24031 : some additional extensions into the source tree and expect them
24032 : to be built.
24033
24034 : Function to recursively find available extensions, ignoring DynaLoader
24035 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
24036 : In 5.10.1 and later, extensions are stored in directories
24037 : like File-Glob instead of the older File/Glob/.
24038 find_extensions='
24039     for xxx in *; do
24040         case "$xxx" in
24041             DynaLoader|dynaload) ;;
24042             *)
24043             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
24044             case "$this_ext" in
24045                 Scalar/List/Utils) this_ext="List/Util" ;;
24046                 PathTools)         this_ext="Cwd"       ;;
24047             esac;
24048             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
24049             if $contains " $this_ext " "$tdir/$$.tmp"; then
24050                 echo >&4;
24051                 echo "Duplicate directories detected for extension $xxx" >&4;
24052                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
24053                 case "$knowitall" in
24054                 "") dflt=y;;
24055                 *) dflt=n;;
24056                 esac;
24057                 . ../UU/myread;
24058                 case "$ans" in
24059                 n*|N*) ;;
24060                 *) echo >&4;
24061                     echo "Ok.  Stopping Configure." >&4;
24062                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
24063                     exit 1;;
24064                 esac;
24065                 echo "Ok.  You will need to correct config.sh before running make." >&4;
24066             fi;
24067             $ls -1 "$xxx" > "$tdir/$$.tmp";
24068             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
24069                 xs_extensions="$xs_extensions $this_ext";
24070             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
24071                 xs_extensions="$xs_extensions $this_ext";
24072             elif $test -d "$xxx"; then
24073                 nonxs_extensions="$nonxs_extensions $this_ext";
24074             fi;
24075             $rm -f "$tdir/$$.tmp";
24076             ;;
24077         esac;
24078     done'
24079 tdir=`pwd`
24080 cd "$rsrc/cpan"
24081 set X
24082 shift
24083 eval $find_extensions
24084 cd "$rsrc/dist"
24085 set X
24086 shift
24087 eval $find_extensions
24088 cd "$rsrc/ext"
24089 set X
24090 shift
24091 eval $find_extensions
24092 set X $xs_extensions
24093 shift
24094 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
24095 set X $nonxs_extensions
24096 shift
24097 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
24098 cd "$tdir"
24099 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
24100
24101 : Now see which are supported on this system.
24102 avail_ext=''
24103 for xxx in $xs_extensions ; do
24104         case "$xxx" in
24105         Amiga*)
24106                 case "$osname" in
24107                 amigaos) avail_ext="$avail_ext $xxx" ;;
24108                 esac
24109                 ;;
24110         DB_File|db_file)
24111                 case "$i_db" in
24112                 $define) avail_ext="$avail_ext $xxx" ;;
24113                 esac
24114                 ;;
24115         GDBM_File|gdbm_fil)
24116                 case "$i_gdbm" in
24117                 $define) avail_ext="$avail_ext $xxx" ;;
24118                 esac
24119                 ;;
24120         IPC/SysV|ipc/sysv)
24121                 : XXX Do we need a useipcsysv variable here
24122                 case "${d_msg}${d_sem}${d_shm}" in
24123                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
24124                 esac
24125                 ;;
24126         NDBM_File|ndbm_fil)
24127                 case "$d_ndbm" in
24128                 $define)
24129                     case "$osname-$use64bitint" in
24130                     hpux-define)
24131                         case "$libs" in
24132                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
24133                         esac
24134                         ;;
24135                     *) avail_ext="$avail_ext $xxx" ;;
24136                     esac
24137                     ;;
24138                 esac
24139                 ;;
24140         ODBM_File|odbm_fil)
24141                 case "${i_dbm}${i_rpcsvcdbm}" in
24142                 *"${define}"*)
24143                     case "$d_cplusplus" in
24144                     define) ;; # delete as a function name will not work
24145                     *)  case "$osname-$use64bitint" in
24146                         hpux-define)
24147                             case "$libs" in
24148                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
24149                             esac
24150                             ;;
24151                         *) avail_ext="$avail_ext $xxx" ;;
24152                         esac
24153                         ;;
24154                     esac
24155                     ;;
24156                 esac
24157                 ;;
24158         Opcode|opcode)
24159                 case "$useopcode" in
24160                 true|define|y) avail_ext="$avail_ext $xxx" ;;
24161                 esac
24162                 ;;
24163         POSIX|posix)
24164                 case "$useposix" in
24165                 true|define|y) avail_ext="$avail_ext $xxx" ;;
24166                 esac
24167                 ;;
24168         Socket|socket)
24169                 case "$d_socket" in
24170                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
24171                 esac
24172                 ;;
24173         I18N/Langinfo|langinfo)
24174                 case "$uselanginfo" in
24175                 true|define|y) avail_ext="$avail_ext $xxx" ;;
24176                 esac
24177                 ;;
24178         Sys/Syslog|sys/syslog)
24179                 case $osname in
24180                         amigaos) ;; # not really very useful on AmigaOS
24181                         *)
24182                         : XXX syslog requires socket
24183                         case "$d_socket" in
24184                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
24185                         esac
24186                         ;;
24187                 esac
24188                 ;;
24189         threads|threads/shared)
24190                 # threads and threads::shared are special cases.
24191                 # To stop people from asking "Perl 5.8.0 was supposed
24192                 # to have this new fancy threads implementation but my
24193                 # perl doesn't have it" and from people trying to
24194                 # (re)install the threads module using CPAN.pm and
24195                 # CPAN.pm then offering to reinstall Perl 5.8.0,
24196                 # the threads.pm and threads/shared.pm will always be
24197                 # there, croaking informatively ("you need to rebuild
24198                 # all of Perl with threads, sorry") when threads haven't
24199                 # been compiled in.
24200                 # --jhi
24201                 avail_ext="$avail_ext $xxx"
24202                 ;;
24203         VMS*)
24204                 ;;
24205         Win32*)
24206                 case "$osname" in
24207                 cygwin) avail_ext="$avail_ext $xxx" ;;
24208                 esac
24209                 ;;
24210         XS/APItest|xs/apitest)
24211                 # This is just for testing.  Skip it unless we have dynamic loading.
24212
24213                 case "$usedl" in
24214                 $define) avail_ext="$avail_ext $xxx" ;;
24215                 esac
24216                 ;;
24217         XS/Typemap|xs/typemap)
24218                 # This is just for testing.  Skip it unless we have dynamic loading.
24219                 case "$usedl" in
24220                 $define) avail_ext="$avail_ext $xxx" ;;
24221                 esac
24222                 ;;
24223         *)      avail_ext="$avail_ext $xxx"
24224                 ;;
24225         esac
24226 done
24227
24228 set X $avail_ext
24229 shift
24230 avail_ext="$*"
24231
24232 case "$onlyextensions" in
24233 '') ;;
24234 *)  keepextensions=''
24235     echo "You have requested that only certain extensions be included..." >&4
24236     for i in $onlyextensions; do
24237         case " $avail_ext " in
24238         *" $i "*)
24239             echo "Keeping extension $i."
24240             keepextensions="$keepextensions $i"
24241             ;;
24242         *) echo "Ignoring extension $i." ;;
24243         esac
24244     done
24245     avail_ext="$keepextensions"
24246     ;;
24247 esac
24248
24249 case "$noextensions" in
24250 '') ;;
24251 *)  keepextensions=''
24252     echo "You have requested that certain extensions be ignored..." >&4
24253     for i in $avail_ext; do
24254         case " $noextensions " in
24255         *" $i "*) echo "Ignoring extension $i." ;;
24256         *) echo "Keeping extension $i.";
24257            keepextensions="$keepextensions $i"
24258            ;;
24259         esac
24260     done
24261     avail_ext="$keepextensions"
24262     ;;
24263 esac
24264
24265 : Now see which nonxs extensions are supported on this system.
24266 : For now assume all are.
24267 nonxs_ext=''
24268 for xxx in $nonxs_extensions ; do
24269         case "$xxx" in
24270         VMS*)
24271                 ;;
24272         *)      nonxs_ext="$nonxs_ext $xxx"
24273                 ;;
24274         esac
24275 done
24276
24277 set X $nonxs_ext
24278 shift
24279 nonxs_ext="$*"
24280
24281 case $usedl in
24282 $define)
24283         $cat <<EOM
24284 A number of extensions are supplied with $package.  You may choose to
24285 compile these extensions for dynamic loading (the default), compile
24286 them into the $package executable (static loading), or not include
24287 them at all.  Answer "none" to include no extensions.
24288 Note that DynaLoader is always built and need not be mentioned here.
24289
24290 EOM
24291         case "$dynamic_ext" in
24292         '')
24293                 : Exclude those listed in static_ext
24294                 dflt=''
24295                 for xxx in $avail_ext; do
24296                         case " $static_ext " in
24297                         *" $xxx "*) ;;
24298                         *) dflt="$dflt $xxx" ;;
24299                         esac
24300                 done
24301                 set X $dflt
24302                 shift
24303                 dflt="$*"
24304                 ;;
24305         *)      dflt="$dynamic_ext"
24306                 # Perhaps we are reusing an old out-of-date config.sh.
24307                 case "$hint" in
24308                 previous)
24309                         if test X"$dynamic_ext" != X"$avail_ext"; then
24310                                 $cat <<EOM
24311 NOTICE:  Your previous config.sh list may be incorrect.
24312 The extensions now available to you are
24313         ${avail_ext}
24314 but the default list from your previous config.sh is
24315         ${dynamic_ext}
24316
24317 EOM
24318                         fi
24319                         ;;
24320                 esac
24321                 ;;
24322         esac
24323         case "$dflt" in
24324         '')     dflt=none;;
24325         esac
24326         rp="What extensions do you wish to load dynamically?"
24327         . ./myread
24328         case "$ans" in
24329         none) dynamic_ext=' ' ;;
24330         *) dynamic_ext="$ans" ;;
24331         esac
24332
24333         case "$static_ext" in
24334         '')
24335                 : Exclude those already listed in dynamic linking
24336                 dflt=''
24337                 for xxx in $avail_ext; do
24338                         case " $dynamic_ext " in
24339                         *" $xxx "*) ;;
24340                         *) dflt="$dflt $xxx" ;;
24341                         esac
24342                 done
24343                 set X $dflt
24344                 shift
24345                 dflt="$*"
24346                 ;;
24347         *)  dflt="$static_ext"
24348                 ;;
24349         esac
24350
24351         case "$dflt" in
24352         '')     dflt=none;;
24353         esac
24354         rp="What extensions do you wish to load statically?"
24355         . ./myread
24356         case "$ans" in
24357         none) static_ext=' ' ;;
24358         *) static_ext="$ans" ;;
24359         esac
24360         ;;
24361 *)
24362         $cat <<EOM
24363 A number of extensions are supplied with $package.  Answer "none"
24364 to include no extensions.
24365 Note that DynaLoader is always built and need not be mentioned here.
24366
24367 EOM
24368         case "$static_ext" in
24369         '') dflt="$avail_ext" ;;
24370         *)      dflt="$static_ext"
24371                 # Perhaps we are reusing an old out-of-date config.sh.
24372                 case "$hint" in
24373                 previous)
24374                         if test X"$static_ext" != X"$avail_ext"; then
24375                                 $cat <<EOM
24376 NOTICE:  Your previous config.sh list may be incorrect.
24377 The extensions now available to you are
24378         ${avail_ext}
24379 but the default list from your previous config.sh is
24380         ${static_ext}
24381
24382 EOM
24383                         fi
24384                         ;;
24385                 esac
24386                 ;;
24387         esac
24388         : Exclude those that are not xs extensions
24389         case "$dflt" in
24390         '')     dflt=none;;
24391         esac
24392         rp="What extensions do you wish to include?"
24393         . ./myread
24394         case "$ans" in
24395         none) static_ext=' ' ;;
24396         *) static_ext="$ans" ;;
24397         esac
24398         ;;
24399 esac
24400 #
24401 # Encode is a special case.  If we are building Encode as a static
24402 # extension, we need to explicitly list its subextensions as well.
24403 # For other nested extensions, this is handled automatically by
24404 # the appropriate Makefile.PL.
24405 case " $static_ext " in
24406         *" Encode "*) # Add the subextensions of Encode
24407         cd "$rsrc/cpan"
24408         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24409                 static_ext="$static_ext Encode/$xxx"
24410                 known_extensions="$known_extensions Encode/$xxx"
24411         done
24412         cd "$tdir"
24413         ;;
24414 esac
24415
24416 set X $dynamic_ext $static_ext $nonxs_ext
24417 shift
24418 extensions="$*"
24419
24420 # Sanity check:  We require an extension suitable for use with
24421 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
24422 # should show up as failures in the test suite, but it's helpful to
24423 # catch them now.) The 'extensions' list is normally sorted
24424 # alphabetically, so we need to accept either
24425 #    DB_File ... Fcntl ... IO  ....
24426 # or something like
24427 #    Fcntl ... NDBM_File ... IO  ....
24428 case " $extensions"  in
24429 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
24430 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24431 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24432 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24433    echo "WARNING: The Perl you are building will be quite crippled." >& 4
24434    ;;
24435 esac
24436
24437 : Remove libraries needed only for extensions
24438 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24439 : The exception is SunOS 4.x, which needs them.
24440 case "${osname}X${osvers}" in
24441 sunos*X4*)
24442     perllibs="$libs"
24443     ;;
24444 *) case "$usedl" in
24445     $define|true|[yY]*)
24446             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24447             shift
24448             perllibs="$*"
24449             ;;
24450     *)  perllibs="$libs"
24451             ;;
24452     esac
24453     ;;
24454 esac
24455
24456 : Remove build directory name from cppstdin so it can be used from
24457 : either the present location or the final installed location.
24458 echo " "
24459 : Get out of the UU directory to get correct path name.
24460 cd ..
24461 case "$cppstdin" in
24462 `pwd`/cppstdin)
24463         echo "Stripping down cppstdin path name"
24464         cppstdin=cppstdin
24465         ;;
24466 esac
24467 cd UU
24468
24469 : end of configuration questions
24470 echo " "
24471 echo "End of configuration questions."
24472 echo " "
24473
24474 : back to where it started
24475 if test -d ../UU; then
24476         cd ..
24477 fi
24478
24479 : configuration may be unconditionally patched via a 'config.arch' file
24480 if $test -f config.arch; then
24481         echo "I see a config.arch file, loading it." >&4
24482         . ./config.arch
24483 fi
24484
24485 : configuration may be patched via a 'config.over' file
24486 if $test -f config.over; then
24487         echo " "
24488         dflt=y
24489         rp='I see a config.over file.  Do you wish to load it?'
24490         . UU/myread
24491         case "$ans" in
24492         n*) echo "OK, I'll ignore it.";;
24493         *)      . ./config.over
24494                 echo "Configuration override changes have been loaded."
24495                 ;;
24496         esac
24497 fi
24498
24499 : in case they want portability, strip down executable paths
24500 case "$d_portable" in
24501 "$define")
24502         echo " "
24503         echo "Stripping down executable paths..." >&4
24504         for file in $loclist $trylist; do
24505                 eval temp=\$$file
24506                 eval $file=`basename $temp`
24507         done
24508         ;;
24509 esac
24510
24511 : create config.sh file
24512 echo " "
24513 echo "Creating config.sh..." >&4
24514 $spitshell <<EOT >config.sh
24515 $startsh
24516 #
24517 # This file was produced by running the Configure script. It holds all the
24518 # definitions figured out by Configure. Should you modify one of these values,
24519 # do not forget to propagate your changes by running "Configure -der". You may
24520 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24521 #
24522
24523 # Package name      : $package
24524 # Source directory  : $src
24525 # Configuration time: $cf_time
24526 # Configured by     : $cf_by
24527 # Target system     : $myuname
24528
24529 EOT
24530 : Add in command line options if available
24531 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24532
24533 $spitshell <<EOT >>config.sh
24534
24535 Author='$Author'
24536 Date='$Date'
24537 Header='$Header'
24538 Id='$Id'
24539 Locker='$Locker'
24540 Log='$Log'
24541 RCSfile='$RCSfile'
24542 Revision='$Revision'
24543 Source='$Source'
24544 State='$State'
24545 _a='$_a'
24546 _exe='$_exe'
24547 _o='$_o'
24548 afs='$afs'
24549 afsroot='$afsroot'
24550 alignbytes='$alignbytes'
24551 aphostname='$aphostname'
24552 api_revision='$api_revision'
24553 api_subversion='$api_subversion'
24554 api_version='$api_version'
24555 api_versionstring='$api_versionstring'
24556 ar='$ar'
24557 archlib='$archlib'
24558 archlibexp='$archlibexp'
24559 archname64='$archname64'
24560 archname='$archname'
24561 archobjs='$archobjs'
24562 asctime_r_proto='$asctime_r_proto'
24563 awk='$awk'
24564 baserev='$baserev'
24565 bash='$bash'
24566 bin='$bin'
24567 bin_ELF='$bin_ELF'
24568 binexp='$binexp'
24569 bison='$bison'
24570 byacc='$byacc'
24571 byteorder='$byteorder'
24572 c='$c'
24573 castflags='$castflags'
24574 cat='$cat'
24575 cc='$cc'
24576 cccdlflags='$cccdlflags'
24577 ccdlflags='$ccdlflags'
24578 ccflags='$ccflags'
24579 ccflags_uselargefiles='$ccflags_uselargefiles'
24580 ccname='$ccname'
24581 ccsymbols='$ccsymbols'
24582 ccversion='$ccversion'
24583 cf_by='$cf_by'
24584 cf_email='$cf_email'
24585 cf_time='$cf_time'
24586 charbits='$charbits'
24587 charsize='$charsize'
24588 chgrp='$chgrp'
24589 chmod='$chmod'
24590 chown='$chown'
24591 clocktype='$clocktype'
24592 comm='$comm'
24593 compiler_warning='$compiler_warning'
24594 compress='$compress'
24595 contains='$contains'
24596 cp='$cp'
24597 cpio='$cpio'
24598 cpp='$cpp'
24599 cpp_stuff='$cpp_stuff'
24600 cppccsymbols='$cppccsymbols'
24601 cppflags='$cppflags'
24602 cpplast='$cpplast'
24603 cppminus='$cppminus'
24604 cpprun='$cpprun'
24605 cppstdin='$cppstdin'
24606 cppsymbols='$cppsymbols'
24607 crypt_r_proto='$crypt_r_proto'
24608 cryptlib='$cryptlib'
24609 csh='$csh'
24610 ctermid_r_proto='$ctermid_r_proto'
24611 ctime_r_proto='$ctime_r_proto'
24612 d_Gconvert='$d_Gconvert'
24613 d_PRIEUldbl='$d_PRIEUldbl'
24614 d_PRIFUldbl='$d_PRIFUldbl'
24615 d_PRIGUldbl='$d_PRIGUldbl'
24616 d_PRIXU64='$d_PRIXU64'
24617 d_PRId64='$d_PRId64'
24618 d_PRIeldbl='$d_PRIeldbl'
24619 d_PRIfldbl='$d_PRIfldbl'
24620 d_PRIgldbl='$d_PRIgldbl'
24621 d_PRIi64='$d_PRIi64'
24622 d_PRIo64='$d_PRIo64'
24623 d_PRIu64='$d_PRIu64'
24624 d_PRIx64='$d_PRIx64'
24625 d_SCNfldbl='$d_SCNfldbl'
24626 d__fwalk='$d__fwalk'
24627 d_accept4='$d_accept4'
24628 d_access='$d_access'
24629 d_accessx='$d_accessx'
24630 d_acosh='$d_acosh'
24631 d_aintl='$d_aintl'
24632 d_alarm='$d_alarm'
24633 d_archlib='$d_archlib'
24634 d_asctime64='$d_asctime64'
24635 d_asctime_r='$d_asctime_r'
24636 d_asinh='$d_asinh'
24637 d_atanh='$d_atanh'
24638 d_atolf='$d_atolf'
24639 d_atoll='$d_atoll'
24640 d_attribute_always_inline='$d_attribute_always_inline'
24641 d_attribute_deprecated='$d_attribute_deprecated'
24642 d_attribute_format='$d_attribute_format'
24643 d_attribute_malloc='$d_attribute_malloc'
24644 d_attribute_nonnull='$d_attribute_nonnull'
24645 d_attribute_noreturn='$d_attribute_noreturn'
24646 d_attribute_pure='$d_attribute_pure'
24647 d_attribute_unused='$d_attribute_unused'
24648 d_attribute_visibility='$d_attribute_visibility'
24649 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24650 d_backtrace='$d_backtrace'
24651 d_bsd='$d_bsd'
24652 d_bsdgetpgrp='$d_bsdgetpgrp'
24653 d_bsdsetpgrp='$d_bsdsetpgrp'
24654 d_builtin_add_overflow='$d_builtin_add_overflow'
24655 d_builtin_choose_expr='$d_builtin_choose_expr'
24656 d_builtin_expect='$d_builtin_expect'
24657 d_builtin_mul_overflow='$d_builtin_mul_overflow'
24658 d_builtin_sub_overflow='$d_builtin_sub_overflow'
24659 d_c99_variadic_macros='$d_c99_variadic_macros'
24660 d_casti32='$d_casti32'
24661 d_castneg='$d_castneg'
24662 d_cbrt='$d_cbrt'
24663 d_chown='$d_chown'
24664 d_chroot='$d_chroot'
24665 d_chsize='$d_chsize'
24666 d_class='$d_class'
24667 d_clearenv='$d_clearenv'
24668 d_closedir='$d_closedir'
24669 d_cmsghdr_s='$d_cmsghdr_s'
24670 d_copysign='$d_copysign'
24671 d_copysignl='$d_copysignl'
24672 d_cplusplus='$d_cplusplus'
24673 d_crypt='$d_crypt'
24674 d_crypt_r='$d_crypt_r'
24675 d_csh='$d_csh'
24676 d_ctermid='$d_ctermid'
24677 d_ctermid_r='$d_ctermid_r'
24678 d_ctime64='$d_ctime64'
24679 d_ctime_r='$d_ctime_r'
24680 d_cuserid='$d_cuserid'
24681 d_dbminitproto='$d_dbminitproto'
24682 d_difftime64='$d_difftime64'
24683 d_difftime='$d_difftime'
24684 d_dir_dd_fd='$d_dir_dd_fd'
24685 d_dirfd='$d_dirfd'
24686 d_dirnamlen='$d_dirnamlen'
24687 d_dladdr='$d_dladdr'
24688 d_dlerror='$d_dlerror'
24689 d_dlopen='$d_dlopen'
24690 d_dlsymun='$d_dlsymun'
24691 d_dosuid='$d_dosuid'
24692 d_double_has_inf='$d_double_has_inf'
24693 d_double_has_nan='$d_double_has_nan'
24694 d_double_has_negative_zero='$d_double_has_negative_zero'
24695 d_double_has_subnormals='$d_double_has_subnormals'
24696 d_double_style_cray='$d_double_style_cray'
24697 d_double_style_ibm='$d_double_style_ibm'
24698 d_double_style_ieee='$d_double_style_ieee'
24699 d_double_style_vax='$d_double_style_vax'
24700 d_drand48_r='$d_drand48_r'
24701 d_drand48proto='$d_drand48proto'
24702 d_dup2='$d_dup2'
24703 d_dup3='$d_dup3'
24704 d_duplocale='$d_duplocale'
24705 d_eaccess='$d_eaccess'
24706 d_endgrent='$d_endgrent'
24707 d_endgrent_r='$d_endgrent_r'
24708 d_endhent='$d_endhent'
24709 d_endhostent_r='$d_endhostent_r'
24710 d_endnent='$d_endnent'
24711 d_endnetent_r='$d_endnetent_r'
24712 d_endpent='$d_endpent'
24713 d_endprotoent_r='$d_endprotoent_r'
24714 d_endpwent='$d_endpwent'
24715 d_endpwent_r='$d_endpwent_r'
24716 d_endsent='$d_endsent'
24717 d_endservent_r='$d_endservent_r'
24718 d_eofnblk='$d_eofnblk'
24719 d_erf='$d_erf'
24720 d_erfc='$d_erfc'
24721 d_eunice='$d_eunice'
24722 d_exp2='$d_exp2'
24723 d_expm1='$d_expm1'
24724 d_faststdio='$d_faststdio'
24725 d_fchdir='$d_fchdir'
24726 d_fchmod='$d_fchmod'
24727 d_fchmodat='$d_fchmodat'
24728 d_fchown='$d_fchown'
24729 d_fcntl='$d_fcntl'
24730 d_fcntl_can_lock='$d_fcntl_can_lock'
24731 d_fd_macros='$d_fd_macros'
24732 d_fd_set='$d_fd_set'
24733 d_fdclose='$d_fdclose'
24734 d_fdim='$d_fdim'
24735 d_fds_bits='$d_fds_bits'
24736 d_fegetround='$d_fegetround'
24737 d_ffs='$d_ffs'
24738 d_ffsl='$d_ffsl'
24739 d_fgetpos='$d_fgetpos'
24740 d_finite='$d_finite'
24741 d_finitel='$d_finitel'
24742 d_flexfnam='$d_flexfnam'
24743 d_flock='$d_flock'
24744 d_flockproto='$d_flockproto'
24745 d_fma='$d_fma'
24746 d_fmax='$d_fmax'
24747 d_fmin='$d_fmin'
24748 d_fork='$d_fork'
24749 d_fp_class='$d_fp_class'
24750 d_fp_classify='$d_fp_classify'
24751 d_fp_classl='$d_fp_classl'
24752 d_fpathconf='$d_fpathconf'
24753 d_fpclass='$d_fpclass'
24754 d_fpclassify='$d_fpclassify'
24755 d_fpclassl='$d_fpclassl'
24756 d_fpgetround='$d_fpgetround'
24757 d_fpos64_t='$d_fpos64_t'
24758 d_freelocale='$d_freelocale'
24759 d_frexpl='$d_frexpl'
24760 d_fs_data_s='$d_fs_data_s'
24761 d_fseeko='$d_fseeko'
24762 d_fsetpos='$d_fsetpos'
24763 d_fstatfs='$d_fstatfs'
24764 d_fstatvfs='$d_fstatvfs'
24765 d_fsync='$d_fsync'
24766 d_ftello='$d_ftello'
24767 d_ftime='$d_ftime'
24768 d_futimes='$d_futimes'
24769 d_gai_strerror='$d_gai_strerror'
24770 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24771 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24772 d_getaddrinfo='$d_getaddrinfo'
24773 d_getcwd='$d_getcwd'
24774 d_getenv_preserves_other_thread='$d_getenv_preserves_other_thread'
24775 d_getespwnam='$d_getespwnam'
24776 d_getfsstat='$d_getfsstat'
24777 d_getgrent='$d_getgrent'
24778 d_getgrent_r='$d_getgrent_r'
24779 d_getgrgid_r='$d_getgrgid_r'
24780 d_getgrnam_r='$d_getgrnam_r'
24781 d_getgrps='$d_getgrps'
24782 d_gethbyaddr='$d_gethbyaddr'
24783 d_gethbyname='$d_gethbyname'
24784 d_gethent='$d_gethent'
24785 d_gethname='$d_gethname'
24786 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24787 d_gethostbyname_r='$d_gethostbyname_r'
24788 d_gethostent_r='$d_gethostent_r'
24789 d_gethostprotos='$d_gethostprotos'
24790 d_getitimer='$d_getitimer'
24791 d_getlogin='$d_getlogin'
24792 d_getlogin_r='$d_getlogin_r'
24793 d_getmnt='$d_getmnt'
24794 d_getmntent='$d_getmntent'
24795 d_getnameinfo='$d_getnameinfo'
24796 d_getnbyaddr='$d_getnbyaddr'
24797 d_getnbyname='$d_getnbyname'
24798 d_getnent='$d_getnent'
24799 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24800 d_getnetbyname_r='$d_getnetbyname_r'
24801 d_getnetent_r='$d_getnetent_r'
24802 d_getnetprotos='$d_getnetprotos'
24803 d_getpagsz='$d_getpagsz'
24804 d_getpbyname='$d_getpbyname'
24805 d_getpbynumber='$d_getpbynumber'
24806 d_getpent='$d_getpent'
24807 d_getpgid='$d_getpgid'
24808 d_getpgrp2='$d_getpgrp2'
24809 d_getpgrp='$d_getpgrp'
24810 d_getppid='$d_getppid'
24811 d_getprior='$d_getprior'
24812 d_getprotobyname_r='$d_getprotobyname_r'
24813 d_getprotobynumber_r='$d_getprotobynumber_r'
24814 d_getprotoent_r='$d_getprotoent_r'
24815 d_getprotoprotos='$d_getprotoprotos'
24816 d_getprpwnam='$d_getprpwnam'
24817 d_getpwent='$d_getpwent'
24818 d_getpwent_r='$d_getpwent_r'
24819 d_getpwnam_r='$d_getpwnam_r'
24820 d_getpwuid_r='$d_getpwuid_r'
24821 d_getsbyname='$d_getsbyname'
24822 d_getsbyport='$d_getsbyport'
24823 d_getsent='$d_getsent'
24824 d_getservbyname_r='$d_getservbyname_r'
24825 d_getservbyport_r='$d_getservbyport_r'
24826 d_getservent_r='$d_getservent_r'
24827 d_getservprotos='$d_getservprotos'
24828 d_getspnam='$d_getspnam'
24829 d_getspnam_r='$d_getspnam_r'
24830 d_gettimeod='$d_gettimeod'
24831 d_gmtime64='$d_gmtime64'
24832 d_gmtime_r='$d_gmtime_r'
24833 d_gnulibc='$d_gnulibc'
24834 d_grpasswd='$d_grpasswd'
24835 d_has_C_UTF8='$d_has_C_UTF8'
24836 d_hasmntopt='$d_hasmntopt'
24837 d_htonl='$d_htonl'
24838 d_hypot='$d_hypot'
24839 d_ilogb='$d_ilogb'
24840 d_ilogbl='$d_ilogbl'
24841 d_inc_version_list='$d_inc_version_list'
24842 d_inetaton='$d_inetaton'
24843 d_inetntop='$d_inetntop'
24844 d_inetpton='$d_inetpton'
24845 d_int64_t='$d_int64_t'
24846 d_ip_mreq='$d_ip_mreq'
24847 d_ip_mreq_source='$d_ip_mreq_source'
24848 d_ipv6_mreq='$d_ipv6_mreq'
24849 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24850 d_isascii='$d_isascii'
24851 d_isblank='$d_isblank'
24852 d_isfinite='$d_isfinite'
24853 d_isfinitel='$d_isfinitel'
24854 d_isinf='$d_isinf'
24855 d_isinfl='$d_isinfl'
24856 d_isless='$d_isless'
24857 d_isnan='$d_isnan'
24858 d_isnanl='$d_isnanl'
24859 d_isnormal='$d_isnormal'
24860 d_j0='$d_j0'
24861 d_j0l='$d_j0l'
24862 d_killpg='$d_killpg'
24863 d_lc_monetary_2008='$d_lc_monetary_2008'
24864 d_lchown='$d_lchown'
24865 d_ldbl_dig='$d_ldbl_dig'
24866 d_ldexpl='$d_ldexpl'
24867 d_lgamma='$d_lgamma'
24868 d_lgamma_r='$d_lgamma_r'
24869 d_libm_lib_version='$d_libm_lib_version'
24870 d_libname_unique='$d_libname_unique'
24871 d_link='$d_link'
24872 d_linkat='$d_linkat'
24873 d_llrint='$d_llrint'
24874 d_llrintl='$d_llrintl'
24875 d_llround='$d_llround'
24876 d_llroundl='$d_llroundl'
24877 d_localeconv_l='$d_localeconv_l'
24878 d_localtime64='$d_localtime64'
24879 d_localtime_r='$d_localtime_r'
24880 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24881 d_locconv='$d_locconv'
24882 d_lockf='$d_lockf'
24883 d_log1p='$d_log1p'
24884 d_log2='$d_log2'
24885 d_logb='$d_logb'
24886 d_long_double_style_ieee='$d_long_double_style_ieee'
24887 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24888 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24889 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24890 d_long_double_style_vax='$d_long_double_style_vax'
24891 d_longdbl='$d_longdbl'
24892 d_longlong='$d_longlong'
24893 d_lrint='$d_lrint'
24894 d_lrintl='$d_lrintl'
24895 d_lround='$d_lround'
24896 d_lroundl='$d_lroundl'
24897 d_lseekproto='$d_lseekproto'
24898 d_lstat='$d_lstat'
24899 d_madvise='$d_madvise'
24900 d_malloc_good_size='$d_malloc_good_size'
24901 d_malloc_size='$d_malloc_size'
24902 d_malloc_usable_size='$d_malloc_usable_size'
24903 d_mblen='$d_mblen'
24904 d_mbrlen='$d_mbrlen'
24905 d_mbrtowc='$d_mbrtowc'
24906 d_mbstowcs='$d_mbstowcs'
24907 d_mbtowc='$d_mbtowc'
24908 d_memmem='$d_memmem'
24909 d_memrchr='$d_memrchr'
24910 d_mkdir='$d_mkdir'
24911 d_mkdtemp='$d_mkdtemp'
24912 d_mkfifo='$d_mkfifo'
24913 d_mkostemp='$d_mkostemp'
24914 d_mkstemp='$d_mkstemp'
24915 d_mkstemps='$d_mkstemps'
24916 d_mktime64='$d_mktime64'
24917 d_mktime='$d_mktime'
24918 d_mmap='$d_mmap'
24919 d_modfl='$d_modfl'
24920 d_modflproto='$d_modflproto'
24921 d_mprotect='$d_mprotect'
24922 d_msg='$d_msg'
24923 d_msg_ctrunc='$d_msg_ctrunc'
24924 d_msg_dontroute='$d_msg_dontroute'
24925 d_msg_oob='$d_msg_oob'
24926 d_msg_peek='$d_msg_peek'
24927 d_msg_proxy='$d_msg_proxy'
24928 d_msgctl='$d_msgctl'
24929 d_msgget='$d_msgget'
24930 d_msghdr_s='$d_msghdr_s'
24931 d_msgrcv='$d_msgrcv'
24932 d_msgsnd='$d_msgsnd'
24933 d_msync='$d_msync'
24934 d_munmap='$d_munmap'
24935 d_mymalloc='$d_mymalloc'
24936 d_nan='$d_nan'
24937 d_nanosleep='$d_nanosleep'
24938 d_ndbm='$d_ndbm'
24939 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24940 d_nearbyint='$d_nearbyint'
24941 d_newlocale='$d_newlocale'
24942 d_nextafter='$d_nextafter'
24943 d_nexttoward='$d_nexttoward'
24944 d_nice='$d_nice'
24945 d_nl_langinfo='$d_nl_langinfo'
24946 d_nl_langinfo_l='$d_nl_langinfo_l'
24947 d_non_int_bitfields='$d_non_int_bitfields'
24948 d_nv_preserves_uv='$d_nv_preserves_uv'
24949 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24950 d_off64_t='$d_off64_t'
24951 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24952 d_oldpthreads='$d_oldpthreads'
24953 d_oldsock='$d_oldsock'
24954 d_open3='$d_open3'
24955 d_openat='$d_openat'
24956 d_pathconf='$d_pathconf'
24957 d_pause='$d_pause'
24958 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24959 d_phostname='$d_phostname'
24960 d_pipe2='$d_pipe2'
24961 d_pipe='$d_pipe'
24962 d_poll='$d_poll'
24963 d_portable='$d_portable'
24964 d_prctl='$d_prctl'
24965 d_prctl_set_name='$d_prctl_set_name'
24966 d_printf_format_null='$d_printf_format_null'
24967 d_procselfexe='$d_procselfexe'
24968 d_pseudofork='$d_pseudofork'
24969 d_pthread_atfork='$d_pthread_atfork'
24970 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24971 d_pthread_yield='$d_pthread_yield'
24972 d_ptrdiff_t='$d_ptrdiff_t'
24973 d_pwage='$d_pwage'
24974 d_pwchange='$d_pwchange'
24975 d_pwclass='$d_pwclass'
24976 d_pwcomment='$d_pwcomment'
24977 d_pwexpire='$d_pwexpire'
24978 d_pwgecos='$d_pwgecos'
24979 d_pwpasswd='$d_pwpasswd'
24980 d_pwquota='$d_pwquota'
24981 d_qgcvt='$d_qgcvt'
24982 d_quad='$d_quad'
24983 d_querylocale='$d_querylocale'
24984 d_random_r='$d_random_r'
24985 d_re_comp='$d_re_comp'
24986 d_readdir64_r='$d_readdir64_r'
24987 d_readdir='$d_readdir'
24988 d_readdir_r='$d_readdir_r'
24989 d_readlink='$d_readlink'
24990 d_readv='$d_readv'
24991 d_recvmsg='$d_recvmsg'
24992 d_regcmp='$d_regcmp'
24993 d_regcomp='$d_regcomp'
24994 d_remainder='$d_remainder'
24995 d_remquo='$d_remquo'
24996 d_rename='$d_rename'
24997 d_renameat='$d_renameat'
24998 d_rewinddir='$d_rewinddir'
24999 d_rint='$d_rint'
25000 d_rmdir='$d_rmdir'
25001 d_round='$d_round'
25002 d_sbrkproto='$d_sbrkproto'
25003 d_scalbn='$d_scalbn'
25004 d_scalbnl='$d_scalbnl'
25005 d_sched_yield='$d_sched_yield'
25006 d_scm_rights='$d_scm_rights'
25007 d_seekdir='$d_seekdir'
25008 d_select='$d_select'
25009 d_sem='$d_sem'
25010 d_semctl='$d_semctl'
25011 d_semctl_semid_ds='$d_semctl_semid_ds'
25012 d_semctl_semun='$d_semctl_semun'
25013 d_semget='$d_semget'
25014 d_semop='$d_semop'
25015 d_sendmsg='$d_sendmsg'
25016 d_setegid='$d_setegid'
25017 d_setenv='$d_setenv'
25018 d_seteuid='$d_seteuid'
25019 d_setgrent='$d_setgrent'
25020 d_setgrent_r='$d_setgrent_r'
25021 d_setgrps='$d_setgrps'
25022 d_sethent='$d_sethent'
25023 d_sethostent_r='$d_sethostent_r'
25024 d_setitimer='$d_setitimer'
25025 d_setlinebuf='$d_setlinebuf'
25026 d_setlocale='$d_setlocale'
25027 d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
25028 d_setlocale_r='$d_setlocale_r'
25029 d_setnent='$d_setnent'
25030 d_setnetent_r='$d_setnetent_r'
25031 d_setpent='$d_setpent'
25032 d_setpgid='$d_setpgid'
25033 d_setpgrp2='$d_setpgrp2'
25034 d_setpgrp='$d_setpgrp'
25035 d_setprior='$d_setprior'
25036 d_setproctitle='$d_setproctitle'
25037 d_setprotoent_r='$d_setprotoent_r'
25038 d_setpwent='$d_setpwent'
25039 d_setpwent_r='$d_setpwent_r'
25040 d_setregid='$d_setregid'
25041 d_setresgid='$d_setresgid'
25042 d_setresuid='$d_setresuid'
25043 d_setreuid='$d_setreuid'
25044 d_setrgid='$d_setrgid'
25045 d_setruid='$d_setruid'
25046 d_setsent='$d_setsent'
25047 d_setservent_r='$d_setservent_r'
25048 d_setsid='$d_setsid'
25049 d_setvbuf='$d_setvbuf'
25050 d_shm='$d_shm'
25051 d_shmat='$d_shmat'
25052 d_shmatprototype='$d_shmatprototype'
25053 d_shmctl='$d_shmctl'
25054 d_shmdt='$d_shmdt'
25055 d_shmget='$d_shmget'
25056 d_sigaction='$d_sigaction'
25057 d_siginfo_si_addr='$d_siginfo_si_addr'
25058 d_siginfo_si_band='$d_siginfo_si_band'
25059 d_siginfo_si_errno='$d_siginfo_si_errno'
25060 d_siginfo_si_fd='$d_siginfo_si_fd'
25061 d_siginfo_si_pid='$d_siginfo_si_pid'
25062 d_siginfo_si_status='$d_siginfo_si_status'
25063 d_siginfo_si_uid='$d_siginfo_si_uid'
25064 d_siginfo_si_value='$d_siginfo_si_value'
25065 d_signbit='$d_signbit'
25066 d_sigprocmask='$d_sigprocmask'
25067 d_sigsetjmp='$d_sigsetjmp'
25068 d_sin6_scope_id='$d_sin6_scope_id'
25069 d_sitearch='$d_sitearch'
25070 d_snprintf='$d_snprintf'
25071 d_sockaddr_in6='$d_sockaddr_in6'
25072 d_sockaddr_sa_len='$d_sockaddr_sa_len'
25073 d_sockaddr_storage='$d_sockaddr_storage'
25074 d_sockatmark='$d_sockatmark'
25075 d_sockatmarkproto='$d_sockatmarkproto'
25076 d_socket='$d_socket'
25077 d_socklen_t='$d_socklen_t'
25078 d_sockpair='$d_sockpair'
25079 d_socks5_init='$d_socks5_init'
25080 d_sqrtl='$d_sqrtl'
25081 d_srand48_r='$d_srand48_r'
25082 d_srandom_r='$d_srandom_r'
25083 d_sresgproto='$d_sresgproto'
25084 d_sresuproto='$d_sresuproto'
25085 d_stat='$d_stat'
25086 d_statblks='$d_statblks'
25087 d_statfs_f_flags='$d_statfs_f_flags'
25088 d_statfs_s='$d_statfs_s'
25089 d_static_inline='$d_static_inline'
25090 d_statvfs='$d_statvfs'
25091 d_stdio_cnt_lval='$d_stdio_cnt_lval'
25092 d_stdio_ptr_lval='$d_stdio_ptr_lval'
25093 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
25094 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
25095 d_stdio_stream_array='$d_stdio_stream_array'
25096 d_stdiobase='$d_stdiobase'
25097 d_stdstdio='$d_stdstdio'
25098 d_strcoll='$d_strcoll'
25099 d_strerror_l='$d_strerror_l'
25100 d_strerror_r='$d_strerror_r'
25101 d_strftime='$d_strftime'
25102 d_strlcat='$d_strlcat'
25103 d_strlcpy='$d_strlcpy'
25104 d_strnlen='$d_strnlen'
25105 d_strtod='$d_strtod'
25106 d_strtod_l='$d_strtod_l'
25107 d_strtol='$d_strtol'
25108 d_strtold='$d_strtold'
25109 d_strtold_l='$d_strtold_l'
25110 d_strtoll='$d_strtoll'
25111 d_strtoq='$d_strtoq'
25112 d_strtoul='$d_strtoul'
25113 d_strtoull='$d_strtoull'
25114 d_strtouq='$d_strtouq'
25115 d_strxfrm='$d_strxfrm'
25116 d_strxfrm_l='$d_strxfrm_l'
25117 d_suidsafe='$d_suidsafe'
25118 d_symlink='$d_symlink'
25119 d_syscall='$d_syscall'
25120 d_syscallproto='$d_syscallproto'
25121 d_sysconf='$d_sysconf'
25122 d_sysernlst='$d_sysernlst'
25123 d_syserrlst='$d_syserrlst'
25124 d_system='$d_system'
25125 d_tcgetpgrp='$d_tcgetpgrp'
25126 d_tcsetpgrp='$d_tcsetpgrp'
25127 d_telldir='$d_telldir'
25128 d_telldirproto='$d_telldirproto'
25129 d_tgamma='$d_tgamma'
25130 d_thread_local='$d_thread_local'
25131 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
25132 d_time='$d_time'
25133 d_timegm='$d_timegm'
25134 d_times='$d_times'
25135 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
25136 d_tm_tm_zone='$d_tm_tm_zone'
25137 d_tmpnam_r='$d_tmpnam_r'
25138 d_towlower='$d_towlower'
25139 d_towupper='$d_towupper'
25140 d_trunc='$d_trunc'
25141 d_truncate='$d_truncate'
25142 d_truncl='$d_truncl'
25143 d_ttyname_r='$d_ttyname_r'
25144 d_tzname='$d_tzname'
25145 d_u32align='$d_u32align'
25146 d_ualarm='$d_ualarm'
25147 d_umask='$d_umask'
25148 d_uname='$d_uname'
25149 d_union_semun='$d_union_semun'
25150 d_unlinkat='$d_unlinkat'
25151 d_unordered='$d_unordered'
25152 d_unsetenv='$d_unsetenv'
25153 d_uselocale='$d_uselocale'
25154 d_usleep='$d_usleep'
25155 d_usleepproto='$d_usleepproto'
25156 d_ustat='$d_ustat'
25157 d_vendorarch='$d_vendorarch'
25158 d_vendorbin='$d_vendorbin'
25159 d_vendorlib='$d_vendorlib'
25160 d_vendorscript='$d_vendorscript'
25161 d_vfork='$d_vfork'
25162 d_void_closedir='$d_void_closedir'
25163 d_voidsig='$d_voidsig'
25164 d_voidtty='$d_voidtty'
25165 d_vsnprintf='$d_vsnprintf'
25166 d_wait4='$d_wait4'
25167 d_waitpid='$d_waitpid'
25168 d_wcrtomb='$d_wcrtomb'
25169 d_wcscmp='$d_wcscmp'
25170 d_wcstombs='$d_wcstombs'
25171 d_wcsxfrm='$d_wcsxfrm'
25172 d_wctomb='$d_wctomb'
25173 d_writev='$d_writev'
25174 d_xenix='$d_xenix'
25175 date='$date'
25176 db_hashtype='$db_hashtype'
25177 db_prefixtype='$db_prefixtype'
25178 db_version_major='$db_version_major'
25179 db_version_minor='$db_version_minor'
25180 db_version_patch='$db_version_patch'
25181 default_inc_excludes_dot='$default_inc_excludes_dot'
25182 direntrytype='$direntrytype'
25183 dlext='$dlext'
25184 dlsrc='$dlsrc'
25185 doubleinfbytes='$doubleinfbytes'
25186 doublekind='$doublekind'
25187 doublemantbits='$doublemantbits'
25188 doublenanbytes='$doublenanbytes'
25189 doublesize='$doublesize'
25190 drand01='$drand01'
25191 drand48_r_proto='$drand48_r_proto'
25192 dtrace='$dtrace'
25193 dtraceobject='$dtraceobject'
25194 dtracexnolibs='$dtracexnolibs'
25195 dynamic_ext='$dynamic_ext'
25196 eagain='$eagain'
25197 ebcdic='$ebcdic'
25198 echo='$echo'
25199 egrep='$egrep'
25200 emacs='$emacs'
25201 endgrent_r_proto='$endgrent_r_proto'
25202 endhostent_r_proto='$endhostent_r_proto'
25203 endnetent_r_proto='$endnetent_r_proto'
25204 endprotoent_r_proto='$endprotoent_r_proto'
25205 endpwent_r_proto='$endpwent_r_proto'
25206 endservent_r_proto='$endservent_r_proto'
25207 eunicefix='$eunicefix'
25208 exe_ext='$exe_ext'
25209 expr='$expr'
25210 extensions='$extensions'
25211 extern_C='$extern_C'
25212 extras='$extras'
25213 fflushNULL='$fflushNULL'
25214 fflushall='$fflushall'
25215 find='$find'
25216 firstmakefile='$firstmakefile'
25217 flex='$flex'
25218 fpossize='$fpossize'
25219 fpostype='$fpostype'
25220 freetype='$freetype'
25221 from='$from'
25222 full_ar='$full_ar'
25223 full_csh='$full_csh'
25224 full_sed='$full_sed'
25225 gccansipedantic='$gccansipedantic'
25226 gccosandvers='$gccosandvers'
25227 gccversion='$gccversion'
25228 getgrent_r_proto='$getgrent_r_proto'
25229 getgrgid_r_proto='$getgrgid_r_proto'
25230 getgrnam_r_proto='$getgrnam_r_proto'
25231 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
25232 gethostbyname_r_proto='$gethostbyname_r_proto'
25233 gethostent_r_proto='$gethostent_r_proto'
25234 getlogin_r_proto='$getlogin_r_proto'
25235 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
25236 getnetbyname_r_proto='$getnetbyname_r_proto'
25237 getnetent_r_proto='$getnetent_r_proto'
25238 getprotobyname_r_proto='$getprotobyname_r_proto'
25239 getprotobynumber_r_proto='$getprotobynumber_r_proto'
25240 getprotoent_r_proto='$getprotoent_r_proto'
25241 getpwent_r_proto='$getpwent_r_proto'
25242 getpwnam_r_proto='$getpwnam_r_proto'
25243 getpwuid_r_proto='$getpwuid_r_proto'
25244 getservbyname_r_proto='$getservbyname_r_proto'
25245 getservbyport_r_proto='$getservbyport_r_proto'
25246 getservent_r_proto='$getservent_r_proto'
25247 getspnam_r_proto='$getspnam_r_proto'
25248 gidformat='$gidformat'
25249 gidsign='$gidsign'
25250 gidsize='$gidsize'
25251 gidtype='$gidtype'
25252 glibpth='$glibpth'
25253 gmake='$gmake'
25254 gmtime_r_proto='$gmtime_r_proto'
25255 gnulibc_version='$gnulibc_version'
25256 grep='$grep'
25257 groupcat='$groupcat'
25258 groupstype='$groupstype'
25259 gzip='$gzip'
25260 h_fcntl='$h_fcntl'
25261 h_sysfile='$h_sysfile'
25262 hint='$hint'
25263 hostcat='$hostcat'
25264 hostgenerate='$hostgenerate'
25265 hostosname='$hostosname'
25266 hostperl='$hostperl'
25267 html1dir='$html1dir'
25268 html1direxp='$html1direxp'
25269 html3dir='$html3dir'
25270 html3direxp='$html3direxp'
25271 i16size='$i16size'
25272 i16type='$i16type'
25273 i32size='$i32size'
25274 i32type='$i32type'
25275 i64size='$i64size'
25276 i64type='$i64type'
25277 i8size='$i8size'
25278 i8type='$i8type'
25279 i_arpainet='$i_arpainet'
25280 i_bfd='$i_bfd'
25281 i_bsdioctl='$i_bsdioctl'
25282 i_crypt='$i_crypt'
25283 i_db='$i_db'
25284 i_dbm='$i_dbm'
25285 i_dirent='$i_dirent'
25286 i_dlfcn='$i_dlfcn'
25287 i_execinfo='$i_execinfo'
25288 i_fcntl='$i_fcntl'
25289 i_fenv='$i_fenv'
25290 i_fp='$i_fp'
25291 i_fp_class='$i_fp_class'
25292 i_gdbm='$i_gdbm'
25293 i_gdbm_ndbm='$i_gdbm_ndbm'
25294 i_gdbmndbm='$i_gdbmndbm'
25295 i_grp='$i_grp'
25296 i_ieeefp='$i_ieeefp'
25297 i_inttypes='$i_inttypes'
25298 i_langinfo='$i_langinfo'
25299 i_libutil='$i_libutil'
25300 i_locale='$i_locale'
25301 i_machcthr='$i_machcthr'
25302 i_malloc='$i_malloc'
25303 i_mallocmalloc='$i_mallocmalloc'
25304 i_mntent='$i_mntent'
25305 i_ndbm='$i_ndbm'
25306 i_netdb='$i_netdb'
25307 i_neterrno='$i_neterrno'
25308 i_netinettcp='$i_netinettcp'
25309 i_niin='$i_niin'
25310 i_poll='$i_poll'
25311 i_prot='$i_prot'
25312 i_pthread='$i_pthread'
25313 i_pwd='$i_pwd'
25314 i_quadmath='$i_quadmath'
25315 i_rpcsvcdbm='$i_rpcsvcdbm'
25316 i_sgtty='$i_sgtty'
25317 i_shadow='$i_shadow'
25318 i_socks='$i_socks'
25319 i_stdbool='$i_stdbool'
25320 i_stdint='$i_stdint'
25321 i_stdlib='$i_stdlib'
25322 i_sunmath='$i_sunmath'
25323 i_sysaccess='$i_sysaccess'
25324 i_sysdir='$i_sysdir'
25325 i_sysfile='$i_sysfile'
25326 i_sysfilio='$i_sysfilio'
25327 i_sysin='$i_sysin'
25328 i_sysioctl='$i_sysioctl'
25329 i_syslog='$i_syslog'
25330 i_sysmman='$i_sysmman'
25331 i_sysmode='$i_sysmode'
25332 i_sysmount='$i_sysmount'
25333 i_sysndir='$i_sysndir'
25334 i_sysparam='$i_sysparam'
25335 i_syspoll='$i_syspoll'
25336 i_sysresrc='$i_sysresrc'
25337 i_syssecrt='$i_syssecrt'
25338 i_sysselct='$i_sysselct'
25339 i_syssockio='$i_syssockio'
25340 i_sysstat='$i_sysstat'
25341 i_sysstatfs='$i_sysstatfs'
25342 i_sysstatvfs='$i_sysstatvfs'
25343 i_systime='$i_systime'
25344 i_systimek='$i_systimek'
25345 i_systimes='$i_systimes'
25346 i_systypes='$i_systypes'
25347 i_sysuio='$i_sysuio'
25348 i_sysun='$i_sysun'
25349 i_sysutsname='$i_sysutsname'
25350 i_sysvfs='$i_sysvfs'
25351 i_syswait='$i_syswait'
25352 i_termio='$i_termio'
25353 i_termios='$i_termios'
25354 i_time='$i_time'
25355 i_unistd='$i_unistd'
25356 i_ustat='$i_ustat'
25357 i_utime='$i_utime'
25358 i_vfork='$i_vfork'
25359 i_wchar='$i_wchar'
25360 i_wctype='$i_wctype'
25361 i_xlocale='$i_xlocale'
25362 ignore_versioned_solibs='$ignore_versioned_solibs'
25363 inc_version_list='$inc_version_list'
25364 inc_version_list_init='$inc_version_list_init'
25365 incpath='$incpath'
25366 incpth='$incpth'
25367 inews='$inews'
25368 initialinstalllocation='$initialinstalllocation'
25369 installarchlib='$installarchlib'
25370 installbin='$installbin'
25371 installhtml1dir='$installhtml1dir'
25372 installhtml3dir='$installhtml3dir'
25373 installman1dir='$installman1dir'
25374 installman3dir='$installman3dir'
25375 installprefix='$installprefix'
25376 installprefixexp='$installprefixexp'
25377 installprivlib='$installprivlib'
25378 installscript='$installscript'
25379 installsitearch='$installsitearch'
25380 installsitebin='$installsitebin'
25381 installsitehtml1dir='$installsitehtml1dir'
25382 installsitehtml3dir='$installsitehtml3dir'
25383 installsitelib='$installsitelib'
25384 installsiteman1dir='$installsiteman1dir'
25385 installsiteman3dir='$installsiteman3dir'
25386 installsitescript='$installsitescript'
25387 installstyle='$installstyle'
25388 installusrbinperl='$installusrbinperl'
25389 installvendorarch='$installvendorarch'
25390 installvendorbin='$installvendorbin'
25391 installvendorhtml1dir='$installvendorhtml1dir'
25392 installvendorhtml3dir='$installvendorhtml3dir'
25393 installvendorlib='$installvendorlib'
25394 installvendorman1dir='$installvendorman1dir'
25395 installvendorman3dir='$installvendorman3dir'
25396 installvendorscript='$installvendorscript'
25397 intsize='$intsize'
25398 issymlink='$issymlink'
25399 ivdformat='$ivdformat'
25400 ivsize='$ivsize'
25401 ivtype='$ivtype'
25402 known_extensions='$known_extensions'
25403 ksh='$ksh'
25404 ld='$ld'
25405 ld_can_script='$ld_can_script'
25406 lddlflags='$lddlflags'
25407 ldflags='$ldflags'
25408 ldflags_uselargefiles='$ldflags_uselargefiles'
25409 ldlibpthname='$ldlibpthname'
25410 less='$less'
25411 lib_ext='$lib_ext'
25412 libc='$libc'
25413 libperl='$libperl'
25414 libpth='$libpth'
25415 libs='$libs'
25416 libsdirs='$libsdirs'
25417 libsfiles='$libsfiles'
25418 libsfound='$libsfound'
25419 libspath='$libspath'
25420 libswanted='$libswanted'
25421 libswanted_uselargefiles='$libswanted_uselargefiles'
25422 line='$line'
25423 lint='$lint'
25424 lkflags='$lkflags'
25425 ln='$ln'
25426 lns='$lns'
25427 localtime_r_proto='$localtime_r_proto'
25428 locincpth='$locincpth'
25429 loclibpth='$loclibpth'
25430 longdblinfbytes='$longdblinfbytes'
25431 longdblkind='$longdblkind'
25432 longdblmantbits='$longdblmantbits'
25433 longdblnanbytes='$longdblnanbytes'
25434 longdblsize='$longdblsize'
25435 longlongsize='$longlongsize'
25436 longsize='$longsize'
25437 lp='$lp'
25438 lpr='$lpr'
25439 ls='$ls'
25440 lseeksize='$lseeksize'
25441 lseektype='$lseektype'
25442 mail='$mail'
25443 mailx='$mailx'
25444 make='$make'
25445 make_set_make='$make_set_make'
25446 mallocobj='$mallocobj'
25447 mallocsrc='$mallocsrc'
25448 malloctype='$malloctype'
25449 man1dir='$man1dir'
25450 man1direxp='$man1direxp'
25451 man1ext='$man1ext'
25452 man3dir='$man3dir'
25453 man3direxp='$man3direxp'
25454 man3ext='$man3ext'
25455 mips_type='$mips_type'
25456 mistrustnm='$mistrustnm'
25457 mkdir='$mkdir'
25458 mmaptype='$mmaptype'
25459 modetype='$modetype'
25460 more='$more'
25461 multiarch='$multiarch'
25462 mv='$mv'
25463 myarchname='$myarchname'
25464 mydomain='$mydomain'
25465 myhostname='$myhostname'
25466 myuname='$myuname'
25467 n='$n'
25468 need_va_copy='$need_va_copy'
25469 netdb_hlen_type='$netdb_hlen_type'
25470 netdb_host_type='$netdb_host_type'
25471 netdb_name_type='$netdb_name_type'
25472 netdb_net_type='$netdb_net_type'
25473 nm='$nm'
25474 nm_opt='$nm_opt'
25475 nm_so_opt='$nm_so_opt'
25476 nonxs_ext='$nonxs_ext'
25477 nroff='$nroff'
25478 nvEUformat='$nvEUformat'
25479 nvFUformat='$nvFUformat'
25480 nvGUformat='$nvGUformat'
25481 nv_overflows_integers_at='$nv_overflows_integers_at'
25482 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25483 nveformat='$nveformat'
25484 nvfformat='$nvfformat'
25485 nvgformat='$nvgformat'
25486 nvmantbits='$nvmantbits'
25487 nvsize='$nvsize'
25488 nvtype='$nvtype'
25489 o_nonblock='$o_nonblock'
25490 obj_ext='$obj_ext'
25491 old_pthread_create_joinable='$old_pthread_create_joinable'
25492 optimize='$optimize'
25493 orderlib='$orderlib'
25494 osname='$osname'
25495 osvers='$osvers'
25496 otherlibdirs='$otherlibdirs'
25497 package='$package'
25498 pager='$pager'
25499 passcat='$passcat'
25500 patchlevel='$patchlevel'
25501 path_sep='$path_sep'
25502 perl5='$perl5'
25503 perl='$perl'
25504 perl_patchlevel='$perl_patchlevel'
25505 perl_static_inline='$perl_static_inline'
25506 perl_thread_local='$perl_thread_local'
25507 perladmin='$perladmin'
25508 perllibs='$perllibs'
25509 perlpath='$perlpath'
25510 pg='$pg'
25511 phostname='$phostname'
25512 pidtype='$pidtype'
25513 plibpth='$plibpth'
25514 pmake='$pmake'
25515 pr='$pr'
25516 prefix='$prefix'
25517 prefixexp='$prefixexp'
25518 privlib='$privlib'
25519 privlibexp='$privlibexp'
25520 procselfexe='$procselfexe'
25521 ptrsize='$ptrsize'
25522 quadkind='$quadkind'
25523 quadtype='$quadtype'
25524 randbits='$randbits'
25525 randfunc='$randfunc'
25526 random_r_proto='$random_r_proto'
25527 randseedtype='$randseedtype'
25528 ranlib='$ranlib'
25529 rd_nodata='$rd_nodata'
25530 readdir64_r_proto='$readdir64_r_proto'
25531 readdir_r_proto='$readdir_r_proto'
25532 revision='$revision'
25533 rm='$rm'
25534 rm_try='$rm_try'
25535 rmail='$rmail'
25536 run='$run'
25537 runnm='$runnm'
25538 sGMTIME_max='$sGMTIME_max'
25539 sGMTIME_min='$sGMTIME_min'
25540 sLOCALTIME_max='$sLOCALTIME_max'
25541 sLOCALTIME_min='$sLOCALTIME_min'
25542 sPRIEUldbl='$sPRIEUldbl'
25543 sPRIFUldbl='$sPRIFUldbl'
25544 sPRIGUldbl='$sPRIGUldbl'
25545 sPRIXU64='$sPRIXU64'
25546 sPRId64='$sPRId64'
25547 sPRIeldbl='$sPRIeldbl'
25548 sPRIfldbl='$sPRIfldbl'
25549 sPRIgldbl='$sPRIgldbl'
25550 sPRIi64='$sPRIi64'
25551 sPRIo64='$sPRIo64'
25552 sPRIu64='$sPRIu64'
25553 sPRIx64='$sPRIx64'
25554 sSCNfldbl='$sSCNfldbl'
25555 sched_yield='$sched_yield'
25556 scriptdir='$scriptdir'
25557 scriptdirexp='$scriptdirexp'
25558 sed='$sed'
25559 seedfunc='$seedfunc'
25560 selectminbits='$selectminbits'
25561 selecttype='$selecttype'
25562 sendmail='$sendmail'
25563 setgrent_r_proto='$setgrent_r_proto'
25564 sethostent_r_proto='$sethostent_r_proto'
25565 setlocale_r_proto='$setlocale_r_proto'
25566 setnetent_r_proto='$setnetent_r_proto'
25567 setprotoent_r_proto='$setprotoent_r_proto'
25568 setpwent_r_proto='$setpwent_r_proto'
25569 setservent_r_proto='$setservent_r_proto'
25570 sh='$sh'
25571 shar='$shar'
25572 sharpbang='$sharpbang'
25573 shmattype='$shmattype'
25574 shortsize='$shortsize'
25575 shrpenv='$shrpenv'
25576 shsharp='$shsharp'
25577 sig_count='$sig_count'
25578 sig_name='$sig_name'
25579 sig_name_init='$sig_name_init'
25580 sig_num='$sig_num'
25581 sig_num_init='$sig_num_init'
25582 sig_size='$sig_size'
25583 signal_t='$signal_t'
25584 sitearch='$sitearch'
25585 sitearchexp='$sitearchexp'
25586 sitebin='$sitebin'
25587 sitebinexp='$sitebinexp'
25588 sitehtml1dir='$sitehtml1dir'
25589 sitehtml1direxp='$sitehtml1direxp'
25590 sitehtml3dir='$sitehtml3dir'
25591 sitehtml3direxp='$sitehtml3direxp'
25592 sitelib='$sitelib'
25593 sitelib_stem='$sitelib_stem'
25594 sitelibexp='$sitelibexp'
25595 siteman1dir='$siteman1dir'
25596 siteman1direxp='$siteman1direxp'
25597 siteman3dir='$siteman3dir'
25598 siteman3direxp='$siteman3direxp'
25599 siteprefix='$siteprefix'
25600 siteprefixexp='$siteprefixexp'
25601 sitescript='$sitescript'
25602 sitescriptexp='$sitescriptexp'
25603 sizesize='$sizesize'
25604 sizetype='$sizetype'
25605 sleep='$sleep'
25606 smail='$smail'
25607 so='$so'
25608 sockethdr='$sockethdr'
25609 socketlib='$socketlib'
25610 socksizetype='$socksizetype'
25611 sort='$sort'
25612 spackage='$spackage'
25613 spitshell='$spitshell'
25614 srand48_r_proto='$srand48_r_proto'
25615 srandom_r_proto='$srandom_r_proto'
25616 src='$src'
25617 ssizetype='$ssizetype'
25618 st_dev_sign='$st_dev_sign'
25619 st_dev_size='$st_dev_size'
25620 st_ino_sign='$st_ino_sign'
25621 st_ino_size='$st_ino_size'
25622 startperl='$startperl'
25623 startsh='$startsh'
25624 static_ext='$static_ext'
25625 stdchar='$stdchar'
25626 stdio_base='$stdio_base'
25627 stdio_bufsiz='$stdio_bufsiz'
25628 stdio_cnt='$stdio_cnt'
25629 stdio_filbuf='$stdio_filbuf'
25630 stdio_ptr='$stdio_ptr'
25631 stdio_stream_array='$stdio_stream_array'
25632 strerror_r_proto='$strerror_r_proto'
25633 submit='$submit'
25634 subversion='$subversion'
25635 sysman='$sysman'
25636 sysroot='$sysroot'
25637 tail='$tail'
25638 tar='$tar'
25639 targetarch='$targetarch'
25640 targetdir='$targetdir'
25641 targetenv='$targetenv'
25642 targethost='$targethost'
25643 targetmkdir='$targetmkdir'
25644 targetport='$targetport'
25645 targetsh='$targetsh'
25646 tbl='$tbl'
25647 tee='$tee'
25648 test='$test'
25649 timeincl='$timeincl'
25650 timetype='$timetype'
25651 tmpnam_r_proto='$tmpnam_r_proto'
25652 to='$to'
25653 touch='$touch'
25654 tr='$tr'
25655 trnl='$trnl'
25656 troff='$troff'
25657 ttyname_r_proto='$ttyname_r_proto'
25658 u16size='$u16size'
25659 u16type='$u16type'
25660 u32size='$u32size'
25661 u32type='$u32type'
25662 u64size='$u64size'
25663 u64type='$u64type'
25664 u8size='$u8size'
25665 u8type='$u8type'
25666 uidformat='$uidformat'
25667 uidsign='$uidsign'
25668 uidsize='$uidsize'
25669 uidtype='$uidtype'
25670 uname='$uname'
25671 uniq='$uniq'
25672 uquadtype='$uquadtype'
25673 use64bitall='$use64bitall'
25674 use64bitint='$use64bitint'
25675 usecbacktrace='$usecbacktrace'
25676 usecrosscompile='$usecrosscompile'
25677 usedefaultstrict='$usedefaultstrict'
25678 usedevel='$usedevel'
25679 usedl='$usedl'
25680 usedtrace='$usedtrace'
25681 usefaststdio='$usefaststdio'
25682 useithreads='$useithreads'
25683 usekernprocpathname='$usekernprocpathname'
25684 uselanginfo='$uselanginfo'
25685 uselargefiles='$uselargefiles'
25686 uselongdouble='$uselongdouble'
25687 usemallocwrap='$usemallocwrap'
25688 usemorebits='$usemorebits'
25689 usemultiplicity='$usemultiplicity'
25690 usemymalloc='$usemymalloc'
25691 usenm='$usenm'
25692 usensgetexecutablepath='$usensgetexecutablepath'
25693 useopcode='$useopcode'
25694 useperlio='$useperlio'
25695 useposix='$useposix'
25696 usequadmath='$usequadmath'
25697 usereentrant='$usereentrant'
25698 userelocatableinc='$userelocatableinc'
25699 useshrplib='$useshrplib'
25700 usesitecustomize='$usesitecustomize'
25701 usesocks='$usesocks'
25702 usethreads='$usethreads'
25703 usevendorprefix='$usevendorprefix'
25704 useversionedarchname='$useversionedarchname'
25705 usevfork='$usevfork'
25706 usrinc='$usrinc'
25707 uuname='$uuname'
25708 uvXUformat='$uvXUformat'
25709 uvoformat='$uvoformat'
25710 uvsize='$uvsize'
25711 uvtype='$uvtype'
25712 uvuformat='$uvuformat'
25713 uvxformat='$uvxformat'
25714 vendorarch='$vendorarch'
25715 vendorarchexp='$vendorarchexp'
25716 vendorbin='$vendorbin'
25717 vendorbinexp='$vendorbinexp'
25718 vendorhtml1dir='$vendorhtml1dir'
25719 vendorhtml1direxp='$vendorhtml1direxp'
25720 vendorhtml3dir='$vendorhtml3dir'
25721 vendorhtml3direxp='$vendorhtml3direxp'
25722 vendorlib='$vendorlib'
25723 vendorlib_stem='$vendorlib_stem'
25724 vendorlibexp='$vendorlibexp'
25725 vendorman1dir='$vendorman1dir'
25726 vendorman1direxp='$vendorman1direxp'
25727 vendorman3dir='$vendorman3dir'
25728 vendorman3direxp='$vendorman3direxp'
25729 vendorprefix='$vendorprefix'
25730 vendorprefixexp='$vendorprefixexp'
25731 vendorscript='$vendorscript'
25732 vendorscriptexp='$vendorscriptexp'
25733 version='$version'
25734 version_patchlevel_string='$version_patchlevel_string'
25735 versiononly='$versiononly'
25736 vi='$vi'
25737 xlibpth='$xlibpth'
25738 xlocale_needed='$xlocale_needed'
25739 yacc='$yacc'
25740 yaccflags='$yaccflags'
25741 zcat='$zcat'
25742 zip='$zip'
25743 EOT
25744
25745 : add special variables
25746 $test -f $src/patchlevel.h && \
25747 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25748 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25749 echo "PERL_CONFIG_SH=true" >>config.sh
25750
25751 : propagate old symbols
25752 if $test -f UU/config.sh; then
25753         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25754         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25755                 config.sh config.sh UU/oldconfig.sh |\
25756                 $sort | $uniq -u >UU/oldsyms
25757         set X `$cat UU/oldsyms`
25758         shift
25759         case $# in
25760         0) ;;
25761         *)
25762                 $cat <<EOM
25763 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25764 EOM
25765                 echo ": Variables propagated from previous config.sh file." >>config.sh
25766                 for sym in `$cat UU/oldsyms`; do
25767                         echo "    Propagating $hint variable "'$'"$sym..."
25768                         eval 'tmp="$'"${sym}"'"'
25769                         echo "$tmp" | \
25770                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25771                 done
25772                 ;;
25773         esac
25774 fi
25775
25776 : preserve RCS keywords in files with variable substitution, grrr
25777 Id='$Id'
25778
25779 : Finish up by extracting the .SH files
25780 case "$alldone" in
25781 exit)
25782         echo "Stopping at your request, leaving temporary files around."
25783         exit 0
25784         ;;
25785 cont)
25786         ;;
25787 '')
25788         dflt=''
25789         nostick=true
25790         $cat <<EOM
25791
25792 If you'd like to make any changes to the config.sh file before I begin
25793 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25794
25795 EOM
25796         rp="Press return or use a shell escape to edit config.sh:"
25797         . UU/myread
25798         nostick=''
25799         case "$ans" in
25800         '') ;;
25801         *) : in case they cannot read
25802                 sh 1>&4 -c "$ans";;
25803         esac
25804         ;;
25805 esac
25806
25807 : if this fails, just run all the .SH files by hand
25808 . ./config.sh
25809
25810 echo " "
25811 exec 1>&4
25812 pwd=`pwd`
25813 . ./UU/extract
25814 cd "$pwd"
25815
25816 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25817         dflt=y
25818         case "$silent" in
25819         true) ;;
25820         *)
25821                 $cat <<EOM
25822
25823 Now you need to generate make dependencies by running "$make depend".
25824 You might prefer to run it in background: "$make depend > makedepend.out &"
25825 It can take a while, so you might not want to run it right now.
25826
25827 EOM
25828                 ;;
25829         esac
25830         rp="Run $make depend now?"
25831         . UU/myread
25832         case "$ans" in
25833         y*)
25834                 $make depend && echo "Now you must run '$make'."
25835                 ;;
25836         *)
25837                 echo "You must run '$make depend' then '$make'."
25838                 ;;
25839         esac
25840 elif test -f [Mm]akefile; then
25841         echo " "
25842         echo "Now you must run a $make."
25843 else
25844         echo "Configure done."
25845 fi
25846
25847 if $test -f Policy.sh; then
25848     $cat <<EOM
25849
25850 If you compile $package on a different machine or from a different object
25851 directory, copy the Policy.sh file from this object directory to the
25852 new one before you run Configure -- this will help you with most of
25853 the policy defaults.
25854
25855 EOM
25856 fi
25857 if $test -f UU/config.msg; then
25858     echo "Hmm.  I also noted the following information while running:"
25859     echo " "
25860     $cat UU/config.msg >&4
25861 fi
25862 $rm -f kit*isdone ark*isdone
25863 $rm -rf UU
25864
25865 : End of Configure
25866