This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Configure: don't probe for the malloc()/free() return type
[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 i32dformat=''
1239 ivdformat=''
1240 nvEUformat=''
1241 nvFUformat=''
1242 nvGUformat=''
1243 nveformat=''
1244 nvfformat=''
1245 nvgformat=''
1246 u32XUformat=''
1247 u32oformat=''
1248 u32uformat=''
1249 u32xformat=''
1250 uvXUformat=''
1251 uvoformat=''
1252 uvuformat=''
1253 uvxformat=''
1254 pidtype=''
1255 prefix=''
1256 prefixexp=''
1257 installprivlib=''
1258 privlib=''
1259 privlibexp=''
1260 ptrsize=''
1261 d_PRIXU64=''
1262 d_PRId64=''
1263 d_PRIi64=''
1264 d_PRIo64=''
1265 d_PRIu64=''
1266 d_PRIx64=''
1267 sPRIXU64=''
1268 sPRId64=''
1269 sPRIi64=''
1270 sPRIo64=''
1271 sPRIu64=''
1272 sPRIx64=''
1273 d_quad=''
1274 quadkind=''
1275 quadtype=''
1276 uquadtype=''
1277 drand01=''
1278 randbits=''
1279 randfunc=''
1280 randseedtype=''
1281 seedfunc=''
1282 installscript=''
1283 scriptdir=''
1284 scriptdirexp=''
1285 selectminbits=''
1286 selecttype=''
1287 sh=''
1288 targetsh=''
1289 sig_count=''
1290 sig_name=''
1291 sig_name_init=''
1292 sig_num=''
1293 sig_num_init=''
1294 sig_size=''
1295 d_sitearch=''
1296 installsitearch=''
1297 sitearch=''
1298 sitearchexp=''
1299 installsitebin=''
1300 sitebin=''
1301 sitebinexp=''
1302 installsitehtml1dir=''
1303 sitehtml1dir=''
1304 sitehtml1direxp=''
1305 installsitehtml3dir=''
1306 sitehtml3dir=''
1307 sitehtml3direxp=''
1308 installsitelib=''
1309 sitelib=''
1310 sitelib_stem=''
1311 sitelibexp=''
1312 installsiteman1dir=''
1313 siteman1dir=''
1314 siteman1direxp=''
1315 installsiteman3dir=''
1316 siteman3dir=''
1317 siteman3direxp=''
1318 siteprefix=''
1319 siteprefixexp=''
1320 installsitescript=''
1321 sitescript=''
1322 sitescriptexp=''
1323 sizesize=''
1324 sizetype=''
1325 d_libname_unique=''
1326 so=''
1327 socksizetype=''
1328 sharpbang=''
1329 shsharp=''
1330 spitshell=''
1331 src=''
1332 ssizetype=''
1333 st_dev_sign=''
1334 st_dev_size=''
1335 st_ino_sign=''
1336 st_ino_size=''
1337 startperl=''
1338 startsh=''
1339 stdchar=''
1340 d_stdio_stream_array=''
1341 stdio_stream_array=''
1342 sysman=''
1343 sGMTIME_max=''
1344 sGMTIME_min=''
1345 sLOCALTIME_max=''
1346 sLOCALTIME_min=''
1347 trnl=''
1348 uidformat=''
1349 uidsign=''
1350 uidsize=''
1351 uidtype=''
1352 archname64=''
1353 use64bitall=''
1354 use64bitint=''
1355 usecbacktrace=''
1356 usedefaultstrict=''
1357 dtrace=''
1358 usedtrace=''
1359 usefaststdio=''
1360 usekernprocpathname=''
1361 ccflags_uselargefiles=''
1362 ldflags_uselargefiles=''
1363 libswanted_uselargefiles=''
1364 uselargefiles=''
1365 uselongdouble=''
1366 usemorebits=''
1367 usemultiplicity=''
1368 nm_opt=''
1369 nm_so_opt=''
1370 runnm=''
1371 usenm=''
1372 usensgetexecutablepath=''
1373 useperlio=''
1374 usequadmath=''
1375 usesocks=''
1376 d_oldpthreads=''
1377 useithreads=''
1378 usereentrant=''
1379 usethreads=''
1380 incpath=''
1381 mips_type=''
1382 usrinc=''
1383 d_vendorarch=''
1384 installvendorarch=''
1385 vendorarch=''
1386 vendorarchexp=''
1387 d_vendorbin=''
1388 installvendorbin=''
1389 vendorbin=''
1390 vendorbinexp=''
1391 installvendorhtml1dir=''
1392 vendorhtml1dir=''
1393 vendorhtml1direxp=''
1394 installvendorhtml3dir=''
1395 vendorhtml3dir=''
1396 vendorhtml3direxp=''
1397 d_vendorlib=''
1398 installvendorlib=''
1399 vendorlib=''
1400 vendorlib_stem=''
1401 vendorlibexp=''
1402 installvendorman1dir=''
1403 vendorman1dir=''
1404 vendorman1direxp=''
1405 installvendorman3dir=''
1406 vendorman3dir=''
1407 vendorman3direxp=''
1408 usevendorprefix=''
1409 vendorprefix=''
1410 vendorprefixexp=''
1411 d_vendorscript=''
1412 installvendorscript=''
1413 vendorscript=''
1414 vendorscriptexp=''
1415 versiononly=''
1416 yacc=''
1417 yaccflags=''
1418 CONFIG=''
1419
1420 : Detect odd OSs
1421 define='define'
1422 undef='undef'
1423 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1424 rmlist=''
1425
1426 : We must find out about Eunice early
1427 eunicefix=':'
1428 if test -f /etc/unixtovms; then
1429         eunicefix=/etc/unixtovms
1430 fi
1431 if test -f /etc/unixtovms.exe; then
1432         eunicefix=/etc/unixtovms.exe
1433 fi
1434
1435 : Set executable suffix now -- needed before hints available
1436 if test -f "/libs/version.library"; then
1437 : Amiga OS
1438     _exe=""
1439 elif test -f "/system/gnu_library/bin/ar.pm"; then
1440 : Stratus VOS
1441     _exe=".pm"
1442 elif test -n "$DJGPP"; then
1443 : DOS DJGPP
1444     _exe=".exe"
1445 elif test -f /kern/cookiejar; then
1446 : MiNT
1447     _exe=""
1448 elif test -d c:/. -o -n "$is_os2" ; then
1449 : OS/2 or cygwin
1450     _exe=".exe"
1451 fi
1452
1453 groupstype=''
1454 i_whoami=''
1455 : Possible local include directories to search.
1456 : Set locincpth to "" in a hint file to defeat local include searches.
1457 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1458 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1459 :
1460 : no include file wanted by default
1461 inclwanted=''
1462
1463 : Enable -DEBUGGING and -DDEBUGGING from the command line
1464 EBUGGING=''
1465 DEBUGGING=''
1466
1467 : Trailing extension.  Override this in a hint file, if needed.
1468 : Extra object files, if any, needed on this platform.
1469 archobjs=''
1470 libnames=''
1471 : change the next line if compiling for Xenix/286 on Xenix/386
1472 xlibpth='/usr/lib/386 /lib/386'
1473 : Possible local library directories to search.
1474 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1475 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1476
1477 : general looking path for locating libraries
1478 glibpth="/lib /usr/lib $xlibpth"
1479 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1480 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1481 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1482 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1483
1484 : Private path used by Configure to find libraries.  Its value
1485 : is prepended to libpth. This variable takes care of special
1486 : machines, like the mips.  Usually, it should be empty.
1487 plibpth=''
1488
1489 : default library list
1490 libswanted=''
1491 : some systems want to use only the non-versioned libso:s
1492 ignore_versioned_solibs=''
1493 ccname=''
1494 ccversion=''
1495 perllibs=''
1496 : set useposix=false in your hint file to disable the POSIX extension.
1497 useposix=true
1498 : set useopcode=false in your hint file to disable the Opcode extension.
1499 useopcode=true
1500 : set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1501 uselanginfo=true
1502 archname64=''
1503 ccflags_uselargefiles=''
1504 ldflags_uselargefiles=''
1505 libswanted_uselargefiles=''
1506 : set usemultiplicity on the Configure command line to enable multiplicity.
1507 : set usesocks on the Configure command line to enable socks.
1508 archname=''
1509 : set usethreads on the Configure command line to enable threads.
1510 usereentrant='undef'
1511 : List of libraries we want.
1512 : If anyone needs extra -lxxx, put those in a hint file.
1513 libswanted="cl pthread socket bind inet ndbm gdbm dbm db malloc dl ld"
1514 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1515 : We probably want to search /usr/shlib before most other libraries.
1516 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1517 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1518 glibpth="/usr/shlib $glibpth"
1519 : Do not use vfork unless overridden by a hint file.
1520 usevfork=false
1521
1522 : Find the basic shell for Bourne shell scripts
1523 case "$sh" in
1524 '')
1525         case "$SYSTYPE" in
1526         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1527         *) xxx='/bin/sh';;
1528         esac
1529         if test -f "$xxx"; then
1530                 sh="$xxx"
1531         else
1532                 : Build up a list and do a single loop so we can 'break' out.
1533                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1534                 for xxx in sh bash ksh pdksh ash; do
1535                         for p in $pth; do
1536                                 try="$try ${p}/${xxx}"
1537                         done
1538                 done
1539                 for xxx in $try; do
1540                         if test -f "$xxx"; then
1541                                 sh="$xxx";
1542                                 break
1543                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1544                                 sh="$xxx";
1545                                 break
1546                         elif test -f "$xxx.exe"; then
1547                                 sh="$xxx";
1548                                 break
1549                         fi
1550                 done
1551         fi
1552         ;;
1553 esac
1554
1555 case "$sh" in
1556 '')     cat >&2 <<EOM
1557 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1558
1559 Usually it's in /bin/sh.  How did you even get this far?
1560 Please report this issue at https://github.com/Perl/perl5/issues
1561 and we'll try to straighten this all out.
1562 EOM
1563         exit 1
1564         ;;
1565 esac
1566
1567 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1568 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1569 targetsh=$sh
1570
1571 : see if sh knows # comments
1572 if `$sh -c '#' >/dev/null 2>&1`; then
1573         shsharp=true
1574         spitshell=cat
1575         xcat=/bin/cat
1576         test -f $xcat$_exe || xcat=/usr/bin/cat
1577         if test ! -f $xcat$_exe; then
1578                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1579                         if test -f $p/cat$_exe; then
1580                                 xcat=$p/cat
1581                                 break
1582                         fi
1583                 done
1584                 if test ! -f $xcat$_exe; then
1585                         echo "Can't find cat anywhere!"
1586                         exit 1
1587                 fi
1588         fi
1589         echo "#!$xcat" >sharp
1590         $eunicefix sharp
1591         chmod +x sharp
1592         ./sharp > today 2>/dev/null
1593         if test -s today; then
1594                 sharpbang='#!'
1595         else
1596                 echo "#! $xcat" > sharp
1597                 $eunicefix sharp
1598                 chmod +x sharp
1599                 ./sharp > today 2>/dev/null
1600                 if test -s today; then
1601                         sharpbang='#! '
1602                 else
1603                         sharpbang=': use '
1604                 fi
1605         fi
1606 else
1607         echo " "
1608         echo "Your $sh doesn't grok # comments--I will strip them later on."
1609         shsharp=false
1610         cd ..
1611         echo "exec grep -v '^[  ]*#'" >spitshell
1612         chmod +x spitshell
1613         $eunicefix spitshell
1614         spitshell=`pwd`/spitshell
1615         cd UU
1616         echo "I presume that if # doesn't work, #! won't work either!"
1617         sharpbang=': use '
1618 fi
1619 rm -f sharp today
1620
1621 : figure out how to guarantee sh startup
1622 case "$startsh" in
1623 '') startsh=${sharpbang}${sh} ;;
1624 *)
1625 esac
1626 cat >sharp <<EOSS
1627 $startsh
1628 set abc
1629 test "$?abc" != 1
1630 EOSS
1631
1632 chmod +x sharp
1633 $eunicefix sharp
1634 if ./sharp; then
1635         : echo "Yup, it does."
1636 else
1637         echo "Hmm... '$startsh' does not guarantee sh startup..."
1638         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1639 fi
1640 rm -f sharp
1641
1642 : Save command line options in file UU/cmdline.opt for later use in
1643 : generating config.sh.
1644 cat > cmdline.opt <<EOSH
1645 : Configure command line arguments.
1646 config_arg0='$0'
1647 config_args='$*'
1648 config_argc=$#
1649 EOSH
1650 argn=1
1651 args_exp=''
1652 args_sep=''
1653 for arg in "$@"; do
1654         cat >>cmdline.opt <<EOSH
1655 config_arg$argn='$arg'
1656 EOSH
1657         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1658 $arg
1659 EOC
1660         arg_exp=`cat cmdl.opt`
1661         args_exp="$args_exp$args_sep'$arg_exp'"
1662         argn=`expr $argn + 1`
1663         args_sep=' '
1664 done
1665 rm -f cmdl.opt
1666
1667 : produce awk script to parse command line options
1668 cat >options.awk <<'EOF'
1669 BEGIN {
1670         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1671
1672         len = length(optstr);
1673         for (i = 1; i <= len; i++) {
1674                 c = substr(optstr, i, 1);
1675                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1676                 if (a == ":") {
1677                         arg[c] = 1;
1678                         i++;
1679                 }
1680                 opt[c] = 1;
1681         }
1682 }
1683 {
1684         expect = 0;
1685         str = $0;
1686         if (substr(str, 1, 1) != "-") {
1687                 printf("'%s'\n", str);
1688                 next;
1689         }
1690         len = length($0);
1691         for (i = 2; i <= len; i++) {
1692                 c = substr(str, i, 1);
1693                 if (!opt[c]) {
1694                         printf("-%s\n", substr(str, i));
1695                         next;
1696                 }
1697                 printf("-%s\n", c);
1698                 if (arg[c]) {
1699                         if (i < len)
1700                                 printf("'%s'\n", substr(str, i + 1));
1701                         else
1702                                 expect = 1;
1703                         next;
1704                 }
1705         }
1706 }
1707 END {
1708         if (expect)
1709                 print "?";
1710 }
1711 EOF
1712
1713 : process the command line options
1714 set X `for arg in "$@"; do echo "X$arg"; done |
1715         sed -e s/X// | awk -f options.awk`
1716 eval "set $*"
1717 shift
1718 rm -f options.awk
1719
1720 : set up default values
1721 fastread=''
1722 reuseval=false
1723 config_sh=''
1724 alldone=''
1725 error=''
1726 silent=''
1727 extractsh=''
1728 knowitall=''
1729 rm -f optdef.sh posthint.sh
1730 cat >optdef.sh <<EOS
1731 $startsh
1732 EOS
1733
1734
1735 : option parsing
1736 while test $# -gt 0; do
1737         case "$1" in
1738         -d) shift; fastread=yes;;
1739         -e) shift; alldone=cont;;
1740         -f)
1741                 shift
1742                 cd ..
1743                 if test -r "$1"; then
1744                         config_sh="$1"
1745                 else
1746                         echo "$me: cannot read config file $1." >&2
1747                         error=true
1748                 fi
1749                 cd UU
1750                 shift;;
1751         --help|\
1752         -h) shift; error=true;;
1753         -r) shift; reuseval=true;;
1754         -s) shift; silent=true; realsilent=true;;
1755         -E) shift; alldone=exit;;
1756         -K) shift; knowitall=true;;
1757         -O) shift;;
1758         -S) shift; silent=true; extractsh=true;;
1759         -D)
1760                 shift
1761                 case "$1" in
1762                 *=)
1763                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1764                         echo "$me: ignoring -D $1" >&2
1765                         ;;
1766                 *=*) echo "$1" | \
1767                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1768                 *) echo "$1='define'" >> optdef.sh;;
1769                 esac
1770                 shift
1771                 ;;
1772         -U)
1773                 shift
1774                 case "$1" in
1775                 *=) echo "$1" >> optdef.sh;;
1776                 *=*)
1777                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1778                         echo "$me: ignoring -U $1" >&2
1779                         ;;
1780                 *) echo "$1='undef'" >> optdef.sh;;
1781                 esac
1782                 shift
1783                 ;;
1784         -A)
1785             shift
1786             xxx=''
1787             yyy="$1"
1788             zzz=''
1789             uuu=undef
1790             case "$yyy" in
1791             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1792                  case "$zzz" in
1793                  *:*) zzz='' ;;
1794                  *)   xxx=append
1795                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1796                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1797                  esac
1798                  ;;
1799             esac
1800             case "$xxx" in
1801             '')  case "$yyy" in
1802                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1803                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1804                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1805                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1806                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1807                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1808                  esac
1809                  ;;
1810             esac
1811             case "$xxx" in
1812             append)
1813                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1814             clear)
1815                 echo "$yyy=''"                  >> posthint.sh ;;
1816             define)
1817                 case "$zzz" in
1818                 '') zzz=define ;;
1819                 esac
1820                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1821             eval)
1822                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1823             prepend)
1824                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1825             undef)
1826                 case "$zzz" in
1827                 '') zzz="$uuu" ;;
1828                 esac
1829                 echo "$yyy=$zzz"                >> posthint.sh ;;
1830             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1831             esac
1832             shift
1833             ;;
1834         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1835             exit 0;;
1836         --) break;;
1837         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1838         *) break;;
1839         esac
1840 done
1841
1842 case "$error" in
1843 true)
1844         cat >&2 <<EOM
1845 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1846                  [-U symbol] [-U symbol=] [-A command:symbol...]
1847   -d : use defaults for all answers.
1848   -e : go on without questioning past the production of config.sh.
1849   -f : specify an alternate default configuration file.
1850   -h : print this help message and exit (with an error status).
1851   -r : reuse C symbols value if possible (skips costly nm extraction).
1852   -s : silent mode, only echoes questions and essential information.
1853   -D : define symbol to have some value:
1854          -D symbol                symbol gets the value 'define'
1855          -D symbol='some value'   symbol is set to 'some value'
1856        common used examples (see INSTALL for more info):
1857          -Duse64bitint            use 64bit integers
1858          -Duse64bitall            use 64bit integers and pointers
1859          -Dusethreads             use thread support
1860          -Dinc_version_list=none  do not include older perl trees in @INC
1861          -DEBUGGING=none          DEBUGGING options
1862          -Dcc=gcc                 choose your compiler
1863          -Dprefix=/opt/perl5      choose your destination
1864   -E : stop at the end of questions, after having produced config.sh.
1865   -K : do not use unless you know what you are doing.
1866   -O : ignored for backward compatibility
1867   -S : perform variable substitutions on all .SH files (can mix with -f)
1868   -U : undefine symbol:
1869          -U symbol    symbol gets the value 'undef'
1870          -U symbol=   symbol gets completely empty
1871        e.g.:  -Uversiononly
1872   -A : manipulate symbol after the platform specific hints have been applied:
1873          -A append:symbol=value   append value to symbol
1874          -A symbol=value          like append:, but with a separating space
1875          -A define:symbol=value   define symbol to have value
1876          -A clear:symbol          define symbol to be ''
1877          -A define:symbol         define symbol to be 'define'
1878          -A eval:symbol=value     define symbol to be eval of value
1879          -A prepend:symbol=value  prepend value to symbol
1880          -A undef:symbol          define symbol to be 'undef'
1881          -A undef:symbol=         define symbol to be ''
1882        e.g.:  -A prepend:libswanted='cl pthread '
1883               -A ccflags=-DSOME_MACRO
1884   -V : print version number and exit (with a zero status).
1885 EOM
1886         exit 1
1887         ;;
1888 esac
1889
1890 : Sanity checks
1891 case "$fastread$alldone" in
1892 yescont|yesexit) ;;
1893 *)
1894         case "$extractsh" in
1895         true) ;;
1896         *)
1897                 if test ! -t 0; then
1898                         echo "Say 'sh Configure', not 'sh <Configure'"
1899                         exit 1
1900                 fi
1901                 ;;
1902         esac
1903         ;;
1904 esac
1905
1906 exec 4>&1
1907 case "$silent" in
1908 true) exec 1>/dev/null;;
1909 esac
1910
1911 : run the defines and the undefines, if any, but leave the file out there...
1912 touch optdef.sh
1913 grep '\\' optdef.sh >/dev/null 2>&1
1914 if test $? = 0; then
1915     echo "Configure does not support \\ in -D arguments"
1916     exit 1
1917 fi
1918 . ./optdef.sh
1919 : create the posthint manipulation script and leave the file out there...
1920 touch posthint.sh
1921
1922 : set package name
1923 package='perl5'
1924 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1925 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1926 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1927 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1928 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1929 esac
1930
1931 : Some greps do not return status, grrr.
1932 echo "grimblepritz" >grimble
1933 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1934         contains=contains
1935 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1936         contains=grep
1937 else
1938         contains=contains
1939 fi
1940 rm -f grimble
1941 : the following should work in any shell
1942 case "$contains" in
1943 contains*)
1944         echo " " >&4
1945         echo "AGH!  Grep doesn't return a status.  Attempting remedial action." >&4
1946         cat >contains <<'EOSS'
1947 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1948 EOSS
1949 contains=./contains
1950 chmod +x $contains
1951 esac
1952
1953 : Find the path to the source tree
1954 case "$src" in
1955 '') case "$0" in
1956     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1957          case "$src" in
1958          /*)    ;;
1959          .)     ;;
1960          *)     src=`cd ../$src && pwd` ;;
1961          esac
1962          ;;
1963     *)   src='.';;
1964     esac;;
1965 esac
1966 case "$src" in
1967 '')     src=/
1968         rsrc=/
1969         ;;
1970 /*)     rsrc="$src";;
1971 *)      rsrc="../$src";;
1972 esac
1973 if test -f $rsrc/Configure && \
1974         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1975 then
1976    : found it, so we are ok.
1977 else
1978         rsrc=''
1979         for src in . .. ../.. ../../.. ../../../..; do
1980                 if test -f ../$src/Configure && \
1981                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1982                 then
1983                         rsrc=../$src
1984                         break
1985                 fi
1986         done
1987 fi
1988 case "$rsrc" in
1989 '')
1990         cat <<EOM >&4
1991
1992 Sorry, I can't seem to locate the source dir for $package.  Please start
1993 Configure with an explicit path -- i.e. /some/path/Configure.
1994
1995 EOM
1996         exit 1
1997         ;;
1998 ../.)   rsrc='..';;
1999 *)
2000         echo " "
2001         echo "Sources for $package found in \"$src\"." >&4
2002         ;;
2003 esac
2004
2005 : script used to extract .SH files with variable substitutions
2006 cat >extract <<'EOS'
2007 PERL_CONFIG_SH=true
2008 echo "Doing variable substitutions on .SH files..."
2009 if test -f MANIFEST; then
2010         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
2011 else
2012         echo "(Looking for .SH files under the source directory.)"
2013         set x `(cd "$src"; find . -name "*.SH" -print)`
2014 fi
2015 shift
2016 case $# in
2017 0) set x `(cd "$src"; echo *.SH)`; shift;;
2018 esac
2019 if test ! -f "$src/$1"; then
2020         shift
2021 fi
2022 mkdir_p='
2023 name=$1;
2024 create="";
2025 while test $name; do
2026         if test ! -d "$name"; then
2027                 create="$name $create";
2028                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2029                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2030         else
2031                 name="";
2032         fi;
2033 done;
2034 for file in $create; do
2035         mkdir $file;
2036 done
2037 '
2038 for file in $*; do
2039         case "$src" in
2040         ".")
2041                 case "$file" in
2042                 */*)
2043                         dir=`expr X$file : 'X\(.*\)/'`
2044                         file=`expr X$file : 'X.*/\(.*\)'`
2045                         (cd "$dir" && . ./$file)
2046                         ;;
2047                 *)
2048                         . ./$file
2049                         ;;
2050                 esac
2051                 ;;
2052         *)
2053                 case "$file" in
2054                 */*)
2055                         dir=`expr X$file : 'X\(.*\)/'`
2056                         file=`expr X$file : 'X.*/\(.*\)'`
2057                         (set x $dir; shift; eval $mkdir_p)
2058                         sh <"$src/$dir/$file"
2059                         ;;
2060                 *)
2061                         sh <"$src/$file"
2062                         ;;
2063                 esac
2064                 ;;
2065         esac
2066 done
2067 if test -f "$src/config_h.SH"; then
2068         if test ! -f config.h; then
2069         : oops, they left it out of MANIFEST, probably, so do it anyway.
2070         . "$src/config_h.SH"
2071         fi
2072 fi
2073 EOS
2074
2075 : extract files and exit if asked to do so
2076 case "$extractsh" in
2077 true)
2078         case "$realsilent" in
2079         true) ;;
2080         *) exec 1>&4;;
2081         esac
2082         case "$config_sh" in
2083         '') config_sh='config.sh';;
2084         esac
2085         echo " "
2086         echo "Fetching answers from $config_sh..."
2087         cd ..
2088         . $config_sh
2089         . UU/optdef.sh
2090         echo " "
2091         . UU/extract
2092         rm -rf UU
2093         echo "Extraction done."
2094         exit 0
2095         ;;
2096 esac
2097
2098 : Eunice requires " " instead of "", can you believe it
2099 echo " "
2100 : Here we go...
2101 echo "Beginning of configuration questions for $package."
2102
2103 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2104
2105 : first determine how to suppress newline on echo command
2106 echo " "
2107 echo "Checking echo to see how to suppress newlines..."
2108 (echo "hi there\c" ; echo " ") >.echotmp
2109 if $contains c .echotmp >/dev/null 2>&1 ; then
2110         echo "...using -n."
2111         n='-n'
2112         c=''
2113 else
2114         cat <<'EOM'
2115 ...using \c
2116 EOM
2117         n=''
2118         c='\c'
2119 fi
2120 echo $n "The star should be here-->$c"
2121 echo '*'
2122 rm -f .echotmp
2123
2124 : Now test for existence of everything in MANIFEST
2125 echo " "
2126 if test -f "$rsrc/MANIFEST"; then
2127         echo "First let's make sure your kit is complete.  Checking..." >&4
2128         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2129                 (split -l 50 2>/dev/null || split -50)
2130         rm -f missing
2131         tmppwd=`pwd`
2132         for filelist in x??; do
2133                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2134                         >/dev/null 2>>"$tmppwd/missing")
2135         done
2136         if test -s missing; then
2137                 cat missing >&4
2138                 cat >&4 <<'EOM'
2139
2140 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2141
2142 You have the option of continuing the configuration process, despite the
2143 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2144 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2145 and contact the author (https://github.com/Perl/perl5/issues).
2146
2147 EOM
2148                 echo $n "Continue? [n] $c" >&4
2149                 read ans
2150                 case "$ans" in
2151                 y*)
2152                         echo "Continuing..." >&4
2153                         rm -f missing
2154                         ;;
2155                 *)
2156                         echo "ABORTING..." >&4
2157                         kill $$
2158                         ;;
2159                 esac
2160         else
2161                 echo "Looks good..."
2162         fi
2163 else
2164         echo "There is no MANIFEST file.  I hope your kit is complete !"
2165 fi
2166 rm -f missing x??
2167
2168 : Find the appropriate value for a newline for tr
2169 if test -n "$DJGPP"; then
2170        trnl='\012'
2171 fi
2172 if test X"$trnl" = X; then
2173         case "`echo foo | tr '\n' x 2>/dev/null`" in
2174         foox) trnl='\n' ;;
2175         esac
2176 fi
2177 if test X"$trnl" = X; then
2178         case "`echo foo | tr '\012' x 2>/dev/null`" in
2179         foox) trnl='\012' ;;
2180         esac
2181 fi
2182 if test X"$trnl" = X; then
2183        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2184        fooxy) trnl='\n\r' ;;
2185        esac
2186 fi
2187 if test X"$trnl" = X; then
2188         cat <<EOM >&2
2189
2190 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2191
2192 EOM
2193         exit 1
2194 fi
2195
2196 : compute the number of columns on the terminal for proper question formatting
2197 case "$COLUMNS" in
2198 '') COLUMNS='80';;
2199 esac
2200
2201 : set up the echo used in my read
2202 myecho="case \"\$xxxm\" in
2203 '') echo $n \"\$rp $c\" >&4;;
2204 *) case \"\$rp\" in
2205         '') echo $n \"[\$xxxm] $c\";;
2206         *)
2207                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2208                         echo \"\$rp\" >&4
2209                         echo $n \"[\$xxxm] $c\" >&4
2210                 else
2211                         echo $n \"\$rp [\$xxxm] $c\" >&4
2212                 fi
2213                 ;;
2214         esac;;
2215 esac"
2216
2217 : now set up to do reads with possible shell escape and default assignment
2218 cat <<EOSC >myread
2219 $startsh
2220 xxxm=\$dflt
2221 $myecho
2222 ans='!'
2223 counter=42
2224 case "\$fastread" in
2225 yes) case "\$dflt" in
2226         '') ;;
2227         *) ans='';
2228                 case "\$silent-\$rp" in
2229                 true-) ;;
2230                 *) echo " " >&4;;
2231                 esac;;
2232         esac;;
2233 *) case "\$silent" in
2234         true) case "\$rp" in
2235                 '') ans='';;
2236                 esac;;
2237         esac;;
2238 esac
2239 while expr "X\$ans" : "X!" >/dev/null; do
2240         read answ
2241         set x \$xxxm
2242         shift
2243         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2244         case  "\$answ" in
2245         "!")
2246                 sh 1>&4
2247                 echo " "
2248                 $myecho
2249                 ;;
2250         !*)
2251                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2252                 shift
2253                 sh 1>&4 -c "\$*"
2254                 echo " "
2255                 $myecho
2256                 ;;
2257         "\$ans")
2258                 case "\$ans" in
2259                 \\&*)
2260                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2261                         shift
2262                         case "\$1" in
2263                         -d)
2264                                 fastread=yes
2265                                 echo "(OK, I'll run with -d after this question.)" >&4
2266                                 ;;
2267                         -*)
2268                                 echo "*** Sorry, \$1 not supported yet." >&4
2269                                 ;;
2270                         esac
2271                         $myecho
2272                         ans=!
2273                         ;;
2274                 esac;;
2275         *)
2276                 case "\$aok" in
2277                 y)
2278                         echo "*** Substitution done -- please confirm."
2279                         xxxm="\$ans"
2280                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2281                         xxxm="\$ans"
2282                         ans=!
2283                         ;;
2284                 *)
2285                         echo "*** Error -- try again."
2286                         ans=!
2287                         ;;
2288                 esac
2289                 $myecho
2290                 ;;
2291         esac
2292         case "\$ans\$xxxm\$nostick" in
2293         '')
2294                 ans=!
2295                 $myecho
2296                 ;;
2297         esac
2298         counter=\`echo \$counter | awk '{ print --\$0 }'\`
2299         if [ \$counter = 0 ]; then
2300                 echo >&4
2301                 echo >&4 Too many attempts asking the same question.  Giving up.
2302                 exit 1
2303         fi
2304 done
2305 case "\$ans" in
2306 '') ans="\$xxxm";;
2307 esac
2308 EOSC
2309
2310 : create .config dir to save info across Configure sessions
2311 test -d ../.config || mkdir ../.config
2312 cat >../.config/README <<EOF
2313 This directory created by Configure to save information that should
2314 persist across sessions for $package.
2315
2316 You may safely delete it if you wish.
2317 EOF
2318
2319 : See if we are using a devel version and want that
2320 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2321 case "$usedevel" in
2322 $define|true|[yY]*)
2323     usedevel="$define" ;;
2324 *) case "$xversion" in
2325    *[13579])
2326         cat >&4 <<EOH
2327 *** WHOA THERE!!! ***
2328
2329     This is an UNSTABLE DEVELOPMENT release.
2330     The version of this $package distribution is $xversion, that is, odd,
2331     (as opposed to even) and that signifies a development release.
2332     If you want a maintenance release, you want an even-numbered version.
2333
2334     Do ***NOT*** install this into production use.
2335     Data corruption and crashes are possible.
2336
2337     It is most seriously suggested that you do not continue any further
2338     unless you want to help in developing and debugging Perl.
2339
2340     If you *still* want to build perl, you can answer 'y' now,
2341     or pass -Dusedevel to Configure.
2342
2343 EOH
2344         rp='Do you really want to continue?'
2345         dflt='n'
2346         . ./myread
2347         case "$ans" in
2348         [yY]) echo >&4 "Okay, continuing."
2349               usedevel="$define" ;;
2350         *) echo >&4 "Okay, bye."
2351            exit 1
2352            ;;
2353         esac
2354         ;;
2355     esac
2356     usedevel="$undef"
2357     ;;
2358 esac
2359 case "$usedevel" in
2360 $define|true|[yY]*)
2361         case "$versiononly" in
2362         '') versiononly="$define" ;;
2363         esac
2364         case "$installusrbinperl" in
2365         '') installusrbinperl="$undef" ;;
2366         esac
2367         ;;
2368 esac
2369
2370 : general instructions
2371 needman=true
2372 firsttime=true
2373 user=`(logname) 2>/dev/null`
2374 case "$user" in
2375 '') user=`whoami 2>&1`;;
2376 esac
2377 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2378         firsttime=false
2379         echo " "
2380         rp='Would you like to see the instructions?'
2381         dflt=n
2382         . ./myread
2383         case "$ans" in
2384         [yY]*) ;;
2385         *) needman=false;;
2386         esac
2387 fi
2388 if $needman; then
2389         cat <<EOH
2390
2391 This installation shell script will examine your system and ask you questions
2392 to determine how the perl5 package should be installed. If you get
2393 stuck on a question, you may use a ! shell escape to start a subshell or
2394 execute a command.  Many of the questions will have default answers in square
2395 brackets; typing carriage return will give you the default.
2396
2397 On some of the questions which ask for file or directory names you are allowed
2398 to use the ~name construct to specify the login directory belonging to "name",
2399 even if you don't have a shell which knows about that.  Questions where this is
2400 allowed will be marked "(~name ok)".
2401
2402 EOH
2403         rp=''
2404         dflt='Type carriage return to continue'
2405         . ./myread
2406         cat <<'EOH'
2407
2408 The prompter used in this script allows you to use shell variables and
2409 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2410 in the default answer, as if the default line was a set of arguments given to a
2411 script shell.  This means you may also use $* to repeat the whole default line,
2412 so you do not have to re-type everything to add something to the default.
2413
2414 Every time there is a substitution, you will have to confirm.  If there is an
2415 error (e.g. an unmatched backtick), the default answer will remain unchanged
2416 and you will be prompted again.
2417
2418 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2419 the questions and use the computed defaults (or the previous answers if there
2420 was already a config.sh file). Type 'Configure -h' for a list of options.
2421 You may also start interactively and then answer '& -d' at any prompt to turn
2422 on the non-interactive behaviour for the remainder of the execution.
2423
2424 EOH
2425         . ./myread
2426         cat <<EOH
2427
2428 Much effort has been expended to ensure that this shell script will run on any
2429 Unix system.  If despite that it blows up on yours, your best bet is to edit
2430 Configure and run it again.  If you can't run Configure for some reason,
2431 you'll have to generate a config.sh file by hand.  Whatever problems you
2432 have, let me (https://github.com/Perl/perl5/issues) know how I blew it.
2433
2434 This installation script affects things in two ways:
2435
2436 1) it may do direct variable substitutions on some of the files included
2437    in this kit.
2438 2) it builds a config.h file for inclusion in C programs.  You may edit
2439    any of these files as the need arises after running this script.
2440
2441 If you make a mistake on a question, there is no easy way to back up to it
2442 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2443 files.  Configure will offer to let you do this before it runs the SH files.
2444
2445 EOH
2446         dflt='Type carriage return to continue'
2447         . ./myread
2448         case "$firsttime" in
2449         true) echo $user >>../.config/instruct;;
2450         esac
2451 fi
2452
2453 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2454 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2455 if test "X$sysroot" = X; then
2456     sysroot=""
2457 else
2458     case "$cc" in
2459         *gcc*|*g++*)
2460             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2461             # _sysroot is used in places where we need --sysroot=foo
2462             # but using the rest of the flags could cause issues.
2463             _sysroot="--sysroot=$sysroot";
2464             case "$ccflags" in
2465                 *sysroot*) ;;
2466                 'undef'|*)
2467                 ccflags="$ccflags $_sysroot"
2468             esac
2469             case "$ldflags" in
2470                 *sysroot*) ;;
2471                 'undef'|*)
2472                 ldflags="$ldflags $_sysroot"
2473             esac
2474             case "$cppflags" in
2475                 *sysroot*) ;;
2476                 'undef'|*)
2477                 cppflags="$cppflags $_sysroot"
2478             esac
2479             # lddlflags updated below in lddlflags section;
2480             # same with cccdlflags
2481             ;;
2482     esac
2483
2484     # Adjust some defaults to also use $sysroot
2485     for var in xlibpth loclibpth locincpth glibpth; do
2486         eval xxx=\$$var
2487         eval $var=''
2488         for path in $xxx; do
2489             eval $var=\"\$$var $sysroot$path\"
2490         done
2491     done
2492
2493 fi
2494
2495 : find out where common programs are
2496 echo " "
2497 echo "Locating common programs..." >&4
2498 cat <<EOSC >loc
2499 $startsh
2500 case \$# in
2501 0) exit 1;;
2502 esac
2503 thing=\$1
2504 shift
2505 dflt=\$1
2506 shift
2507 for dir in \$*; do
2508         case "\$thing" in
2509         .)
2510         if test -d \$dir/\$thing; then
2511                 echo \$dir
2512                 exit 0
2513         fi
2514         ;;
2515         *)
2516         for thisthing in \$dir/\$thing; do
2517                 : just loop through to pick last item
2518         done
2519         if test -f \$thisthing; then
2520                 echo \$thisthing
2521                 exit 0
2522         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2523                 echo \$thisthing
2524                 exit 0
2525         elif test -f \$dir/\$thing.exe; then
2526                 if test -n "$DJGPP"; then
2527                         echo \$dir/\$thing.exe
2528                 elif test "$eunicefix" != ":"; then
2529                         : on Eunice apparently
2530                         echo \$dir/\$thing
2531                 fi
2532                 exit 0
2533         fi
2534         ;;
2535         esac
2536 done
2537 echo \$dflt
2538 exit 1
2539 EOSC
2540 chmod +x loc
2541 $eunicefix loc
2542 loclist="
2543 awk
2544 cat
2545 chmod
2546 comm
2547 cp
2548 echo
2549 expr
2550 grep
2551 ls
2552 mkdir
2553 rm
2554 sed
2555 sort
2556 touch
2557 tr
2558 uniq
2559 "
2560 trylist="
2561 ar
2562 bison
2563 byacc
2564 cpp
2565 csh
2566 date
2567 egrep
2568 gmake
2569 gzip
2570 less
2571 ln
2572 make
2573 more
2574 nm
2575 nroff
2576 perl
2577 pg
2578 test
2579 uname
2580 zip
2581 "
2582 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2583 pth="$pth $sysroot/lib $sysroot/usr/lib"
2584 for file in $loclist; do
2585         eval xxx=\$$file
2586         case "$xxx" in
2587         /*|?:[\\/]*)
2588                 if test -f "$xxx"; then
2589                         : ok
2590                 else
2591                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2592                         xxx=`./loc $file $file $pth`
2593                 fi
2594                 ;;
2595         '') xxx=`./loc $file $file $pth`;;
2596         *) xxx=`./loc $xxx $xxx $pth`;;
2597         esac
2598         eval $file=$xxx$_exe
2599         eval _$file=$xxx
2600         case "$xxx" in
2601         /*)
2602                 echo $file is in $xxx.
2603                 ;;
2604         ?:[\\/]*)
2605                 echo $file is in $xxx.
2606                 ;;
2607         *)
2608                 echo "I don't know where '$file' is, and my life depends on it." >&4
2609                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2610                 exit 1
2611                 ;;
2612         esac
2613 done
2614 echo " "
2615 echo "Don't worry if any of the following aren't found..."
2616 say=offhand
2617 for file in $trylist; do
2618         eval xxx=\$$file
2619         case "$xxx" in
2620         /*|?:[\\/]*)
2621                 if test -f "$xxx"; then
2622                         : ok
2623                 else
2624                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2625                         xxx=`./loc $file $file $pth`
2626                 fi
2627                 ;;
2628         '') xxx=`./loc $file $file $pth`;;
2629         *) xxx=`./loc $xxx $xxx $pth`;;
2630         esac
2631         eval $file=$xxx$_exe
2632         eval _$file=$xxx
2633         case "$xxx" in
2634         /*)
2635                 echo $file is in $xxx.
2636                 ;;
2637         ?:[\\/]*)
2638                 echo $file is in $xxx.
2639                 ;;
2640         *)
2641                 echo "I don't see $file out there, $say."
2642                 say=either
2643                 ;;
2644         esac
2645 done
2646 case "$egrep" in
2647 egrep)
2648         echo "Substituting grep for egrep."
2649         egrep=$grep
2650         _egrep=$grep
2651         ;;
2652 esac
2653 case "$less" in
2654 '')     ;;
2655 *)      if $less -R </dev/null >/dev/null 2>&1; then
2656                echo "Substituting less -R for less."
2657                less="$less -R"
2658                _less=$less
2659         fi
2660         ;;
2661 esac
2662 case "$ln" in
2663 ln)
2664         echo "Substituting cp for ln."
2665         ln=$cp
2666         _ln=$cp
2667         ;;
2668 esac
2669 case "$make" in
2670 make)
2671         case "$gmake" in
2672         gmake)
2673         echo "I can't find make or gmake, and my life depends on it." >&4
2674         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2675         exit 1
2676         ;;
2677         esac
2678         ;;
2679 esac
2680 case "$gmake" in
2681 gmake)  ;;
2682 *)      # We can't have osname yet.
2683         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2684                 # Assume that gmake, if found, is definitely GNU make
2685                 # and prefer it over the system make.
2686                 echo "Substituting gmake for make."
2687                 make=$gmake
2688                 _make=$gmake
2689         fi
2690         ;;
2691 esac
2692 case "$test" in
2693 test)
2694         echo "Hopefully test is built into your sh."
2695         ;;
2696 *)
2697         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2698                 echo "Using the test built into your sh."
2699                 test=test
2700                 _test=test
2701         fi
2702         ;;
2703 esac
2704 case "$echo" in
2705 echo)
2706         echo "Hopefully echo is built into your sh."
2707         ;;
2708 '') ;;
2709 *)
2710         echo " "
2711 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2712         $echo $n "hi there$c" >foo1
2713         echo $n "hi there$c" >foo2
2714         if cmp foo1 foo2 >/dev/null 2>&1; then
2715                 echo "They are compatible.  In fact, they may be identical."
2716         else
2717                 case "$n" in
2718                 '-n') n='' c='\c';;
2719                 *) n='-n' c='';;
2720                 esac
2721                 cat <<FOO
2722 They are not compatible!  You are probably running ksh on a non-USG system.
2723 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2724 have echo built in and we may have to run some Bourne shell scripts.  That
2725 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2726
2727 FOO
2728                 $echo $n "The star should be here-->$c"
2729                 $echo "*"
2730         fi
2731         $rm -f foo1 foo2
2732         ;;
2733 esac
2734
2735 # This question was auctioned at YAPC::Europe-2007 in Vienna
2736 # I never promised you could answer it. I only auctioned the question.
2737 cat <<FOO
2738 The following message is sponsored by
2739
2740   Dresden.pm<--The stars should be here.
2741
2742 Dear Perl user, system administrator or package
2743 maintainer, the Perl community sends greetings to
2744 you. Do you (emblematical) greet back [Y/n]? n
2745
2746 FOO
2747
2748 : Check what type of C compiler we use
2749 cat <<EOS >trygcc
2750 $startsh
2751 EOS
2752 cat <<'EOSC' >>trygcc
2753 case "$cc" in
2754 '') ;;
2755 *)  $rm -f try try.*
2756     $cat >try.c <<EOM
2757 int main(int argc, char *argv[]) {
2758   return 0;
2759 }
2760 EOM
2761     if $cc -o try $ccflags $ldflags try.c; then
2762        :
2763     else
2764         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2765         despair=yes
2766         trygcc=yes
2767         case "$cc" in
2768         *gcc*) trygcc=no ;;
2769         esac
2770         # Skip this test because it gives a false match on output like:
2771         #    ./trygcc: line 23: cc: command not found
2772         # case "`$cc -v -c try.c 2>&1`" in
2773         # *gcc*) trygcc=no ;;
2774         # esac
2775         if $test X"$trygcc" = Xyes; then
2776             if gcc -o try -c try.c; then
2777                 echo " "
2778                 echo "You seem to have a working gcc, though." >&4
2779                 # Switching compilers may undo the work of hints files.
2780                 # The most common problem is -D_REENTRANT for threads.
2781                 # This heuristic catches that case, but gets false positives
2782                 # if -Dusethreads was not actually specified.  Better to
2783                 # bail out here with a useful message than fail
2784                 # mysteriously later. Should we perhaps just try to
2785                 # re-invoke Configure -Dcc=gcc config_args ?
2786                 if $test -f usethreads.cbu; then
2787                         $cat >&4 <<EOM
2788
2789 *** However, any setting of the C compiler flags (e.g. for thread support)
2790 *** will be lost.  It may be necessary for you to restart Configure and
2791 *** add -Dcc=gcc to your Configure command line.
2792
2793 EOM
2794                         rp="Would you like to go ahead and try gcc anyway?"
2795                         dflt=n
2796                 else
2797                         rp="Would you like to use it?"
2798                         dflt=y
2799                 fi
2800                 if $test -f myread; then
2801                     . ./myread
2802                 else
2803                     if $test -f UU/myread; then
2804                         . ./UU/myread
2805                     else
2806                         echo "Cannot find myread, sorry.  Aborting." >&4
2807                         exit 1
2808                     fi
2809                 fi
2810                 case "$ans" in
2811                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2812                 esac
2813             fi
2814         fi
2815     fi
2816     $rm -f try try.*
2817     ;;
2818 esac
2819 EOSC
2820
2821 cat <<EOS >checkcc
2822 $startsh
2823 EOS
2824 cat <<'EOSC' >>checkcc
2825 case "$cc" in
2826 '') ;;
2827 *)  $rm -f try try.*
2828     $cat >try.c <<EOM
2829 int main(int argc, char *argv[]) {
2830   return 0;
2831 }
2832 EOM
2833     if $cc -o try $ccflags $ldflags try.c; then
2834        :
2835     else
2836         if $test X"$despair" = Xyes; then
2837            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2838         fi
2839         $cat >&4 <<EOM
2840 You need to find a working C compiler.
2841 Either (purchase and) install the C compiler supplied by your OS vendor,
2842 or for a free C compiler try http://gcc.gnu.org/
2843 I cannot continue any further, aborting.
2844 EOM
2845         exit 1
2846     fi
2847     $rm -f try try.*
2848     ;;
2849 esac
2850 EOSC
2851
2852 : determine whether symbolic links are supported
2853 echo " "
2854 $touch blurfl
2855 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2856         echo "Symbolic links are supported." >&4
2857         lns="$ln -s"
2858 else
2859         echo "Symbolic links are NOT supported." >&4
2860         lns="$ln"
2861 fi
2862 $rm -f blurfl sym
2863
2864 : determine whether symbolic links are supported
2865 echo " "
2866 case "$lns" in
2867 *"ln"*" -s")
2868         echo "Checking how to test for symbolic links..." >&4
2869         $lns blurfl sym
2870         if $test "X$issymlink" = X; then
2871                 case "$newsh" in
2872                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2873                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2874                 esac
2875                 if test $? = 0; then
2876                         issymlink="test -h"
2877                 else
2878                         echo "Your builtin 'test -h' may be broken." >&4
2879                         case "$test" in
2880                         /*)     ;;
2881                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2882                                 for p in $pth
2883                                 do
2884                                         if test -f "$p/$test"; then
2885                                                 test="$p/$test"
2886                                                 break
2887                                         fi
2888                                 done
2889                                 ;;
2890                         esac
2891                         case "$test" in
2892                         /*)
2893                                 echo "Trying external '$test -h'." >&4
2894                                 issymlink="$test -h"
2895                                 if $test ! -h sym >/dev/null 2>&1; then
2896                                         echo "External '$test -h' is broken, too." >&4
2897                                         issymlink=''
2898                                 fi
2899                                 ;;
2900                         *)      issymlink='' ;;
2901                         esac
2902                 fi
2903         fi
2904         if $test "X$issymlink" = X; then
2905                 if $test -L sym 2>/dev/null; then
2906                         issymlink="$test -L"
2907                         echo "The builtin '$test -L' worked." >&4
2908                 fi
2909         fi
2910         if $test "X$issymlink" != X; then
2911                 echo "You can test for symbolic links with '$issymlink'." >&4
2912         else
2913                 echo "I do not know how you can test for symbolic links." >&4
2914         fi
2915         $rm -f blurfl sym
2916         ;;
2917 *)      echo "No symbolic links, so not testing for their testing..." >&4
2918         ;;
2919 esac
2920
2921 : Make symlinks util
2922 case "$mksymlinks" in
2923 $define|true|[yY]*)
2924         case "$src" in
2925         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2926                 exit 1
2927                 ;;
2928         *)      case "$lns:$issymlink" in
2929                 *"ln"*" -s:"*"test -"?)
2930                         echo "Creating the symbolic links..." >&4
2931                         cd ..
2932                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2933                         awk 'NF == 1 {
2934                                 dir=".";
2935                                 file=$1 "";
2936                              }
2937                              NF == 2 {
2938                                 dir=$1 "";
2939                                 file=$2 "";
2940                              }
2941                              {
2942                                  print "# dir = ", dir, "file = ", file
2943                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2944                              } END {
2945                                  for (d in mf) {
2946                                      if (d != ".") { print("mkdir -p "d) }
2947                                      print("ln -sf "mf[d]" "d);
2948                                  }
2949                              }' source="$src" > UU/mksymlinks.$$
2950                         sh UU/mksymlinks.$$
2951                         rm UU/mksymlinks.$$
2952                         # Sanity check 1.
2953                         if test ! -d t/base; then
2954                                 echo "Failed to create the subdirectories.  Aborting." >&4
2955                                 exit 1
2956                         fi
2957                         # Sanity check 2.
2958                         if test ! -f t/base/lex.t; then
2959                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2960                                 exit 1
2961                         fi
2962                         if test ! -f win32/win32.c; then
2963                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2964                                 exit 1
2965                         fi
2966                         cd UU
2967                         ;;
2968                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2969                         ;;
2970                 esac
2971                 ;;
2972         esac
2973         ;;
2974 esac
2975
2976 : Check for Cross-Compilation
2977 if $test "X$targethost" = "X"; then
2978     targethost=""
2979 fi
2980 if $test "X$targetenv" = "X"; then
2981     targetenv=""
2982 fi
2983 case "$usecrosscompile" in
2984 $define|true|[yY]*)
2985         $echo "Cross-compiling..."
2986         croak=''
2987         case "$cc" in
2988         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2989             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2990             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2991             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2992             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2993             # leave out ld, choosing it is more complex
2994             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2995             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2996             # We are in a weird spot. Just before us, some values
2997             # were 'saved', to be restored after the hints are
2998             # run.  This means that the changes we made to ar,
2999             # nm and ranlib will get reverted.
3000             # To avoid that, we hijack the saving mechanism and
3001             # have it save our new values.
3002             for file in ar nm ranlib; do
3003                 eval xxx=\$$file
3004                 eval $file=$xxx$_exe
3005                 eval _$file=$xxx
3006             done
3007         ;;
3008         esac
3009         case "$targetarch" in
3010         '') echo "Targetarch not defined." >&4; croak=y ;;
3011         *)  echo "Using targetarch $targetarch." >&4 ;;
3012         esac
3013         case "$targethost" in
3014         '') echo "Targethost not defined." >&4; croak=n ;;
3015         *)  echo "Using targethost $targethost." >&4
3016         esac
3017         locincpth=' '
3018         loclibpth=' '
3019         case "$croak" in
3020         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
3021         esac
3022     : compile a host miniperl and generate_uudmap, unless we got passed them
3023     if $test "X$hostperl" = X; then
3024       echo "Building host miniperl and generate_uudmap binaries" >&4
3025       before_host=`pwd`
3026       cd ..
3027       cd $src
3028       src=`pwd`
3029       rm -rf $src/host
3030       mkdir $src/host
3031       cd $src/host
3032       $src/Configure -des -Dusedevel -Dmksymlinks
3033       $make miniperl
3034       case "$hostgenerate" in
3035       '') $make generate_uudmap
3036           hostgenerate=$src/host/generate_uudmap
3037           ;;
3038        "$undef") hostgenerate=''
3039           ;;
3040       esac
3041       hostperl=$src/host/miniperl
3042       cd $before_host
3043     fi
3044     hostosname=`$hostperl -le 'print $^O'`
3045     ;;
3046 *)
3047     usecrosscompile="$undef"
3048     ;;
3049 esac
3050
3051 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3052 case "$targethost" in
3053     '') echo "Checking for cross-compile" >&4
3054     case "$usecrosscompile$multiarch" in
3055        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3056          if [ -f Makefile ]; then
3057            echo " "
3058            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3059          else
3060            echo "Configure done."
3061          fi
3062        exit 0
3063        ;;
3064      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3065         run=''
3066         to=:
3067         from=:
3068         ;;
3069     esac
3070     ;;
3071     *) echo "Using targethost $targethost." >&4
3072         case "$src" in
3073         /*) run=$src/Cross/run
3074             targetmkdir=$src/Cross/mkdir
3075             to=$src/Cross/to
3076             from=$src/Cross/from
3077             ;;
3078         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3079             run=$pwd/Cross/run
3080             targetmkdir=$pwd/Cross/mkdir
3081             to=$pwd/Cross/to
3082             from=$pwd/Cross/from
3083             ;;
3084         esac
3085         case "$targetrun" in
3086         '') targetrun=ssh ;;
3087         esac
3088         case "$targetto" in
3089         '') targetto=scp ;;
3090         esac
3091         case "$targetfrom" in
3092         '') targetfrom=scp ;;
3093         esac
3094         run=$run-$targetrun
3095         to=$to-$targetto
3096         from=$from-$targetfrom
3097         case "$targetdir" in
3098         '')  targetdir=/tmp
3099              echo "Guessing targetdir $targetdir." >&4
3100              ;;
3101         esac
3102         case "$targetuser" in
3103         '')  targetuser=root
3104              echo "Guessing targetuser $targetuser." >&4
3105              ;;
3106         esac
3107         case "$targetport" in
3108         '')  targetport=22
3109              echo "Guessing targetport $targetport." >&4
3110              ;;
3111         esac
3112         case "$targetfrom" in
3113         scp)    q=-q ;;
3114         *)      q='' ;;
3115         esac
3116         case "$targetrun" in
3117         ssh|rsh)
3118             cat >$run <<EOF
3119 #!/bin/sh
3120 env=''
3121 case "\$1" in
3122 -cwd)
3123   shift
3124   cwd=\$1
3125   shift
3126   ;;
3127 esac
3128 case "\$1" in
3129 -env)
3130   shift
3131   env=\$1
3132   shift
3133   ;;
3134 esac
3135 case "\$cwd" in
3136 '') cwd=$targetdir ;;
3137 esac
3138 exe=\$1
3139 shift
3140 $to \$exe
3141 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3142 EOF
3143             ;;
3144         adb)
3145             $touch $run
3146             ;;
3147         *)  echo "Unknown targetrun '$targetrun'" >&4
3148             exit 1
3149             ;;
3150         esac
3151         case "$targetmkdir" in
3152         */Cross/mkdir)
3153             cat >$targetmkdir <<EOF
3154 #!/bin/sh
3155 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3156 EOF
3157             $chmod a+rx $targetmkdir
3158             ;;
3159         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3160             exit 1
3161             ;;
3162         esac
3163         case "$targetto" in
3164         scp|rcp)
3165             cat >$to <<EOF
3166 #!/bin/sh
3167 for f in \$@
3168 do
3169   case "\$f" in
3170   /*)
3171     $targetmkdir \`dirname \$f\`
3172     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3173     ;;
3174   *)
3175     $targetmkdir $targetdir/\`dirname \$f\`
3176     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3177     ;;
3178   esac
3179 done
3180 exit 0
3181 EOF
3182             ;;
3183         cp) cat >$to <<EOF
3184 #!/bin/sh
3185 for f in \$@
3186 do
3187   case "\$f" in
3188   /*)
3189     $mkdir -p $targetdir/\`dirname \$f\`
3190     $cp \$f $targetdir/\$f || exit 1
3191     ;;
3192   *)
3193     $targetmkdir $targetdir/\`dirname \$f\`
3194     $cp \$f $targetdir/\$f || exit 1
3195     ;;
3196   esac
3197 done
3198 exit 0
3199 EOF
3200             ;;
3201         *)  echo "Unknown targetto '$targetto'" >&4
3202             exit 1
3203             ;;
3204         esac
3205         case "$targetfrom" in
3206         scp|rcp)
3207           cat >$from <<EOF
3208 #!/bin/sh
3209 for f in \$@
3210 do
3211   $rm -f \$f
3212   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3213 done
3214 exit 0
3215 EOF
3216             ;;
3217         cp) cat >$from <<EOF
3218 #!/bin/sh
3219 for f in \$@
3220 do
3221   $rm -f \$f
3222   cp $targetdir/\$f . || exit 1
3223 done
3224 exit 0
3225 EOF
3226             ;;
3227         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3228             exit 1
3229             ;;
3230         esac
3231         if $test ! -f $run; then
3232             echo "Target 'run' script '$run' not found." >&4
3233         else
3234             $chmod a+rx $run
3235         fi
3236         if $test ! -f $to; then
3237             echo "Target 'to' script '$to' not found." >&4
3238         else
3239             $chmod a+rx $to
3240         fi
3241         if $test ! -f $from; then
3242             echo "Target 'from' script '$from' not found." >&4
3243         else
3244             $chmod a+rx $from
3245         fi
3246         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3247             exit 1
3248         fi
3249         cat >&4 <<EOF
3250 Using '$run' for remote execution,
3251 and '$from' and '$to'
3252 for remote file transfer.
3253 EOF
3254         ;;
3255 *)      run=''
3256         to=:
3257         from=:
3258         usecrosscompile="$undef"
3259         targetarch=''
3260         ;;
3261 esac
3262
3263 : see whether [:lower:] and [:upper:] are supported character classes
3264 echo " "
3265 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3266 ABYZ-abyz)
3267         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3268         up='[:upper:]'
3269         low='[:lower:]'
3270         ;;
3271 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3272         # (0xd9 and 0xe2), therefore that is a nice testing point.
3273         if test "X$up" = X -o "X$low" = X; then
3274             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3275             rs) up='[A-Z]'
3276                 low='[a-z]'
3277                 ;;
3278             esac
3279         fi
3280         if test "X$up" = X -o "X$low" = X; then
3281             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3282             rs) up='A-Z'
3283                 low='a-z'
3284                 ;;
3285             esac
3286         fi
3287         if test "X$up" = X -o "X$low" = X; then
3288             case "`echo RS | od -x 2>/dev/null`" in
3289             *D9E2*|*d9e2*)
3290                 echo "Hey, this might be EBCDIC." >&4
3291                 if test "X$up" = X -o "X$low" = X; then
3292                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3293                     rs) up='[A-IJ-RS-Z]'
3294                         low='[a-ij-rs-z]'
3295                         ;;
3296                     esac
3297                 fi
3298                 if test "X$up" = X -o "X$low" = X; then
3299                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3300                     rs) up='A-IJ-RS-Z'
3301                         low='a-ij-rs-z'
3302                         ;;
3303                     esac
3304                 fi
3305                 ;;
3306             esac
3307         fi
3308 esac
3309 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3310 rs)
3311     echo "Using $up and $low to convert case." >&4
3312     ;;
3313 *)
3314     echo "I don't know how to translate letters from upper to lower case." >&4
3315     echo "Your tr is not acting any way I know of." >&4
3316     exit 1
3317     ;;
3318 esac
3319 : set up the translation script tr, must be called with ./tr of course
3320 cat >tr <<EOSC
3321 $startsh
3322 case "\$1\$2" in
3323 '[A-Z][a-z]') exec $tr '$up' '$low';;
3324 '[a-z][A-Z]') exec $tr '$low' '$up';;
3325 esac
3326 exec $tr "\$@"
3327 EOSC
3328 chmod +x tr
3329 $eunicefix tr
3330
3331 : Try to determine whether config.sh was made on this system
3332 case "$config_sh" in
3333 '')
3334 myuname=`$uname -a 2>/dev/null`
3335 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3336 # Downcase everything to avoid ambiguity.
3337 # Remove slashes and single quotes so we can use parts of this in
3338 # directory and file names.
3339 # Remove newlines so myuname is sane to use elsewhere.
3340 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3341 # because the A-Z/a-z are not consecutive.
3342 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3343         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3344 newmyuname="$myuname"
3345 dflt=n
3346 case "$knowitall" in
3347 '')
3348         if test -f ../config.sh; then
3349                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3350                         eval "`grep myuname= ../config.sh`"
3351                 fi
3352                 if test "X$myuname" = "X$newmyuname"; then
3353                         dflt=y
3354                 fi
3355         fi
3356         ;;
3357 *) dflt=y;;
3358 esac
3359
3360 : Get old answers from old config file if Configure was run on the
3361 : same system, otherwise use the hints.
3362 hint=default
3363 cd ..
3364 if test -f config.sh; then
3365         echo " "
3366         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3367         . UU/myread
3368         case "$ans" in
3369         n*|N*) echo "OK, I'll ignore it."
3370                 mv config.sh config.sh.old
3371                 myuname="$newmyuname"
3372                 ;;
3373         *)  echo "Fetching default answers from your old config.sh file..." >&4
3374                 tmp_n="$n"
3375                 tmp_c="$c"
3376                 tmp_sh="$sh"
3377                 . ./config.sh
3378                 cp config.sh UU
3379                 n="$tmp_n"
3380                 c="$tmp_c"
3381                 : Older versions did not always set $sh.  Catch re-use of such
3382                 : an old config.sh.
3383                 case "$sh" in
3384                 '') sh="$tmp_sh" ;;
3385                 esac
3386                 hint=previous
3387                 ;;
3388         esac
3389 fi
3390 . ./UU/checkcc
3391 if test ! -f config.sh; then
3392         $cat <<EOM
3393
3394 First time through, eh?  I have some defaults handy for some systems
3395 that need some extra help getting the Configure answers right:
3396
3397 EOM
3398         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3399         dflt=''
3400         : Half the following guesses are probably wrong... If you have better
3401         : tests or hints, please send them to https://github.com/Perl/perl5/issues
3402         : The metaconfig authors would also appreciate a copy...
3403         $test -f /irix && osname=irix
3404         $test -f /xenix && osname=sco_xenix
3405         $test -f /dynix && osname=dynix
3406         $test -f /dnix && osname=dnix
3407         $test -f /lynx.os && osname=lynxos
3408         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3409         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3410         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3411         $test -f /bin/mips && /bin/mips && osname=mips
3412         $test -d /usr/apollo/bin && osname=apollo
3413         $test -f /etc/saf/_sactab && osname=svr4
3414         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3415         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3416         $test -f /sys/utilities/MultiView && osname=amigaos
3417         if $test -d /MachTen -o -d /MachTen_Folder; then
3418                 osname=machten
3419                 if $test -x /sbin/version; then
3420                         osvers=`/sbin/version | $awk '{print $2}' |
3421                         $sed -e 's/[A-Za-z]$//'`
3422                 elif $test -x /usr/etc/version; then
3423                         osvers=`/usr/etc/version | $awk '{print $2}' |
3424                         $sed -e 's/[A-Za-z]$//'`
3425                 else
3426                         osvers="$2.$3"
3427                 fi
3428         fi
3429
3430         $test -f /sys/posix.dll &&
3431                 $test -f /usr/bin/what &&
3432                 set X `/usr/bin/what /sys/posix.dll` &&
3433                 $test "$3" = UWIN &&
3434                 osname=uwin &&
3435                 osvers="$5"
3436
3437         if $test -f $uname; then
3438                 set X $myuname
3439                 shift
3440
3441                 case "$5" in
3442                 fps*) osname=fps ;;
3443                 mips*)
3444                         case "$4" in
3445                         umips) osname=umips ;;
3446                         *) osname=mips ;;
3447                         esac;;
3448                 [23]100) osname=mips ;;
3449                 i386*)
3450                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3451                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3452                                 osname='sco'
3453                                 osvers=$tmp
3454                         elif $test -f /etc/kconfig; then
3455                                 osname=isc
3456                                 if test "$lns" = "$ln -s"; then
3457                                         osvers=4
3458                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3459                                         osvers=3
3460                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3461                                         osvers=2
3462                                 fi
3463                         fi
3464                         tmp=''
3465                         ;;
3466                 pc*)
3467                         if test -n "$DJGPP"; then
3468                                 osname=dos
3469                                 osvers=djgpp
3470                         fi
3471                         ;;
3472                 esac
3473
3474                 case "$1" in
3475                 aix) osname=aix
3476                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3477                         case "$tmp" in
3478                         # oslevel can fail with:
3479                         # oslevel: Unable to acquire lock.
3480                         *not\ found) osvers="$4"."$3" ;;
3481                         '<3240'|'<>3240') osvers=3.2.0 ;;
3482                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3483                         '=3250'|'>3250') osvers=3.2.5 ;;
3484                         *) osvers=$tmp;;
3485                         esac
3486                         ;;
3487                 bitrig) osname=bitrig
3488                         osvers="$3"
3489                         ;;
3490                 bsd386) osname=bsd386
3491                         osvers=`$uname -r`
3492                         ;;
3493                 cygwin*) osname=cygwin
3494                         osvers="$3"
3495                         ;;
3496                 *dc.osx) osname=dcosx
3497                         osvers="$3"
3498                         ;;
3499                 dnix) osname=dnix
3500                         osvers="$3"
3501                         ;;
3502                 domainos) osname=apollo
3503                         osvers="$3"
3504                         ;;
3505                 dgux)   osname=dgux
3506                         osvers="$3"
3507                         ;;
3508                 dragonfly) osname=dragonfly
3509                         case "$3" in
3510                             [0-9]*) osvers="$3" ;;
3511                             *) osvers="$2" ;;
3512                         esac
3513                         ;;
3514                 dynixptx*) osname=dynixptx
3515                         osvers=`echo "$4"|sed 's/^v//'`
3516                         ;;
3517                 freebsd) osname=freebsd
3518                         osvers="$3" ;;
3519                 genix)  osname=genix ;;
3520                 gnu)    osname=gnu
3521                         osvers="$3" ;;
3522                 hp*)    osname=hpux
3523                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3524                         ;;
3525                 irix*)  osname=irix
3526                         case "$3" in
3527                         4*) osvers=4 ;;
3528                         5*) osvers=5 ;;
3529                         *)      osvers="$3" ;;
3530                         esac
3531                         ;;
3532                 linux)  osname=linux
3533                         case "$3" in
3534                         *)      osvers="$3" ;;
3535                         esac
3536                         $test -f /system/lib/libandroid.so && osname=linux-android
3537                         ;;
3538                 MiNT)   osname=mint
3539                         ;;
3540                 minix)  osname=minix
3541                         osvers=`$uname -r`
3542                         ;;
3543                 netbsd*) osname=netbsd
3544                         osvers="$3"
3545                         ;;
3546                 news-os) osvers="$3"
3547                         case "$3" in
3548                         4*) osname=newsos4 ;;
3549                         *) osname=newsos ;;
3550                         esac
3551                         ;;
3552                 nonstop-ux) osname=nonstopux ;;
3553                 openbsd) osname=openbsd
3554                         osvers="$3"
3555                         ;;
3556                 os2)    osname=os2
3557                         osvers="$4"
3558                         ;;
3559                 POSIX-BC | posix-bc ) osname=posix-bc
3560                         osvers="$3"
3561                         ;;
3562                 powerux | power_ux | powermax_os | powermaxos | \
3563                 powerunix | power_unix) osname=powerux
3564                         osvers="$3"
3565                         ;;
3566                 qnx) osname=qnx
3567                         osvers="$4"
3568                         ;;
3569                 solaris) osname=solaris
3570                         case "$3" in
3571                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3572                         *)      osvers="$3" ;;
3573                         esac
3574                         ;;
3575                 sunos) osname=sunos
3576                         case "$3" in
3577                         5*) osname=solaris
3578                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3579                         *)      osvers="$3" ;;
3580                         esac
3581                         ;;
3582                 titanos) osname=titanos
3583                         case "$3" in
3584                         1*) osvers=1 ;;
3585                         2*) osvers=2 ;;
3586                         3*) osvers=3 ;;
3587                         4*) osvers=4 ;;
3588                         *)      osvers="$3" ;;
3589                         esac
3590                         ;;
3591                 ultrix) osname=ultrix
3592                         osvers="$3"
3593                         ;;
3594                 osf1|mls+)      case "$5" in
3595                                 alpha)
3596                                         osname=dec_osf
3597                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3598                                         case "$osvers" in
3599                                         [1-9].[0-9]*) ;;
3600                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3601                                         esac
3602                                         ;;
3603                         hp*)    osname=hp_osf1  ;;
3604                         mips)   osname=mips_osf1 ;;
3605                         esac
3606                         ;;
3607                 # UnixWare 7.1.2 is known as Open UNIX 8
3608                 openunix|unixware) osname=svr5
3609                         osvers="$4"
3610                         ;;
3611                 uts)    osname=uts
3612                         osvers="$3"
3613                         ;;
3614                 vos) osvers="$3"
3615                         ;;
3616                 $2) case "$osname" in
3617                         *isc*) ;;
3618                         *freebsd*) ;;
3619                         svr*)
3620                                 : svr4.x or possibly later
3621                                 case "svr$3" in
3622                                 ${osname}*)
3623                                         osname=svr$3
3624                                         osvers=$4
3625                                         ;;
3626                                 esac
3627                                 case "$osname" in
3628                                 svr4.0)
3629                                         : Check for ESIX
3630                                         if test -f /stand/boot ; then
3631                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3632                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3633                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3634                                                         if test -n "$isesix"; then
3635                                                                 osname=esix4
3636                                                         fi
3637                                                 fi
3638                                         fi
3639                                         ;;
3640                                 esac
3641                                 ;;
3642                         *)      if test -f /etc/systemid; then
3643                                         osname=sco
3644                                         set `echo $3 | $sed 's/\./ /g'` $4
3645                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3646                                                 osvers=$1.$2.$3
3647                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3648                                                 osvers=$1.$2
3649                                         elif $test -f $src/hints/sco_$1.sh; then
3650                                                 osvers=$1
3651                                         fi
3652                                 else
3653                                         case "$osname" in
3654                                         '') : Still unknown.  Probably a generic Sys V.
3655                                                 osname="sysv"
3656                                                 osvers="$3"
3657                                                 ;;
3658                                         esac
3659                                 fi
3660                                 ;;
3661                         esac
3662                         ;;
3663                 *)      case "$osname" in
3664                         '') : Still unknown.  Probably a generic BSD.
3665                                 osname="$1"
3666                                 osvers="$3"
3667                                 ;;
3668                         esac
3669                         ;;
3670                 esac
3671         else
3672                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3673                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3674                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3675                                 osname=news_os
3676                         fi
3677                         $rm -f UU/kernel.what
3678                 elif test -d c:/. -o -n "$is_os2" ; then
3679                         set X $myuname
3680                         osname=os2
3681                         osvers="$5"
3682                 fi
3683         fi
3684
3685         case "$targetarch" in
3686         '') ;;
3687         *)  hostarch=$osname
3688             case "$targetarch" in
3689                 nto*|*-nto-*)
3690                     # Will load qnx.sh, which should change osname to nto
3691                     osname=qnx
3692                     osvers=''
3693                     ;;
3694                 *linux-android*)
3695                     # Catch arm-linux-androideabi, mipsel-linux-android,
3696                     # and i686-linux-android
3697                     osname=linux-android
3698                     osvers=''
3699                     ;;
3700                 *linux*)
3701                     # Something like arm-linux-gnueabihf is really just
3702                     # plain linux.
3703                     osname=linux
3704                     osvers=''
3705                     ;;
3706                 *solaris*|*sunos*)
3707                     osname=solaris
3708                     # XXX perhaps we should just assume
3709                     # osvers to be 2, or maybe take the value
3710                     # from targetarch. Using $run before the
3711                     # hints are run is somewhat icky.
3712                     set X `$run $uname -a 2>/dev/null`
3713                     shift
3714                     case "$3" in
3715                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3716                         *)  osvers="$3" ;;
3717                     esac
3718                     ;;
3719                 *)
3720                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3721                     osvers=''
3722                 ;;
3723             esac
3724             ;;
3725         esac
3726
3727         : Now look for a hint file osname_osvers, unless one has been
3728         : specified already.
3729         case "$hintfile" in
3730         ''|' ')
3731                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3732                 : Also try without trailing minor version numbers.
3733                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3734                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3735                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3736                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3737                 case "$file" in
3738                 '') dflt=none ;;
3739                 *)  case "$osvers" in
3740                         '') dflt=$file
3741                                 ;;
3742                         *)  if $test -f $src/hints/$file.sh ; then
3743                                         dflt=$file
3744                                 elif $test -f $src/hints/$xfile.sh ; then
3745                                         dflt=$xfile
3746                                 elif $test -f $src/hints/$xxfile.sh ; then
3747                                         dflt=$xxfile
3748                                 elif $test -f $src/hints/$xxxfile.sh ; then
3749                                         dflt=$xxxfile
3750                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3751                                         dflt=$xxxxfile
3752                                 elif $test -f "$src/hints/${osname}.sh" ; then
3753                                         dflt="${osname}"
3754                                 else
3755                                         dflt=none
3756                                 fi
3757                                 ;;
3758                         esac
3759                         ;;
3760                 esac
3761                 if $test -f Policy.sh ; then
3762                         case "$dflt" in
3763                         *Policy*) ;;
3764                         none) dflt="Policy" ;;
3765                         *) dflt="Policy $dflt" ;;
3766                         esac
3767                 fi
3768                 ;;
3769         *)
3770                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3771                 ;;
3772         esac
3773
3774         if $test -f Policy.sh ; then
3775                 $cat <<EOM
3776
3777 There's also a Policy hint file available, which should make the
3778 site-specific (policy) questions easier to answer.
3779 EOM
3780
3781         fi
3782
3783         $cat <<EOM
3784
3785 You may give one or more space-separated answers, or "none" if appropriate.
3786 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3787 previous run of Configure, you may specify it as well as or instead of
3788 OS-specific hints.  If hints are provided for your OS, you should use them:
3789 although Perl can probably be built without hints on many platforms, using
3790 hints often improve performance and may enable features that Configure can't
3791 set up on its own. If there are no hints that match your OS, specify "none";
3792 DO NOT give a wrong version or a wrong OS.
3793
3794 EOM
3795
3796         rp="Which of these apply, if any?"
3797         . UU/myread
3798         tans=$ans
3799         for file in $tans; do
3800                 if $test X$file = XPolicy -a -f Policy.sh; then
3801                         . Policy.sh
3802                         $cat Policy.sh >> UU/config.sh
3803                 elif $test -f $src/hints/$file.sh; then
3804                         . $src/hints/$file.sh
3805                         $cat $src/hints/$file.sh >> UU/config.sh
3806                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3807                         : nothing
3808                 else
3809                         : Give one chance to correct a possible typo.
3810                         echo "$file.sh does not exist"
3811                         dflt=$file
3812                         rp="hint to use instead?"
3813                         . UU/myread
3814                         for file in $ans; do
3815                                 if $test -f "$src/hints/$file.sh"; then
3816                                         . $src/hints/$file.sh
3817                                         $cat $src/hints/$file.sh >> UU/config.sh
3818                                 elif $test X$ans = X -o X$ans = Xnone ; then
3819                                         : nothing
3820                                 else
3821                                         echo "$file.sh does not exist -- ignored."
3822                                 fi
3823                         done
3824                 fi
3825         done
3826
3827         hint=recommended
3828         : Remember our hint file for later.
3829         if $test -f "$src/hints/$file.sh" ; then
3830                 hintfile="$file"
3831         else
3832                 hintfile=''
3833         fi
3834 fi
3835 cd UU
3836 ;;
3837 *)
3838         echo " "
3839         echo "Fetching default answers from $config_sh..." >&4
3840         tmp_n="$n"
3841         tmp_c="$c"
3842         cd ..
3843         cp $config_sh config.sh 2>/dev/null
3844         chmod +w config.sh
3845         . ./config.sh
3846         cd UU
3847         cp ../config.sh .
3848         n="$tmp_n"
3849         c="$tmp_c"
3850         hint=previous
3851         ;;
3852 esac
3853 . ./optdef.sh
3854
3855 : Restore computed paths
3856 for file in $loclist $trylist; do
3857         eval $file="\$_$file"
3858 done
3859
3860 cat << EOM
3861
3862 Configure uses the operating system name and version to set some defaults.
3863 The default value is probably right if the name rings a bell. Otherwise,
3864 since spelling matters for me, either accept the default or answer "none"
3865 to leave it blank.
3866
3867 EOM
3868 case "$osname" in
3869         ''|' ')
3870                 case "$hintfile" in
3871                 ''|' '|none) dflt=none ;;
3872                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3873                 esac
3874                 ;;
3875         *) dflt="$osname" ;;
3876 esac
3877 rp="Operating system name?"
3878 . ./myread
3879 case "$ans" in
3880 none)  osname='' ;;
3881 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3882 esac
3883 echo " "
3884 case "$osvers" in
3885         ''|' ')
3886                 case "$hintfile" in
3887                 ''|' '|none) dflt=none ;;
3888                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3889                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3890                         case "$dflt" in
3891                         ''|' ') dflt=none ;;
3892                         esac
3893                         ;;
3894                 esac
3895                 ;;
3896         *) dflt="$osvers" ;;
3897 esac
3898 rp="Operating system version?"
3899 . ./myread
3900 case "$ans" in
3901 none)  osvers='' ;;
3902 *) osvers="$ans" ;;
3903 esac
3904
3905
3906 . ./posthint.sh
3907
3908 : who configured the system
3909 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3910 case "$cf_by" in
3911 "")
3912         cf_by=`(logname) 2>/dev/null`
3913         case "$cf_by" in
3914         "")
3915                 cf_by=`(whoami) 2>/dev/null`
3916                 case "$cf_by" in
3917                 "") cf_by=unknown ;;
3918                 esac ;;
3919         esac ;;
3920 esac
3921
3922 : decide how portable to be.  Allow command line overrides.
3923 case "$d_portable" in
3924 "$undef") ;;
3925 *)      d_portable="$define" ;;
3926 esac
3927
3928 : set up shell script to do ~ expansion
3929 cat >filexp <<EOSS
3930 $startsh
3931 : expand filename
3932 case "\$1" in
3933  \~/*|\~)
3934         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3935         ;;
3936  \~*)
3937         if $test -f /bin/csh; then
3938                 /bin/csh -f -c "glob \$1"
3939                 failed=\$?
3940                 echo ""
3941                 exit \$failed
3942         else
3943                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3944                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3945                 if $test ! -d "\$dir"; then
3946                         me=\`basename \$0\`
3947                         echo "\$me: can't locate home directory for: \$name" >&2
3948                         exit 1
3949                 fi
3950                 case "\$1" in
3951                 */*)
3952                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3953                         ;;
3954                 *)
3955                         echo \$dir
3956                         ;;
3957                 esac
3958         fi
3959         ;;
3960 *)
3961         echo \$1
3962         ;;
3963 esac
3964 EOSS
3965 chmod +x filexp
3966 $eunicefix filexp
3967
3968 : now set up to get a file name
3969 cat <<EOS >getfile
3970 $startsh
3971 EOS
3972 cat <<'EOSC' >>getfile
3973 tilde=''
3974 fullpath=''
3975 already=''
3976 skip=''
3977 none_ok=''
3978 exp_file=''
3979 nopath_ok=''
3980 orig_rp="$rp"
3981 orig_dflt="$dflt"
3982 case "$gfpth" in
3983 '') gfpth='.' ;;
3984 esac
3985
3986 case "$fn" in
3987 *\(*)
3988         : getfile will accept an answer from the comma-separated list
3989         : enclosed in parentheses even if it does not meet other criteria.
3990         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3991         fn=`echo $fn | sed 's/(.*)//'`
3992         ;;
3993 esac
3994
3995 case "$fn" in
3996 *:*)
3997         loc_file=`expr $fn : '.*:\(.*\)'`
3998         fn=`expr $fn : '\(.*\):.*'`
3999         ;;
4000 esac
4001
4002 case "$fn" in
4003 *~*) tilde=true;;
4004 esac
4005 case "$fn" in
4006 */*) fullpath=true;;
4007 esac
4008 case "$fn" in
4009 *+*) skip=true;;
4010 esac
4011 case "$fn" in
4012 *n*) none_ok=true;;
4013 esac
4014 case "$fn" in
4015 *e*) exp_file=true;;
4016 esac
4017 case "$fn" in
4018 *p*) nopath_ok=true;;
4019 esac
4020
4021 case "$fn" in
4022 *f*) type='File';;
4023 *d*) type='Directory';;
4024 *l*) type='Locate';;
4025 esac
4026
4027 what="$type"
4028 case "$what" in
4029 Locate) what='File';;
4030 esac
4031
4032 case "$exp_file" in
4033 '')
4034         case "$d_portable" in
4035         "$define") ;;
4036         *) exp_file=true;;
4037         esac
4038         ;;
4039 esac
4040
4041 cd ..
4042 while test "$type"; do
4043         redo=''
4044         rp="$orig_rp"
4045         dflt="$orig_dflt"
4046         case "$tilde" in
4047         true) rp="$rp (~name ok)";;
4048         esac
4049         . UU/myread
4050         if test -f UU/getfile.ok && \
4051                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4052         then
4053                 value="$ans"
4054                 ansexp="$ans"
4055                 break
4056         fi
4057         case "$ans" in
4058         none)
4059                 value=''
4060                 ansexp=''
4061                 case "$none_ok" in
4062                 true) type='';;
4063                 esac
4064                 ;;
4065         *)
4066                 case "$tilde" in
4067                 '') value="$ans"
4068                         ansexp="$ans";;
4069                 *)
4070                         value=`UU/filexp $ans`
4071                         case $? in
4072                         0)
4073                                 if test "$ans" != "$value"; then
4074                                         echo "(That expands to $value on this system.)"
4075                                 fi
4076                                 ;;
4077                         *) value="$ans";;
4078                         esac
4079                         ansexp="$value"
4080                         case "$exp_file" in
4081                         '') value="$ans";;
4082                         esac
4083                         ;;
4084                 esac
4085                 case "$fullpath" in
4086                 true)
4087                         case "$ansexp" in
4088                         /*) value="$ansexp" ;;
4089                         [a-zA-Z]:/*) value="$ansexp" ;;
4090                         *)
4091                                 redo=true
4092                                 case "$already" in
4093                                 true)
4094                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4095                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4096                                         ;;
4097                                 *)
4098                                 echo "Please give a full path name, starting with slash." >&4
4099                                         case "$tilde" in
4100                                         true)
4101                                 echo "Note that using ~name is ok provided it expands well." >&4
4102                                                 already=true
4103                                                 ;;
4104                                         esac
4105                                 esac
4106                                 ;;
4107                         esac
4108                         ;;
4109                 esac
4110                 case "$redo" in
4111                 '')
4112                         case "$type" in
4113                         File)
4114                                 for fp in $gfpth; do
4115                                         if test "X$fp" = X.; then
4116                                             pf="$ansexp"
4117                                         else    
4118                                             pf="$fp/$ansexp"
4119                                         fi
4120                                         if test -f "$pf"; then
4121                                                 type=''
4122                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4123                                         then
4124                                                 echo "($value is not a plain file, but that's ok.)"
4125                                                 type=''
4126                                         fi
4127                                         if test X"$type" = X; then
4128                                             value="$pf"
4129                                             break
4130                                         fi
4131                                 done
4132                                 ;;
4133                         Directory)
4134                                 for fp in $gfpth; do
4135                                         if test "X$fp" = X.; then
4136                                             dir="$ans"
4137                                             direxp="$ansexp"
4138                                         else    
4139                                             dir="$fp/$ansexp"
4140                                             direxp="$fp/$ansexp"
4141                                         fi
4142                                         if test -d "$direxp"; then
4143                                                 type=''
4144                                                 value="$dir"
4145                                                 break
4146                                         fi
4147                                 done
4148                                 ;;
4149                         Locate)
4150                                 if test -d "$ansexp"; then
4151                                         echo "(Looking for $loc_file in directory $value.)"
4152                                         value="$value/$loc_file"
4153                                         ansexp="$ansexp/$loc_file"
4154                                 fi
4155                                 if test -f "$ansexp"; then
4156                                         type=''
4157                                 fi
4158                                 case "$nopath_ok" in
4159                                 true)   case "$value" in
4160                                         */*) ;;
4161                                         *)      echo "Assuming $value will be in people's path."
4162                                                 type=''
4163                                                 ;;
4164                                         esac
4165                                         ;;
4166                                 esac
4167                                 ;;
4168                         esac
4169
4170                         case "$skip" in
4171                         true) type='';
4172                         esac
4173
4174                         case "$type" in
4175                         '') ;;
4176                         *)
4177                                 if test "$fastread" = yes; then
4178                                         dflt=y
4179                                 else
4180                                         dflt=n
4181                                 fi
4182                                 rp="$what $value doesn't exist.  Use that name anyway?"
4183                                 . UU/myread
4184                                 dflt=''
4185                                 case "$ans" in
4186                                 y*) type='';;
4187                                 *) echo " ";;
4188                                 esac
4189                                 ;;
4190                         esac
4191                         ;;
4192                 esac
4193                 ;;
4194         esac
4195 done
4196 cd UU
4197 ans="$value"
4198 rp="$orig_rp"
4199 dflt="$orig_dflt"
4200 rm -f getfile.ok
4201 test "X$gfpthkeep" != Xy && gfpth=""
4202 EOSC
4203
4204 : determine root of directory hierarchy where package will be installed.
4205 case "$prefix" in
4206 '')     dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4207         ;;
4208 *)      dflt="$prefix"
4209         ;;
4210 esac
4211 $cat <<EOM
4212
4213 By default, $package will be installed in $dflt/bin, manual pages
4214 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4215 installation directories. Typically this is something like /usr/local.
4216 If you wish to have binaries under /usr/bin but other parts of the
4217 installation under /usr/local, that's ok: you will be prompted
4218 separately for each of the installation directories, the prefix being
4219 only used to set the defaults.
4220
4221 EOM
4222 fn=d~
4223 rp='Installation prefix to use?'
4224 . ./getfile
4225 oldprefix=''
4226 case "$prefix" in
4227 '')     ;;
4228 *)      case "$ans" in
4229         "$prefix") ;;
4230         *) oldprefix="$prefix";;
4231         esac
4232         ;;
4233 esac
4234
4235 case "$ans" in
4236 *?/)    prefix=`echo "$ans" | sed 's/.$//'`
4237         ;;
4238 *)      prefix="$ans"
4239 esac
4240
4241 case "$ansexp" in
4242 *?/)    prefixexp=`echo "$ansexp" | sed 's/.$//'`
4243         ;;
4244 *)      prefixexp="$ansexp"
4245 esac
4246
4247 : allow them to override the AFS root
4248 case "$afsroot" in
4249 '')     afsroot=/afs ;;
4250 *)      afsroot=$afsroot ;;
4251 esac
4252
4253 : is AFS running?
4254 echo " "
4255 case "$afs" in
4256 $define|true)   afs=true ;;
4257 $undef|false)   afs=false ;;
4258 *)      if $test -d $afsroot; then
4259                 afs=true
4260         else
4261                 afs=false
4262         fi
4263         ;;
4264 esac
4265 if $afs; then
4266         echo "AFS may be running... I'll be extra cautious then..." >&4
4267 else
4268         echo "AFS does not seem to be running..." >&4
4269 fi
4270
4271 : determine installation prefix for where package is to be installed.
4272 if $afs; then
4273 $cat <<EOM
4274
4275 Since you are running AFS, I need to distinguish the directory in which
4276 files will reside from the directory in which they are installed (and from
4277 which they are presumably copied to the former directory by occult means).
4278
4279 EOM
4280         case "$installprefix" in
4281         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4282         *) dflt="$installprefix";;
4283         esac
4284 else
4285 $cat <<EOM
4286
4287 In some special cases, particularly when building $package for distribution,
4288 it is convenient to distinguish the directory in which files should be
4289 installed from the directory ($prefix) in which they will
4290 eventually reside.  For most users, these two directories are the same.
4291
4292 EOM
4293         case "$installprefix" in
4294         '') dflt=$prefix ;;
4295         *) dflt=$installprefix;;
4296         esac
4297 fi
4298 fn=d~
4299 rp='What installation prefix should I use for installing files?'
4300 . ./getfile
4301 installprefix="$ans"
4302 installprefixexp="$ansexp"
4303
4304 : Perform the prefixexp/installprefixexp correction if necessary
4305 cat <<EOS >installprefix
4306 $startsh
4307 EOS
4308 cat <<'EOSC' >>installprefix
4309 : Change installation prefix, if necessary.
4310 if $test X"$prefix" != X"$installprefix"; then
4311     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4312 else
4313     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4314 fi
4315 EOSC
4316 chmod +x installprefix
4317 $eunicefix installprefix
4318
4319 : Set variables such as privlib and privlibexp from the output of ./getfile
4320 : performing the prefixexp/installprefixexp correction if necessary.
4321 cat <<EOS >setprefixvar
4322 $startsh
4323 EOS
4324 cat <<'EOSC' >>setprefixvar
4325 eval "${prefixvar}=\"\$ans\""
4326 eval "${prefixvar}exp=\"\$ansexp\""
4327 . ./installprefix
4328 EOSC
4329 chmod +x setprefixvar
4330 $eunicefix setprefixvar
4331
4332 : set up the script used to warn in case of inconsistency
4333 cat <<EOS >whoa
4334 $startsh
4335 EOS
4336 cat <<'EOSC' >>whoa
4337 dflt=y
4338 case "$hint" in
4339     recommended)
4340         case "$hintfile" in
4341         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4342                 ;;
4343         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4344                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4345                 ;;
4346         esac
4347         ;;
4348     *)  echo " "
4349         echo "*** WHOA THERE!!! ***" >&4
4350         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4351         ;;
4352 esac
4353 rp="    Keep the $hint value?"
4354 . ./myread
4355 case "$ans" in
4356 y) td=$was; tu=$was;;
4357 esac
4358 EOSC
4359
4360 : function used to set '$1' to '$val'
4361 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4362 case "$val$was" in
4363 $define$undef) . ./whoa; eval "$var=\$td";;
4364 $undef$define) . ./whoa; eval "$var=\$tu";;
4365 *) eval "$var=$val";;
4366 esac'
4367
4368 : Do we want threads support and if so, what type
4369 case "$usethreads" in
4370 $define|true|[yY]*)     dflt='y';;
4371 *)     # Catch case where user specified ithreads but
4372        # forgot -Dusethreads (A.D. 4/2002)
4373        case "$useithreads" in
4374        *$define*)       dflt='y';;
4375        *)               dflt='n';;
4376        esac
4377        ;;
4378 esac
4379 cat <<EOM
4380
4381 Perl can be built to offer a form of threading support on some systems
4382 To do so, Configure can be run with -Dusethreads.
4383
4384 Note that Perl built with threading support runs slightly slower
4385 and uses slightly more memory than plain Perl.
4386
4387 If this doesn't make any sense to you, just accept the default '$dflt'.
4388 EOM
4389 rp='Build a threading Perl?'
4390 . ./myread
4391 case "$ans" in
4392 y|Y)    val="$define" ;;
4393 *)      val="$undef" ;;
4394 esac
4395 set usethreads
4396 eval $setvar
4397
4398 useithreads="$usethreads"
4399
4400 case "$d_oldpthreads" in
4401 '')     : Configure tests would be welcome here.  For now, assume undef.
4402         val="$undef" ;;
4403 *)      val="$d_oldpthreads" ;;
4404 esac
4405 set d_oldpthreads
4406 eval $setvar
4407
4408
4409 : Look for a hint-file generated 'call-back-unit'.  If the
4410 : user has specified that a threading perl is to be built,
4411 : we may need to set or change some other defaults.
4412 if $test -f usethreads.cbu; then
4413     echo "Your platform has some specific hints regarding threaded builds, using them..."
4414     . ./usethreads.cbu
4415 else
4416     case "$usethreads" in
4417         "$define"|true|[yY]*)
4418                 $cat <<EOM
4419 (Your platform does not have any specific hints for threaded builds.
4420  Assuming POSIX threads, then.)
4421 EOM
4422         ;;
4423     esac
4424 fi
4425
4426 : Check if multiplicity is required
4427 cat <<EOM
4428
4429 Perl can be built so that multiple Perl interpreters can coexist
4430 within the same Perl executable.
4431 EOM
4432
4433 case "$useithreads" in
4434 $define)
4435         cat <<EOM
4436 This multiple interpreter support is required for interpreter-based threads.
4437 EOM
4438         val="$define"
4439         ;;
4440 *)      case "$usemultiplicity" in
4441         $define|true|[yY]*)     dflt='y';;
4442         *) dflt='n';;
4443         esac
4444         echo " "
4445         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4446         rp='Build Perl for multiplicity?'
4447         . ./myread
4448         case "$ans" in
4449         y|Y)    val="$define" ;;
4450         *)      val="$undef" ;;
4451         esac
4452         ;;
4453 esac
4454 set usemultiplicity
4455 eval $setvar
4456
4457 : Check if morebits is requested
4458 case "$usemorebits" in
4459 "$define"|true|[yY]*)
4460         use64bitint="$define"
4461         uselongdouble="$define"
4462         usemorebits="$define"
4463         ;;
4464 *)      usemorebits="$undef"
4465         ;;
4466 esac
4467
4468 : Determine the C compiler to be used
4469 echo " "
4470 case "$cc" in
4471 '') dflt=cc;;
4472 *) dflt="$cc";;
4473 esac
4474 rp="Use which C compiler?"
4475 . ./myread
4476 cc="$ans"
4477
4478 : See whether they have no cc but they do have gcc
4479 . ./trygcc
4480 if $test -f cc.cbu; then
4481     . ./cc.cbu
4482 fi
4483 . ./checkcc
4484
4485 : make some quick guesses about what we are up against
4486 echo " "
4487 $echo $n "Hmm...  $c"
4488 echo exit 1 >bsd
4489 echo exit 1 >usg
4490 echo exit 1 >v7
4491 echo exit 1 >osf1
4492 echo exit 1 >eunice
4493 echo exit 1 >xenix
4494 echo exit 1 >venix
4495 echo exit 1 >os2
4496 d_bsd="$undef"
4497 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4498 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4499 then
4500         echo "Looks kind of like an OSF/1 system, but we'll see..."
4501         echo exit 0 >osf1
4502 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4503         xxx=`./loc addbib blurfl $pth`
4504         if $test -f $xxx; then
4505         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4506                 echo exit 0 >bsd
4507                 echo exit 0 >usg
4508         else
4509                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4510                         echo "Looks kind of like an extended USG system, but we'll see..."
4511                 else
4512                         echo "Looks kind of like a USG system, but we'll see..."
4513                 fi
4514                 echo exit 0 >usg
4515         fi
4516 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4517         echo "Looks kind of like a BSD system, but we'll see..."
4518         d_bsd="$define"
4519         echo exit 0 >bsd
4520 else
4521         echo "Looks kind of like a Version 7 system, but we'll see..."
4522         echo exit 0 >v7
4523 fi
4524 case "$eunicefix" in
4525 *unixtovms*)
4526         $cat <<'EOI'
4527 There is, however, a strange, musty smell in the air that reminds me of
4528 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4529 EOI
4530         echo exit 0 >eunice
4531         d_eunice="$define"
4532 : it so happens the Eunice I know will not run shell scripts in Unix format
4533         ;;
4534 *)
4535         echo " "
4536         echo "Congratulations.  You aren't running Eunice."
4537         d_eunice="$undef"
4538         ;;
4539 esac
4540 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4541 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4542 : semicolon as a patch separator
4543 case "$p_" in
4544 :) ;;
4545 *)
4546         $cat <<'EOI'
4547 I have the feeling something is not exactly right, however...don't tell me...
4548 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4549 (Or you may be running DOS with DJGPP.)
4550 EOI
4551         echo exit 0 >os2
4552         ;;
4553 esac
4554 if test -f /xenix; then
4555         echo "Actually, this looks more like a XENIX system..."
4556         echo exit 0 >xenix
4557         d_xenix="$define"
4558 else
4559         echo " "
4560         echo "It's not Xenix..."
4561         d_xenix="$undef"
4562 fi
4563 chmod +x xenix
4564 $eunicefix xenix
4565 if test -f /venix; then
4566         echo "Actually, this looks more like a VENIX system..."
4567         echo exit 0 >venix
4568 else
4569         echo " "
4570         if ./xenix; then
4571                 : null
4572         else
4573                 echo "Nor is it Venix..."
4574         fi
4575 fi
4576 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4577 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4578 $rm -f foo
4579
4580 : Check if we are using GNU gcc and what its version is
4581 echo " "
4582 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4583 $cat >try.c <<EOM
4584 #include <stdio.h>
4585 int main() {
4586 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4587 #ifdef __VERSION__
4588         printf("%s\n", __VERSION__);
4589 #else
4590         printf("%s\n", "1");
4591 #endif
4592 #endif
4593         return(0);
4594 }
4595 EOM
4596 if $cc -o try $ccflags $ldflags try.c; then
4597         gccversion=`$run ./try`
4598         case "$gccversion" in
4599         '') echo "You are not using GNU cc." ;;
4600         *)  echo "You are using GNU cc $gccversion."
4601             ccname=gcc
4602             ;;
4603         esac
4604 else
4605         echo " "
4606         echo "*** WHOA THERE!!! ***" >&4
4607         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4608         case "$knowitall" in
4609         '')
4610         echo "    You'd better start hunting for one and let me know about it." >&4
4611                 exit 1
4612                 ;;
4613         esac
4614 fi
4615 $rm -f try try.*
4616 case "$gccversion" in
4617 1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4618 esac
4619 case "$gccversion" in
4620 '') gccosandvers='' ;;
4621 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4622    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4623    gccshortvers=''
4624    case "$gccosandvers" in
4625    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4626    $osname$osvers) ;; # looking good
4627    $osname*) cat <<EOM >&4
4628
4629 *** WHOA THERE!!! ***
4630
4631     Your gcc has not been compiled for the exact release of
4632     your operating system ($gccosandvers versus $osname$osvers).
4633
4634     In general it is a good idea to keep gcc synchronized with
4635     the operating system because otherwise serious problems
4636     may ensue when trying to compile software, like Perl.
4637
4638     I'm trying to be optimistic here, though, and will continue.
4639     If later during the configuration and build icky compilation
4640     problems appear (headerfile conflicts being the most common
4641     manifestation), I suggest reinstalling the gcc to match
4642     your operating system release.
4643
4644 EOM
4645       ;;
4646    *) gccosandvers='' ;; # failed to parse, better be silent
4647    esac
4648    ;;
4649 esac
4650 case "$ccname" in
4651 '') ccname="$cc" ;;
4652 esac
4653
4654 # gcc 3.* complain about adding -Idirectories that they already know about,
4655 # so we will take those off from locincpth.
4656 case "$gccversion" in
4657 3.*)
4658     echo "int main(){}">try.c
4659     for incdir in $locincpth; do
4660        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4661              grep '^c[cp]p*[01]: warning: changing search order '`
4662        if test "X$warn" != X; then
4663            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4664        fi
4665     done
4666     $rm -f try try.*
4667 esac
4668
4669 # gcc 4.9 by default does some optimizations that break perl.
4670 # see ticket 121505.
4671 #
4672 # The -fwrapv disables those optimizations (and probably others,) so
4673 # for gcc 4.9 (and later, since the optimizations probably won't go
4674 # away), add -fwrapv unless the user requests -fno-wrapv, which
4675 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4676 # which turns the overflows -fwrapv ignores into runtime errors.
4677 case "$gccversion" in
4678 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4679     case "$ccflags" in
4680     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4681     *) ccflags="$ccflags -fwrapv" ;;
4682     esac
4683 esac
4684
4685 # Really old versions of gcc default to C89 and will error for this code.
4686 # See if the compiler (gcc or otherwise) needs a flag to compile C99 code
4687 # Initialisations in for loops seem to be the particular problem
4688 # (Does this syntax conflict with something else that was valid C89?)
4689 # We also add a declaration after a statement to detect whether the compiler
4690 # (or the user supplied -Accflags) consider such declarations to be errors.
4691 # This causes 'Configure with -Accflags="-Werror=declaration-after-statement"'
4692 # to fail hard and early.
4693 #
4694 # Annoyingly -std=c99 will cause gcc to tell glibc not to define prototypes for
4695 # syscall, drand48 etc when including <unistd.h>, which messes up our build.
4696 # I guess we *could* loop round trying -std=c99 first with checks both for the
4697 # prototype found and the code compiling (because -std=gnu99 might do other
4698 # things we don't want, particularly on non-GCC compilers) but
4699 # 1) We would need to check for the prototype first (without any flags)
4700 # 2) We would still end up with most Linux systems either being -std=gnu99
4701 #    or "" (no flag), and so both common options would not rigorously check our
4702 #    portability to other platforms.
4703 # So it doesn't seem worth the complexity and chance of different failure.
4704 $cat >try.c <<'EOCP'
4705 int main(int argc, char **argv) {
4706     argc = argc + 1;
4707     /* This is deliberately a declaration after a statement. */
4708     unsigned long long count = 0;
4709     for (char **p = argv; *p; ++p) {
4710         ++count;
4711     }
4712     return count == 1 ? 0 : argc;
4713 }
4714 EOCP
4715 c99_for=no
4716 for flag in '' '-std=gnu99' '-std=c99'; do
4717     if $cc -o try $flag $ccflags $ldflags try.c 2>/dev/null && ./try; then
4718         c99_for="$flag"
4719         break;
4720     fi
4721 done
4722 case "$c99_for" in
4723 '') echo "Your C compiler doesn't need any special flags to compile C99 code"
4724     ;;
4725 no) echo >&4 "Your C compiler doesn't seem to be able to compile C99 code"
4726     rp='Do you really want to continue?'
4727     dflt='n'
4728     . ./myread
4729     case "$ans" in
4730         [yY])   echo >&4 "Okay, continuing."    ;;
4731         *)      exit 1                          ;;
4732     esac
4733     ;;
4734 *)  echo "Your C compiler needs $c99_for to compile C99 code"
4735     ccflags="$c99_for $ccflags"
4736     ;;
4737 esac
4738 $rm -f try try.*
4739
4740 : What should the include directory be ?
4741 : Use sysroot if set, so findhdr looks in the right place.
4742 echo " "
4743 $echo $n "Hmm...  $c"
4744 dflt="$sysroot/usr/include"
4745 incpath=''
4746 mips_type=''
4747 if $test -f /bin/mips && /bin/mips; then
4748         echo "Looks like a MIPS system..."
4749         $cat >usr.c <<'EOCP'
4750 #ifdef SYSTYPE_BSD43
4751 /bsd43
4752 #endif
4753 EOCP
4754         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4755                 dflt='/bsd43/usr/include'
4756                 incpath='/bsd43'
4757                 mips_type='BSD 4.3'
4758         else
4759                 mips_type='System V'
4760         fi
4761         $rm -f usr.c usr.out
4762         echo "and you're compiling with the $mips_type compiler and libraries."
4763         xxx_prompt=y
4764         echo "exit 0" >mips
4765 else
4766         echo "Doesn't look like a MIPS system."
4767         xxx_prompt=n
4768         echo "exit 1" >mips
4769 fi
4770 chmod +x mips
4771 $eunicefix mips
4772 case "$usrinc" in
4773 '') ;;
4774 *) dflt="$usrinc";;
4775 esac
4776 case "$xxx_prompt" in
4777 y)      fn=d/
4778         echo " "
4779         rp='Where are the include files you want to use?'
4780         . ./getfile
4781         usrinc="$ans"
4782         ;;
4783 *)      usrinc="$dflt"
4784         ;;
4785 esac
4786
4787 : see how we invoke the C preprocessor
4788 echo " "
4789 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4790 cat <<'EOT' >testcpp.c
4791 #define ABC abc
4792 #define XYZ xyz
4793 ABC.XYZ
4794 EOT
4795 cd ..
4796 if test ! -f cppstdin; then
4797         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4798                 # AIX cc -E doesn't show the absolute headerfile
4799                 # locations but we'll cheat by using the -M flag.
4800                 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
4801         else
4802                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4803         fi
4804 else
4805         echo "Keeping your $hint cppstdin wrapper."
4806 fi
4807 chmod 755 cppstdin
4808 wrapper=`pwd`/cppstdin
4809 ok='false'
4810 cd UU
4811
4812 if $test "X$cppstdin" != "X" && \
4813         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4814         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4815 then
4816         echo "You used to use $cppstdin $cppminus so we'll use that again."
4817         case "$cpprun" in
4818         '') echo "But let's see if we can live without a wrapper..." ;;
4819         *)
4820                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4821                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4822                 then
4823                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4824                         ok='true'
4825                 else
4826                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4827                 fi
4828                 ;;
4829         esac
4830 else
4831         case "$cppstdin" in
4832         '') ;;
4833         *)
4834                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4835                 ;;
4836         esac
4837 fi
4838
4839 if $ok; then
4840         : nothing
4841 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4842         $cc -E <testcpp.c >testcpp.out 2>&1; \
4843         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4844         echo "Yup, it does."
4845         x_cpp="$cc $cppflags -E"
4846         x_minus='';
4847 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4848         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4849         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4850         echo "Yup, it does."
4851         x_cpp="$cc $cppflags -E"
4852         x_minus='-';
4853 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4854         $cc -P <testcpp.c >testcpp.out 2>&1; \
4855         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4856         echo "Yipee, that works!"
4857         x_cpp="$cc $cppflags -P"
4858         x_minus='';
4859 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4860         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4861         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4862         echo "At long last!"
4863         x_cpp="$cc $cppflags -P"
4864         x_minus='-';
4865 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4866         $cpp <testcpp.c >testcpp.out 2>&1; \
4867         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4868         echo "It works!"
4869         x_cpp="$cpp $cppflags"
4870         x_minus='';
4871 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4872         $cpp - <testcpp.c >testcpp.out 2>&1; \
4873         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4874         echo "Hooray, it works!  I was beginning to wonder."
4875         x_cpp="$cpp $cppflags"
4876         x_minus='-';
4877 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4878         $wrapper <testcpp.c >testcpp.out 2>&1; \
4879         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4880         x_cpp="$wrapper"
4881         x_minus=''
4882         echo "Eureka!"
4883 else
4884         dflt=''
4885         rp="No dice.  I can't find a C preprocessor.  Name one:"
4886         . ./myread
4887         x_cpp="$ans"
4888         x_minus=''
4889         $x_cpp <testcpp.c >testcpp.out 2>&1
4890         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4891                 echo "OK, that will do." >&4
4892         else
4893 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4894                 exit 1
4895         fi
4896 fi
4897
4898 case "$ok" in
4899 false)
4900         cppstdin="$x_cpp"
4901         cppminus="$x_minus"
4902         cpprun="$x_cpp"
4903         cpplast="$x_minus"
4904         set X $x_cpp
4905         shift
4906         case "$1" in
4907         "$cpp")
4908                 echo "Perhaps can we force $cc -E using a wrapper..."
4909                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4910                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4911                 then
4912                         echo "Yup, we can."
4913                         cppstdin="$wrapper"
4914                         cppminus='';
4915                 else
4916                         echo "Nope, we'll have to live without it..."
4917                 fi
4918                 ;;
4919         esac
4920         case "$cpprun" in
4921         "$wrapper")
4922                 cpprun=''
4923                 cpplast=''
4924                 ;;
4925         esac
4926         ;;
4927 esac
4928
4929 case "$cppstdin" in
4930 "$wrapper"|'cppstdin') ;;
4931 *) $rm -f $wrapper;;
4932 esac
4933 $rm -f testcpp.c testcpp.out
4934
4935 : Adjust cppfilter for path component separator
4936 case "$osname" in
4937 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4938 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4939 *)   cppfilter='' ;;
4940 esac
4941
4942 : Use gcc to determine libpth and incpth
4943 # If using gcc or clang, we can get better values for libpth, incpth
4944 # and usrinc directly from the compiler.
4945 # Note that ccname for clang is also gcc.
4946 case "$ccname" in
4947     gcc)
4948         realpath=`which realpath 2>/dev/null | sed 's/no realpath in.*//'`
4949         $echo 'extern int foo;' > try.c
4950         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4951         shift
4952         inclibpth=""
4953         if $test $# -gt 0; then
4954             for i in $*; do
4955                 case $realpath in
4956                     */realpath) i=`$realpath $i` ;;
4957                 esac
4958                 incpth="$incpth $i"
4959                 j="`$echo $i | $sed 's,/include[^/]*,/lib,'`"
4960                 if $test -d $j; then
4961                     inclibpth="$inclibpth $j"
4962                 fi
4963             done
4964             incpth="`$echo $incpth | $sed 's/^ //'`"
4965             for xxx in $inclibpth $loclibpth $plibpth $glibpth; do
4966                 if $test -d $xxx; then
4967                     case $realpath in
4968                         */realpath) xxx=`$realpath $xxx` ;;
4969                     esac
4970                     case " $libpth " in
4971                     *" $xxx "*) ;;
4972                     *) libpth="$libpth $xxx";;
4973                     esac
4974                 fi
4975             done
4976             libpth="`$echo $libpth | $sed 's/^ //'`"
4977         fi
4978         $rm -f try.c
4979         case "$usrinc" in
4980         '') for i in $incpth; do
4981                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4982                     usrinc="$i"
4983                     break
4984                 fi
4985             done
4986             ;;
4987         esac
4988
4989         case "$usecrosscompile" in
4990         $define|true|[yY]*)
4991             case "$incpth" in
4992                 '') echo "Incpth not defined." >&4; croak=y ;;
4993                 *)  echo "Using incpth '$incpth'." >&4 ;;
4994             esac
4995             case "$libpth" in
4996                 '') echo "Libpth not defined." >&4; croak=y ;;
4997                 *)  echo "Using libpth '$libpth'." >&4 ;;
4998             esac
4999             case "$usrinc" in
5000                 '') echo "Usrinc not defined." >&4; croak=y ;;
5001                 *)  echo "Using usrinc $usrinc." >&4 ;;
5002             esac
5003             case "$croak" in
5004                 y)
5005                 if test "X$sysroot" = X; then
5006                     echo "Cannot continue, aborting." >&4; exit 1
5007                 else
5008                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
5009                 fi
5010                 ;;
5011             esac
5012             ;;
5013         esac
5014     ;;
5015 esac
5016
5017 : Default value for incpth is just usrinc
5018 case "$incpth" in
5019 '') incpth="$usrinc";;
5020 esac
5021
5022 : Set private lib path
5023 case "$plibpth" in
5024 '') if ./mips; then
5025         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5026     fi;;
5027 esac
5028 case "$libpth" in
5029 ' ') dlist='';;
5030 '') dlist="$loclibpth $plibpth $glibpth";;
5031 *) dlist="$libpth";;
5032 esac
5033
5034 : Now check and see which directories actually exist, avoiding duplicates
5035 for xxx in $dlist
5036 do
5037     if $test -d $xxx; then
5038                 case " $libpth " in
5039                 *" $xxx "*) ;;
5040                 *) libpth="$libpth $xxx";;
5041                 esac
5042     fi
5043 done
5044 $cat <<'EOM'
5045
5046 Some systems have incompatible or broken versions of libraries.  Among
5047 the directories listed in the question below, please remove any you
5048 know not to be holding relevant libraries, and add any that are needed.
5049 Say "none" for none.
5050
5051 EOM
5052
5053 if test "X$sysroot" != X; then
5054     $cat <<EOM
5055 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5056
5057 EOM
5058 fi
5059
5060 case "$libpth" in
5061 '') dflt='none';;
5062 *)
5063         set X $libpth
5064         shift
5065         dflt=${1+"$@"}
5066         ;;
5067 esac
5068 rp="Directories to use for library searches?"
5069 . ./myread
5070 case "$ans" in
5071 none) libpth=' ';;
5072 *) libpth="$ans";;
5073 esac
5074
5075 : compute shared library extension
5076 case "$so" in
5077 '')
5078         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5079                 dflt='sl'
5080         else
5081                 dflt='so'
5082         fi
5083         ;;
5084 *) dflt="$so";;
5085 esac
5086 $cat <<EOM
5087
5088 On some systems, shared libraries may be available.  Answer 'none' if
5089 you want to suppress searching of shared libraries for the remainder
5090 of this configuration.
5091
5092 EOM
5093 rp='What is the file extension used for shared libraries?'
5094 . ./myread
5095 so="$ans"
5096
5097 : Does target system insist that shared library basenames are unique
5098 $cat << EOM
5099
5100 Some dynamic loaders assume that the *basename* of shared library filenames
5101 are globally unique.  We'll default this to undef as we assume your system
5102 is not this weird. Set to defined if you're on one of them.
5103
5104 EOM
5105
5106 dflt='n'
5107 rp='Make shared library basenames unique?'
5108 . ./myread
5109 case "$ans" in
5110 y|Y) val="$define" ;;
5111 *)   val="$undef"  ;;
5112 esac
5113 set d_libname_unique
5114 eval $setvar
5115
5116 : Define several unixisms.
5117 : Hints files or command line option can be used to override them.
5118 : The convoluted testing is in case hints files set either the old
5119 : or the new name.
5120 case "$_exe" in
5121 '')     case "$exe_ext" in
5122         '')     ;;
5123         *)      _exe="$exe_ext" ;;
5124         esac
5125         ;;
5126 esac
5127 case "$_a" in
5128 '')     case "$lib_ext" in
5129     '') _a='.a';;
5130         *)      _a="$lib_ext" ;;
5131         esac
5132         ;;
5133 esac
5134 case "$_o" in
5135 '') case "$obj_ext" in
5136         '')     _o='.o';;
5137         *)      _o="$obj_ext";;
5138         esac
5139         ;;
5140 esac
5141 case "$p_" in
5142 '') case "$path_sep" in
5143         '')     p_=':';;
5144         *)      p_="$path_sep";;
5145         esac
5146         ;;
5147 esac
5148 exe_ext=$_exe
5149 lib_ext=$_a
5150 obj_ext=$_o
5151 path_sep=$p_
5152
5153 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5154
5155 : Which makefile gets called first.  This is used by make depend.
5156 case "$firstmakefile" in
5157 '') firstmakefile='makefile';;
5158 esac
5159
5160 : Check is we will use socks
5161 case "$usesocks" in
5162 $define|true|[yY]*)     dflt='y';;
5163 *) dflt='n';;
5164 esac
5165 cat <<EOM
5166
5167 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5168 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5169 to use the PerlIO abstraction layer, this will be implicitly selected.
5170
5171 If this doesn't make any sense to you, just accept the default '$dflt'.
5172 EOM
5173 rp='Build Perl for SOCKS?'
5174 . ./myread
5175 case "$ans" in
5176 y|Y)    val="$define" ;;
5177 *)      val="$undef" ;;
5178 esac
5179 set usesocks
5180 eval $setvar
5181
5182 : Check for uselongdouble support
5183 case "$ccflags" in
5184 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5185 esac
5186
5187 case "$uselongdouble" in
5188 $define|true|[yY]*)     dflt='y';;
5189 *) dflt='n';;
5190 esac
5191 cat <<EOM
5192
5193 Perl can be built to take advantage of long doubles which
5194 (if available) may give more accuracy and range for floating point numbers.
5195
5196 If this doesn't make any sense to you, just accept the default '$dflt'.
5197 EOM
5198 rp='Try to use long doubles if available?'
5199 . ./myread
5200 case "$ans" in
5201 y|Y)    val="$define"   ;;
5202 *)      val="$undef"    ;;
5203 esac
5204 set uselongdouble
5205 eval $setvar
5206
5207 case "$uselongdouble" in
5208 true|[yY]*) uselongdouble="$define" ;;
5209 esac
5210
5211 : Look for a hint-file generated 'call-back-unit'.  If the
5212 : user has specified that long doubles should be used,
5213 : we may need to set or change some other defaults.
5214 if $test -f uselongdouble.cbu; then
5215     echo "Your platform has some specific hints regarding long doubles, using them..."
5216     . ./uselongdouble.cbu
5217 else
5218     case "$uselongdouble" in
5219         $define)
5220                 $cat <<EOM
5221 (Your platform does not have any specific hints for long doubles.)
5222 EOM
5223         ;;
5224     esac
5225 fi
5226
5227 : Check if quadmath is requested
5228 case "$usequadmath" in
5229 "$define"|true|[yY]*) usequadmath="$define" ;;
5230 *)                    usequadmath="$undef"  ;;
5231 esac
5232
5233 : Fail if both uselongdouble and usequadmath are requested
5234 case "$usequadmath:$uselongdouble" in
5235 define:define)
5236         $cat <<EOM >&4
5237
5238 *** You requested the use of the quadmath library and use
5239 *** of long doubles.
5240 ***
5241 *** Please select one or the other.
5242 EOM
5243         exit 1
5244         ;;
5245 esac
5246
5247 : Looking for optional libraries
5248 echo " "
5249 echo "Checking for optional libraries..." >&4
5250 case "$libs" in
5251 ' '|'') dflt='';;
5252 *) dflt="$libs";;
5253 esac
5254 case "$libswanted" in
5255 '') libswanted='c_s';;
5256 esac
5257 case "$usesocks" in
5258 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5259 esac
5260 case "$usecbacktrace" in
5261 "$define") libswanted="$libswanted bfd" ;;
5262 esac
5263 case "$usequadmath" in
5264 "$define") libswanted="$libswanted quadmath" ;;
5265 esac
5266 libsfound=''
5267 libsfiles=''
5268 libsdirs=''
5269 libspath=''
5270 for thisdir in $libpth $xlibpth; do
5271   test -d $thisdir && libspath="$libspath $thisdir"
5272 done
5273 for thislib in $libswanted; do
5274         for thisdir in $libspath; do
5275             xxx=''
5276             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5277                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5278                 $test -f "$xxx" && eval $libscheck
5279                 $test -f "$xxx" && libstyle=shared
5280                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5281                 $test -f "$xxx" && eval $libscheck
5282                 $test -f "$xxx" && libstyle=shared
5283             fi
5284             if test ! -f "$xxx"; then
5285                 xxx=$thisdir/lib$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/$thislib.$so$_a
5291                 $test -f "$xxx" && eval $libscheck
5292                 $test -f "$xxx" && libstyle="import"
5293             fi
5294             if test ! -f "$xxx"; then
5295                 xxx=$thisdir/lib$thislib.$so
5296                 $test -f "$xxx" && eval $libscheck
5297                 $test -f "$xxx" && libstyle=shared
5298             fi
5299             if test ! -f "$xxx"; then
5300                 xxx=$thisdir/lib$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/$thislib$_a
5306                 $test -f "$xxx" && eval $libscheck
5307                 $test -f "$xxx" && libstyle=static
5308             fi
5309             if test ! -f "$xxx"; then
5310                 xxx=$thisdir/lib${thislib}_s$_a
5311                 $test -f "$xxx" && eval $libscheck
5312                 $test -f "$xxx" && libstyle=static
5313                 $test -f "$xxx" && thislib=${thislib}_s
5314             fi
5315             if test ! -f "$xxx"; then
5316                 xxx=$thisdir/Slib$thislib$_a
5317                 $test -f "$xxx" && eval $libscheck
5318                 $test -f "$xxx" && libstyle=static
5319             fi
5320             if $test -f "$xxx"; then
5321                 case "$libstyle" in
5322                 shared) echo "Found -l$thislib (shared)." ;;
5323                 static) echo "Found -l$thislib." ;;
5324                 *)      echo "Found -l$thislib ($libstyle)." ;;
5325                 esac
5326                 case " $dflt " in
5327                 *"-l$thislib "*);;
5328                 *) dflt="$dflt -l$thislib"
5329                    libsfound="$libsfound $xxx"
5330                    yyy=`basename $xxx`
5331                    libsfiles="$libsfiles $yyy"
5332                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5333                    case " $libsdirs " in
5334                    *" $yyy "*) ;;
5335                    *) libsdirs="$libsdirs $yyy" ;;
5336                    esac
5337                    ;;
5338                 esac
5339                 break
5340             fi
5341         done
5342         if $test ! -f "$xxx"; then
5343             echo "No -l$thislib."
5344         fi
5345 done
5346 set X $dflt
5347 shift
5348 dflt="$*"
5349 case "$libs" in
5350 '') dflt="$dflt";;
5351 *) dflt="$libs";;
5352 esac
5353 case "$dflt" in
5354 ' '|'') dflt='none';;
5355 esac
5356
5357 $cat <<EOM
5358
5359 In order to compile $package on your machine, a number of libraries
5360 are usually needed.  Include any other special libraries here as well.
5361 Say "none" for none.  The default list is almost always right.
5362 EOM
5363
5364 echo " "
5365 rp="What libraries to use?"
5366 . ./myread
5367 case "$ans" in
5368 none) libs=' ';;
5369 *) libs="$ans";;
5370 esac
5371
5372 : determine optimization, if desired, or use for debug flag also
5373 case "$optimize" in
5374 ' '|$undef) dflt='none';;
5375 '') dflt='-O';;
5376 *) dflt="$optimize";;
5377 esac
5378 $cat <<EOH
5379
5380 By default, $package compiles with the -O flag to use the optimizer.
5381 Alternately, you might want to use the symbolic debugger, which uses
5382 the -g flag (on traditional Unix systems).  Either flag can be
5383 specified here.  To use neither flag, specify the word "none".
5384
5385 EOH
5386 rp="What optimizer/debugger flag should be used?"
5387 . ./myread
5388 optimize="$ans"
5389 case "$optimize" in
5390 'none') optimize=" ";;
5391 esac
5392
5393 : Check what DEBUGGING is required from the command line
5394 : -DEBUGGING      or -DDEBUGGING or
5395 : -DEBUGGING=both                       = -g + -DDEBUGGING
5396 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5397 : -DEBUGGING=none or -UDEBUGGING        =
5398 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5399 case "$EBUGGING" in
5400 '')     ;;
5401 *)      DEBUGGING=$EBUGGING ;;
5402 esac
5403
5404 case "$DEBUGGING" in
5405 -g|both|$define)
5406     case "$optimize" in
5407         *-g*) ;;
5408         *)    optimize="$optimize -g" ;;
5409     esac ;;
5410 none|$undef)
5411     case "$optimize" in
5412         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5413                 shift
5414                 optimize="$*"
5415                 ;;
5416     esac ;;
5417 esac
5418
5419 dflt=''
5420 case "$DEBUGGING" in
5421 both|$define) dflt='-DDEBUGGING'
5422 esac
5423
5424 : argument order is deliberate, as the flag will start with - which set could
5425 : think is an option
5426 checkccflag='check=$1; flag=$2; callback=$3;
5427 echo " ";
5428 echo "Checking if your compiler accepts $flag" >&4;
5429 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5430 echo "int main(void) { return 0; }" > gcctest.c;
5431 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5432     echo "Yes, it does." >&4;
5433     if $test -s gcctest.out ; then
5434         echo "But your platform does not like it:";
5435         cat gcctest.out;
5436     else
5437         case "$ccflags" in
5438         *$check*)
5439             echo "Leaving current flags $ccflags alone." >&4
5440             ;;
5441         *) dflt="$dflt $flag";
5442             eval $callback
5443             ;;
5444         esac
5445     fi
5446 else
5447     echo "Nope, it does not, but that is ok." >&4;
5448 fi
5449 '
5450
5451 : We will not override a previous value, but we might want to
5452 : augment a hint file
5453 case "$hint" in
5454 default|recommended)
5455         case "$gccversion" in
5456         1.*) dflt="$dflt -fpcc-struct-return" ;;
5457         esac
5458         case "$optimize:$DEBUGGING" in
5459         *-g*:old) dflt="$dflt -DDEBUGGING";;
5460         esac
5461         case "$gccversion" in
5462         2.*) if $test -d /etc/conf/kconfig.d &&
5463                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5464                 then
5465                         # Interactive Systems (ISC) POSIX mode.
5466                         dflt="$dflt -posix"
5467                 fi
5468                 ;;
5469         esac
5470         case "$gccversion" in
5471         1.*) ;;
5472         2.[0-8]*) ;;
5473         ?*)     set strict-aliasing -fno-strict-aliasing
5474                 eval $checkccflag
5475                 ;;
5476         esac
5477         # For gcc, adding -pipe speeds up compilations for some, but apparently
5478         # some assemblers can't read from stdin.  (It also slows down compilations
5479         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5480         case "$gccversion" in
5481         ?*)     set pipe -pipe
5482                 eval $checkccflag
5483                 ;;
5484         esac
5485
5486         # on x86_64 (at least) we require an extra library (libssp) in the
5487         # link command line. This library is not named, so I infer that it is
5488         # an implementation detail that may change. Hence the safest approach
5489         # is to add the flag to the flags passed to the compiler at link time,
5490         # as that way the compiler can do the right implementation dependant
5491         # thing. (NWC)
5492         case "$ccflags" in
5493         *-fno-stack-protector*)
5494             echo "Do not add -fstack-protector nor -fstack-protector-strong" 2>&1
5495             ;;
5496         *) case "$gccversion" in
5497            ?*)  set stack-protector-strong -fstack-protector-strong
5498                 eval $checkccflag
5499                 case "$dflt" in
5500                 *-fstack-protector-strong*) ;; # It got added.
5501                 *) # Try the plain/older -fstack-protector.
5502                    set stack-protector -fstack-protector
5503                    eval $checkccflag
5504                    ;;
5505                 esac
5506                 ;;
5507             esac
5508             ;;
5509         esac
5510 esac
5511
5512 case "$mips_type" in
5513 *BSD*|'') inclwanted="$locincpth $usrinc";;
5514 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5515 esac
5516 for thisincl in $inclwanted; do
5517         if $test -d $thisincl; then
5518                 if $test x$thisincl != x$usrinc; then
5519                         case "$dflt" in
5520                         *" -I$thisincl "*);;
5521                         *) dflt="$dflt -I$thisincl ";;
5522                         esac
5523                 fi
5524         fi
5525 done
5526
5527 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5528         xxx=true;
5529 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5530         xxx=true;
5531 else
5532         xxx=false;
5533 fi;
5534 if $xxx; then
5535         case "$dflt" in
5536         *$2*);;
5537         *) dflt="$dflt -D$2";;
5538         esac;
5539 fi'
5540
5541 set signal.h LANGUAGE_C; eval $inctest
5542
5543 case "$usesocks" in
5544 $define)
5545         ccflags="$ccflags -DSOCKS"
5546         ;;
5547 esac
5548
5549 case "$hint" in
5550 default|recommended) dflt="$ccflags $dflt" ;;
5551 *) dflt="$ccflags";;
5552 esac
5553
5554 case "$dflt" in
5555 ''|' ') dflt=none;;
5556 esac
5557
5558 $cat <<EOH
5559
5560 Your C compiler may want other flags.  For this question you should include
5561 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5562 but you should NOT include libraries or ld flags like -lwhatever.  If you
5563 want $package to honor its debug switch, you should include -DDEBUGGING here.
5564 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5565
5566 To use no flags, specify the word "none".
5567
5568 EOH
5569 set X $dflt
5570 shift
5571 dflt=${1+"$@"}
5572 rp="Any additional cc flags?"
5573 . ./myread
5574 case "$ans" in
5575 none) ccflags='';;
5576 *) ccflags="$ans";;
5577 esac
5578
5579 : the following weeds options from ccflags that are of no interest to cpp
5580 case "$cppflags" in
5581 '') cppflags="$ccflags" ;;
5582 *)  set X $ccflags; shift
5583     case " $cppflags " in
5584     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5585     *) cppflags="$cppflags $ccflags" ;;
5586     esac
5587     ;;
5588 esac
5589 case "$gccversion" in
5590 1.*) cppflags="$cppflags -D__GNUC__"
5591 esac
5592 case "$mips_type" in
5593 '');;
5594 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5595 esac
5596 case "$cppflags" in
5597 '');;
5598 *)
5599         echo " "
5600         echo "Let me guess what the preprocessor flags are..." >&4
5601         set X $cppflags
5602         shift
5603         cppflags=''
5604         $cat >cpp.c <<'EOM'
5605 #define BLURFL foo
5606
5607 BLURFL xx LFRULB
5608 EOM
5609         previous=''
5610         for flag in $*
5611         do
5612                 case "$flag" in
5613                 -*) ftry="$flag";;
5614                 *) ftry="$previous $flag";;
5615                 esac
5616                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5617                         >cpp1.out 2>/dev/null && \
5618                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5619                         >cpp2.out 2>/dev/null && \
5620                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5621                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5622                 then
5623                         cppflags="$cppflags $ftry"
5624                         previous=''
5625                 else
5626                         previous="$flag"
5627                 fi
5628         done
5629         set X $cppflags
5630         shift
5631         cppflags=${1+"$@"}
5632         case "$cppflags" in
5633         *-*)  echo "They appear to be: $cppflags";;
5634         esac
5635         $rm -f cpp.c cpp?.out
5636         ;;
5637 esac
5638
5639 : flags used in final linking phase
5640 case "$ldflags" in
5641 '') if ./venix; then
5642                 dflt='-i -z'
5643         else
5644                 dflt=''
5645         fi
5646         case "$ccflags" in
5647         *-posix*) dflt="$dflt -posix" ;;
5648         esac
5649         ;;
5650 *) dflt="$ldflags";;
5651 esac
5652 # See note above about -fstack-protector
5653 case "$ccflags" in
5654 *-fstack-protector-strong*)
5655         case "$dflt" in
5656         *-fstack-protector-strong*) ;; # Don't add it again
5657         *) dflt="$dflt -fstack-protector-strong" ;;
5658         esac
5659         ;;
5660 *-fstack-protector*)
5661         case "$dflt" in
5662         *-fstack-protector*) ;; # Don't add it again
5663         *) dflt="$dflt -fstack-protector" ;;
5664         esac
5665         ;;
5666 esac
5667
5668 : Try to guess additional flags to pick up local libraries.
5669 for thislibdir in $libpth; do
5670         case " $loclibpth " in
5671         *" $thislibdir "*)
5672                 case "$dflt " in
5673                 *"-L$thislibdir "*) ;;
5674                 *)  dflt="$dflt -L$thislibdir" ;;
5675                 esac
5676                 ;;
5677         esac
5678 done
5679
5680 case "$dflt" in
5681 '') dflt='none' ;;
5682 esac
5683
5684 $cat <<EOH
5685
5686 Your C linker may need flags.  For this question you should
5687 include -L/whatever and any other flags used by the C linker, but you
5688 should NOT include libraries like -lwhatever.
5689
5690 Make sure you include the appropriate -L/path flags if your C linker
5691 does not normally search all of the directories you specified above,
5692 namely
5693         $libpth
5694 To use no flags, specify the word "none".
5695
5696 EOH
5697
5698 rp="Any additional ld flags (NOT including libraries)?"
5699 . ./myread
5700 case "$ans" in
5701 none) ldflags='';;
5702 *) ldflags="$ans";;
5703 esac
5704 rmlist="$rmlist pdp11"
5705
5706 : coherency check
5707 echo " "
5708 echo "Checking your choice of C compiler and flags for coherency..." >&4
5709 $cat > try.c <<'EOF'
5710 #include <stdio.h>
5711 int main() { printf("Ok\n"); return(0); }
5712 EOF
5713 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5714 shift
5715 $cat >try.msg <<'EOM'
5716 I've tried to compile and run the following simple program:
5717
5718 EOM
5719 $cat try.c >> try.msg
5720
5721 $cat >> try.msg <<EOM
5722
5723 I used the command:
5724
5725         $*
5726         $run ./try
5727
5728 and I got the following output:
5729
5730 EOM
5731 dflt=y
5732 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5733         if $sh -c "$run ./try " >>try.msg 2>&1; then
5734                 xxx=`$run ./try`
5735                 case "$xxx" in
5736                 "Ok") dflt=n ;;
5737                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5738                 esac
5739         else
5740                 echo "The program compiled OK, but exited with status $?." >>try.msg
5741                 rp="You have a problem.  Shall I abort Configure"
5742                 dflt=y
5743         fi
5744 else
5745         echo "I can't compile the test program." >>try.msg
5746         rp="You have a BIG problem.  Shall I abort Configure"
5747         dflt=y
5748 fi
5749 case "$dflt" in
5750 y)
5751         $cat try.msg >&4
5752         case "$knowitall" in
5753         '')
5754                 echo "(The supplied flags or libraries might be incorrect.)"
5755                 ;;
5756         *) dflt=n;;
5757         esac
5758         echo " "
5759         . ./myread
5760         case "$ans" in
5761         n*|N*) ;;
5762         *)      echo "Ok.  Stopping Configure." >&4
5763                 exit 1
5764                 ;;
5765         esac
5766         ;;
5767 n) echo "OK, that should do.";;
5768 esac
5769 $rm_try gcctest gcctest.out
5770
5771 : define a shorthand compile call
5772 compile='
5773 mc_file=$1;
5774 shift;
5775 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5776 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4;
5777 exit 1;
5778 fi;
5779 esac;
5780 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5781 : define a shorthand compile call for compilations that should be ok.
5782 compile_ok='
5783 mc_file=$1;
5784 shift;
5785 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5786
5787 : stub, used only to satisfy other units
5788 i_stdlib='define'
5789
5790 : check for lengths of integral types
5791 echo " "
5792 case "$intsize" in
5793 '')
5794         echo "Checking to see how big your integers are..." >&4
5795         $cat >try.c <<EOCP
5796 #include <stdio.h>
5797 #$i_stdlib I_STDLIB
5798 #ifdef I_STDLIB
5799 #include <stdlib.h>
5800 #endif
5801 #include <stdio.h>
5802 int main()
5803 {
5804         printf("intsize=%d;\n", (int)sizeof(int));
5805         printf("longsize=%d;\n", (int)sizeof(long));
5806         printf("shortsize=%d;\n", (int)sizeof(short));
5807         exit(0);
5808 }
5809 EOCP
5810         set try
5811         if eval $compile_ok && $run ./try > /dev/null; then
5812                 eval `$run ./try`
5813                 echo "Your integers are $intsize bytes long."
5814                 echo "Your long integers are $longsize bytes long."
5815                 echo "Your short integers are $shortsize bytes long."
5816         else
5817                 $cat >&4 <<EOM
5818 !
5819 Help! I can't compile and run the intsize test program: please enlighten me!
5820 (This is probably a misconfiguration in your system or libraries, and
5821 you really ought to fix it.  Still, I'll try anyway.)
5822 !
5823 EOM
5824                 dflt=4
5825                 rp="What is the size of an integer (in bytes)?"
5826                 . ./myread
5827                 intsize="$ans"
5828                 dflt=$intsize
5829                 rp="What is the size of a long integer (in bytes)?"
5830                 . ./myread
5831                 longsize="$ans"
5832                 dflt=2
5833                 rp="What is the size of a short integer (in bytes)?"
5834                 . ./myread
5835                 shortsize="$ans"
5836         fi
5837         ;;
5838 esac
5839 $rm_try
5840
5841 : check for long long
5842 echo " "
5843 echo "Checking to see if you have long long..." >&4
5844 echo 'int main() { long long x = 7; return 0; }' > try.c
5845 set try
5846 if eval $compile; then
5847         val="$define"
5848         echo "You have long long."
5849 else
5850         val="$undef"
5851         echo "You do not have long long."
5852 fi
5853 $rm_try
5854 set d_longlong
5855 eval $setvar
5856
5857 : check for length of long long
5858 case "${d_longlong}${longlongsize}" in
5859 $define)
5860         echo " "
5861         echo "Checking to see how big your long longs are..." >&4
5862         $cat >try.c <<'EOCP'
5863 #include <stdio.h>
5864 int main()
5865 {
5866     printf("%d\n", (int)sizeof(long long));
5867     return(0);
5868 }
5869 EOCP
5870         set try
5871         if eval $compile_ok; then
5872                 longlongsize=`$run ./try`
5873                 echo "Your long longs are $longlongsize bytes long."
5874         else
5875                 dflt='8'
5876                 echo " "
5877                 echo "(I can't seem to compile the test program.  Guessing...)"
5878                 rp="What is the size of a long long (in bytes)?"
5879                 . ./myread
5880                 longlongsize="$ans"
5881         fi
5882         if $test "X$longsize" = "X$longlongsize"; then
5883                 echo "(That isn't any different from an ordinary long.)"
5884         fi
5885         ;;
5886 esac
5887 $rm_try
5888
5889 : determine filename position in cpp output
5890 echo " "
5891 echo "Computing filename position in cpp output for #include directives..." >&4
5892 case "$osname" in
5893 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5894 esac
5895 case "$fieldn" in
5896 '')
5897 case "$osname" in
5898 vos) testaccess=-e ;;
5899 *)   testaccess=-r ;;
5900 esac
5901 echo '#include <stdio.h>' > foo.c
5902 $cat >fieldn <<EOF
5903 $startsh
5904 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5905 $grep '^[       ]*#.*stdio\.h' | \
5906 while read cline; do
5907         pos=1
5908         set \$cline
5909         while $test \$# -gt 0; do
5910                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5911                         echo "\$pos"
5912                         exit 0
5913                 fi
5914                 shift
5915                 pos=\`expr \$pos + 1\`
5916         done
5917 done
5918 EOF
5919 chmod +x fieldn
5920 fieldn=`./fieldn`
5921 $rm -f foo.c fieldn
5922 ;;
5923 esac
5924 case $fieldn in
5925 '') pos='???';;
5926 1) pos=first;;
5927 2) pos=second;;
5928 3) pos=third;;
5929 *) pos="${fieldn}th";;
5930 esac
5931 echo "Your cpp writes the filename in the $pos field of the line."
5932
5933 : locate header file
5934 $cat >findhdr <<EOF
5935 $startsh
5936 wanted=\$1
5937 name=''
5938 for usrincdir in $incpth
5939 do
5940         if test -f \$usrincdir/\$wanted; then
5941                 echo "\$usrincdir/\$wanted"
5942                 exit 0
5943         fi
5944 done
5945 awkprg='{ print \$$fieldn }'
5946 echo "#include <\$wanted>" > foo\$\$.c
5947 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5948 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5949 while read cline; do
5950         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5951         case "\$name" in
5952         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5953         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5954         *) exit 2;;
5955         esac;
5956 done;
5957 #
5958 # status = 0: grep returned 0 lines, case statement not executed
5959 # status = 1: headerfile found
5960 # status = 2: while loop executed, no headerfile found
5961 #
5962 status=\$?
5963 $rm -f foo\$\$.c;
5964 if test \$status -eq 1; then
5965         exit 0;
5966 fi
5967 exit 1
5968 EOF
5969 chmod +x findhdr
5970
5971 : define an alternate in-header-list? function
5972 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5973 cont=true; xxf="echo \"<\$1> found.\" >&4";
5974 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5975 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5976 esac;
5977 case $# in 4) instead=instead;; *) instead="at last";; esac;
5978 while $test "$cont"; do
5979         xxx=`./findhdr $1`
5980         var=$2; eval "was=\$$2";
5981         if $test "$xxx" && $test -r "$xxx";
5982         then eval $xxf;
5983         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5984                 cont="";
5985         else eval $xxnf;
5986         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5987         set $yyy; shift; shift; yyy=$@;
5988         case $# in 0) cont="";;
5989         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5990                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5991         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5992                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5993         esac;
5994 done;
5995 while $test "$yyy";
5996 do set $yyy; var=$2; eval "was=\$$2";
5997         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5998         set $yyy; shift; shift; yyy=$@;
5999 done'
6000
6001 : see if inttypes.h is available
6002 : we want a real compile instead of Inhdr because some systems
6003 : have an inttypes.h which includes non-existent headers
6004 echo " "
6005 $cat >try.c <<EOCP
6006 #include <inttypes.h>
6007 int main() {
6008         static int32_t foo32 = 0x12345678;
6009 }
6010 EOCP
6011 set try
6012 if eval $compile; then
6013         echo "<inttypes.h> found." >&4
6014         val="$define"
6015 else
6016         echo "<inttypes.h> NOT found." >&4
6017         val="$undef"
6018 fi
6019 $rm_try
6020 set i_inttypes
6021 eval $setvar
6022
6023 : check for int64_t
6024 echo " "
6025 echo "Checking to see if you have int64_t..." >&4
6026 $cat >try.c <<EOCP
6027 #include <sys/types.h>
6028 #$i_inttypes I_INTTYPES
6029 #ifdef I_INTTYPES
6030 #include <inttypes.h>
6031 #endif
6032 int main() { int64_t x = 7; }
6033 EOCP
6034 set try
6035 if eval $compile; then
6036         val="$define"
6037         echo "You have int64_t."
6038 else
6039         val="$undef"
6040         echo "You do not have int64_t."
6041 fi
6042 $rm_try
6043 set d_int64_t
6044 eval $setvar
6045
6046 : Check if 64bit ints have a quad type
6047 echo " "
6048 echo "Checking which 64-bit integer type we could use..." >&4
6049
6050 case "$intsize" in
6051 8) val=int
6052    set quadtype
6053    eval $setvar
6054    val='"unsigned int"'
6055    set uquadtype
6056    eval $setvar
6057    quadkind=1
6058    ;;
6059 *) case "$longsize" in
6060    8) val=long
6061       set quadtype
6062       eval $setvar
6063       val='"unsigned long"'
6064       set uquadtype
6065       eval $setvar
6066       quadkind=2
6067       ;;
6068    *) case "$d_longlong:$longlongsize" in
6069       define:8)
6070         val='"long long"'
6071         set quadtype
6072         eval $setvar
6073         val='"unsigned long long"'
6074         set uquadtype
6075         eval $setvar
6076         quadkind=3
6077         ;;
6078       *) case "$d_int64_t" in
6079          define)
6080            val=int64_t
6081            set quadtype
6082            eval $setvar
6083            val=uint64_t
6084            set uquadtype
6085            eval $setvar
6086            quadkind=4
6087            ;;
6088          esac
6089          ;;
6090       esac
6091       ;;
6092    esac
6093    ;;
6094 esac
6095
6096 case "$quadtype" in
6097 '')     echo "Alas, no 64-bit integer types in sight." >&4
6098         d_quad="$undef"
6099         ;;
6100 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6101         d_quad="$define"
6102         ;;
6103 esac
6104
6105 : Do we want 64bit support
6106 case "$uselonglong" in
6107 "$define"|true|[yY]*)
6108         cat <<EOM >&4
6109
6110 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6111 EOM
6112         use64bitint="$define"
6113         ;;
6114 esac
6115 case "$use64bits" in
6116 "$define"|true|[yY]*)
6117         cat <<EOM >&4
6118
6119 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6120 EOM
6121         use64bitint="$define"
6122         ;;
6123 esac
6124 case "$use64bitints" in
6125 "$define"|true|[yY]*)
6126         cat <<EOM >&4
6127
6128 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6129 EOM
6130         use64bitint="$define"
6131         ;;
6132 esac
6133 case "$use64bitsint" in
6134 "$define"|true|[yY]*)
6135         cat <<EOM >&4
6136
6137 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6138 EOM
6139         use64bitint="$define"
6140         ;;
6141 esac
6142 case "$uselonglongs" in
6143 "$define"|true|[yY]*)
6144         cat <<EOM >&4
6145
6146 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6147 EOM
6148         use64bitint="$define"
6149         ;;
6150 esac
6151 case "$use64bitsall" in
6152 "$define"|true|[yY]*)
6153         cat <<EOM >&4
6154
6155 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6156 EOM
6157         use64bitall="$define"
6158         ;;
6159 esac
6160
6161 case "$ccflags" in
6162 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6163 esac
6164 case "$use64bitall" in
6165 "$define"|true|[yY]*) use64bitint="$define" ;;
6166 esac
6167
6168 case "$longsize" in
6169 8) cat <<EOM
6170
6171 You have natively 64-bit long integers.
6172 EOM
6173    val="$define"
6174    ;;
6175 *) case "$use64bitint" in
6176    "$define"|true|[yY]*) dflt='y';;
6177    *) dflt='n';;
6178    esac
6179    case "$d_quad" in
6180    "$define") ;;
6181    *) dflt='n' ;;
6182    esac
6183    cat <<EOM
6184
6185 Perl can be built to take advantage of 64-bit integer types
6186 on some systems.  To do so, Configure can be run with -Duse64bitint.
6187 Choosing this option will most probably introduce binary incompatibilities.
6188
6189 If this doesn't make any sense to you, just accept the default '$dflt'.
6190 (The default has been chosen based on your configuration.)
6191 EOM
6192    rp='Try to use 64-bit integers, if available?'
6193    . ./myread
6194    case "$ans" in
6195    [yY]*) val="$define" ;;
6196    *)     val="$undef"  ;;
6197    esac
6198    ;;
6199 esac
6200 set use64bitint
6201 eval $setvar
6202
6203 case "$use64bitall" in
6204 "$define"|true|[yY]*) dflt='y' ;;
6205 *) case "$longsize" in
6206    8) dflt='y' ;;
6207    *) dflt='n' ;;
6208    esac
6209    ;;
6210 esac
6211 cat <<EOM
6212
6213 You may also choose to try maximal 64-bitness.  It means using as much
6214 64-bitness as possible on the platform.  This in turn means even more
6215 binary incompatibilities.  On the other hand, your platform may not
6216 have any more 64-bitness available than what you already have chosen.
6217
6218 If this doesn't make any sense to you, just accept the default '$dflt'.
6219 (The default has been chosen based on your configuration.)
6220 EOM
6221 rp='Try to use maximal 64-bit support, if available?'
6222 . ./myread
6223 case "$ans" in
6224 [yY]*) val="$define" ;;
6225 *)     val="$undef"  ;;
6226 esac
6227 set use64bitall
6228 eval $setvar
6229 case "$use64bitall" in
6230 "$define")
6231         case "$use64bitint" in
6232         "$undef")
6233                 cat <<EOM
6234
6235 Since you have chosen a maximally 64-bit build, I'm also turning on
6236 the use of 64-bit integers.
6237 EOM
6238                 use64bitint="$define" ;;
6239         esac
6240         ;;
6241 esac
6242
6243 : Look for a hint-file generated 'call-back-unit'.  If the
6244 : user has specified that a 64-bit perl is to be built,
6245 : we may need to set or change some other defaults.
6246 if $test -f use64bitint.cbu; then
6247         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6248         . ./use64bitint.cbu
6249 fi
6250 case "$use64bitint" in
6251 "$define"|true|[yY]*)
6252         : This test was common to all the OpenBSD forks, and seems harmless for
6253         : other platforms:
6254         echo " "
6255         echo "Checking if your C library has broken 64-bit functions..." >&4
6256         cat >try.c <<EOCP
6257 #include <stdio.h>
6258 typedef $uquadtype myULL;
6259 int main (void)
6260 {
6261     struct {
6262         double d;
6263         myULL  u;
6264     } *p, test[] = {
6265         {4294967303.15, 4294967303ULL},
6266         {4294967294.2,  4294967294ULL},
6267         {4294967295.7,  4294967295ULL},
6268         {0.0, 0ULL}
6269     };
6270     for (p = test; p->u; p++) {
6271         myULL x = (myULL)p->d;
6272         if (x != p->u) {
6273             printf("buggy\n");
6274             return 0;
6275         }
6276     }
6277     printf("ok\n");
6278     return 0;
6279 }
6280 EOCP
6281         set try
6282         if eval $compile_ok; then
6283             libcquad=`$run ./try`
6284             echo "Your C library's 64-bit functions are $libcquad."
6285         else
6286             echo "(I can't seem to compile the test program.)"
6287             echo "Assuming that your C library's 64-bit functions are ok."
6288             libcquad="ok"
6289         fi
6290         $rm_try
6291
6292         case "$libcquad" in
6293             buggy*)
6294                 cat >&4 <<EOM
6295
6296 *** You have a C library with broken 64-bit functions.
6297 *** 64-bit support does not work reliably in this configuration.
6298 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6299 *** Cannot continue, aborting.
6300
6301 EOM
6302                 exit 1
6303                 ;;
6304         esac
6305         case "$longsize" in
6306         4) case "$archname64" in
6307            '') archname64=64int ;;
6308            esac
6309            ;;
6310         esac
6311         ;;
6312 esac
6313
6314 : Look for a hint-file generated 'call-back-unit'.  If the
6315 : user has specified that a maximally 64-bit perl is to be built,
6316 : we may need to set or change some other defaults.
6317 if $test -f use64bitall.cbu; then
6318         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6319         . ./use64bitall.cbu
6320 fi
6321 case "$use64bitall" in
6322 "$define"|true|[yY]*)
6323         case "$longsize" in
6324         4) case "$archname64" in
6325            ''|64int) archname64=64all ;;
6326            esac
6327            ;;
6328         esac
6329         ;;
6330 esac
6331
6332 case "$d_quad:$use64bitint" in
6333 $undef:$define)
6334         cat >&4 <<EOF
6335
6336 *** You have chosen to use 64-bit integers,
6337 *** but none can be found.
6338 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6339 *** Cannot continue, aborting.
6340
6341 EOF
6342         exit 1
6343         ;;
6344 esac
6345
6346 : Check if we are using the GNU C library
6347 echo " "
6348 echo "Checking for GNU C Library..." >&4
6349 cat >try.c <<'EOCP'
6350 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6351    alone are insufficient to distinguish different versions, such as
6352    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6353    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6354 */
6355 #include <stdio.h>
6356 int main(void)
6357 {
6358 #ifdef __GLIBC__
6359 #   ifdef __GLIBC_MINOR__
6360 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6361 #           include <gnu/libc-version.h>
6362             printf("%s\n",  gnu_get_libc_version());
6363 #       else
6364             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6365 #       endif
6366 #   else
6367         printf("%d\n",  __GLIBC__);
6368 #   endif
6369     return 0;
6370 #else
6371     return 1;
6372 #endif
6373 }
6374 EOCP
6375 set try
6376 if eval $compile_ok && $run ./try > glibc.ver; then
6377         val="$define"
6378         gnulibc_version=`$cat glibc.ver`
6379         echo "You are using the GNU C Library version $gnulibc_version"
6380 else
6381         val="$undef"
6382         gnulibc_version=''
6383         echo "You are not using the GNU C Library"
6384 fi
6385 $rm_try glibc.ver
6386 set d_gnulibc
6387 eval $setvar
6388
6389 : see if nm is to be used to determine whether a symbol is defined or not
6390 case "$usenm" in
6391 '')
6392         dflt=''
6393         case "$d_gnulibc" in
6394         "$define")
6395                 echo " "
6396                 echo "nm probably won't work on the GNU C Library." >&4
6397                 dflt=n
6398                 ;;
6399         esac
6400         case "$dflt" in
6401         '')
6402                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6403                         echo " "
6404                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6405                         echo "'nm' won't be sufficient on this system." >&4
6406                         dflt=n
6407                 fi
6408                 ;;
6409         esac
6410         case "$dflt" in
6411         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6412                 if $test $dflt -gt 20; then
6413                         dflt=y
6414                 else
6415                         dflt=n
6416                 fi
6417                 ;;
6418         esac
6419         ;;
6420 *)
6421         case "$usenm" in
6422         true|$define) dflt=y;;
6423         *) dflt=n;;
6424         esac
6425         ;;
6426 esac
6427 $cat <<EOM
6428
6429 I can use $nm to extract the symbols from your C libraries. This
6430 is a time consuming task which may generate huge output on the disk (up
6431 to 3 megabytes) but that should make the symbols extraction faster. The
6432 alternative is to skip the 'nm' extraction part and to compile a small
6433 test program instead to determine whether each symbol is present. If
6434 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6435 this may be the best solution.
6436
6437 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6438
6439 EOM
6440 rp="Shall I use $nm to extract C symbols from the libraries?"
6441 . ./myread
6442 case "$ans" in
6443 [Nn]*) usenm=false;;
6444 *) usenm=true;;
6445 esac
6446
6447 runnm=$usenm
6448 case "$reuseval" in
6449 true) runnm=false;;
6450 esac
6451
6452 : nm options which may be necessary
6453 case "$nm_opt" in
6454 '') if $test -f /mach_boot; then
6455                 nm_opt=''       # Mach
6456         elif $test -d /usr/ccs/lib; then
6457                 nm_opt='-p'     # Solaris (and SunOS?)
6458         elif $test -f /dgux; then
6459                 nm_opt='-p'     # DG-UX
6460         elif $test -f /lib64/rld; then
6461                 nm_opt='-p'     # 64-bit Irix
6462         else
6463                 nm_opt=''
6464         fi;;
6465 esac
6466
6467 : nm options which may be necessary for shared libraries but illegal
6468 : for archive libraries.  Thank you, Linux.
6469 case "$nm_so_opt" in
6470 '')     case "$myuname" in
6471         *linux*|gnu*)
6472                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6473                         nm_so_opt='--dynamic'
6474                 fi
6475                 ;;
6476         esac
6477         ;;
6478 esac
6479
6480 : Figure out where the libc is located
6481 case "$runnm" in
6482 true)
6483 : get list of predefined functions in a handy place
6484 echo " "
6485 case "$libc" in
6486 '') libc=unknown
6487         case "$libs" in
6488         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6489         esac
6490         ;;
6491 esac
6492 case "$libs" in
6493 '') ;;
6494 *)  for thislib in $libs; do
6495         case "$thislib" in
6496         -lc|-lc_s)
6497                 : Handle C library specially below.
6498                 ;;
6499         -l*)
6500                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6501                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6502                         :
6503                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6504                         :
6505                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6506                         :
6507                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6508                         :
6509                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6510                         :
6511                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6512                         :
6513                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6514                         :
6515                 else
6516                         try=''
6517                 fi
6518                 libnames="$libnames $try"
6519                 ;;
6520         *) libnames="$libnames $thislib" ;;
6521         esac
6522         done
6523         ;;
6524 esac
6525 xxx=normal
6526 case "$libc" in
6527 unknown)
6528         set /lib/libc.$so
6529         for xxx in $libpth; do
6530                 $test -r $1 || set $xxx/libc.$so
6531                 : The messy sed command sorts on library version numbers.
6532                 $test -r $1 || \
6533                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6534                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6535                                 h
6536                                 s/[0-9][0-9]*/0000&/g
6537                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6538                                 G
6539                                 s/\n/ /' | \
6540                          $sort | $sed -e 's/^.* //'`
6541                 eval set \$$#
6542         done
6543         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6544         $test -r $1 || set $sysroot/lib/libsys_s$_a
6545         ;;
6546 *)
6547         set blurfl
6548         ;;
6549 esac
6550 if $test -r "$1"; then
6551         echo "Your (shared) C library seems to be in $1."
6552         libc="$1"
6553 elif $test -r /lib/libc && $test -r /lib/clib; then
6554         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6555         xxx=apollo
6556         libc='/lib/clib /lib/libc'
6557         if $test -r /lib/syslib; then
6558                 echo "(Your math library is in /lib/syslib.)"
6559                 libc="$libc /lib/syslib"
6560         fi
6561 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6562         echo "Your C library seems to be in $libc, as you said before."
6563 elif $test -r $incpath/usr/lib/libc$_a; then
6564         libc=$incpath/usr/lib/libc$_a;
6565         echo "Your C library seems to be in $libc.  That's fine."
6566 elif $test -r /lib/libc$_a; then
6567         libc=/lib/libc$_a;
6568         echo "Your C library seems to be in $libc.  You're normal."
6569 else
6570         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6571                 :
6572         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6573                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6574         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6575                 :
6576         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6577                 :
6578         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6579                 :
6580         else
6581                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6582         fi
6583         if $test -r "$tans"; then
6584                 echo "Your C library seems to be in $tans, of all places."
6585                 libc=$tans
6586         else
6587                 libc='blurfl'
6588         fi
6589 fi
6590 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6591         dflt="$libc"
6592         cat <<EOM
6593
6594 If the guess above is wrong (which it might be if you're using a strange
6595 compiler, or your machine supports multiple models), you can override it here.
6596
6597 EOM
6598 else
6599         dflt=''
6600         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6601         cat >&4 <<EOM
6602 I can't seem to find your C library.  I've looked in the following places:
6603
6604 EOM
6605         $sed 's/^/      /' libpath
6606         cat <<EOM
6607
6608 None of these seems to contain your C library. I need to get its name...
6609
6610 EOM
6611 fi
6612 fn=f
6613 rp='Where is your C library?'
6614 . ./getfile
6615 libc="$ans"
6616
6617 echo " "
6618 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6619 set X `cat libnames`
6620 shift
6621 xxx=files
6622 case $# in 1) xxx=file; esac
6623 echo "Extracting names from the following $xxx for later perusal:" >&4
6624 echo " "
6625 $sed 's/^/      /' libnames >&4
6626 echo " "
6627 $echo $n "This may take a while...$c" >&4
6628
6629 for file in $*; do
6630         case $file in
6631         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6632         *) $nm $nm_opt $file 2>/dev/null;;
6633         esac
6634 done >libc.tmp
6635
6636 $echo $n ".$c"
6637 $grep fprintf libc.tmp > libc.ptf
6638 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6639 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6640 xxx='[ADTSIWi]'
6641 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6642         eval $xscan;\
6643         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6644                 eval $xrun
6645 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6646         eval $xscan;\
6647         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6648                 eval $xrun
6649 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6650         eval $xscan;\
6651         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6652                 eval $xrun
6653 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6654         eval $xscan;\
6655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6656                 eval $xrun
6657 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6658         eval $xscan;\
6659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6660                 eval $xrun
6661 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6662         eval $xscan;\
6663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6664                 eval $xrun
6665 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6666                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6667         eval $xscan;\
6668         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6669                 eval $xrun
6670 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6671         eval $xscan;\
6672         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6673                 eval $xrun
6674 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6675         eval $xscan;\
6676         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6677                 eval $xrun
6678 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6679         eval $xscan;\
6680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6681                 eval $xrun
6682 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6683         eval $xscan;\
6684         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6685                 eval $xrun
6686 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6687         eval $xscan;\
6688         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6689                 eval $xrun
6690 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6691         eval $xscan;\
6692         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6693                 eval $xrun
6694 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6695         eval $xscan;\
6696         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6697                 eval $xrun
6698 else
6699         $nm -p $* 2>/dev/null >libc.tmp
6700         $grep fprintf libc.tmp > libc.ptf
6701         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6702                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6703         then
6704                 nm_opt='-p'
6705                 eval $xrun
6706         else
6707                 echo " "
6708                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6709                 com=''
6710                 if $ar t $libc > libc.tmp && \
6711                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6712                 then
6713                         for thisname in $libnames $libc; do
6714                                 $ar t $thisname >>libc.tmp
6715                         done
6716                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6717                         echo "Ok." >&4
6718                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6719                         for thisname in $libnames $libc; do
6720                                 $ar tv $thisname >>libc.tmp
6721                                 emximp -o tmp.imp $thisname \
6722                                     2>/dev/null && \
6723                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6724                                     < tmp.imp >>libc.tmp
6725                                 $rm -f tmp.imp
6726                         done
6727                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6728                         echo "Ok." >&4
6729                 else
6730                         echo "$ar didn't seem to work right." >&4
6731                         echo "Maybe this is a Cray...trying bld instead..." >&4
6732                         if  bld t $libc | \
6733                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6734                                 $test -s libc.list
6735                         then
6736                                 for thisname in $libnames; do
6737                                         bld t $libnames | \
6738                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6739                                         $ar t $thisname >>libc.tmp
6740                                 done
6741                                 echo "Ok." >&4
6742                         else
6743                                 echo "That didn't work either.  Giving up." >&4
6744                                 exit 1
6745                         fi
6746                 fi
6747         fi
6748 fi
6749 nm_extract="$com"
6750 case "$PASE" in
6751 define)
6752     echo " "
6753     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6754     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6755     ;;
6756 *)  if $test -f /lib/syscalls.exp; then
6757         echo " "
6758         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6759         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6760                 /lib/syscalls.exp >>libc.list
6761     fi
6762     ;;
6763 esac
6764 ;;
6765 esac
6766 $rm -f libnames libpath
6767
6768 : Check if we are using C++
6769 echo " "
6770 echo "Checking for C++..." >&4
6771 $cat >try.c <<'EOCP'
6772 #include <stdio.h>
6773 int main(void)
6774 {
6775 #ifdef __cplusplus
6776     return 0;
6777 #else
6778     return 1;
6779 #endif
6780 }
6781 EOCP
6782 set try
6783 if eval $compile_ok && $run ./try; then
6784         val="$define"
6785         echo "You are using a C++ compiler."
6786 else
6787         val="$undef"
6788         echo "You are not using a C++ compiler."
6789 fi
6790 $rm_try cplusplus$$
6791 set d_cplusplus
6792 eval $setvar
6793
6794 : is a C symbol defined?
6795 csym='tlook=$1;
6796 case "$3" in
6797 -v) tf=libc.tmp; tdc="";;
6798 -a) tf=libc.tmp; tdc="[]";;
6799 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6800 esac;
6801 case "$d_cplusplus" in
6802     $define)    extern_C="extern \"C\"" ;;
6803     *)          extern_C="extern"       ;;
6804 esac;
6805 tx=yes;
6806 case "$reuseval-$4" in
6807 true-) ;;
6808 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6809 esac;
6810 case "$tx" in
6811 yes)
6812         tval=false;
6813         if $test "$runnm" = true; then
6814                 if $contains $tlook $tf >/dev/null 2>&1; then
6815                         tval=true;
6816                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
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 >/dev/null 2>&1 $libs && tval=true;
6819                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6820                         $rm_try;
6821                 fi;
6822         else
6823                 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;
6824                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6825                 $rm_try;
6826         fi;
6827         ;;
6828 *)
6829         case "$tval" in
6830         $define) tval=true;;
6831         *) tval=false;;
6832         esac;
6833         ;;
6834 esac;
6835 eval "$2=$tval"'
6836
6837 : define an is-in-libc? function
6838 inlibc='echo " "; td=$define; tu=$undef;
6839 sym=$1; var=$2; eval "was=\$$2";
6840 tx=yes;
6841 case "$reuseval$was" in
6842 true) ;;
6843 true*) tx=no;;
6844 esac;
6845 case "$tx" in
6846 yes)
6847         set $sym tres -f;
6848         eval $csym;
6849         case "$tres" in
6850         true)
6851                 echo "$sym() found." >&4;
6852                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6853         *)
6854                 echo "$sym() NOT found." >&4;
6855                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6856         esac;;
6857 *)
6858         case "$was" in
6859         $define) echo "$sym() found." >&4;;
6860         *) echo "$sym() NOT found." >&4;;
6861         esac;;
6862 esac'
6863
6864 : check for length of double
6865 echo " "
6866 case "$doublesize" in
6867 '')
6868         echo "Checking to see how big your double precision numbers are..." >&4
6869         $cat >try.c <<EOCP
6870 #include <stdio.h>
6871 #$i_stdlib I_STDLIB
6872 #ifdef I_STDLIB
6873 #include <stdlib.h>
6874 #endif
6875 #include <stdio.h>
6876 int main()
6877 {
6878     printf("%d\n", (int)sizeof(double));
6879     exit(0);
6880 }
6881 EOCP
6882         set try
6883         if eval $compile_ok; then
6884                 doublesize=`$run ./try`
6885                 echo "Your double is $doublesize bytes long."
6886         else
6887                 dflt='8'
6888                 echo "(I can't seem to compile the test program.  Guessing...)"
6889                 rp="What is the size of a double precision number (in bytes)?"
6890                 . ./myread
6891                 doublesize="$ans"
6892         fi
6893         ;;
6894 esac
6895 $rm_try
6896
6897 : check for long doubles
6898 echo " " >&4
6899 echo "Checking to see if you have long double..." >&4
6900 echo 'int main() { long double x = 7.0; }' > try.c
6901 set try
6902 if eval $compile; then
6903         val="$define"
6904         echo "You have long double." >&4
6905 else
6906         val="$undef"
6907         echo "You do not have long double." >&4
6908 fi
6909 $rm_try
6910 set d_longdbl
6911 eval $setvar
6912
6913 : see if ldexpl exists
6914 set ldexpl d_ldexpl
6915 eval $inlibc
6916
6917 : check for length of long double
6918 case "${d_longdbl}${longdblsize}" in
6919 $define)
6920         echo " " >&4
6921         echo "Checking to see how big your long doubles are..." >&4
6922         $cat >try.c <<'EOCP'
6923 #include <stdio.h>
6924 int main()
6925 {
6926         printf("%d\n", sizeof(long double));
6927 }
6928 EOCP
6929         set try
6930         set try
6931         if eval $compile; then
6932                 longdblsize=`$run ./try`
6933                 echo "Your long doubles are $longdblsize bytes long." >&4
6934         else
6935                 dflt='8'
6936                 echo " " >&4
6937                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6938                 rp="What is the size of a long double (in bytes)?"
6939                 . ./myread
6940                 longdblsize="$ans"
6941         fi
6942         if $test "X$doublesize" = "X$longdblsize"; then
6943                 echo "That isn't any different from an ordinary double." >&4
6944                 echo "I'll keep your setting anyway, but you may see some" >&4
6945                 echo "harmless compilation warnings." >&4
6946         fi
6947         ;;
6948 esac
6949 $rm_try
6950
6951 $echo "Checking the kind of long doubles you have..." >&4
6952 case "$d_longdbl" in
6953 define)
6954 $cat <<EOP >try.c
6955 #$i_stdlib I_STDLIB
6956 #define LONGDBLSIZE $longdblsize
6957 #define DOUBLESIZE $doublesize
6958 #include <float.h>
6959 #ifdef I_STDLIB
6960 #include <stdlib.h>
6961 #endif
6962 #include <stdio.h>
6963 static const long double d = -0.1L;
6964 int main() {
6965   unsigned const char* b = (unsigned const char*)(&d);
6966 #if DOUBLESIZE == LONGDBLSIZE
6967   printf("0\n"); /* if it floats like double */
6968   exit(0);
6969 #endif
6970 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6971   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6972     /* IEEE 754 128-bit little-endian */
6973     printf("1\n");
6974     exit(0);
6975   }
6976   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6977     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6978     printf("2\n");
6979     exit(0);
6980   }
6981 #endif
6982 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6983  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6984  * cannot be trusted. */
6985 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6986   if (b[0] == 0xCD && b[9] == 0xBF) {
6987     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6988      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6989      * Also known as "extended precision". */
6990     printf("3\n");
6991     exit(0);
6992   }
6993   if (b[0] == 0xBF && b[9] == 0xCD) {
6994     /* Is there ever big-endian 80-bit, really?
6995      *
6996      * The Motorola 68881 had another "extended precision" format:
6997      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6998      * for total of 96 bits of bytes.  The zero bits were unused.
6999      * See "M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL" for more details.
7000      * If it ever becomes relevant, this format should be allocated a
7001      * new doublekind code since it is quite different from the Intel x87.
7002      */
7003     printf("4\n");
7004     exit(0);
7005   }
7006 #endif
7007 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7008   /* software "double double", the 106 is 53+53.
7009    * but irix thinks it is 107. */
7010   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7011     /* double double 128-bit fully little-endian,
7012      * little-endian doubles in little-endian order,
7013      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7014     printf("5\n");
7015     exit(0);
7016   }
7017   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7018     /* double double 128-bit fully big-endian,
7019      * big-endian doubles in big-endian order,
7020      * e.g. PPC/Power and MIPS:
7021      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7022     printf("6\n");
7023     exit(0);
7024   }
7025   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
7026     /* double double 128-bit mixed endian.
7027      * little-endian doubles in big-endian order,
7028      * e.g. ppc64el,
7029      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
7030     printf("7\n");
7031     exit(0);
7032   }
7033   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
7034     /* double double 128-bit mixed endian,
7035      * big-endian doubles in little-endian order,
7036      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
7037     printf("8\n");
7038     exit(0);
7039   }
7040 #endif
7041 /* We are largely making this up because it may well be
7042  * that the VAX format H was never made available to C,
7043  * only to Fortran. */
7044 #if LONGDBLSIZE == 16 && defined(__vax__)
7045   if (b[0] == 0xFD && b[15] == 0x99) {
7046     /* VAX format H, PDP-11 mixed endian. */
7047     printf("9\n");
7048     exit(0);
7049   }
7050 #endif
7051   printf("-1\n"); /* unknown */
7052   exit(0);
7053 }
7054 EOP
7055 set try
7056 if eval $compile; then
7057     longdblkind=`$run ./try`
7058 else
7059     longdblkind=-1
7060 fi
7061 ;;
7062 *) longdblkind=0 ;;
7063 esac
7064 case "$longdblkind" in
7065 0) echo "Your long doubles are doubles." >&4 ;;
7066 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7067 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7068 3) echo "You have x86 80-bit little endian long doubles." >&4 ;;
7069 4) echo "You have x86 80-bit big endian long doubles." >&4 ;;
7070 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >&4 ;;
7071 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >&4 ;;
7072 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >&4 ;;
7073 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >&4 ;;
7074 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >&4 ;;
7075 *) echo "Cannot figure out your long double." >&4 ;;
7076 esac
7077 d_long_double_style_ieee=$undef
7078 d_long_double_style_ieee_std=$undef
7079 d_long_double_style_ieee_extended=$undef
7080 d_long_double_style_ieee_doubledouble=$undef
7081 d_long_double_style_vax=$undef
7082 case "$longdblkind" in
7083 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
7084 esac
7085 case "$longdblkind" in
7086 1|2) d_long_double_style_ieee_std=$define ;;
7087 esac
7088 case "$longdblkind" in
7089 3|4) d_long_double_style_ieee_extended=$define ;;
7090 esac
7091 case "$longdblkind" in
7092 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
7093 esac
7094 case "$longdblkind" in
7095 9) d_long_double_style_vax=$define ;;
7096 esac
7097 $rm_try
7098
7099 : get the patchlevel
7100 echo " "
7101 echo "Getting the current patchlevel..." >&4
7102 if $test -r $rsrc/patchlevel.h;then
7103         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
7104         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
7105         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
7106         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
7107         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
7108         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
7109         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
7110 else
7111         revision=0
7112         patchlevel=0
7113         subversion=0
7114         api_revision=0
7115         api_version=0
7116         api_subversion=0
7117         perl_patchlevel=0
7118         $echo "(You do not have patchlevel.h.  Eek.)"
7119 fi
7120 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
7121 version_patchlevel_string="version $patchlevel subversion $subversion"
7122 case "$perl_patchlevel" in
7123 0|'') ;;
7124 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
7125     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
7126     ;;
7127 esac
7128
7129 $echo "(You have $package $version_patchlevel_string.)"
7130
7131 case "$osname" in
7132 dos|vms)
7133         : XXX Should be a Configure test for double-dots in filenames.
7134         version=`echo $revision $patchlevel $subversion | \
7135                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
7136         api_versionstring=`echo $api_revision $api_version $api_subversion | \
7137                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
7138         ;;
7139 *)
7140         version=`echo $revision $patchlevel $subversion | \
7141                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
7142         api_versionstring=`echo $api_revision $api_version $api_subversion | \
7143                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
7144         ;;
7145 esac
7146 : Special case the 5.005_xx maintenance series, which used 5.005
7147 : without any subversion label as a subdirectory in $sitelib
7148 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
7149         api_versionstring='5.005'
7150 fi
7151
7152 : determine the architecture name
7153 echo " "
7154 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7155         tarch=`arch`"-$osname"
7156 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7157         if uname -m > tmparch 2>&1 ; then
7158                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7159                         -e 's/$/'"-$osname/" tmparch`
7160         else
7161                 tarch="$osname"
7162         fi
7163         $rm -f tmparch
7164 else
7165         tarch="$osname"
7166 fi
7167 case "$myarchname" in
7168 ''|"$tarch") ;;
7169 *)
7170         echo "(Your architecture name used to be $myarchname.)"
7171         archname=''
7172         ;;
7173 esac
7174 case "$targetarch" in
7175 '') ;;
7176 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7177 esac
7178 myarchname="$tarch"
7179 case "$archname" in
7180 '') dflt="$tarch";;
7181 *) dflt="$archname";;
7182 esac
7183 rp='What is your architecture name'
7184 . ./myread
7185 archname="$ans"
7186
7187 : optionally add API version to the architecture for versioned archlibs
7188 case "$useversionedarchname" in
7189 $define|true|[yY]*) dflt='y';;
7190 *)                  dflt='n';;
7191 esac
7192 rp='Add the Perl API version to your archname?'
7193 . ./myread
7194 case "$ans" in
7195 y|Y)    useversionedarchname="$define" ;;
7196 *)      useversionedarchname="$undef" ;;
7197 esac
7198 case "$useversionedarchname" in
7199 $define)
7200         case "$archname" in
7201         *-$api_versionstring)
7202                 echo "...and architecture name already has -$api_versionstring" >&4
7203                 ;;
7204         *)
7205                 archname="$archname-$api_versionstring"
7206                 echo "...setting architecture name to $archname." >&4
7207                 ;;
7208         esac
7209         ;;
7210 esac
7211
7212 case "$usethreads" in
7213 $define)
7214         echo "Threads selected." >&4
7215         case "$archname" in
7216         *-thread*) echo "...and architecture name already has -thread." >&4
7217                 ;;
7218         *)      archname="$archname-thread"
7219                 echo "...setting architecture name to $archname." >&4
7220                 ;;
7221         esac
7222         ;;
7223 esac
7224 case "$usemultiplicity" in
7225 $define)
7226         echo "Multiplicity selected." >&4
7227         case "$archname" in
7228         *-multi*) echo "...and architecture name already has -multi." >&4
7229                 ;;
7230         *)      archname="$archname-multi"
7231                 echo "...setting architecture name to $archname." >&4
7232                 ;;
7233         esac
7234         ;;
7235 esac
7236 case "$use64bitint$use64bitall" in
7237 *"$define"*)
7238         case "$archname64" in
7239         '')
7240                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7241                 ;;
7242         *)
7243                 case "$use64bitint" in
7244                 "$define") echo "64 bit integers selected." >&4 ;;
7245                 esac
7246                 case "$use64bitall" in
7247                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7248                 esac
7249                 case "$archname" in
7250                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7251                         ;;
7252                 *)      archname="$archname-$archname64"
7253                         echo "...setting architecture name to $archname." >&4
7254                         ;;
7255                 esac
7256                 ;;
7257         esac
7258 esac
7259 case "$uselongdouble" in
7260 $define)
7261         echo "Long doubles selected." >&4
7262         case "$longdblsize" in
7263         $doublesize)
7264                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7265                 ;;
7266         *)
7267                 case "$archname" in
7268                 *-ld*) echo "...and architecture name already has -ld." >&4
7269                         ;;
7270                 *)      archname="$archname-ld"
7271                         echo "...setting architecture name to $archname." >&4
7272                         ;;
7273                 esac
7274                 ;;
7275         esac
7276         ;;
7277 esac
7278 case "$usequadmath" in
7279 $define)
7280         echo "quadmath selected." >&4
7281         case "$archname" in
7282         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7283                 ;;
7284         *)      archname="$archname-quadmath"
7285                 echo "...setting architecture name to $archname." >&4
7286                 ;;
7287         esac
7288         ;;
7289 esac
7290 if $test -f archname.cbu; then
7291         echo "Your platform has some specific hints for architecture name, using them..."
7292         . ./archname.cbu
7293 fi
7294
7295 : set the prefixit variable, to compute a suitable default value
7296 prefixit='case "$3" in
7297 ""|none)
7298         case "$oldprefix" in
7299         "") eval "$1=\"\$$2\"";;
7300         *)
7301                 case "$3" in
7302                 "") eval "$1=";;
7303                 none)
7304                         eval "tp=\"\$$2\"";
7305                         case "$tp" in
7306                         ""|" "|none) eval "$1=\"\$$2\"";;
7307                         *) eval "$1=";;
7308                         esac;;
7309                 esac;;
7310         esac;;
7311 *)
7312         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7313         case "$tp" in
7314         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7315         /*-$oldprefix/*|\~*-$oldprefix/*)
7316                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7317         *) eval "$1=\"\$$2\"";;
7318         esac;;
7319 esac'
7320
7321 : determine installation style
7322 : For now, try to deduce it from prefix unless it is already set.
7323 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7324 case "$installstyle" in
7325 '')     case "$prefix" in
7326                 *perl*) dflt='lib';;
7327                 *) dflt='lib/perl5' ;;
7328         esac
7329         ;;
7330 *)      dflt="$installstyle" ;;
7331 esac
7332 : Probably not worth prompting for this since we prompt for all
7333 : the directories individually, and the prompt would be too long and
7334 : confusing anyway.
7335 installstyle=$dflt
7336
7337 : determine where public executables go
7338 echo " "
7339 set dflt bin bin
7340 eval $prefixit
7341 fn=d~
7342 rp='Pathname where the public executables will reside?'
7343 . ./getfile
7344 if $test "X$ansexp" != "X$binexp"; then
7345         installbin=''
7346 fi
7347 prefixvar=bin
7348 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7349 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7350 :     this via initialinstalllocation
7351 . ./setprefixvar
7352
7353 case "$userelocatableinc" in
7354 $define|true|[yY]*)     dflt='y' ;;
7355 *)                      dflt='n' ;;
7356 esac
7357 cat <<EOM
7358
7359 Would you like to build Perl so that the installation is relocatable, so that
7360 library paths in @INC are determined relative to the path of the perl binary?
7361 This is not advised for system Perl installs, or if you need to run setid
7362 scripts or scripts under taint mode.
7363
7364 If this doesn't make any sense to you, just accept the default '$dflt'.
7365 EOM
7366 rp='Use relocatable @INC?'
7367 . ./myread
7368 case "$ans" in
7369 y|Y)    val="$define" ;;
7370 *)      val="$undef"  ;;
7371 esac
7372 set userelocatableinc
7373 eval $setvar
7374
7375 initialinstalllocation="$binexp"
7376 : Default prefix is now "up one level from where the binaries are"
7377 case "$userelocatableinc" in
7378 $define|true|[yY]*)
7379     bin=".../"
7380     binexp=".../"
7381     prefix=".../.."
7382     prefixexp=".../.."
7383     installprefixexp=".../.."
7384     ;;
7385 esac
7386
7387 : determine where private library files go
7388 : Usual default is /usr/local/lib/perl5/$version.
7389 : Also allow things like /opt/perl/lib/$version, since
7390 : /opt/perl/lib/perl5... would be redundant.
7391 : The default "style" setting is made in installstyle.U
7392 case "$installstyle" in
7393 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7394 *)       set dflt privlib lib/$version ;;
7395 esac
7396 eval $prefixit
7397 $cat <<EOM
7398
7399 There are some auxiliary files for $package that need to be put into a
7400 private library directory that is accessible by everyone.
7401
7402 EOM
7403 fn=$binexp
7404 fn=d~+
7405 rp='Pathname where the private library files will reside?'
7406 . ./getfile
7407 prefixvar=privlib
7408 . ./setprefixvar
7409
7410 : set the prefixup variable, to restore leading tilda escape
7411 prefixup='case "$prefixexp" in
7412 "$prefix") ;;
7413 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7414 esac'
7415
7416 : determine where public architecture dependent libraries go
7417 set archlib archlib
7418 eval $prefixit
7419 : privlib default is /usr/local/lib/$package/$version
7420 : archlib default is /usr/local/lib/$package/$version/$archname
7421 : privlib may have an optional trailing /share.
7422 tdflt=`echo $privlib | $sed 's,/share$,,'`
7423 tdflt=$tdflt/$archname
7424 case "$archlib" in
7425 '')     dflt=$tdflt
7426         ;;
7427 *)      dflt="$archlib"
7428     ;;
7429 esac
7430 $cat <<EOM
7431
7432 $spackage contains architecture-dependent library files.  If you are
7433 sharing libraries in a heterogeneous environment, you might store
7434 these files in a separate location.  Otherwise, you can just include
7435 them with the rest of the public library files.
7436
7437 EOM
7438 fn=$binexp
7439 fn=d+~
7440 rp='Where do you want to put the public architecture-dependent libraries?'
7441 . ./getfile
7442 prefixvar=archlib
7443 . ./setprefixvar
7444 if $test X"$archlib" = X"$privlib"; then
7445         d_archlib="$undef"
7446 else
7447         d_archlib="$define"
7448 fi
7449
7450 : see if setuid scripts can be secure
7451 $cat <<EOM
7452
7453 Some kernels have a bug that prevents setuid #! scripts from being
7454 secure.  Some sites have disabled setuid #! scripts because of this.
7455
7456 First let's decide if your kernel supports secure setuid #! scripts.
7457 (If setuid #! scripts would be secure but have been disabled anyway,
7458 don't say that they are secure if asked.)
7459
7460 EOM
7461
7462 val="$undef"
7463 if $test -d /dev/fd; then
7464         echo "#!$ls" >reflect
7465         chmod +x,u+s reflect
7466         ./reflect >flect 2>&1
7467         if $contains "/dev/fd" flect >/dev/null; then
7468                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7469                 val="$define"
7470         else
7471                 $cat <<EOM
7472 If you are not sure if they are secure, I can check but I'll need a
7473 username and password different from the one you are using right now.
7474 If you don't have such a username or don't want me to test, simply
7475 enter 'none'.
7476
7477 EOM
7478                 rp='Other username to test security of setuid scripts with?'
7479                 dflt='none'
7480                 . ./myread
7481                 case "$ans" in
7482                 n|none)
7483                         case "$d_suidsafe" in
7484                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7485                                 dflt=n;;
7486                         "$undef")
7487                                 echo "Well, the $hint value is *not* secure." >&4
7488                                 dflt=n;;
7489                         *)      echo "Well, the $hint value *is* secure." >&4
7490                                 dflt=y;;
7491                         esac
7492                         ;;
7493                 *)
7494                         $rm -f reflect flect
7495                         echo "#!$ls" >reflect
7496                         chmod +x,u+s reflect
7497                         echo >flect
7498                         chmod a+w flect
7499                         echo '"su" will (probably) prompt you for '"$ans's password."
7500                         su $ans -c './reflect >flect'
7501                         if $contains "/dev/fd" flect >/dev/null; then
7502                                 echo "Okay, it looks like setuid scripts are secure." >&4
7503                                 dflt=y
7504                         else
7505                                 echo "I don't think setuid scripts are secure." >&4
7506                                 dflt=n
7507                         fi
7508                         ;;
7509                 esac
7510                 rp='Does your kernel have *secure* setuid scripts?'
7511                 . ./myread
7512                 case "$ans" in
7513                 [yY]*)  val="$define";;
7514                 *)      val="$undef";;
7515                 esac
7516         fi
7517 else
7518         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7519         echo "(That's for file descriptors, not floppy disks.)"
7520         val="$undef"
7521 fi
7522 set d_suidsafe
7523 eval $setvar
7524
7525 $rm -f reflect flect
7526
7527 : now see if they want to do setuid emulation
7528 if $test $patchlevel -lt 11; then
7529 echo " "
7530 val="$undef"
7531 case "$d_suidsafe" in
7532 "$define")
7533         val="$undef"
7534         echo "No need to emulate SUID scripts since they are secure here." >&4
7535         ;;
7536 *)
7537         $cat <<EOM
7538 Some systems have disabled setuid scripts, especially systems where
7539 setuid scripts cannot be secure.  On systems where setuid scripts have
7540 been disabled, the setuid/setgid bits on scripts are currently
7541 useless.  It is possible for $package to detect those bits and emulate
7542 setuid/setgid in a secure fashion.  This emulation will only work if
7543 setuid scripts have been disabled in your kernel.
7544
7545 EOM
7546         case "$d_dosuid" in
7547         "$define") dflt=y ;;
7548         *) dflt=n ;;
7549         esac
7550         rp="Do you want to do setuid/setgid emulation?"
7551         . ./myread
7552         case "$ans" in
7553         [yY]*)  val="$define";;
7554         *)      val="$undef";;
7555         esac
7556         ;;
7557 esac
7558 set d_dosuid
7559 eval $setvar
7560 else
7561     case "$d_dosuid" in
7562         "$define")
7563         cat >&4 <<EOH
7564
7565 SUID emulation has been removed for 5.12
7566 Please re-run Configure without -Dd_dosuid
7567
7568 EOH
7569         exit 1;
7570         ;;
7571     esac
7572     d_dosuid=undef
7573 fi
7574
7575 : Find perl5.005 or later.
7576 echo "Looking for a previously installed perl5.005 or later... "
7577 case "$perl5" in
7578 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7579                 : Check if this perl is recent and can load a simple module
7580                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7581                         perl5=$tdir/perl
7582                         break;
7583                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7584                         perl5=$tdir/perl5
7585                         break;
7586                 fi
7587         done
7588         ;;
7589 *)      perl5="$perl5"
7590         ;;
7591 esac
7592 case "$perl5" in
7593 '')     echo "None found.  That's ok.";;
7594 *)      echo "Using $perl5." ;;
7595 esac
7596
7597 : Set the siteprefix variables
7598 $cat <<EOM
7599
7600 After $package is installed, you may wish to install various
7601 add-on modules and utilities.  Typically, these add-ons will
7602 be installed under $prefix with the rest
7603 of this package.  However, you may wish to install such add-ons
7604 elsewhere under a different prefix.
7605
7606 If you do not wish to put everything under a single prefix, that's
7607 ok.  You will be prompted for the individual locations; this siteprefix
7608 is only used to suggest the defaults.
7609
7610 The default should be fine for most people.
7611
7612 EOM
7613 fn=d~+
7614 rp='Installation prefix to use for add-on modules and utilities?'
7615 : XXX Here might be another good place for an installstyle setting.
7616 case "$siteprefix" in
7617 '') dflt=$prefix ;;
7618 *)  dflt=$siteprefix ;;
7619 esac
7620 . ./getfile
7621 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7622 oldsiteprefix=''
7623 case "$siteprefix" in
7624 '') ;;
7625 *)      case "$ans" in
7626         "$prefix") ;;
7627         *) oldsiteprefix="$prefix";;
7628         esac
7629         ;;
7630 esac
7631 siteprefix="$ans"
7632 siteprefixexp="$ansexp"
7633
7634 : determine where site specific libraries go.
7635 : Usual default is /usr/local/lib/perl5/site_perl/$version
7636 : The default "style" setting is made in installstyle.U
7637 : XXX No longer works with Prefixit stuff.
7638 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7639 case "$sitelib" in
7640 '') case "$installstyle" in
7641         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7642         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7643         esac
7644         ;;
7645 *)      dflt="$sitelib"
7646         ;;
7647 esac
7648 $cat <<EOM
7649
7650 The installation process will create a directory for
7651 site-specific extensions and modules.  Most users find it convenient
7652 to place all site-specific files in this directory rather than in the
7653 main distribution directory.
7654
7655 EOM
7656 fn=d~+
7657 rp='Pathname for the site-specific library files?'
7658 . ./getfile
7659 prefixvar=sitelib
7660 . ./setprefixvar
7661 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7662
7663 : Determine list of previous versions to include in @INC
7664 $cat > getverlist <<EOPL
7665 #!$perl5
7666 use strict;
7667 use warnings;
7668 use File::Basename;
7669 my \$api_versionstring = "$api_versionstring";
7670 my \$version = "$version";
7671 my \$stem = "$sitelib_stem";
7672 my \$archname = "$archname";
7673 EOPL
7674         $cat >> getverlist <<'EOPL'
7675 # The list found is stored twice for each entry: the original name, and
7676 # the binary broken down version into pack "s>s>s>", so sorting is easy
7677 # and unambiguous.  This will work for all versions that have a maximum
7678 # of three digit per group separate by '.'s or '_'s. Names are extended
7679 # with ".0.0" to ensure at least three elements for the pack.
7680 #                                   -- H.Merijn Brand (m)'06 23-10-2006
7681
7682 my @inc_version_list;
7683 my @candidates;
7684 # XXX Redo to do opendir/readdir?
7685 if (-d $stem) {
7686     chdir($stem);
7687     ;@candidates = map {
7688         [ $_, pack "s>s>s>", split m/[._]/, "$_.0.0" ] } glob("5.*");
7689     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7690 }
7691 else {
7692     ;@candidates = ();
7693 }
7694
7695 my ($pversion, $aversion, $vsn5005) = map {
7696     pack "s>s>s>", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7697 foreach my $d (@candidates) {
7698     if ($d->[1] lt $pversion) {
7699         if ($d->[1] ge $aversion) {
7700             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7701         }
7702         elsif ($d->[1] ge $vsn5005) {
7703             unshift(@inc_version_list, grep { -d } $d->[0]);
7704         }
7705     }
7706     else {
7707         # Skip newer version.  I.e. don't look in
7708         # 5.7.0 if we're installing 5.6.1.
7709     }
7710 }
7711
7712 if (@inc_version_list) {
7713     print join(' ', @inc_version_list);
7714 }
7715 else {
7716     # Blank space to preserve value for next Configure run.
7717     print " ";
7718 }
7719 EOPL
7720 chmod +x getverlist
7721 case "$inc_version_list" in
7722 '')     if test -x "$perl5$exe_ext"; then
7723                 dflt=`$perl5 getverlist`
7724         else
7725                 dflt='none'
7726         fi
7727         ;;
7728 $undef) dflt='none' ;;
7729 *)  eval dflt=\"$inc_version_list\" ;;
7730 esac
7731 case "$dflt" in
7732 ''|' ') dflt=none ;;
7733 esac
7734 case "$dflt" in
7735 5.005) dflt=none ;;
7736 esac
7737 $cat <<EOM
7738
7739 In order to ease the process of upgrading, this version of perl
7740 can be configured to use modules built and installed with earlier
7741 versions of perl that were installed under $prefix.  Specify here
7742 the list of earlier versions that this version of perl should check.
7743 If Configure detected no earlier versions of perl installed under
7744 $prefix, then the list will be empty.  Answer 'none' to tell perl
7745 to not search earlier versions.
7746
7747 The default should almost always be sensible, so if you're not sure,
7748 just accept the default.
7749 EOM
7750
7751 rp='List of earlier versions to include in @INC?'
7752 . ./myread
7753 case "$ans" in
7754 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7755 *) inc_version_list="$ans" ;;
7756 esac
7757 case "$inc_version_list" in
7758 ''|' ')
7759         inc_version_list_init='0'
7760         d_inc_version_list="$undef"
7761         ;;
7762 *)      inc_version_list_init=`echo $inc_version_list |
7763                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7764         d_inc_version_list="$define"
7765         ;;
7766 esac
7767 $rm -f getverlist
7768
7769 : see if malloc/malloc.h has to be included
7770 set malloc/malloc.h i_mallocmalloc
7771 eval $inhdr
7772
7773 : see if this is a malloc.h system
7774 : we want a real compile instead of Inhdr because some systems have a
7775 : malloc.h that just gives a compile error saying to use stdlib.h instead
7776 echo " "
7777 $cat >try.c <<EOCP
7778 #include <stdlib.h>
7779 #include <malloc.h>
7780 #$i_mallocmalloc I_MALLOCMALLOC
7781 #ifdef I_MALLOCMALLOC
7782 # include <malloc/malloc.h>
7783 #endif
7784
7785 int main () { return 0; }
7786 EOCP
7787 set try
7788 if eval $compile; then
7789     echo "<malloc.h> found." >&4
7790     val="$define"
7791 else
7792     echo "<malloc.h> NOT found." >&4
7793     val="$undef"
7794 fi
7795 $rm_try
7796 set i_malloc
7797 eval $setvar
7798
7799 : check for length of pointer
7800 echo " "
7801 case "$ptrsize" in
7802 '')
7803         echo "Checking to see how big your pointers are..." >&4
7804         $cat >try.c <<EOCP
7805 #include <stdio.h>
7806 #$i_stdlib I_STDLIB
7807 #ifdef I_STDLIB
7808 #include <stdlib.h>
7809 #endif
7810 int main()
7811 {
7812     printf("%d\n", (int)sizeof(void *));
7813     exit(0);
7814 }
7815 EOCP
7816         set try
7817         if eval $compile_ok; then
7818                 ptrsize=`$run ./try`
7819                 echo "Your pointers are $ptrsize bytes long."
7820         else
7821                 dflt='4'
7822                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7823                 rp="What is the size of a pointer (in bytes)?"
7824                 . ./myread
7825                 ptrsize="$ans"
7826         fi
7827         ;;
7828 esac
7829 $rm_try
7830 case "$use64bitall" in
7831 "$define"|true|[yY]*)
7832         case "$ptrsize" in
7833         4)      cat <<EOM >&4
7834
7835 *** You have chosen a maximally 64-bit build,
7836 *** but your pointers are only 4 bytes wide.
7837 *** Please rerun Configure without -Duse64bitall.
7838 EOM
7839                 case "$d_quad" in
7840                 define)
7841                         cat <<EOM >&4
7842 *** Since you have quads, you could possibly try with -Duse64bitint.
7843 EOM
7844                         ;;
7845                 esac
7846                 cat <<EOM >&4
7847 *** Cannot continue, aborting.
7848
7849 EOM
7850
7851                 exit 1
7852                 ;;
7853         esac
7854         ;;
7855 esac
7856
7857 : determine whether to use malloc wrapping
7858 echo " "
7859 case "$usemallocwrap" in
7860 [yY]*|true|$define)     dflt='y' ;;
7861 [nN]*|false|$undef)     dflt='n' ;;
7862 *)      case "$usedevel" in
7863         [yY]*|true|$define)     dflt='y' ;;
7864         *) dflt='n' ;;
7865         esac
7866         ;;
7867 esac
7868 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7869 . ./myread
7870 usemallocwrap="$ans"
7871 case "$ans" in
7872 y*|true)
7873         usemallocwrap="$define" ;;
7874 *)
7875         usemallocwrap="$undef" ;;
7876 esac
7877
7878 : determine which malloc to compile in
7879 echo " "
7880 case "$usemymalloc" in
7881 [yY]*|true|$define)     dflt='y' ;;
7882 [nN]*|false|$undef)     dflt='n' ;;
7883 *)      case "$ptrsize" in
7884         4) dflt='y' ;;
7885         *) dflt='n' ;;
7886         esac
7887         if test "$useithreads" = "$define"; then dflt='n'; fi
7888         ;;
7889 esac
7890 rp="Do you wish to attempt to use the malloc that comes with $package?"
7891 . ./myread
7892 usemymalloc="$ans"
7893 case "$ans" in
7894 y*|true)
7895         usemymalloc='y'
7896         mallocsrc='malloc.c'
7897         mallocobj="malloc$_o"
7898         d_mymalloc="$define"
7899         case "$libs" in
7900         *-lmalloc*)
7901                 : Remove malloc from list of libraries to use
7902                 echo "Removing unneeded -lmalloc from library list" >&4
7903                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7904                 shift
7905                 libs="$*"
7906                 echo "libs = $libs" >&4
7907                 ;;
7908         esac
7909         ;;
7910 *)
7911         usemymalloc='n'
7912         mallocsrc=''
7913         mallocobj=''
7914         d_mymalloc="$undef"
7915         ;;
7916 esac
7917
7918 : compute the return types of malloc and free
7919 echo " "
7920 case "$malloctype" in
7921 '')
7922         malloctype='void *'
7923         ;;
7924 esac
7925 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7926
7927 case "$freetype" in
7928 '')
7929         freetype='void'
7930         ;;
7931 esac
7932 echo "Your system uses $freetype free(), it would seem." >&4
7933
7934 : determine where site specific architecture-dependent libraries go.
7935 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7936 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7937 : sitelib may have an optional trailing /share.
7938 case "$sitearch" in
7939 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7940         dflt="$dflt/$archname"
7941         ;;
7942 *)      dflt="$sitearch"
7943         ;;
7944 esac
7945 set sitearch sitearch none
7946 eval $prefixit
7947 $cat <<EOM
7948
7949 The installation process will also create a directory for
7950 architecture-dependent site-specific extensions and modules.
7951
7952 EOM
7953 fn=d~+
7954 rp='Pathname for the site-specific architecture-dependent library files?'
7955 . ./getfile
7956 prefixvar=sitearch
7957 . ./setprefixvar
7958 if $test X"$sitearch" = X"$sitelib"; then
7959         d_sitearch="$undef"
7960 else
7961         d_sitearch="$define"
7962 fi
7963
7964 : Set the vendorprefix variables
7965 $cat <<EOM
7966
7967 The installation process will also create a directory for
7968 vendor-supplied add-ons.  Vendors who supply perl with their system
7969 may find it convenient to place all vendor-supplied files in this
7970 directory rather than in the main distribution directory.  This will
7971 ease upgrades between binary-compatible maintenance versions of perl.
7972
7973 Of course you may also use these directories in whatever way you see
7974 fit.  For example, you might use them to access modules shared over a
7975 company-wide network.
7976
7977 The default answer should be fine for most people.
7978 This causes further questions about vendor add-ons to be skipped
7979 and no vendor-specific directories will be configured for perl.
7980
7981 EOM
7982 rp='Do you want to configure vendor-specific add-on directories?'
7983 case "$usevendorprefix" in
7984 define|true|[yY]*) dflt=y ;;
7985 *)      : User may have set vendorprefix directly on Configure command line.
7986         case "$vendorprefix" in
7987         ''|' ') dflt=n ;;
7988         *)      dflt=y ;;
7989         esac
7990         ;;
7991 esac
7992 . ./myread
7993 case "$ans" in
7994 [yY]*)  fn=d~+
7995         rp='Installation prefix to use for vendor-supplied add-ons?'
7996         case "$vendorprefix" in
7997         '') dflt="$prefix" ;;
7998         *)  dflt=$vendorprefix ;;
7999         esac
8000         . ./getfile
8001         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
8002         oldvendorprefix=''
8003         case "$vendorprefix" in
8004         '') ;;
8005         *)      case "$ans" in
8006                 "$prefix") ;;
8007                 *) oldvendorprefix="$prefix";;
8008                 esac
8009                 ;;
8010         esac
8011         usevendorprefix="$define"
8012         vendorprefix="$ans"
8013         vendorprefixexp="$ansexp"
8014         ;;
8015 *)      usevendorprefix="$undef"
8016         vendorprefix=''
8017         vendorprefixexp=''
8018         ;;
8019 esac
8020
8021 : Set the vendorlib variables
8022 case "$vendorprefix" in
8023 '')     d_vendorlib="$undef"
8024         vendorlib=''
8025         vendorlibexp=''
8026         ;;
8027 *)      d_vendorlib="$define"
8028         : determine where vendor-supplied modules go.
8029         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8030         case "$vendorlib" in
8031         '')
8032                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8033                 case "$installstyle" in
8034                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8035                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8036                 esac
8037                 ;;
8038         *)      dflt="$vendorlib"
8039                 ;;
8040         esac
8041         fn=d~+
8042         rp='Pathname for the vendor-supplied library files?'
8043         . ./getfile
8044         vendorlib="$ans"
8045         vendorlibexp="$ansexp"
8046         ;;
8047 esac
8048 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8049 prefixvar=vendorlib
8050 . ./installprefix
8051
8052 : Set the vendorarch variables
8053 case "$vendorprefix" in
8054 '')     d_vendorarch="$undef"
8055         vendorarch=''
8056         vendorarchexp=''
8057         ;;
8058 *)      d_vendorarch="$define"
8059         : determine where vendor-supplied architecture-dependent libraries go.
8060         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8061         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8062         : vendorlib may have an optional trailing /share.
8063         case "$vendorarch" in
8064         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8065                 dflt="$dflt/$archname"
8066                 ;;
8067         *)      dflt="$vendorarch" ;;
8068         esac
8069         fn=d~+
8070         rp='Pathname for vendor-supplied architecture-dependent files?'
8071         . ./getfile
8072         vendorarch="$ans"
8073         vendorarchexp="$ansexp"
8074         ;;
8075 esac
8076 prefixvar=vendorarch
8077 . ./installprefix
8078 if $test X"$vendorarch" = X"$vendorlib"; then
8079         d_vendorarch="$undef"
8080 else
8081         d_vendorarch="$define"
8082 fi
8083
8084 : Final catch-all directories to search
8085 $cat <<EOM
8086
8087 Lastly, you can have perl look in other directories for extensions and
8088 modules in addition to those already specified.
8089 These directories will be searched after
8090         $sitearch
8091         $sitelib
8092 EOM
8093 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8094 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8095 echo ' '
8096 case "$otherlibdirs" in
8097 ''|' ') dflt='none' ;;
8098 *)      dflt="$otherlibdirs" ;;
8099 esac
8100 $cat <<EOM
8101 Enter a colon-separated set of extra paths to include in perl's @INC
8102 search path, or enter 'none' for no extra paths.
8103
8104 EOM
8105
8106 rp='Colon-separated list of additional directories for perl to search?'
8107 . ./myread
8108 case "$ans" in
8109 ' '|''|none)    otherlibdirs=' ' ;;
8110 *)      otherlibdirs="$ans" ;;
8111 esac
8112 case "$otherlibdirs" in
8113 ' ') val=$undef ;;
8114 *)      val=$define ;;
8115 esac
8116 set d_perl_otherlibdirs
8117 eval $setvar
8118
8119 : DTrace support
8120 dflt_dtrace='/usr/sbin/dtrace'
8121 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8122
8123 cat <<EOM
8124
8125 Perl can be built to support DTrace on platforms that support it.
8126 DTrace is a diagnosis and performance analysis tool from Sun.
8127
8128 If this doesn't make any sense to you, just accept the default.
8129 EOM
8130
8131 while $test 1 ; do
8132         case "$usedtrace" in
8133         $define|true|[yY]*)
8134                 dflt='y'
8135                 ;;
8136         $undef|false|[nN]*)
8137                 dflt='n'
8138                 dflt_dtrace=""
8139                 ;;
8140         ?*)
8141                 dflt='y'
8142                 dflt_dtrace=$usedtrace
8143                 ;;
8144         *)
8145                 dflt='n'
8146                 ;;
8147         esac
8148
8149         rp='Support DTrace if available?'
8150         . ./myread
8151         case "$ans" in
8152         y|Y)    val="$define" ;;
8153         *)      val="$undef" ;;
8154         esac
8155         set usedtrace
8156         eval $setvar
8157
8158         test "X$usedtrace" != "X$define" && break
8159
8160         echo " "
8161         rp='Where is the dtrace executable?'
8162         dflt=$dflt_dtrace
8163         . ./getfile
8164         val="$ans"
8165         set dtrace
8166         eval $setvar
8167
8168         if $test -f $dtrace
8169         then
8170                 if $dtrace -h -s ../perldtrace.d \
8171                         -o perldtrace.tmp >/dev/null 2>&1 \
8172                         && rm -f perldtrace.tmp
8173                 then
8174                         echo " "
8175                         echo "Good: your $dtrace knows about the -h flag."
8176                 else
8177                         cat >&2 <<EOM
8178
8179 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8180 ***
8181 *** Your installed dtrace doesn't support the -h switch to compile a D
8182 *** program into a C header. Can't continue.
8183
8184 EOM
8185                         exit 1
8186                 fi
8187                 break;
8188         fi
8189
8190         case "$fastread" in
8191         yes)
8192                 cat >&2 <<EOM
8193
8194 *** $me:  Fatal Error:  $dtrace not found.
8195 *** Can't continue.
8196
8197 EOM
8198                 exit 1
8199                 ;;
8200         *)
8201                 echo "*** $dtrace was not found."
8202                 echo " "
8203                 ;;
8204         esac
8205 done
8206
8207 : See if we want extra modules installed
8208 echo " "
8209 case "$extras" in
8210 '') dflt='n';;
8211 *) dflt='y';;
8212 esac
8213 cat <<EOM
8214 Perl can be built with extra modules or bundles of modules which
8215 will be fetched from the CPAN and installed alongside Perl.
8216
8217 Notice that you will need access to the CPAN; either via the Internet,
8218 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8219 be asked later to configure the CPAN.pm module which will in turn do
8220 the installation of the rest of the extra modules or bundles.)
8221
8222 Notice also that if the modules require any external software such as
8223 libraries and headers (the libz library and the zlib.h header for the
8224 Compress::Zlib module, for example) you MUST have any such software
8225 already installed, this configuration process will NOT install such
8226 things for you.
8227
8228 If this doesn't make any sense to you, just accept the default '$dflt'.
8229 EOM
8230 rp='Install any extra modules (y or n)?'
8231 . ./myread
8232 case "$ans" in
8233 y|Y)
8234         cat <<EOM
8235
8236 Please list any extra modules or bundles to be installed from CPAN,
8237 with spaces between the names.  The names can be in any format the
8238 'install' command of CPAN.pm will understand.  (Answer 'none',
8239 without the quotes, to install no extra modules or bundles.)
8240 EOM
8241         rp='Extras?'
8242         dflt="$extras"
8243         . ./myread
8244         extras="$ans"
8245 esac
8246 case "$extras" in
8247 ''|'none')
8248         val=''
8249         $rm -f ../extras.lst
8250         ;;
8251 *)      echo "(Saving the list of extras for later...)"
8252         echo "$extras" > ../extras.lst
8253         val="'$extras'"
8254         ;;
8255 esac
8256 set extras
8257 eval $setvar
8258 echo " "
8259
8260 : determine where html pages for programs go
8261 set html1dir html1dir none
8262 eval $prefixit
8263 $cat <<EOM
8264
8265 If you wish to install html files for programs in $spackage, indicate
8266 the appropriate directory here.  To skip installing html files,
8267 answer "none".
8268 EOM
8269 case "$html1dir" in
8270 ''|none|$undef|' ') dflt=none ;;
8271 *) dflt=$html1dir ;;
8272 esac
8273 fn=dn+~
8274 rp="Directory for the main $spackage html pages?"
8275 . ./getfile
8276 prefixvar=html1dir
8277 . ./setprefixvar
8278 : Use ' ' for none so value is preserved next time through Configure
8279 $test X"$html1dir" = "X" && html1dir=' '
8280
8281 : determine where html pages for libraries and modules go
8282 set html3dir html3dir none
8283 eval $prefixit
8284 $cat <<EOM
8285
8286 If you wish to install html files for modules associated with $spackage,
8287 indicate the appropriate directory here.  To skip installing html files,
8288 answer "none".
8289 EOM
8290 : There is no obvious default.  If they have specified html1dir, then
8291 : try to key off that, possibly changing .../html1 into .../html3.
8292 case "$html3dir" in
8293 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8294 *) dflt=$html3dir ;;
8295 esac
8296 fn=dn+~
8297 rp="Directory for the $spackage module html pages?"
8298 . ./getfile
8299 prefixvar=html3dir
8300 . ./setprefixvar
8301 : Use ' ' for none so value is preserved next time through Configure
8302 $test X"$html3dir" = "X" && html3dir=' '
8303
8304 : determine whether to install perl also as /usr/bin/perl
8305
8306 echo " "
8307 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8308         $cat <<EOM
8309 Many scripts expect perl to be installed as /usr/bin/perl.
8310
8311 If you want to, I can install the perl you are about to compile
8312 as /usr/bin/perl (in addition to $bin/perl).
8313 EOM
8314         if test -f /usr/bin/perl; then
8315             $cat <<EOM
8316
8317 However, please note that because you already have a /usr/bin/perl,
8318 overwriting that with a new Perl would very probably cause problems.
8319 Therefore I'm assuming you don't want to do that (unless you insist).
8320
8321 EOM
8322             case "$installusrbinperl" in
8323             "$define"|[yY]*)    dflt='y';;
8324             *)                  dflt='n';;
8325             esac
8326         else
8327             $cat <<EOM
8328
8329 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8330
8331 EOM
8332             case "$installusrbinperl" in
8333             "$undef"|[nN]*)     dflt='n';;
8334             *)                  dflt='y';;
8335             esac
8336         fi
8337         rp="Do you want to install perl as /usr/bin/perl?"
8338         . ./myread
8339         case "$ans" in
8340         [yY]*)  val="$define";;
8341         *)      val="$undef" ;;
8342         esac
8343 else
8344         val="$undef"
8345 fi
8346 set installusrbinperl
8347 eval $setvar
8348
8349 : see if dlopen exists
8350 xxx_runnm="$runnm"
8351 xxx_ccflags="$ccflags"
8352 runnm=false
8353 : with g++ one needs -shared to get is-in-libc to work for dlopen
8354 case "$gccversion" in
8355 '')     ;;
8356 *Clang*)        ;;
8357 *)      case "$d_cplusplus" in
8358         "$define") ccflags="$ccflags -shared" ;;
8359         esac
8360         ;;
8361 esac
8362 set dlopen d_dlopen
8363 eval $inlibc
8364 runnm="$xxx_runnm"
8365 ccflags="$xxx_ccflags"
8366
8367 : see if this is a unistd.h system
8368 set unistd.h i_unistd
8369 eval $inhdr
8370
8371 : determine which dynamic loading, if any, to compile in
8372 echo " "
8373 dldir="ext/DynaLoader"
8374 case "$usedl" in
8375     $define|y|true)
8376         dflt='y'
8377         usedl="$define"
8378         ;;
8379     $undef|n|false)
8380         dflt='n'
8381         usedl="$undef"
8382         ;;
8383     *)
8384         dflt='n'
8385         case "$d_dlopen" in
8386             $define) dflt='y' ;;
8387         esac
8388         : Does a dl_xxx.xs file exist for this operating system
8389         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8390         ;;
8391 esac
8392 rp="Do you wish to use dynamic loading?"
8393 . ./myread
8394 usedl="$ans"
8395 bin_ELF="$undef"
8396 case "$ans" in
8397     y*) usedl="$define"
8398         case "$dlsrc" in
8399             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8400                     dflt="$dldir/dl_${osname}.xs"
8401                 elif $test "$d_dlopen" = "$define" ; then
8402                     dflt="$dldir/dl_dlopen.xs"
8403                 else
8404                     dflt=''
8405                 fi
8406                 ;;
8407             *)  dflt="$dldir/$dlsrc"
8408                 ;;
8409         esac
8410         echo "The following dynamic loading files are available:"
8411         : Can not go over to $dldir because getfile has path hard-coded in.
8412         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8413         rp="Source file to use for dynamic loading"
8414         fn="fne"
8415         gfpth="$src"
8416         . ./getfile
8417         usedl="$define"
8418         : emulate basename
8419         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8420
8421         $cat << EOM
8422
8423 Some systems may require passing special flags to $cc -c to
8424 compile modules that will be used to create a shared library.
8425 To use no flags, say "none".
8426
8427 EOM
8428         case "$cccdlflags" in
8429             '') case "$gccversion" in
8430                 '') case "$osname" in
8431                         hpux)   dflt='+z' ;;
8432                         irix*)  dflt='-KPIC' ;;
8433                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8434                         sunos)  dflt='-pic' ;;
8435                         *)      dflt='none' ;;
8436                     esac
8437                     ;;
8438                 *)  case "$osname" in
8439                         darwin) dflt='none' ;;
8440                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8441                         *)      dflt='-fpic' ;;
8442                     esac ;;
8443                 esac ;;
8444             ' ') dflt='none' ;;
8445             *)   dflt="$cccdlflags" ;;
8446         esac
8447
8448         case "$dflt" in
8449             none) dflt='' ;;
8450         esac
8451
8452         # If -Dsysroot was specified, now's the time to add it
8453         # to cccdlflags
8454         if test "X$sysroot" != X; then
8455             case "$gccversion" in
8456                 '') ;;
8457                 *)  case "$dflt" in
8458                         *sysroot*) ;;
8459                         'undef'|*)
8460                             dflt="$dflt --sysroot=$sysroot" ;;
8461                     esac
8462                     ;;
8463             esac
8464         fi
8465
8466         case "$dflt" in
8467             '') dflt='none';;
8468         esac
8469
8470         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8471         . ./myread
8472         case "$ans" in
8473             none) cccdlflags=' ' ;;
8474             *)    cccdlflags="$ans" ;;
8475         esac
8476
8477         cat << EOM
8478
8479 Some systems use ld to create libraries that can be dynamically loaded,
8480 while other systems (such as those using ELF) use $cc.
8481
8482 EOM
8483
8484 : Determine if this is ELF
8485         $cat >try.c <<EOM
8486 /* Test for whether ELF binaries are produced */
8487 #include <fcntl.h>
8488 #$i_stdlib I_STDLIB
8489 #ifdef I_STDLIB
8490 #include <stdlib.h>
8491 #endif
8492 #$i_unistd I_UNISTD
8493 #ifdef I_UNISTD
8494 #include <unistd.h>
8495 #endif
8496 int main() {
8497     char b[4];
8498     int i = open("a.out",O_RDONLY);
8499     if(i == -1)
8500         exit(1); /* fail */
8501     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8502         exit(0); /* succeed (yes, it is ELF) */
8503     exit(1); /* fail */
8504 }
8505 EOM
8506         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8507             bin_ELF="$define"
8508         fi
8509         $rm_try
8510
8511         case "$ld" in
8512             '') if $test $bin_ELF = "$define"; then
8513                     cat <<EOM
8514 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8515 EOM
8516                     dflt="$cc"
8517                 else
8518                     echo "I'll use ld to build dynamic libraries."
8519                     dflt='ld'
8520                 fi
8521                 ;;
8522             *)  dflt="$ld"
8523                 ;;
8524         esac
8525
8526         rp="What command should be used to create dynamic libraries?"
8527         . ./myread
8528         ld="$ans"
8529
8530         cat << EOM
8531
8532 Some systems may require passing special flags to $ld to create a
8533 library that can be dynamically loaded.  If your ld flags include
8534 -L/other/path options to locate libraries outside your loader's normal
8535 search path, you may need to specify those -L options here as well.  To
8536 use no flags, say "none".
8537
8538 EOM
8539         case "$lddlflags" in
8540             '') case "$osname" in
8541                     haiku) dflt='-shared' ;;
8542                     hpux) dflt='-b';
8543                           case "$gccversion" in
8544                               '') dflt="$dflt +vnocompatwarnings" ;;
8545                           esac
8546                           ;;
8547                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8548                     solaris) # See [perl #66604].
8549                             # On Solaris 11, gcc -m64 on amd64
8550                             # appears not to understand -G.  gcc versions at
8551                             # least as old as 3.4.3 support -shared, so just
8552                             # use that with Solaris 11 and later, but keep
8553                             # the old behavior for older Solaris versions.
8554                             case "$gccversion" in
8555                                 '') dflt='-G' ;;
8556                                 *)  case "$osvers" in
8557                                         2.?|2.10) dflt='-G' ;;
8558                                         *) dflt='-shared' ;;
8559                                     esac
8560                                     ;;
8561                             esac
8562                             ;;
8563                     sunos) dflt='-assert nodefinitions' ;;
8564                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8565                     *)     dflt='none' ;;
8566                 esac
8567                 ;;
8568             *) dflt="$lddlflags" ;;
8569         esac
8570
8571         : Only do this for gcc, since, for example, qcc has no concept
8572         : of --sysroot.
8573         if $test "X$sysroot" != X; then
8574             case "$gccversion" in
8575                 '') ;;
8576                 *)  dflt="$dflt --sysroot=$sysroot" ;;
8577             esac
8578         fi
8579
8580         : Try to guess additional flags to pick up local libraries.
8581         : Be careful not to append to a plain 'none'
8582         case "$dflt" in
8583             none) dflt='' ;;
8584         esac
8585         for thisflag in $ldflags; do
8586             case "$thisflag" in
8587                 -L*|-R*|-Wl,-R*)
8588                     case " $dflt " in
8589                         *" $thisflag "*) ;;
8590                         *) dflt="$dflt $thisflag" ;;
8591                     esac
8592                     ;;
8593             esac
8594         done
8595
8596         case "$dflt" in
8597             ''|' ') dflt='none' ;;
8598         esac
8599
8600         case "$ldflags" in
8601             *-fstack-protector-strong*)
8602                 case "$dflt" in
8603                     *-fstack-protector-strong*) ;; # Don't add it again
8604                     *) dflt="$dflt -fstack-protector-strong" ;;
8605                 esac
8606                 ;;
8607             *-fstack-protector*)
8608                 case "$dflt" in
8609                     *-fstack-protector*) ;; # Don't add it again
8610                     *) dflt="$dflt -fstack-protector" ;;
8611                 esac
8612                 ;;
8613         esac
8614
8615         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8616         . ./myread
8617         case "$ans" in
8618             none) lddlflags=' ' ;;
8619             *) lddlflags="$ans" ;;
8620         esac
8621
8622         cat <<EOM
8623
8624 Some systems may require passing special flags to $cc to indicate that
8625 the resulting executable will use dynamic linking.  To use no flags,
8626 say "none".
8627
8628 EOM
8629         case "$ccdlflags" in
8630             '') case "$osname" in
8631                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8632                     sunos)             dflt='none'   ;;
8633                     *)                 dflt='none'   ;;
8634                 esac ;;
8635             ' ') dflt='none' ;;
8636             *)   dflt="$ccdlflags" ;;
8637         esac
8638         rp="Any special flags to pass to $cc to use dynamic linking?"
8639         . ./myread
8640         case "$ans" in
8641             none) ccdlflags=' ' ;;
8642             *)    ccdlflags="$ans" ;;
8643         esac
8644         ;;
8645
8646     *)  usedl="$undef"
8647         ld='ld'
8648         dlsrc='dl_none.xs'
8649         lddlflags=''
8650         ccdlflags=''
8651         ;;
8652 esac
8653
8654 ld_can_script="$undef"
8655 case "$bin_ELF$usedl" in
8656     $define$define)
8657         # Abuse try.h and a.out names for neat cleanup
8658         $cat >try.c <<EOM
8659 void foo() {}
8660 void bar() {}
8661 EOM
8662         $cat >try.h <<EOM
8663 LIBTEST_42 {
8664  global:
8665   foo;
8666  local: *;
8667  };
8668 EOM
8669         if $cc $cccdlflags $ccdlflags $ccflags \
8670                $ldflags $lddlflags -o a.out try.c \
8671                -Wl,--version-script=try.h >/dev/null 2>&1 \
8672            &&  $test -s a.out ; then
8673             echo "ld supports scripting" >&4
8674             ld_can_script="$define"
8675         else
8676             echo "ld does not support scripting" >&4
8677         fi
8678         $rm_try
8679         ;;
8680 esac
8681
8682 : Do we want a shared libperl?
8683 also=''
8684 case "$usedl" in
8685 $undef)
8686         # No dynamic loading being used, so don't bother even to prompt.
8687         useshrplib='false'
8688         ;;
8689 *)      case "$useshrplib" in
8690         '')     case "$osname" in
8691                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8692                         dflt=y
8693                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8694                         ;;
8695                 *)      dflt=n
8696                         ;;
8697                 esac
8698                 ;;
8699         $define|true|[Yy]*)
8700                 dflt=y
8701                 ;;
8702         *)      dflt=n
8703                 ;;
8704         esac
8705         $cat << EOM
8706
8707 The perl executable is normally obtained by linking perlmain.c with
8708 libperl${_a}, any static extensions (usually just DynaLoader), and
8709 any other libraries needed on this system (such as -lm, etc.).  Since
8710 your system supports dynamic loading, it is probably possible to build
8711 a shared libperl.$so.  If you will have more than one executable linked
8712 to libperl.$so, this will significantly reduce the size of each
8713 executable, but it may have a noticeable effect on performance.  The
8714 default is probably sensible for your system.
8715 $also
8716
8717 EOM
8718         rp="Build a shared libperl.$so (y/n)"
8719         . ./myread
8720         case "$ans" in
8721         true|$define|[Yy]*)
8722                 useshrplib='true'  ;;
8723         *)      useshrplib='false' ;;
8724         esac
8725         ;;
8726 esac
8727
8728 case "$useshrplib" in
8729 true)
8730         case "$userelocatableinc" in
8731         true|define)
8732                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8733                 echo "See INSTALL for an explanation why that won't work." >&4
8734                 exit 4
8735                 ;;
8736         esac
8737         case "$libperl" in
8738         '')
8739                 # Figure out a good name for libperl.so.  Since it gets stored in
8740                 # a version-specific architecture-dependent library, the version
8741                 # number isn't really that important, except for making cc/ld happy.
8742                 #
8743                 # A name such as libperl.so.10.1
8744                 majmin="libperl.$so.$patchlevel.$subversion"
8745                 # A name such as libperl.so.100
8746                 majonly=`echo $patchlevel $subversion |
8747                         $awk '{printf "%d%02d", $1, $2}'`
8748                 majonly=libperl.$so.$majonly
8749                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8750                 # rely on figuring it out from the naming of libc.
8751                 case "${osname}${osvers}" in
8752                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8753                         dflt=libperl.$so
8754                         ;;
8755                 cygwin*) # ld links now against the dll directly
8756                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8757                         majonly=`echo $patchlevel $subversion |
8758                                 $awk '{printf "%03d%03d", $1, $2}'`
8759                         majonly=cygperl5.$majonly.$so
8760                         dflt=$majmin
8761                         ;;
8762                 *)      # Try to guess based on whether libc has major.minor.
8763                         case "$libc" in
8764                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8765                         *libc.$so.[0-9]*) dflt=$majonly ;;
8766                         *)      dflt=libperl.$so ;;
8767                         esac
8768                         ;;
8769                 esac
8770                 ;;
8771         *)      dflt=$libperl
8772                 ;;
8773         esac
8774         cat << EOM
8775
8776 I need to select a good name for the shared libperl.  If your system uses
8777 library names with major and minor numbers, then you might want something
8778 like $majmin.  Alternatively, if your system uses a single version
8779 number for shared libraries, then you might want to use $majonly.
8780 Or, your system might be quite happy with a simple libperl.$so.
8781
8782 Since the shared libperl will get installed into a version-specific
8783 architecture-dependent directory, the version number of the shared perl
8784 library probably isn't important, so the default should be o.k.
8785
8786 EOM
8787         rp='What name do you want to give to the shared libperl?'
8788         . ./myread
8789         libperl=$ans
8790         echo "Ok, I'll use $libperl"
8791         ;;
8792 *)
8793         libperl="libperl${_a}"
8794         ;;
8795 esac
8796
8797 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8798 case "$shrpdir" in
8799 '') ;;
8800 *)      $cat >&4 <<EOM
8801 WARNING:  Use of the shrpdir variable for the installation location of
8802 the shared $libperl is not supported.  It was never documented and
8803 will not work in this version.  Let me (https://github.com/Perl/perl5/issues)
8804 know of any problems this may cause.
8805
8806 EOM
8807         case "$shrpdir" in
8808         "$archlibexp/CORE")
8809                 $cat >&4 <<EOM
8810 But your current setting of $shrpdir is
8811 the default anyway, so it's harmless.
8812 EOM
8813                 ;;
8814         *)
8815                 $cat >&4 <<EOM
8816 Further, your current attempted setting of $shrpdir
8817 conflicts with the value of $archlibexp/CORE
8818 that installperl will use.
8819 EOM
8820                 ;;
8821         esac
8822         ;;
8823 esac
8824
8825 # How will the perl executable find the installed shared $libperl?
8826 # Add $xxx to ccdlflags.
8827 # If we can't figure out a command-line option, use $shrpenv to
8828 # set env LD_RUN_PATH.  The main perl makefile uses this.
8829 shrpdir=$archlibexp/CORE
8830 xxx=''
8831 tmp_shrpenv=''
8832 if "$useshrplib"; then
8833     case "$osname" in
8834         aix)
8835                 # We'll set it in Makefile.SH...
8836                 ;;
8837         solaris)
8838                 xxx="-R $shrpdir"
8839                 ;;
8840         freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8841                 xxx="-Wl,-R$shrpdir"
8842                 ;;
8843         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8844                 xxx="-Wl,-rpath,$shrpdir"
8845                 ;;
8846         hpux*)
8847                 # hpux doesn't like the default, either.
8848                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8849                 ;;
8850         cygwin)
8851                 # cygwin needs only ldlibpth
8852                 ;;
8853         *)
8854                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8855                 ;;
8856         esac
8857         case "$xxx" in
8858         '') ;;
8859         *)
8860                 # Only add $xxx if it isn't already in ccdlflags.
8861                 case " $ccdlflags " in
8862                 *" $xxx "*)     ;;
8863                 *)      ccdlflags="$ccdlflags $xxx"
8864                         cat <<EOM >&4
8865
8866 Adding $xxx to the flags
8867 passed to $ld so that the perl executable will find the
8868 installed shared $libperl.
8869
8870 EOM
8871                         ;;
8872                 esac
8873                 ;;
8874         esac
8875 fi
8876 # Fix ccdlflags in AIX for building external extensions.
8877 # (For building Perl itself bare -bE:perl.exp is needed,
8878 #  Makefile.SH takes care of this.)
8879 case "$osname" in
8880 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8881 esac
8882 # Respect a hint or command-line value.
8883 case "$shrpenv" in
8884 '') shrpenv="$tmp_shrpenv" ;;
8885 esac
8886 case "$ldlibpthname" in
8887 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8888 none)   ldlibpthname='' ;;
8889 esac
8890
8891 : determine where manual pages are on this system
8892 echo " "
8893 case "$sysman" in
8894 '')
8895         syspath='/usr/share/man/man1 /usr/man/man1'
8896         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8897         syspath="$syspath /usr/man/u_man/man1"
8898         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8899         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8900         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8901         sysman=`./loc . /usr/man/man1 $syspath`
8902         ;;
8903 esac
8904 if $test -d "$sysman"; then
8905         echo "System manual is in $sysman." >&4
8906 else
8907         echo "Could not find manual pages in source form." >&4
8908 fi
8909
8910 : determine where manual pages go
8911 set man1dir man1dir none
8912 eval $prefixit
8913 $cat <<EOM
8914
8915 $spackage has manual pages available in source form.
8916 EOM
8917 case "$nroff" in
8918 nroff)
8919         echo "However, you don't have nroff, so they're probably useless to you."
8920         case "$man1dir" in
8921         '') man1dir="none";;
8922         esac;;
8923 esac
8924 echo "If you don't want the manual sources installed, answer 'none'."
8925 case "$man1dir" in
8926 ' ') dflt=none
8927         ;;
8928 '')
8929         lookpath="$prefixexp/share/man/man1"
8930         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8931         lookpath="$lookpath $prefixexp/man/p_man/man1"
8932         lookpath="$lookpath $prefixexp/man/u_man/man1"
8933         lookpath="$lookpath $prefixexp/man/man.1"
8934         case "$sysman" in
8935         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8936         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8937         esac
8938         set dflt
8939         eval $prefixup
8940         ;;
8941 *)  dflt="$man1dir"
8942         ;;
8943 esac
8944 echo " "
8945 fn=dn+~
8946 rp="Where do the main $spackage manual pages (source) go?"
8947 . ./getfile
8948 if $test "X$man1direxp" != "X$ansexp"; then
8949         installman1dir=''
8950 fi
8951 prefixvar=man1dir
8952 . ./setprefixvar
8953
8954 case "$man1dir" in
8955 '')     man1dir=' '
8956         installman1dir='';;
8957 esac
8958
8959 : What suffix to use on installed man pages
8960
8961 case "$man1dir" in
8962 ' ')
8963         man1ext='0'
8964         ;;
8965 *)
8966         rp="What suffix should be used for the main $spackage man pages?"
8967         case "$man1ext" in
8968         '')     case "$man1dir" in
8969                 *1)  dflt=1 ;;
8970                 *1p) dflt=1p ;;
8971                 *1pm) dflt=1pm ;;
8972                 *l) dflt=l;;
8973                 *n) dflt=n;;
8974                 *o) dflt=o;;
8975                 *p) dflt=p;;
8976                 *C) dflt=C;;
8977                 *L) dflt=L;;
8978                 *L1) dflt=L1;;
8979                 *) dflt=1;;
8980                 esac
8981                 ;;
8982         *)      dflt="$man1ext";;
8983         esac
8984         . ./myread
8985         man1ext="$ans"
8986         ;;
8987 esac
8988
8989 : see if we can have long filenames
8990 echo " "
8991 first=123456789abcdef
8992 $rm -f $first
8993 if (echo hi >$first) 2>/dev/null; then
8994         if $test -f 123456789abcde; then
8995                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8996                 val="$undef"
8997         else
8998                 echo 'You can have filenames longer than 14 characters.'>&4
8999                 val="$define"
9000         fi
9001 else
9002         $cat <<'EOM'
9003 You can't have filenames longer than 14 chars.
9004 You can't even think about them!
9005 EOM
9006         val="$undef"
9007 fi
9008 set d_flexfnam
9009 eval $setvar
9010 $rm -rf 123456789abcde*
9011
9012 : determine where library module manual pages go
9013 set man3dir man3dir none
9014 eval $prefixit
9015 $cat <<EOM
9016
9017 $spackage has manual pages for many of the library modules.
9018 EOM
9019
9020 case "$nroff" in
9021 nroff)
9022         $cat <<'EOM'
9023 However, you don't have nroff, so they're probably useless to you.
9024 EOM
9025         case "$man3dir" in
9026         '') man3dir="none";;
9027         esac;;
9028 esac
9029
9030 case "$d_flexfnam" in
9031 undef)
9032         $cat <<'EOM'
9033 However, your system can't handle the long file names like File::Basename.3.
9034 EOM
9035         case "$man3dir" in
9036         '') man3dir="none";;
9037         esac;;
9038 esac
9039
9040 echo "If you don't want the manual sources installed, answer 'none'."
9041 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9042 case "$man3dir" in
9043 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9044         if $test -d "$privlib/man/man3"; then
9045                 cat <<EOM >&4
9046
9047 WARNING:  Previous versions of perl installed man3 pages into
9048 $privlib/man/man3.  This version will suggest a
9049 new default of $dflt.
9050 EOM
9051                 tdflt=$dflt
9052                 dflt='n'
9053                 rp='Do you wish to preserve the old behavior?(y/n)'
9054                 . ./myread
9055                 case "$ans" in
9056                 y*) dflt="$privlib/man/man3" ;;
9057                 *)  dflt=$tdflt ;;
9058                 esac
9059     fi
9060         ;;
9061 *)      dflt="$man3dir" ;;
9062 esac
9063 case "$dflt" in
9064 ' ') dflt=none ;;
9065 esac
9066 echo " "
9067 fn=dn+~
9068 rp="Where do the $package library man pages (source) go?"
9069 . ./getfile
9070 prefixvar=man3dir
9071 . ./setprefixvar
9072
9073 case "$man3dir" in
9074 '')     man3dir=' '
9075         installman3dir='';;
9076 esac
9077
9078 : What suffix to use on installed man pages
9079 case "$man3dir" in
9080 ' ')
9081         man3ext='0'
9082         ;;
9083 *)
9084         rp="What suffix should be used for the $package library man pages?"
9085         case "$man3ext" in
9086         '')     case "$man3dir" in
9087                 *3)  dflt=3 ;;
9088                 *3p) dflt=3p ;;
9089                 *3pm) dflt=3pm ;;
9090                 *l) dflt=l;;
9091                 *n) dflt=n;;
9092                 *o) dflt=o;;
9093                 *p) dflt=p;;
9094                 *C) dflt=C;;
9095                 *L) dflt=L;;
9096                 *L3) dflt=L3;;
9097                 *) dflt=3;;
9098                 esac
9099                 ;;
9100         *)      dflt="$man3ext";;
9101         esac
9102         . ./myread
9103         man3ext="$ans"
9104         ;;
9105 esac
9106
9107 : see if we have to deal with yellow pages, now NIS.
9108 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9109         case "$hostcat" in
9110         nidump*) ;;
9111         *)
9112                 case "$hostcat" in
9113                 *ypcat*) dflt=y;;
9114                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9115                                 dflt=y
9116                         else
9117                                 dflt=n
9118                         fi;;
9119                 *) dflt=n;;
9120                 esac
9121                 echo " "
9122                 rp='Are you getting the hosts file via yellow pages?'
9123                 . ./myread
9124                 case "$ans" in
9125                 y*) hostcat='ypcat hosts';;
9126                 *) hostcat='cat /etc/hosts';;
9127                 esac
9128                 ;;
9129         esac
9130 fi
9131 case "$hostcat" in
9132 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9133 esac
9134 case "$groupcat" in
9135 '') test -f /etc/group && groupcat='cat /etc/group';;
9136 esac
9137 case "$passcat" in
9138 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9139 esac
9140
9141 : now get the host name
9142 echo " "
9143 echo "Figuring out host name..." >&4
9144 case "$myhostname" in
9145 '') cont=true
9146         echo 'Maybe "hostname" will work...'
9147         if tans=`sh -c hostname 2>&1` ; then
9148                 myhostname=$tans
9149                 phostname=hostname
9150                 cont=''
9151         fi
9152         ;;
9153 *) cont='';;
9154 esac
9155 if $test "$cont"; then
9156         if ./xenix; then
9157                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9158                 if tans=`cat /etc/systemid 2>&1` ; then
9159                         myhostname=$tans
9160                         phostname='cat /etc/systemid'
9161                         echo "Whadyaknow.  Xenix always was a bit strange..."
9162                         cont=''
9163                 fi
9164         elif $test -r /etc/systemid; then
9165                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9166         fi
9167 fi
9168 if $test "$cont"; then
9169         echo 'No, maybe "uuname -l" will work...'
9170         if tans=`sh -c 'uuname -l' 2>&1` ; then
9171                 myhostname=$tans
9172                 phostname='uuname -l'
9173         else
9174                 echo 'Strange.  Maybe "uname -n" will work...'
9175                 if tans=`sh -c 'uname -n' 2>&1` ; then
9176                         myhostname=$tans
9177                         phostname='uname -n'
9178                 else
9179                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9180                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9181                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9182                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9183                         else
9184                                 case "$myhostname" in
9185                                 '') echo "Does this machine have an identity crisis or something?"
9186                                         phostname='';;
9187                                 *)
9188                                         echo "Well, you said $myhostname before..."
9189                                         phostname='echo $myhostname';;
9190                                 esac
9191                         fi
9192                 fi
9193         fi
9194 fi
9195 case "$myhostname" in
9196 '') myhostname=noname ;;
9197 esac
9198 : you do not want to know about this
9199 set $myhostname
9200 myhostname=$1
9201
9202 : verify guess
9203 if $test "$myhostname" ; then
9204         dflt=y
9205         rp='Your host name appears to be "'$myhostname'".'" Right?"
9206         . ./myread
9207         case "$ans" in
9208         y*) ;;
9209         *) myhostname='';;
9210         esac
9211 fi
9212
9213 : bad guess or no guess
9214 while $test "X$myhostname" = X ; do
9215         dflt=''
9216         rp="Please type the (one word) name of your host:"
9217         . ./myread
9218         myhostname="$ans"
9219 done
9220
9221 : translate upper to lower if necessary
9222 case "$myhostname" in
9223 *[A-Z]*)
9224         echo "(Normalizing case in your host name)"
9225         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9226         ;;
9227 esac
9228
9229 case "$myhostname" in
9230 *.*)
9231         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9232         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9233         echo "(Trimming domain name from host name--host name is now $myhostname)"
9234         ;;
9235 *) case "$mydomain" in
9236         '')
9237                 {
9238                         test "X$hostcat" = "Xypcat hosts" &&
9239                         ypmatch "$myhostname" hosts 2>/dev/null |\
9240                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9241                         $test -s hosts
9242                 } || {
9243                         test "X$hostcat" != "X" &&
9244                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9245                                         /[       ]$myhostname[  . ]/p" > hosts
9246                 }
9247                 tmp_re="[       . ]"
9248                 if $test -f hosts; then
9249                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9250                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9251                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9252                                 hosts | $sort | $uniq | \
9253                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9254                         case `$echo X$dflt` in
9255                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9256                                 dflt=.
9257                                 ;;
9258                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9259                                 ;;
9260                         esac
9261                 else
9262                         echo "(I cannot locate a hosts database anywhere)"
9263                         dflt=.
9264                 fi
9265                 case "$dflt" in
9266                 .)
9267                         tans=`./loc resolv.conf X /etc /usr/etc`
9268                         if $test -f "$tans"; then
9269                                 echo "(Attempting domain name extraction from $tans)"
9270                                 dflt=.`$sed -n -e 's/   / /g' \
9271                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9272                                   -e 1q 2>/dev/null`
9273                                 case "$dflt" in
9274                                 .) dflt=.`$sed -n -e 's/        / /g' \
9275                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9276                                      -e 1q 2>/dev/null`
9277                                         ;;
9278                                 esac
9279                         fi
9280                         ;;
9281                 esac
9282                 case "$dflt" in
9283                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9284                         dflt=.`sh -c domainname 2>/dev/null`
9285                         case "$dflt" in
9286                         '') dflt='.';;
9287                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9288                         esac
9289                         ;;
9290                 esac
9291                 case "$dflt$osname" in
9292                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9293                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9294                         ;;
9295                 esac
9296                 case "$dflt" in
9297                 .) echo "(Lost all hope -- silly guess then)"
9298                         dflt='.nonet'
9299                         ;;
9300                 esac
9301                 $rm -f hosts
9302                 ;;
9303         *) dflt="$mydomain";;
9304         esac;;
9305 esac
9306 echo " "
9307 rp="What is your domain name?"
9308 . ./myread
9309 tans="$ans"
9310 case "$ans" in
9311 '') ;;
9312 .*) ;;
9313 *) tans=".$tans";;
9314 esac
9315 mydomain="$tans"
9316
9317 : translate upper to lower if necessary
9318 case "$mydomain" in
9319 *[A-Z]*)
9320         echo "(Normalizing case in your domain name)"
9321         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9322         ;;
9323 esac
9324
9325 : a little sanity check here
9326 case "$phostname" in
9327 '') ;;
9328 *)
9329         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9330         $myhostname$mydomain|$myhostname) ;;
9331         *)
9332                 case "$phostname" in
9333                 sed*)
9334                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9335                         ;;
9336                 *)
9337                         echo "(That doesn't agree with your $phostname command, by the way.)"
9338                         ;;
9339                 esac
9340         ;;
9341         esac
9342         ;;
9343 esac
9344
9345 : determine the e-mail address of the user who is running us
9346 $cat <<EOM
9347
9348 I need to get your e-mail address in Internet format if possible, i.e.
9349 something like user@host.domain. Please answer accurately since I have
9350 no easy means to double check it. The default value provided below
9351 is most probably close to reality but may not be valid from outside
9352 your organization...
9353
9354 EOM
9355 cont=x
9356 while test "$cont"; do
9357         case "$MAILDOMAIN" in
9358         '')
9359                 if $test -s /etc/mailname; then
9360                         maildomain=`$cat /etc/mailname`
9361                 else
9362                         maildomain="$myhostname$mydomain"
9363                 fi
9364                 ;;
9365         *)  maildomain="$MAILDOMAIN";;
9366         esac
9367         case "$cf_email" in
9368         '') dflt="$cf_by@$maildomain";;
9369         *)  dflt="$cf_email";;
9370         esac
9371         rp='What is your e-mail address?'
9372         . ./myread
9373         cf_email="$ans"
9374         case "$cf_email" in
9375         *@*.*) cont='' ;;
9376         *)
9377                 rp='Address does not look like an Internet one.  Use it anyway?'
9378                 case "$fastread" in
9379                 yes) dflt=y ;;
9380                 *) dflt=n ;;
9381                 esac
9382                 . ./myread
9383                 case "$ans" in
9384                 y*) cont='' ;;
9385                 *) echo " " ;;
9386                 esac
9387                 ;;
9388         esac
9389 done
9390
9391 : Ask e-mail of administrator
9392 $cat <<EOM
9393
9394 If you or somebody else will be maintaining perl at your site, please
9395 fill in the correct e-mail address here so that they may be contacted
9396 if necessary. You may enter "none" for no administrator.
9397
9398 EOM
9399 case "$perladmin" in
9400 '') dflt="$cf_email";;
9401 *) dflt="$perladmin";;
9402 esac
9403 rp='Perl administrator e-mail address'
9404 . ./myread
9405 perladmin="$ans"
9406
9407 : determine whether to use a version number suffix for installed binaries
9408 echo " "
9409 $cat <<EOM
9410 Do you want to use a version number suffix for installed binaries? This
9411 will install 'perl$version' instead of 'perl', and likewise for other
9412 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9413 to be installed side-by-side. Unless you are a developer, you probably
9414 do *not* want to do this.
9415 EOM
9416 case "$versiononly" in
9417 "$define"|[Yy]*|true) dflt='y' ;;
9418 *) dflt='n';
9419 esac
9420 rp="Do you want to use a version number suffix for installed binaries?"
9421 . ./myread
9422 case "$ans" in
9423 [yY]*)  val="$define";;
9424 *)      val="$undef" ;;
9425 esac
9426 set versiononly
9427 eval $setvar
9428
9429 case "$versiononly" in
9430 "$define") inc_version_list=''
9431            inc_version_list_init=0
9432            ;;
9433 esac
9434
9435 : figure out how to guarantee perl startup
9436 : XXX Note that this currently takes advantage of the bug that binexp ignores
9437 :     the Configure -Dinstallprefix setting, which in turn means that under
9438 :     relocatable @INC, initialinstalllocation is what binexp started as.
9439 case "$startperl" in
9440 '')
9441         case "$sharpbang" in
9442         *!)
9443                 $cat <<EOH
9444
9445 I can use the #! construct to start perl on your system. This will
9446 make startup of perl scripts faster, but may cause problems if you
9447 want to share those scripts and perl is not in a standard place
9448 ($initialinstalllocation/perl) on all your platforms. The alternative
9449 is to force a shell by starting the script with a single ':' character.
9450
9451 EOH
9452                 case "$versiononly" in
9453                 "$define")      dflt="$initialinstalllocation/perl$version";;
9454                 *)              dflt="$initialinstalllocation/perl";;
9455                 esac
9456                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9457                 . ./myread
9458                 case "$ans" in
9459                 none)   startperl=": # use perl";;
9460                 *)      startperl="#!$ans"
9461                         if $test 30 -lt `echo "$ans" | wc -c`; then
9462                                 $cat >&4 <<EOM
9463
9464 WARNING:  Some systems limit the #! command to 32 characters.
9465 If you experience difficulty running Perl scripts with #!, try
9466 installing Perl in a directory with a shorter pathname.
9467
9468 EOM
9469                         fi ;;
9470                 esac
9471                 ;;
9472         *) startperl=": # use perl"
9473                 ;;
9474         esac
9475         ;;
9476 esac
9477 echo "I'll use $startperl to start perl scripts."
9478
9479 : figure best path for perl in scripts
9480 case "$perlpath" in
9481 '')
9482         case "$versiononly" in
9483         "$define")      perlpath="$initialinstalllocation/perl$version";;
9484         *)              perlpath="$initialinstalllocation/perl";;
9485         esac
9486         case "$startperl" in
9487         *!*) ;;
9488         *)
9489                 $cat <<EOH
9490
9491 I will use the "eval 'exec'" idiom to start Perl on your system.
9492 I can use the full path of your Perl binary for this purpose, but
9493 doing so may cause problems if you want to share those scripts and
9494 Perl is not always in a standard place ($initialinstalllocation/perl).
9495
9496 EOH
9497                 dflt="$initialinstalllocation/perl"
9498                 rp="What path shall I use in \"eval 'exec'\"?"
9499                 . ./myread
9500                 perlpath="$ans"
9501                 ;;
9502         esac
9503         ;;
9504 esac
9505 case "$startperl" in
9506 *!*)    ;;
9507 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9508 esac
9509
9510 : determine where public executable scripts go
9511 set scriptdir scriptdir
9512 eval $prefixit
9513 case "$scriptdir" in
9514 '')
9515         dflt="$bin"
9516         : guess some guesses
9517         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9518         $test -d /usr/share/bin     && dflt=/usr/share/bin
9519         $test -d /usr/local/script  && dflt=/usr/local/script
9520         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9521         $test -d $prefixexp/script  && dflt=$prefixexp/script
9522         set dflt
9523         eval $prefixup
9524         ;;
9525 *)  dflt="$scriptdir"
9526         ;;
9527 esac
9528 $cat <<EOM
9529
9530 Some installations have a separate directory just for executable scripts so
9531 that they can mount it across multiple architectures but keep the scripts in
9532 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9533 Or you might just lump your scripts in with all your other executables.
9534
9535 EOM
9536 fn=d~
9537 rp='Where do you keep publicly executable scripts?'
9538 . ./getfile
9539 if $test "X$ansexp" != "X$scriptdirexp"; then
9540         installscript=''
9541 fi
9542 installscriptdir=''
9543 prefixvar=scriptdir
9544 . ./setprefixvar
9545 : A little fix up for an irregularly named variable.
9546 installscript="$installscriptdir"
9547
9548 : determine where add-on public executables go
9549 case "$sitebin" in
9550 '')     dflt=$siteprefix/bin ;;
9551 *)      dflt=$sitebin ;;
9552 esac
9553 fn=d~
9554 rp='Pathname where the add-on public executables should be installed?'
9555 . ./getfile
9556 prefixvar=sitebin
9557 . ./setprefixvar
9558
9559 : determine where add-on html pages go
9560 : There is no standard location, so try to copy the previously-selected
9561 : directory structure for the core html pages.
9562 case "$sitehtml1dir" in
9563 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9564 *)     dflt=$sitehtml1dir ;;
9565 esac
9566 case "$dflt" in
9567 ''|' ') dflt=none ;;
9568 esac
9569 fn=dn+~
9570 rp='Pathname where the site-specific html pages should be installed?'
9571 . ./getfile
9572 prefixvar=sitehtml1dir
9573 . ./setprefixvar
9574
9575 : determine where add-on library html pages go
9576 : There is no standard location, so try to copy the previously-selected
9577 : directory structure for the core html pages.
9578 case "$sitehtml3dir" in
9579 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9580 *)     dflt=$sitehtml3dir ;;
9581 esac
9582 case "$dflt" in
9583 ''|' ') dflt=none ;;
9584 esac
9585 fn=dn+~
9586 rp='Pathname where the site-specific library html pages should be installed?'
9587 . ./getfile
9588 prefixvar=sitehtml3dir
9589 . ./setprefixvar
9590
9591 : determine where add-on manual pages go
9592 case "$siteman1dir" in
9593 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9594 *)      dflt=$siteman1dir ;;
9595 esac
9596 case "$dflt" in
9597 ''|' ') dflt=none ;;
9598 esac
9599 fn=dn+~
9600 rp='Pathname where the site-specific manual pages should be installed?'
9601 . ./getfile
9602 prefixvar=siteman1dir
9603 . ./setprefixvar
9604
9605 : determine where add-on library man pages go
9606 case "$siteman3dir" in
9607 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9608 *)      dflt=$siteman3dir ;;
9609 esac
9610 case "$dflt" in
9611 ''|' ') dflt=none ;;
9612 esac
9613 fn=dn+~
9614 rp='Pathname where the site-specific library manual pages should be installed?'
9615 . ./getfile
9616 prefixvar=siteman3dir
9617 . ./setprefixvar
9618
9619 : determine where add-on public executable scripts go
9620 case "$sitescript" in
9621 '')     dflt=$siteprefix/script
9622         $test -d $dflt || dflt=$sitebin ;;
9623 *)  dflt="$sitescript" ;;
9624 esac
9625 fn=d~+
9626 rp='Pathname where add-on public executable scripts should be installed?'
9627 . ./getfile
9628 prefixvar=sitescript
9629 . ./setprefixvar
9630
9631 : see if backtrace exists
9632 set backtrace d_backtrace
9633 eval $inlibc
9634
9635 : Check if C backtrace is actually supported.
9636 case "$usecbacktrace" in
9637   "") usecbacktrace=$undef ;;
9638   [yY]*|true|$define)
9639     case "$d_backtrace" in
9640       [yY]*|true|$define)
9641         ;;
9642       *)
9643         echo "This system does not support backtrace" >&4
9644         usecbacktrace=$undef
9645         ;;
9646       esac
9647     ;;
9648   esac
9649
9650 : Check if faststdio is requested and available
9651 case "$usefaststdio" in
9652 $define|true|[yY]*|'')
9653         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9654         case "$xversion" in
9655         [68])   dflt='y' ;;
9656         *)      dflt='n' ;;
9657         esac
9658         ;;
9659 *) dflt='n';;
9660 esac
9661 cat <<EOM
9662
9663 Perl can be built to use 'fast stdio', which means using the stdio
9664 library but also directly manipulating the stdio buffers to enable
9665 faster I/O.  Using stdio is better for backward compatibility (especially
9666 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9667 interface has been preferred instead of stdio.
9668
9669 If this doesn't make any sense to you, just accept the default '$dflt'.
9670 EOM
9671 rp='Use the "fast stdio" if available?'
9672 . ./myread
9673 case "$ans" in
9674 y|Y)    val="$define" ;;
9675 *)      val="$undef" ;;
9676 esac
9677 set usefaststdio
9678 eval $setvar
9679
9680 : define an is-a-typedef? function
9681 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9682 case "$inclist" in
9683 "") inclist="sys/types.h";;
9684 esac;
9685 eval "varval=\$$var";
9686 case "$varval" in
9687 "")
9688         $rm -f temp.c;
9689         for inc in $inclist; do
9690                 echo "#include <$inc>" >>temp.c;
9691         done;
9692         echo "#ifdef $type" >> temp.c;
9693         echo "printf(\"We have $type\");" >> temp.c;
9694         echo "#endif" >> temp.c;
9695         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9696         if $contains $type temp.E >/dev/null 2>&1; then
9697                 eval "$var=\$type";
9698         else
9699                 eval "$var=\$def";
9700         fi;
9701         $rm -f temp.?;;
9702 *) eval "$var=\$varval";;
9703 esac'
9704
9705 : define an is-a-typedef? function that prompts if the type is not available.
9706 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9707 case "$inclist" in
9708 "") inclist="sys/types.h";;
9709 esac;
9710 eval "varval=\$$var";
9711 case "$varval" in
9712 "")
9713         $rm -f temp.c;
9714         for inc in $inclist; do
9715                 echo "#include <$inc>" >>temp.c;
9716         done;
9717         echo "#ifdef $type" >> temp.c;
9718         echo "printf(\"We have $type\");" >> temp.c;
9719         echo "#endif" >> temp.c;
9720         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9721         echo " " ;
9722         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9723         if $contains $type temp.E >/dev/null 2>&1; then
9724                 echo "$type found." >&4;
9725                 eval "$var=\$type";
9726         else
9727                 echo "$type NOT found." >&4;
9728                 dflt="$def";
9729                 . ./myread ;
9730                 eval "$var=\$ans";
9731         fi;
9732         $rm -f temp.?;;
9733 *) eval "$var=\$varval";;
9734 esac'
9735
9736 : see what type lseek is declared as in the kernel
9737 rp="What is the type used for lseek's offset on this system?"
9738 set off_t lseektype long stdio.h sys/types.h
9739 eval $typedef_ask
9740
9741 echo " "
9742 echo "Checking to see how big your file offsets are..." >&4
9743 $cat >try.c <<EOCP
9744 #include <sys/types.h>
9745 #include <stdio.h>
9746 int main()
9747 {
9748     printf("%d\n", (int)sizeof($lseektype));
9749     return(0);
9750 }
9751 EOCP
9752 set try
9753 if eval $compile_ok; then
9754         lseeksize=`$run ./try`
9755         echo "Your file offsets are $lseeksize bytes long."
9756 else
9757         dflt=$longsize
9758         echo " "
9759         echo "(I can't seem to compile the test program.  Guessing...)"
9760         rp="What is the size of your file offsets (in bytes)?"
9761         . ./myread
9762         lseeksize="$ans"
9763 fi
9764 $rm_try
9765
9766 : see what type file positions are declared as in the library
9767 rp="What is the type for file position used by fsetpos()?"
9768 set fpos_t fpostype long stdio.h sys/types.h
9769 eval $typedef_ask
9770
9771 : Check size for Fpos_t
9772 echo " "
9773 case "$fpostype" in
9774 *_t) zzz="$fpostype"    ;;
9775 *)   zzz="fpos_t"       ;;
9776 esac
9777 echo "Checking the size of $zzz..." >&4
9778 cat > try.c <<EOCP
9779 #include <sys/types.h>
9780 #include <stdio.h>
9781 #$i_stdlib I_STDLIB
9782 #ifdef I_STDLIB
9783 #include <stdlib.h>
9784 #endif
9785 int main() {
9786     printf("%d\n", (int)sizeof($fpostype));
9787     exit(0);
9788 }
9789 EOCP
9790 set try
9791 if eval $compile_ok; then
9792         yyy=`$run ./try`
9793         case "$yyy" in
9794         '')     fpossize=4
9795                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9796                 ;;
9797         *)      fpossize=$yyy
9798                 echo "Your $zzz is $fpossize bytes long."
9799                 ;;
9800         esac
9801 else
9802         dflt="$longsize"
9803         echo " " >&4
9804         echo "(I can't compile the test program.  Guessing...)" >&4
9805         rp="What is the size of your file positions (in bytes)?"
9806         . ./myread
9807         fpossize="$ans"
9808 fi
9809
9810 : Check for large file support
9811 # Backward compatibility (uselfs is deprecated).
9812 case "$uselfs" in
9813 "$define"|true|[yY]*)
9814         cat <<EOM >&4
9815
9816 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9817 EOM
9818         uselargefiles="$define"
9819         ;;
9820 esac
9821
9822 case "$lseeksize:$fpossize" in
9823 8:8) cat <<EOM
9824
9825 You can have files larger than 2 gigabytes.
9826 EOM
9827    val="$define" ;;
9828 *)    case "$uselargefiles" in
9829    "$undef"|false|[nN]*) dflt='n' ;;
9830    *)   dflt='y' ;;
9831    esac
9832    cat <<EOM
9833
9834 Perl can be built to understand large files (files larger than 2 gigabytes)
9835 on some systems.  To do so, Configure can be run with -Duselargefiles.
9836
9837 If this doesn't make any sense to you, just accept the default '$dflt'.
9838 EOM
9839    rp='Try to understand large files, if available?'
9840    . ./myread
9841    case "$ans" in
9842    y|Y) val="$define" ;;
9843    *)   val="$undef"  ;;
9844    esac
9845    ;;
9846 esac
9847 set uselargefiles
9848 eval $setvar
9849 : Look for a hint-file generated 'call-back-unit'.  If the
9850 : user has specified that a large files perl is to be built,
9851 : we may need to set or change some other defaults.
9852 if $test -f uselargefiles.cbu; then
9853         echo "Your platform has some specific hints regarding large file builds, using them..."
9854         . ./uselargefiles.cbu
9855 fi
9856 case "$uselargefiles" in
9857 "$define")
9858         if $test -f uselargefiles.cbu; then
9859                 echo " "
9860                 echo "Rechecking to see how big your file offsets are..." >&4
9861                 $cat >try.c <<EOCP
9862 #include <sys/types.h>
9863 #include <stdio.h>
9864 int main()
9865 {
9866     printf("%d\n", (int)sizeof($lseektype));
9867     return(0);
9868 }
9869 EOCP
9870                 set try
9871                 if eval $compile_ok; then
9872                         lseeksize=`$run ./try`
9873                         $echo "Your file offsets are now $lseeksize bytes long."
9874                 else
9875                         dflt="$lseeksize"
9876                         echo " "
9877                         echo "(I can't seem to compile the test program.  Guessing...)"
9878                         rp="What is the size of your file offsets (in bytes)?"
9879                         . ./myread
9880                         lseeksize="$ans"
9881                 fi
9882                 case "$fpostype" in
9883                 *_t) zzz="$fpostype"    ;;
9884                 *)   zzz="fpos_t"       ;;
9885                 esac
9886                 $echo $n "Rechecking the size of $zzz...$c" >&4
9887                 $cat > try.c <<EOCP
9888 #include <sys/types.h>
9889 #include <stdio.h>
9890 #$i_stdlib I_STDLIB
9891 #ifdef I_STDLIB
9892 #include <stdlib.h>
9893 #endif
9894 int main() {
9895     printf("%d\n", (int)sizeof($fpostype));
9896     return(0);
9897 }
9898 EOCP
9899                 set try
9900                 if eval $compile_ok; then
9901                         yyy=`$run ./try`
9902                         dflt="$lseeksize"
9903                         case "$yyy" in
9904                         '')     echo " "
9905                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9906                                 ;;
9907                         *)      fpossize=$yyy
9908                                 echo " $fpossize bytes." >&4
9909                                 ;;
9910                         esac
9911                 else
9912                         dflt="$fpossize"
9913                         echo " "
9914                         echo "(I can't compile the test program.  Guessing...)" >&4
9915                         rp="What is the size of your file positions (in bytes)?"
9916                         . ./myread
9917                         fpossize="$ans"
9918                 fi
9919                 $rm_try
9920         fi
9921         ;;
9922 esac
9923
9924 : Check if we want perlio
9925 useperlio="$define"
9926
9927 : Set the vendorbin variables
9928 case "$vendorprefix" in
9929 '')     d_vendorbin="$undef"
9930         vendorbin=''
9931         vendorbinexp=''
9932         ;;
9933 *)      d_vendorbin="$define"
9934         : determine where vendor-supplied executables go.
9935         case "$vendorbin" in
9936         '') dflt=$vendorprefix/bin ;;
9937         *)      dflt="$vendorbin" ;;
9938         esac
9939         fn=d~+
9940         rp='Pathname for the vendor-supplied executables directory?'
9941         . ./getfile
9942         vendorbin="$ans"
9943         vendorbinexp="$ansexp"
9944         ;;
9945 esac
9946 prefixvar=vendorbin
9947 . ./installprefix
9948
9949 : Set the vendorhtml1dir variables
9950 case "$vendorprefix" in
9951 '')     vendorhtml1dir=''
9952         vendorhtml1direxp=''
9953         ;;
9954 *)      : determine where vendor-supplied html pages go.
9955         : There is no standard location, so try to copy the previously-selected
9956         : directory structure for the core html pages.
9957         : XXX Better default suggestions would be welcome.
9958         case "$vendorhtml1dir" in
9959         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9960         *)      dflt=$vendorhtml1dir ;;
9961         esac
9962         case "$dflt" in
9963         ''|' ') dflt=none ;;
9964         esac
9965         fn=dn+~
9966         rp='Pathname for the vendor-supplied html pages?'
9967         . ./getfile
9968         vendorhtml1dir="$ans"
9969         vendorhtml1direxp="$ansexp"
9970         ;;
9971 esac
9972 : Use ' ' for none so value is preserved next time through Configure
9973 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9974 prefixvar=vendorhtml1dir
9975 . ./installprefix
9976
9977 : Set the vendorhtml3dir variables
9978 case "$vendorprefix" in
9979 '')     vendorhtml3dir=''
9980         vendorhtml3direxp=''
9981         ;;
9982 *)      : determine where vendor-supplied module html pages go.
9983         : There is no standard location, so try to copy the previously-selected
9984         : directory structure for the core html pages.
9985         : XXX Better default suggestions would be welcome.
9986         case "$vendorhtml3dir" in
9987         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9988         *)      dflt=$vendorhtml3dir ;;
9989         esac
9990         case "$dflt" in
9991         ''|' ') dflt=none ;;
9992         esac
9993         fn=dn+~
9994         rp='Pathname for the vendor-supplied html pages?'
9995         . ./getfile
9996         vendorhtml3dir="$ans"
9997         vendorhtml3direxp="$ansexp"
9998         ;;
9999 esac
10000 : Use ' ' for none so value is preserved next time through Configure
10001 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
10002 prefixvar=vendorhtml3dir
10003 . ./installprefix
10004
10005 : Set the vendorman1dir variables
10006 case "$vendorprefix" in
10007 '')     vendorman1dir=''
10008         vendorman1direxp=''
10009         ;;
10010 *)      : determine where vendor-supplied manual pages go.
10011         case "$vendorman1dir" in
10012         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10013         *)      dflt=$vendorman1dir ;;
10014         esac
10015         case "$dflt" in
10016         ''|' ') dflt=none ;;
10017         esac
10018         fn=nd~+
10019         rp='Pathname for the vendor-supplied manual section 1 pages?'
10020         . ./getfile
10021         vendorman1dir="$ans"
10022         vendorman1direxp="$ansexp"
10023         ;;
10024 esac
10025 : Use ' ' for none so value is preserved next time through Configure
10026 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10027 prefixvar=vendorman1dir
10028 . ./installprefix
10029
10030 : Set the vendorman3dir variables
10031 case "$vendorprefix" in
10032 '')     vendorman3dir=''
10033         vendorman3direxp=''
10034         ;;
10035 *)      : determine where vendor-supplied module manual pages go.
10036         case "$vendorman3dir" in
10037         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10038         *)      dflt=$vendorman3dir ;;
10039         esac
10040         case "$dflt" in
10041         ''|' ') dflt=none ;;
10042         esac
10043         fn=nd~+
10044         rp='Pathname for the vendor-supplied manual section 3 pages?'
10045         . ./getfile
10046         vendorman3dir="$ans"
10047         vendorman3direxp="$ansexp"
10048         ;;
10049 esac
10050 : Use ' ' for none so value is preserved next time through Configure
10051 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10052 prefixvar=vendorman3dir
10053 . ./installprefix
10054
10055 : Set the vendorscript variables
10056 case "$vendorprefix" in
10057 '')     d_vendorscript="$undef"
10058         vendorscript=''
10059         vendorscriptexp=''
10060         ;;
10061 *)      d_vendorscript="$define"
10062         : determine where vendor-supplied scripts go.
10063         case "$vendorscript" in
10064         '')     dflt=$vendorprefix/script
10065                 $test -d $dflt || dflt=$vendorbin ;;
10066         *)  dflt="$vendorscript" ;;
10067         esac
10068         $cat <<EOM
10069
10070 The installation process will create a directory for
10071 vendor-supplied scripts.
10072
10073 EOM
10074         fn=d~+
10075         rp='Pathname for the vendor-supplied scripts directory?'
10076         . ./getfile
10077         vendorscript="$ans"
10078         vendorscriptexp="$ansexp"
10079         ;;
10080 esac
10081 prefixvar=vendorscript
10082 . ./installprefix
10083
10084 : see if qgcvt exists
10085 set qgcvt d_qgcvt
10086 eval $inlibc
10087
10088 : Check what kind of doubles your system has
10089 $echo "Checking the kind of doubles you have..." >&4
10090 $cat >try.c <<EOP
10091 #$i_stdlib I_STDLIB
10092 #define DOUBLESIZE $doublesize
10093 #ifdef I_STDLIB
10094 #include <stdlib.h>
10095 #endif
10096 #include <stdio.h>
10097 static const double d = -0.1;
10098 int main() {
10099   unsigned const char* b = (unsigned const char*)(&d);
10100 #if DOUBLESIZE == 4
10101   if (b[0] == 0xCD && b[3] == 0xBD) {
10102     /* IEEE 754 32-bit little-endian */
10103     printf("1\n");
10104     exit(0);
10105   }
10106   if (b[0] == 0xBD && b[3] == 0xCD) {
10107     /* IEEE 754 32-bit big-endian */
10108     printf("2\n");
10109     exit(0);
10110   }
10111   if (b[0] == 0xCC && b[3] == 0xCC) {
10112     /* VAX format F, 32-bit PDP-style mixed endian. */
10113     printf("9\n");
10114     exit(0);
10115   }
10116   if (b[0] == 0xC0 && b[3] == 0x9A) {
10117     /* IBM single 32-bit */
10118     printf("12\n");
10119     exit(0);
10120   }
10121 #endif
10122 #if DOUBLESIZE == 8
10123   if (b[0] == 0x9A && b[7] == 0xBF) {
10124     /* IEEE 754 64-bit little-endian */
10125     printf("3\n");
10126     exit(0);
10127   }
10128   if (b[0] == 0xBF && b[7] == 0x9A) {
10129     /* IEEE 754 64-bit big-endian */
10130     printf("4\n");
10131     exit(0);
10132   }
10133   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10134    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10135     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10136     * 99 99 b9 bf 9a 99 99 99 */
10137     printf("7\n");
10138     exit(0);
10139   }
10140   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10141    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10142     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10143     * 99 99 99 9a bf b9 99 99 */
10144     printf("8\n");
10145     exit(0);
10146   }
10147   if (b[0] == 0xCC && b[7] == 0xCC) {
10148    /* VAX format D, 64-bit PDP-style mixed endian. */
10149     printf("10\n");
10150     exit(0);
10151   }
10152   if (b[0] == 0xD9 && b[7] == 0x99) {
10153    /* VAX format G, 64-bit PDP-style mixed endian. */
10154     printf("11\n");
10155     exit(0);
10156   }
10157   if (b[0] == 0xC0 && b[7] == 0x9A) {
10158     /* IBM double 64-bit */
10159     printf("13\n");
10160     exit(0);
10161   }
10162   if (b[0] == 0xBF && b[7] == 0xCD) {
10163     /* CRAY single 64-bit */
10164     printf("14\n");
10165     exit(0);
10166   }
10167 #endif
10168 #if DOUBLESIZE == 16
10169   if (b[0] == 0x9A && b[15] == 0xBF) {
10170     /* IEEE 754 128-bit little-endian */
10171     printf("5\n");
10172     exit(0);
10173   }
10174   if (b[0] == 0xBF && b[15] == 0x9A) {
10175     /* IEEE 754 128-bit big-endian */
10176     printf("6\n");
10177     exit(0);
10178   }
10179 #endif
10180   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10181    * Whether those environments can still build Perl is debatable. */
10182   printf("-1\n"); /* unknown */
10183   exit(0);
10184 }
10185 EOP
10186 set try
10187 if eval $compile; then
10188     doublekind=`$run ./try`
10189 else
10190     doublekind=-1
10191 fi
10192 case "$doublekind" in
10193 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10194 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10195 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10196 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10197 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10198 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10199 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10200 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10201 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10202 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10203 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10204 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10205 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10206 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10207 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10208 esac
10209 d_double_style_ieee=$undef
10210 d_double_style_vax=$undef
10211 d_double_style_ibm=$undef
10212 d_double_style_cray=$undef
10213 case "$doublekind" in
10214 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10215 9|10|11) d_double_style_vax=$define ;;
10216 12|13) d_double_style_ibm=$define ;;
10217 14) d_double_style_cray=$define ;;
10218 esac
10219 case "$d_double_style_ieee" in
10220 $define)
10221     d_double_has_inf=$define
10222     d_double_has_nan=$define
10223     d_double_has_negative_zero=$define
10224     d_double_has_subnormals=$define
10225     ;;
10226 *)
10227     d_double_has_inf=$undef
10228     d_double_has_nan=$undef
10229     d_double_has_negative_zero=$undef
10230     d_double_has_subnormals=$undef
10231     ;;
10232 esac
10233 $rm_try
10234
10235 : Check print/scan long double stuff
10236 echo " "
10237
10238 if $test X"$d_longdbl" = X"$define"; then
10239
10240 echo "Checking how to print long doubles..." >&4
10241
10242 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10243         $cat >try.c <<'EOCP'
10244 #include <sys/types.h>
10245 #include <stdio.h>
10246 int main() {
10247   double d = 123.456;
10248   printf("%.3f\n", d);
10249 }
10250 EOCP
10251         set try
10252         if eval $compile; then
10253                 yyy=`$run ./try`
10254                 case "$yyy" in
10255                 123.456)
10256                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10257                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10258                         echo "We will use %f."
10259                         ;;
10260                 esac
10261         fi
10262 fi
10263
10264 if $test X"$sPRIfldbl" = X; then
10265         $cat >try.c <<'EOCP'
10266 #include <sys/types.h>
10267 #include <stdio.h>
10268 int main() {
10269   long double d = 123.456;
10270   printf("%.3Lf\n", d);
10271 }
10272 EOCP
10273         set try
10274         if eval $compile; then
10275                 yyy=`$run ./try`
10276                 case "$yyy" in
10277                 123.456)
10278                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10279                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10280                         echo "We will use %Lf."
10281                         ;;
10282                 esac
10283         fi
10284 fi
10285
10286 if $test X"$sPRIfldbl" = X; then
10287         $cat >try.c <<'EOCP'
10288 #include <sys/types.h>
10289 #include <stdio.h>
10290 int main() {
10291   long double d = 123.456;
10292   printf("%.3llf\n", d);
10293 }
10294 EOCP
10295         set try
10296         if eval $compile; then
10297                 yyy=`$run ./try`
10298                 case "$yyy" in
10299                 123.456)
10300                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10301                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10302                         echo "We will use %llf."
10303                         ;;
10304                 esac
10305         fi
10306 fi
10307
10308 if $test X"$sPRIfldbl" = X; then
10309         $cat >try.c <<'EOCP'
10310 #include <sys/types.h>
10311 #include <stdio.h>
10312 int main() {
10313   long double d = 123.456;
10314   printf("%.3lf\n", d);
10315 }
10316 EOCP
10317         set try
10318         if eval $compile; then
10319                 yyy=`$run ./try`
10320                 case "$yyy" in
10321                 123.456)
10322                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10323                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10324                         echo "We will use %lf."
10325                         ;;
10326                 esac
10327         fi
10328 fi
10329
10330 if $test X"$sPRIfldbl" = X; then
10331         echo "Cannot figure out how to print long doubles." >&4
10332 else
10333         sSCNfldbl=$sPRIfldbl    # expect consistency
10334 fi
10335
10336 $rm_try
10337
10338 fi # d_longdbl
10339
10340 case "$sPRIfldbl" in
10341 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10342         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10343         d_SCNfldbl="$undef";
10344         ;;
10345 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10346         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10347         d_SCNfldbl="$define";
10348         ;;
10349 esac
10350
10351 : Before committing on uselongdouble, see whether that looks sane.
10352 if $test "$uselongdouble" = "$define"; then
10353     message=""
10354     echo " "
10355     echo "Checking if your long double math functions work right..." >&4
10356     $cat > try.c <<EOF
10357 #include <math.h>
10358 #include <stdio.h>
10359 int main() {
10360   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10361 }
10362 EOF
10363     case "$osname:$gccversion" in
10364     aix:)       saveccflags="$ccflags"
10365                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10366     esac
10367     set try
10368     if eval $compile_ok; then
10369       yyy=`$run ./try`
10370     fi
10371     case "$yyy" in
10372     3) echo "Your long double math functions are working correctly." >&4 ;;
10373     *) echo "Your long double math functions are broken, not using long doubles." >&4
10374        uselongdouble=$undef
10375        ;;
10376     esac
10377     $rm_try
10378     case "$osname:$gccversion" in
10379     aix:)       ccflags="$saveccflags" ;; # restore
10380     esac
10381 fi
10382
10383 : Check how to convert floats to strings.
10384
10385 if test "X$d_Gconvert" = X; then
10386
10387 echo " "
10388 echo "Checking for an efficient way to convert floats to strings."
10389 echo " " > try.c
10390 case "$uselongdouble" in
10391 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10392 esac
10393 case "$d_longdbl" in
10394 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10395 esac
10396 case "$d_PRIgldbl" in
10397 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10398 esac
10399 $cat >>try.c <<EOP
10400 #ifdef TRY_gconvert
10401 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10402 const char *myname = "gconvert";
10403 #endif
10404 #ifdef TRY_gcvt
10405 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10406 const char *myname = "gcvt";
10407 #endif
10408 #ifdef TRY_qgcvt
10409 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10410 const char *myname = "qgcvt";
10411 #define DOUBLETYPE long double
10412 #endif
10413 #ifdef TRY_sprintf
10414 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10415 #ifdef HAS_PRIgldbl
10416 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10417 #else
10418 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10419 #endif
10420 #else
10421 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10422 #endif
10423 const char *myname = "sprintf";
10424 #endif
10425
10426 #ifndef DOUBLETYPE
10427 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10428 #define DOUBLETYPE long double
10429 #else
10430 #define DOUBLETYPE double
10431 #endif
10432 #endif
10433
10434 #include <stdio.h>
10435
10436 #$i_stdlib I_STDLIB
10437 #ifdef I_STDLIB
10438 #include <stdlib.h>
10439 #endif
10440 #include <string.h>
10441
10442 void checkit(const char *expect, char *got)
10443 {
10444     if (strcmp(expect, got)) {
10445                 printf("%s oddity:  Expected %s, got %s\n",
10446                         myname, expect, got);
10447                 exit(1);
10448         }
10449 }
10450
10451 void lencheck(int expect, int got)
10452 {
10453     if (expect != got) {
10454                 printf("%s length mismatch:  Expected %d, got %d\n",
10455                         myname, expect, got);
10456                 exit(1);
10457         }
10458 }
10459
10460 int main()
10461 {
10462         char buf[64];
10463         buf[63] = '\0';
10464
10465         /* This must be 1st test on (which?) platform */
10466         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10467         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10468         checkit("0.1", buf);
10469
10470         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10471         checkit("0.01", buf);
10472
10473         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10474         checkit("0.001", buf);
10475
10476         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10477         checkit("0.0001", buf);
10478
10479         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10480         if (strlen(buf) > 5)
10481             checkit("9e-005", buf); /* for Microsoft ?? */
10482         else
10483             checkit("9e-05", buf);
10484
10485         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10486         checkit("1", buf);
10487
10488         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10489         checkit("1.1", buf);
10490
10491         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10492         checkit("1.01", buf);
10493
10494         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10495         checkit("1.001", buf);
10496
10497         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10498         checkit("1.0001", buf);
10499
10500         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10501         checkit("1.00001", buf);
10502
10503         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10504         checkit("1.000001", buf);
10505
10506         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10507         checkit("0", buf);
10508
10509         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10510         checkit("-1", buf);
10511
10512         /* Some Linux gcvt's give 1.e+5 here. */
10513         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10514         checkit("100000", buf);
10515
10516         /* Some Linux gcvt's give -1.e+5 here. */
10517         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10518         checkit("-100000", buf);
10519
10520         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10521         checkit("123.456", buf);
10522
10523         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10524         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10525         /* 34 should be enough to scare even long double
10526          * places into using the e notation. */
10527         if (strlen(buf) > 5)
10528             checkit("1e+034", buf); /* for Microsoft */
10529         else
10530             checkit("1e+34", buf);
10531
10532         /* Test for an Ubuntu/Debian bug in gcvt and qgcvt. See:        *
10533          * https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1899553 */
10534
10535         Gconvert((DOUBLETYPE)0.4, 53, 0, buf);
10536         lencheck(55, (int)strlen(buf));
10537
10538         /* For Perl, if you add additional tests here, also add them to
10539          * t/base/num.t for benefit of platforms not using Configure or
10540          * overriding d_Gconvert */
10541
10542         exit(0);
10543 }
10544 EOP
10545 : first add preferred functions to our list
10546 xxx_list=""
10547 for xxx_convert in $gconvert_preference; do
10548     case $xxx_convert in
10549     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10550     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10551     esac
10552 done
10553 : then add any others
10554 for xxx_convert in gconvert gcvt sprintf; do
10555     case "$xxx_list" in
10556     *$xxx_convert*) ;;
10557     *) xxx_list="$xxx_list $xxx_convert" ;;
10558     esac
10559 done
10560
10561 case "$d_longdbl$uselongdouble" in
10562 "$define$define")
10563     : again, add preferred functions to our list first
10564     xxx_ld_list=""
10565     for xxx_convert in $gconvert_ld_preference; do
10566         case $xxx_convert in
10567         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10568         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10569         esac
10570     done
10571     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10572     for xxx_convert in qgcvt sprintf $xxx_list; do
10573         case "$xxx_ld_list" in
10574         $xxx_convert*|*" $xxx_convert"*) ;;
10575         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10576         esac
10577     done
10578     : if sprintf cannot do long doubles, move it to the end
10579     if test "$d_PRIgldbl" != "$define"; then
10580         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10581     fi
10582     : if no qgcvt, remove it
10583     if test "$d_qgcvt" != "$define"; then
10584         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10585     fi
10586     : use the ld_list
10587     xxx_list="$xxx_ld_list"
10588     ;;
10589 esac
10590
10591 for xxx_convert in $xxx_list; do
10592         echo "Trying $xxx_convert..."
10593         $rm -f try try$_o core
10594         set try -DTRY_$xxx_convert
10595         if eval $compile; then
10596                 echo "$xxx_convert() found." >&4
10597                 if $run ./try; then
10598                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10599                         break;
10600                 else
10601                         echo "...But $xxx_convert didn't work as I expected."
10602                         xxx_convert=''
10603                 fi
10604         else
10605                 echo "$xxx_convert NOT found." >&4
10606                 xxx_convert=''
10607         fi
10608 done
10609
10610 if test X$xxx_convert = X; then
10611     echo "*** WHOA THERE!!! ***" >&4
10612     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10613     xxx_convert=sprintf
10614 fi
10615
10616 case "$xxx_convert" in
10617 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10618 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10619 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10620 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10621    "$define$define$define")
10622       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10623    "$define$define$undef")
10624       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10625    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10626    esac
10627    ;;
10628 esac
10629
10630 fi
10631 $rm_try
10632
10633 : see if _fwalk exists
10634 set fwalk d__fwalk
10635 eval $inlibc
10636
10637 : see if accept4 exists
10638 set accept4 d_accept4
10639 eval $inlibc
10640
10641 : Initialize h_fcntl
10642 h_fcntl=false
10643
10644 : Initialize h_sysfile
10645 h_sysfile=false
10646
10647 : access call always available on UNIX
10648 set access d_access
10649 eval $inlibc
10650
10651 : locate the flags for 'access()'
10652 case "$d_access" in
10653 "$define")
10654         echo " "
10655         $cat >access.c <<EOCP
10656 #include <sys/types.h>
10657 #ifdef I_FCNTL
10658 #include <fcntl.h>
10659 #endif
10660 #ifdef I_SYS_FILE
10661 #include <sys/file.h>
10662 #endif
10663 #ifdef I_UNISTD
10664 #include <unistd.h>
10665 #endif
10666 #$i_stdlib I_STDLIB
10667 #ifdef I_STDLIB
10668 #include <stdlib.h>
10669 #endif
10670 int main() {
10671         exit(R_OK);
10672 }
10673 EOCP
10674         : check sys/file.h first, no particular reason here
10675         if $test `./findhdr sys/file.h` && \
10676                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10677                 h_sysfile=true;
10678                 echo "<sys/file.h> defines the *_OK access constants." >&4
10679         elif $test `./findhdr fcntl.h` && \
10680                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10681                 h_fcntl=true;
10682                 echo "<fcntl.h> defines the *_OK access constants." >&4
10683         elif $test `./findhdr unistd.h` && \
10684                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10685                 echo "<unistd.h> defines the *_OK access constants." >&4
10686         else
10687                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10688         fi
10689         ;;
10690 esac
10691 $rm -f access*
10692
10693 : see if accessx exists
10694 set accessx d_accessx
10695 eval $inlibc
10696
10697 : see if acosh exists
10698 set acosh d_acosh
10699 eval $inlibc
10700
10701 : see if aintl exists
10702 set aintl d_aintl
10703 eval $inlibc
10704
10705 : see if alarm exists
10706 set alarm d_alarm
10707 eval $inlibc
10708
10709 : see if 64bit time functions exists
10710
10711 set ctime64 d_ctime64
10712 eval $inlibc
10713
10714 set localtime64 d_localtime64
10715 eval $inlibc
10716
10717 set gmtime64 d_gmtime64
10718 eval $inlibc
10719
10720 set mktime64 d_mktime64
10721 eval $inlibc
10722
10723 set difftime64 d_difftime64
10724 eval $inlibc
10725
10726 set asctime64 d_asctime64
10727 eval $inlibc
10728
10729 : see if POSIX threads are available
10730 set pthread.h i_pthread
10731 eval $inhdr
10732
10733 : define a function to check prototypes
10734 $cat > protochk <<EOSH
10735 $startsh
10736 cc="$cc"
10737 optimize="$optimize"
10738 ccflags="$ccflags"
10739 define="$define"
10740 rm_try="$rm_try"
10741 usethreads=$usethreads
10742 i_pthread=$i_pthread
10743 pthread_h_first=$pthread_h_first
10744 EOSH
10745
10746 $cat >> protochk <<'EOSH'
10747
10748 $rm_try
10749 foo="$1"
10750 shift
10751 while test $# -ge 2; do
10752         case "$1" in
10753                 $define) echo "#include <$2>" >> try.c ;;
10754                 literal) echo "$2" >> try.c ;;
10755         esac
10756     # Extra magic for the benefit of systems that need pthread.h
10757     # to be included early to correctly detect threadsafe functions.
10758     # Such functions must guarantee themselves, though, that the usethreads
10759     # and i_pthread have been defined, before calling protochk.
10760     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10761         echo "#include <pthread.h>" >> try.c
10762         pthread_h_done=yes
10763     fi
10764     shift 2
10765 done
10766 cat >> try.c <<'EOCP'
10767 #define _(args) args
10768 EOCP
10769 echo "$foo" >> try.c
10770 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10771 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10772 status=$?
10773 $rm_try
10774 exit $status
10775 EOSH
10776 chmod +x protochk
10777 $eunicefix protochk
10778
10779 : Define hasproto macro for Configure internal use
10780 hasproto='varname=$1; func=$2; shift; shift;
10781 while $test $# -ge 2; do
10782         case "$1" in
10783         $define) echo "#include <$2>";;
10784         literal) echo "$2" ;;
10785         esac ;
10786     shift 2;
10787 done > try.c;
10788 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10789 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10790         echo "$func() prototype found.";
10791         val="$define";
10792 else
10793         echo "$func() prototype NOT found.";
10794         val="$undef";
10795 fi;
10796 set $varname;
10797 eval $setvar;
10798 $rm_try tryout.c'
10799
10800 : see if sys/types.h has to be included
10801 set sys/types.h i_systypes
10802 eval $inhdr
10803
10804 : see if sys/select.h has to be included
10805 set sys/select.h i_sysselct
10806 eval $inhdr
10807
10808 : Define hasfield macro for Configure internal use
10809 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10810 while $test $# -ge 2; do
10811         case "$1" in
10812         $define) echo "#include <$2>";;
10813         esac ;
10814     shift 2;
10815 done > try.c;
10816 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10817 set try;
10818 if eval $compile; then
10819         val="$define";
10820 else
10821         val="$undef";
10822 fi;
10823 set $varname;
10824 eval $setvar;
10825 $rm_try'
10826
10827 : see if we should include sys/time.h
10828 echo " "
10829 i_time='define'
10830 if test "X$timeincl" = X; then
10831         echo "Testing to see if we should include <sys/time.h>." >&4
10832         $echo $n "I'm now running the test program...$c"
10833         $cat >try.c <<EOCP
10834 #include <sys/types.h>
10835 #include <time.h>
10836 #ifdef I_SYSTIME
10837 #ifdef SYSTIMEKERNEL
10838 #define KERNEL
10839 #endif
10840 #include <sys/time.h>
10841 #endif
10842 #ifdef I_SYSSELECT
10843 #include <sys/select.h>
10844 #endif
10845 #$i_stdlib I_STDLIB
10846 #ifdef I_STDLIB
10847 #include <stdlib.h>
10848 #endif
10849 int main()
10850 {
10851         struct tm foo;
10852 #ifdef S_TIMEVAL
10853         struct timeval bar;
10854 #endif
10855 #ifdef S_TIMEZONE
10856         struct timezone tzp;
10857 #endif
10858         if (foo.tm_sec == foo.tm_sec)
10859                 exit(0);
10860 #ifdef S_TIMEVAL
10861         if (bar.tv_sec == bar.tv_sec)
10862                 exit(0);
10863 #endif
10864         exit(1);
10865 }
10866 EOCP
10867         flags=''
10868         for s_timezone in '-DS_TIMEZONE' ''; do
10869         sysselect=''
10870         for s_timeval in '-DS_TIMEVAL' ''; do
10871         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10872         for i_systime in '-DI_SYSTIME' ''; do
10873                 case "$flags" in
10874                 '') $echo $n ".$c"
10875                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10876                         if eval $compile; then
10877                                 set X $i_systime $i_systimek $sysselect $s_timeval
10878                                 shift
10879                                 flags="$*"
10880                                 echo " "
10881                                 $echo $n "Succeeded with $flags$c"
10882                         fi
10883                         ;;
10884                 esac
10885         done
10886         done
10887         done
10888         done
10889         timeincl=''
10890         echo " "
10891         case "$flags" in
10892         *SYSTIMEKERNEL*) i_systimek="$define"
10893                 timeincl=`./findhdr sys/time.h`
10894                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10895         *) i_systimek="$undef";;
10896         esac
10897         case "$flags" in
10898         *I_SYSTIME*) i_systime="$define"
10899                 timeincl=`./findhdr sys/time.h`" $timeincl"
10900                 echo "We'll include <sys/time.h>." >&4;;
10901         *) i_systime="$undef";;
10902         esac
10903         $rm_try
10904 fi
10905 : see if struct tm knows about tm_zone
10906 case "$i_systime$i_time" in
10907 *$define*)
10908         echo " "
10909         echo "Checking to see if your struct tm has tm_zone field..." >&4
10910         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10911         eval $hasfield
10912         ;;
10913 *)      val="$undef"
10914         set d_tm_tm_zone
10915         eval $setvar
10916         ;;
10917 esac
10918 case "$d_tm_tm_zone" in
10919 "$define")      echo "Yes, it does."   ;;
10920 *)              echo "No, it doesn't." ;;
10921 esac
10922 : see if struct tm knows about tm_gmtoff
10923 case "$i_systime$i_time" in
10924 *$define*)
10925         echo " "
10926         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10927         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10928         eval $hasfield
10929         ;;
10930 *)      val="$undef"
10931         set d_tm_tm_gmtoff
10932         eval $setvar
10933         ;;
10934 esac
10935 case "$d_tm_tm_gmtoff" in
10936 "$define")      echo "Yes, it does."   ;;
10937 *)              echo "No, it doesn't." ;;
10938 esac
10939
10940 : see if asctime_r exists
10941 set asctime_r d_asctime_r
10942 eval $inlibc
10943 case "$d_asctime_r" in
10944 "$define")
10945         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10946         case "$d_asctime_r_proto:$usethreads" in
10947         ":define")      d_asctime_r_proto=define
10948                 set d_asctime_r_proto asctime_r $hdrs
10949                 eval $hasproto ;;
10950         *)      ;;
10951         esac
10952         case "$d_asctime_r_proto" in
10953         define)
10954         case "$asctime_r_proto" in
10955         ''|0) try='char* asctime_r(const struct tm*, char*);'
10956         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10957         esac
10958         case "$asctime_r_proto" in
10959         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10960         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10961         esac
10962         case "$asctime_r_proto" in
10963         ''|0) try='int asctime_r(const struct tm*, char*);'
10964         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10965         esac
10966         case "$asctime_r_proto" in
10967         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10968         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10969         esac
10970         case "$asctime_r_proto" in
10971         ''|0)   d_asctime_r=undef
10972                 asctime_r_proto=0
10973                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10974         * )     case "$asctime_r_proto" in
10975                 REENTRANT_PROTO*) ;;
10976                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10977                 esac
10978                 echo "Prototype: $try" ;;
10979         esac
10980         ;;
10981         *)      case "$usethreads" in
10982                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10983                 esac
10984                 d_asctime_r=undef
10985                 asctime_r_proto=0
10986                 ;;
10987         esac
10988         ;;
10989 *)      asctime_r_proto=0
10990         ;;
10991 esac
10992
10993 : see if asinh exists
10994 set asinh d_asinh
10995 eval $inlibc
10996
10997 : see if atanh exists
10998 set atanh d_atanh
10999 eval $inlibc
11000
11001 : see if atolf exists
11002 set atolf d_atolf
11003 eval $inlibc
11004
11005 : see if atoll exists
11006 set atoll d_atoll
11007 eval $inlibc
11008
11009 : See if a file contains compiler warnings
11010 : See if a file contains compiler warnings
11011 case "$osname" in
11012   'aix')
11013         cat >compiler_warning <<EOSS
11014 # Sample for aix ('.5' indicates the column number in the line):
11015 #    "op.h", line 203.5: 1506-159 (E) Bit field type specified for op_type
11016 # Since the word 'warning' isn't present, use a fairly rigorous match of what
11017 # warning messages look like
11018 #            "    o        p        .  h   ", line    203      .   5        :   1506     -    159      (  E  )
11019 $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"
11020 EOSS
11021         compiler_warning=./compiler_warning
11022         chmod +x $compiler_warning
11023     ;;
11024      # Maybe a colon after the 'warning' would be appropriate
11025   *) compiler_warning="$contains -i warning"
11026     ;;
11027 esac
11028
11029 : Look for GCC-style attribute format
11030 case "$d_attribute_format" in
11031 '')
11032 echo " "
11033 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
11034 $cat >attrib.c <<'EOCP'
11035 #include <stdio.h>
11036 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
11037 EOCP
11038 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11039         if $compiler_warning attrib.out >/dev/null 2>&1; then
11040                 echo "Your C compiler doesn't support __attribute__((format))."
11041                 val="$undef"
11042         else
11043                 echo "Your C compiler supports __attribute__((format))."
11044                 val="$define"
11045         fi
11046 else
11047         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11048         val="$undef"
11049 fi
11050 ;;
11051 *) val="$d_attribute_format" ;;
11052 esac
11053 set d_attribute_format
11054 eval $setvar
11055 $rm -f attrib*
11056
11057 : Look for GCC-style attribute format with null format allowed
11058 case "$d_printf_format_null" in
11059 '') case "$d_attribute_format" in
11060     $define)
11061         echo " "
11062         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
11063 $cat >attrib.c <<EOCP
11064 #include <stdio.h>
11065 #$i_stdlib I_STDLIB
11066 #ifdef I_STDLIB
11067 #include <stdlib.h>
11068 #endif
11069 #$i_inttypes I_INTTYPES
11070 #ifdef I_INTTYPES
11071 #include <inttypes.h>
11072 #endif
11073 #ifndef INTPTR_MAX
11074 #define intptr_t int
11075 #endif
11076 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
11077 int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
11078 int main () { exit(null_printf(NULL)); }
11079 EOCP
11080         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
11081             : run the executable in case it produces a run-time warning
11082             if $run ./attrib >>attrib.out 2>&1; then
11083                 if $compiler_warning attrib.out >/dev/null 2>&1; then
11084                     echo "Your C compiler doesn't allow __printf__ format to be null."
11085                     val="$undef"
11086                 else
11087                     echo "Your C compiler allows __printf__ format to be null."
11088                     val="$define"
11089                 fi
11090             else
11091             echo "Your C compiler executable failed with __printf__ format null."
11092             val="$undef"
11093         fi
11094     else
11095         echo "Your C compiler fails with __printf__ format null."
11096         val="$undef"
11097     fi
11098     ;;
11099     *)  val="$undef" ;;
11100     esac
11101 ;;
11102 *)  val="$d_printf_format_null" ;;
11103 esac
11104 set d_printf_format_null
11105 eval $setvar
11106 $rm -f attrib*
11107
11108 : Look for GCC-style attribute malloc
11109 case "$d_attribute_malloc" in
11110 '')
11111 echo " "
11112 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11113 $cat >attrib.c <<'EOCP'
11114 #include <stdio.h>
11115 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11116 EOCP
11117 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11118         if $compiler_warning attrib.out >/dev/null 2>&1; then
11119                 echo "Your C compiler doesn't support __attribute__((malloc))."
11120                 val="$undef"
11121         else
11122                 echo "Your C compiler supports __attribute__((malloc))."
11123                 val="$define"
11124         fi
11125 else
11126         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11127         val="$undef"
11128 fi
11129 ;;
11130 *) val="$d_attribute_malloc" ;;
11131 esac
11132 set d_attribute_malloc
11133 eval $setvar
11134 $rm -f attrib*
11135
11136 : Look for GCC-style attribute nonnull
11137 case "$d_attribute_nonnull" in
11138 '')
11139 echo " "
11140 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11141 $cat >attrib.c <<'EOCP'
11142 #include <stdio.h>
11143 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11144 EOCP
11145 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11146         if $compiler_warning attrib.out >/dev/null 2>&1; then
11147                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11148                 val="$undef"
11149         else
11150                 echo "Your C compiler supports __attribute__((nonnull))."
11151                 val="$define"
11152         fi
11153 else
11154         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11155         val="$undef"
11156 fi
11157 ;;
11158 *) val="$d_attribute_nonnull" ;;
11159 esac
11160 set d_attribute_nonnull
11161 eval $setvar
11162 $rm -f attrib*
11163
11164 : Look for GCC-style attribute noreturn
11165 case "$d_attribute_noreturn" in
11166 '')
11167 echo " "
11168 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11169 $cat >attrib.c <<'EOCP'
11170 #include <stdio.h>
11171 void fall_over_dead( void ) __attribute__((noreturn));
11172 EOCP
11173 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11174         if $compiler_warning attrib.out >/dev/null 2>&1; then
11175                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11176                 val="$undef"
11177         else
11178                 echo "Your C compiler supports __attribute__((noreturn))."
11179                 val="$define"
11180         fi
11181 else
11182         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11183         val="$undef"
11184 fi
11185 ;;
11186 *) val="$d_attribute_noreturn" ;;
11187 esac
11188 set d_attribute_noreturn
11189 eval $setvar
11190 $rm -f attrib*
11191
11192 : Look for GCC-style attribute pure
11193 case "$d_attribute_pure" in
11194 '')
11195 echo " "
11196 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11197 $cat >attrib.c <<'EOCP'
11198 #include <stdio.h>
11199 int square( int n ) __attribute__((pure));
11200 EOCP
11201 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11202         if $compiler_warning attrib.out >/dev/null 2>&1; then
11203                 echo "Your C compiler doesn't support __attribute__((pure))."
11204                 val="$undef"
11205         else
11206                 echo "Your C compiler supports __attribute__((pure))."
11207                 val="$define"
11208         fi
11209 else
11210         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11211         val="$undef"
11212 fi
11213 ;;
11214 *) val="$d_attribute_pure" ;;
11215 esac
11216 set d_attribute_pure
11217 eval $setvar
11218 $rm -f attrib*
11219
11220 : Look for GCC-style attribute unused
11221 case "$d_attribute_unused" in
11222 '')
11223 echo " "
11224 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11225 $cat >attrib.c <<'EOCP'
11226 #include <stdio.h>
11227 int do_something( int dummy __attribute__((unused)), int n );
11228 EOCP
11229 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11230         if $compiler_warning attrib.out >/dev/null 2>&1; then
11231                 echo "Your C compiler doesn't support __attribute__((unused))."
11232                 val="$undef"
11233         else
11234                 echo "Your C compiler supports __attribute__((unused))."
11235                 val="$define"
11236         fi
11237 else
11238         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11239         val="$undef"
11240 fi
11241 ;;
11242 *) val="$d_attribute_unused" ;;
11243 esac
11244 set d_attribute_unused
11245 eval $setvar
11246 $rm -f attrib*
11247
11248 : Look for GCC-style attribute deprecated
11249 case "$d_attribute_deprecated" in
11250 '')
11251 echo " "
11252 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11253 $cat >attrib.c <<'EOCP'
11254 #include <stdio.h>
11255 int I_am_deprecated(void) __attribute__((deprecated));
11256 EOCP
11257 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11258         if $compiler_warning attrib.out >/dev/null 2>&1; then
11259                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11260                 val="$undef"
11261         else
11262                 echo "Your C compiler supports __attribute__((deprecated))."
11263                 val="$define"
11264         fi
11265 else
11266         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11267         val="$undef"
11268 fi
11269 ;;
11270 *) val="$d_attribute_deprecated" ;;
11271 esac
11272 set d_attribute_deprecated
11273 eval $setvar
11274 $rm -f attrib*
11275
11276 : Look for GCC-style attribute warn_unused_result
11277 case "$d_attribute_warn_unused_result" in
11278 '')
11279 echo " "
11280 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11281 $cat >attrib.c <<'EOCP'
11282 #include <stdio.h>
11283 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11284 EOCP
11285 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11286         if $compiler_warning attrib.out >/dev/null 2>&1; then
11287                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11288                 val="$undef"
11289         else
11290                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11291                 val="$define"
11292         fi
11293 else
11294         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11295         val="$undef"
11296 fi
11297 ;;
11298 *) val="$d_attribute_warn_unused_result" ;;
11299 esac
11300 set d_attribute_warn_unused_result
11301 eval $setvar
11302 $rm -f attrib*
11303
11304 : Look for GCC-style attribute always_inline
11305 case "$d_attribute_always_inline" in
11306 '')
11307 echo " "
11308 echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
11309 $cat >attrib.c <<'EOCP'
11310 #include <stdio.h>
11311 static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
11312 EOCP
11313 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11314         if $compiler_warning attrib.out >/dev/null 2>&1; then
11315                 echo "Your C compiler doesn't support __attribute__((always_inline))."
11316                 val="$undef"
11317         else
11318                 echo "Your C compiler supports __attribute__((always_inline))."
11319                 val="$define"
11320         fi
11321 else
11322         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11323         val="$undef"
11324 fi
11325 ;;
11326 *) val="$d_attribute_always_inline" ;;
11327 esac
11328 set d_attribute_always_inline
11329 eval $setvar
11330 $rm -f attrib*
11331
11332 : Look for GCC-style attribute visibility
11333 case "$d_attribute_visibility" in
11334 '')
11335 echo " "
11336 echo "Checking whether your compiler can handle __attribute__((visibility)) ..." >&4
11337 $cat >attrib.c <<'EOCP'
11338 #include <stdio.h>
11339 __attribute__((visibility("hidden"))) int I_will_be_hidden(void);
11340 EOCP
11341 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11342         if $compiler_warning attrib.out >/dev/null 2>&1; then
11343                 echo "Your C compiler doesn't support __attribute__((visibility))."
11344                 val="$undef"
11345         else
11346                 echo "Your C compiler supports __attribute__((visibility))."
11347                 val="$define"
11348         fi
11349 else
11350         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11351         val="$undef"
11352 fi
11353 ;;
11354 *) val="$d_attribute_visibility" ;;
11355 esac
11356 set d_attribute_visibility
11357 eval $setvar
11358 $rm -f attrib*
11359
11360 : see if getpgrp exists
11361 set getpgrp d_getpgrp
11362 eval $inlibc
11363
11364 case "$d_getpgrp" in
11365 "$define")
11366         echo " "
11367         echo "Checking to see which flavor of getpgrp is in use..."
11368         $cat >try.c <<EOP
11369 #include <stdio.h>
11370 #$i_unistd I_UNISTD
11371 #include <sys/types.h>
11372 #ifdef I_UNISTD
11373 #  include <unistd.h>
11374 #endif
11375 #$i_stdlib I_STDLIB
11376 #ifdef I_STDLIB
11377 #include <stdlib.h>
11378 #endif
11379 int main()
11380 {
11381         if (getuid() == 0) {
11382                 printf("(I see you are running Configure as super-user...)\n");
11383                 setuid(1);
11384         }
11385 #ifdef TRY_BSD_PGRP
11386         if (getpgrp(1) == 0)
11387                 exit(0);
11388 #else
11389         if (getpgrp() > 0)
11390                 exit(0);
11391 #endif
11392         exit(1);
11393 }
11394 EOP
11395         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11396                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11397                 val="$define"
11398         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11399                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11400                 val="$undef"
11401         else
11402                 echo "I can't seem to compile and run the test program."
11403                 if ./usg; then
11404                         xxx="a USG one, i.e. you use getpgrp()."
11405                 else
11406                         # SVR4 systems can appear rather BSD-ish.
11407                         case "$i_unistd" in
11408                         $undef)
11409                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11410                                 val="$define"
11411                                 ;;
11412                         $define)
11413                                 xxx="probably a USG one, i.e. you use getpgrp()."
11414                                 val="$undef"
11415                                 ;;
11416                         esac
11417                 fi
11418                 echo "Assuming your getpgrp is $xxx" >&4
11419         fi
11420         ;;
11421 *) val="$undef";;
11422 esac
11423 set d_bsdgetpgrp
11424 eval $setvar
11425 $rm_try
11426
11427 : see if setpgrp exists
11428 set setpgrp d_setpgrp
11429 eval $inlibc
11430
11431 case "$d_setpgrp" in
11432 "$define")
11433         echo " "
11434         echo "Checking to see which flavor of setpgrp is in use..."
11435         $cat >try.c <<EOP
11436 #include <stdio.h>
11437 #$i_unistd I_UNISTD
11438 #include <sys/types.h>
11439 #ifdef I_UNISTD
11440 #  include <unistd.h>
11441 #endif
11442 #$i_stdlib I_STDLIB
11443 #ifdef I_STDLIB
11444 #include <stdlib.h>
11445 #endif
11446 int main()
11447 {
11448         if (getuid() == 0) {
11449                 printf("(I see you are running Configure as super-user...)\n");
11450                 setuid(1);
11451         }
11452 #ifdef TRY_BSD_PGRP
11453         if (-1 == setpgrp(1, 1))
11454                 exit(0);
11455 #else
11456         if (setpgrp() != -1)
11457                 exit(0);
11458 #endif
11459         exit(1);
11460 }
11461 EOP
11462         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11463                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11464                 val="$define"
11465         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11466                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11467                 val="$undef"
11468         else
11469                 echo "(I can't seem to compile and run the test program.)"
11470                 if ./usg; then
11471                         xxx="a USG one, i.e. you use setpgrp()."
11472                 else
11473                         # SVR4 systems can appear rather BSD-ish.
11474                         case "$i_unistd" in
11475                         $undef)
11476                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11477                                 val="$define"
11478                                 ;;
11479                         $define)
11480                                 xxx="probably a USG one, i.e. you use setpgrp()."
11481                                 val="$undef"
11482                                 ;;
11483                         esac
11484                 fi
11485                 echo "Assuming your setpgrp is $xxx" >&4
11486         fi
11487         ;;
11488 *) val="$undef";;
11489 esac
11490 set d_bsdsetpgrp
11491 eval $setvar
11492 $rm_try
11493
11494 : Look for GCC-style __builtin_add_overflow
11495 case "$d_builtin_add_overflow" in
11496 '')
11497     echo " "
11498     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11499     $cat >try.c <<'EOCP'
11500 int main(void) {
11501     const unsigned int uint_max = ~0u;
11502     int target_int = 0;
11503     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11504         return 1;
11505     }
11506     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11507         return 1;
11508     }
11509     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11510         return 1;
11511     }
11512     return 0;
11513 }
11514 EOCP
11515     set try
11516     if eval $compile && $run ./try; then
11517         echo "Your C compiler supports __builtin_add_overflow."
11518         val="$define"
11519     else
11520         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11521         val="$undef"
11522     fi
11523     ;;
11524 *) val="$d_builtin_add_overflow" ;;
11525 esac
11526
11527 set d_builtin_add_overflow
11528 eval $setvar
11529 $rm_try
11530
11531 : Look for GCC-style __builtin_sub_overflow
11532 case "$d_builtin_sub_overflow" in
11533 '')
11534     echo " "
11535     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11536     $cat >try.c <<'EOCP'
11537 int main(void) {
11538     const unsigned int uint_max = ~0u;
11539     int target_int = 0;
11540     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11541         return 1;
11542     }
11543     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11544         return 1;
11545     }
11546     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11547         return 1;
11548     }
11549     return 0;
11550 }
11551 EOCP
11552     set try
11553     if eval $compile && $run ./try; then
11554         echo "Your C compiler supports __builtin_sub_overflow."
11555         val="$define"
11556     else
11557         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11558         val="$undef"
11559     fi
11560     ;;
11561 *) val="$d_builtin_sub_overflow" ;;
11562 esac
11563
11564 set d_builtin_sub_overflow
11565 eval $setvar
11566 $rm_try
11567
11568 : Look for GCC-style __builtin_mul_overflow
11569 case "$d_builtin_mul_overflow" in
11570 '')
11571     echo " "
11572     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11573     $cat >try.c <<'EOCP'
11574 int main(void) {
11575     const unsigned int uint_max = ~0u;
11576     int target_int = 0;
11577     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11578         return 1;
11579     }
11580     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11581         return 1;
11582     }
11583     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11584         return 1;
11585     }
11586     return 0;
11587 }
11588 EOCP
11589     set try
11590     if eval $compile && $run ./try; then
11591         echo "Your C compiler supports __builtin_mul_overflow."
11592         val="$define"
11593     else
11594         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11595         val="$undef"
11596     fi
11597     ;;
11598 *) val="$d_builtin_mul_overflow" ;;
11599 esac
11600
11601 set d_builtin_mul_overflow
11602 eval $setvar
11603 $rm_try
11604
11605 : Look for GCC-style __builtin_choose_expr
11606 case "$d_builtin_choose_expr" in
11607 '')
11608     echo " "
11609     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11610     $cat >try.c <<'EOCP'
11611 #include <assert.h>
11612 #include <stdlib.h>
11613 #include <stdio.h>
11614
11615 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11616
11617 int main(void) {
11618     assert( SYRINX(1) == 2112 );
11619     assert( SYRINX(1) != 5150 );
11620     assert( SYRINX(0) == 5150 );
11621     assert( SYRINX(0) != 2112 );
11622     puts( "All good!" );
11623     exit(0);
11624 }
11625
11626 EOCP
11627     set try
11628     if eval $compile && $run ./try; then
11629         echo "Your C compiler supports __builtin_choose_expr."
11630         val="$define"
11631     else
11632         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11633         val="$undef"
11634     fi
11635 ;;
11636 *) val="$d_builtin_choose_expr" ;;
11637 esac
11638
11639 set d_builtin_choose_expr
11640 eval $setvar
11641 $rm_try
11642
11643 : Look for GCC-style __builtin_expect
11644 case "$d_builtin_expect" in
11645 '')
11646     echo " "
11647     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11648     $cat >try.c <<'EOCP'
11649 int main(void) {
11650     int n = 50;
11651     if ( __builtin_expect(n, 0) ) n = 1;
11652     /* Remember shell exit code truth is 0, C truth is non-zero */
11653     return !(n == 1);
11654 }
11655 EOCP
11656     set try
11657     if eval $compile && $run ./try; then
11658         echo "Your C compiler supports __builtin_expect."
11659         val="$define"
11660     else
11661         echo "Your C compiler doesn't seem to understand __builtin_expect."
11662         val="$undef"
11663     fi
11664     ;;
11665 *) val="$d_builtin_expect" ;;
11666 esac
11667
11668 set d_builtin_expect
11669 eval $setvar
11670 $rm_try
11671
11672 : see if the Compiler supports C99 variadic macros
11673 echo "Checking for C99 variadic macros." >&4
11674 $cat >try.c <<EOCP
11675 #include <stdio.h>
11676 #include <stdarg.h>
11677
11678 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11679
11680 int main() {
11681   char buf[20];
11682   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11683   puts(buf);
11684   return 0;
11685 }
11686 EOCP
11687 set try
11688 if eval $compile && $run ./try 2>&1 >/dev/null; then
11689     case "`$run ./try`" in
11690         "123 456 789")
11691         echo "You have C99 variadic macros." >&4
11692         d_c99_variadic_macros="$define"
11693         ;;
11694         *)
11695         echo "You don't have functional C99 variadic macros." >&4
11696         d_c99_variadic_macros="$undef"
11697         ;;
11698     esac
11699 else
11700     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11701     d_c99_variadic_macros="$undef"
11702 fi
11703 $rm_try
11704
11705 : see if signal is declared as pointer to function returning int or void
11706 echo " "
11707 xxx=`./findhdr signal.h`
11708 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11709 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11710         echo "You have int (*signal())() instead of void." >&4
11711         val="$undef"
11712 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11713         echo "You have void (*signal())()." >&4
11714         val="$define"
11715 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11716         echo "You have int (*signal())() instead of void." >&4
11717         val="$undef"
11718 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11719         echo "You have void (*signal())()." >&4
11720         val="$define"
11721 else
11722         case "$d_voidsig" in
11723         '')
11724         echo "I can't determine whether signal handler returns void or int..." >&4
11725                 dflt=void
11726                 rp="What type does your signal handler return?"
11727                 . ./myread
11728                 case "$ans" in
11729                 v*) val="$define";;
11730                 *) val="$undef";;
11731                 esac;;
11732         "$define")
11733                 echo "As you already told me, signal handler returns void." >&4
11734                 val="$define"
11735                 ;;
11736         *)      echo "As you already told me, signal handler returns int." >&4
11737                 val="$undef"
11738                 ;;
11739         esac
11740 fi
11741 set d_voidsig
11742 eval $setvar
11743 case "$d_voidsig" in
11744 "$define") signal_t="void";;
11745 *) signal_t="int";;
11746 esac
11747 $rm -f $$.tmp
11748
11749 : check for ability to cast large floats to 32-bit ints.
11750 echo " "
11751 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11752 if $test "$intsize" -ge 4; then
11753         xxx=int
11754 else
11755         xxx=long
11756 fi
11757 $cat >try.c <<EOCP
11758 #include <stdio.h>
11759 #$i_stdlib I_STDLIB
11760 #ifdef I_STDLIB
11761 #include <stdlib.h>
11762 #endif
11763 #include <sys/types.h>
11764 #include <signal.h>
11765 $signal_t blech(int s) { exit(3); }
11766 int main()
11767 {
11768         $xxx i32;
11769         double f, g;
11770         int result = 0;
11771         char str[16];
11772         signal(SIGFPE, blech);
11773
11774         /* Don't let compiler optimize the test away.  Store the number
11775            in a writable string for gcc to pass to sscanf under HP-UX.
11776         */
11777         sprintf(str, "2147483647");
11778         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11779         g = 10 * f;
11780         i32  = ($xxx) g;
11781
11782         /* x86 processors will probably give 0x8000 0000, which is a
11783            sign change.  We don't want that.  We want to mimic SPARC
11784            behavior here, which is to preserve the sign and give
11785            back 0x7fff ffff.
11786         */
11787         if (i32 != ($xxx) f)
11788                 result |= 1;
11789         exit(result);
11790 }
11791 EOCP
11792 set try
11793 if eval $compile_ok; then
11794         $run ./try 2>/dev/null
11795         yyy=$?
11796 else
11797         echo "(I can't seem to compile the test program--assuming it can't)"
11798         yyy=1
11799 fi
11800 case "$yyy" in
11801 0)      val="$define"
11802         echo "Yup, it can."
11803         ;;
11804 *)      val="$undef"
11805         echo "Nope, it can't."
11806         ;;
11807 esac
11808 set d_casti32
11809 eval $setvar
11810 $rm_try
11811
11812 : check for ability to cast negative floats to unsigned
11813 echo " "
11814 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11815 $cat >try.c <<EOCP
11816 #include <stdio.h>
11817 #$i_stdlib I_STDLIB
11818 #ifdef I_STDLIB
11819 #include <stdlib.h>
11820 #endif
11821 #include <sys/types.h>
11822 #include <signal.h>
11823 $signal_t blech(int s) { exit(7); }
11824 $signal_t blech_in_list(int s) { exit(4); }
11825 unsigned long dummy_long(unsigned long p) { return p; }
11826 unsigned int dummy_int(unsigned int p) { return p; }
11827 unsigned short dummy_short(unsigned short p) { return p; }
11828 int main()
11829 {
11830         double f;
11831         unsigned long along;
11832         unsigned int aint;
11833         unsigned short ashort;
11834         int result = 0;
11835         char str[16];
11836
11837         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11838            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11839            optimized the whole file away
11840         */
11841         /* Store the number in a writable string for gcc to pass to
11842            sscanf under HP-UX.
11843         */
11844         sprintf(str, "-123");
11845         sscanf(str, "%lf", &f);  /* f = -123.; */
11846
11847         signal(SIGFPE, blech);
11848         along = (unsigned long)f;
11849         aint = (unsigned int)f;
11850         ashort = (unsigned short)f;
11851         if (along != (unsigned long)-123)
11852                 result |= 1;
11853         if (aint != (unsigned int)-123)
11854                 result |= 1;
11855         if (ashort != (unsigned short)-123)
11856                 result |= 1;
11857         sprintf(str, "1073741824.");
11858         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11859         f = f + f;
11860         along = 0;
11861         along = (unsigned long)f;
11862         if (along != 0x80000000)
11863                 result |= 2;
11864         f -= 1.;
11865         along = 0;
11866         along = (unsigned long)f;
11867         if (along != 0x7fffffff)
11868                 result |= 1;
11869         f += 2.;
11870         along = 0;
11871         along = (unsigned long)f;
11872         if (along != 0x80000001)
11873                 result |= 2;
11874         if (result)
11875                 exit(result);
11876         signal(SIGFPE, blech_in_list);
11877         sprintf(str, "123.");
11878         sscanf(str, "%lf", &f);  /* f = 123.; */
11879         along = dummy_long((unsigned long)f);
11880         aint = dummy_int((unsigned int)f);
11881         ashort = dummy_short((unsigned short)f);
11882         if (along != (unsigned long)123)
11883                 result |= 4;
11884         if (aint != (unsigned int)123)
11885                 result |= 4;
11886         if (ashort != (unsigned short)123)
11887                 result |= 4;
11888         exit(result);
11889
11890 }
11891 EOCP
11892 set try
11893 if eval $compile_ok; then
11894         $run ./try 2>/dev/null
11895         castflags=$?
11896 else
11897         echo "(I can't seem to compile the test program--assuming it can't)"
11898         castflags=7
11899 fi
11900 case "$castflags" in
11901 0)      val="$define"
11902         echo "Yup, it can."
11903         ;;
11904 *)      val="$undef"
11905         echo "Nope, it can't."
11906         ;;
11907 esac
11908 set d_castneg
11909 eval $setvar
11910 $rm_try
11911
11912 : see if cbrt exists
11913 set cbrt d_cbrt
11914 eval $inlibc
11915
11916 : see if chown exists
11917 set chown d_chown
11918 eval $inlibc
11919
11920 : see if chroot exists
11921 set chroot d_chroot
11922 eval $inlibc
11923
11924 : see if chsize exists
11925 set chsize d_chsize
11926 eval $inlibc
11927
11928 : see if class exists
11929 set class d_class
11930 eval $inlibc
11931
11932 : see if clearenv exists
11933 set clearenv d_clearenv
11934 eval $inlibc
11935
11936 : Define hasstruct macro for Configure internal use
11937 hasstruct='varname=$1; struct=$2; shift; shift;
11938 while $test $# -ge 2; do
11939         case "$1" in
11940         $define) echo "#include <$2>";;
11941         esac ;
11942     shift 2;
11943 done > try.c;
11944 echo "int main () { struct $struct foo; }" >> try.c;
11945 set try;
11946 if eval $compile; then
11947         val="$define";
11948 else
11949         val="$undef";
11950 fi;
11951 set $varname;
11952 eval $setvar;
11953 $rm_try'
11954
11955 : see whether socket exists
11956 socketlib=''
11957 sockethdr=''
11958 echo " "
11959 $echo $n "Hmm... $c" >&4
11960 if set socket val -f d_socket; eval $csym; $val; then
11961     echo "Looks like you have Berkeley networking support." >&4
11962     d_socket="$define"
11963     if set setsockopt val -f; eval $csym; $val; then
11964         d_oldsock="$undef"
11965     else
11966         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11967         d_oldsock="$define"
11968     fi
11969 else
11970     if $contains socklib libc.list >/dev/null 2>&1; then
11971         echo "Looks like you have Berkeley networking support." >&4
11972         d_socket="$define"
11973         : we will have to assume that it supports the 4.2 BSD interface
11974         d_oldsock="$undef"
11975     else
11976         echo "You don't have Berkeley networking in libc$_a..." >&4
11977         if test "X$d_socket" = "X$define"; then
11978             echo "...but you seem to believe that you have sockets." >&4
11979         else
11980             for net in net socket
11981             do
11982                 if test -f $sysroot/usr/lib/lib$net$_a; then
11983                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11984                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11985                     if $contains socket libc.list >/dev/null 2>&1; then
11986                         d_socket="$define"
11987                         socketlib="-l$net"
11988                         case "$net" in
11989                         net)
11990                             echo "...but the Wollongong group seems to have hacked it in." >&4
11991                             sockethdr="-I$sysroot/usr/netinclude"
11992                             ;;
11993                         esac
11994                         echo "Found Berkeley sockets interface in lib$net." >&4
11995                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11996                             d_oldsock="$undef"
11997                         else
11998                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11999                             d_oldsock="$define"
12000                         fi
12001                         break
12002                     fi
12003                 fi
12004             done
12005             if test "X$d_socket" != "X$define"; then
12006                echo "or anywhere else I see." >&4
12007                d_socket="$undef"
12008                d_oldsock="$undef"
12009             fi
12010         fi
12011     fi
12012 fi
12013
12014 : see if socketpair exists
12015 set socketpair d_sockpair
12016 eval $inlibc
12017
12018
12019 echo "Checking the availability sa_len in the sock struct ..." >&4
12020 $cat >try.c <<EOF
12021 #include <sys/types.h>
12022 #include <sys/socket.h>
12023 int main() {
12024 struct sockaddr sa;
12025 return (sa.sa_len);
12026 }
12027 EOF
12028 val="$undef"
12029 set try; if eval $compile; then
12030     val="$define"
12031 fi
12032 set d_sockaddr_sa_len; eval $setvar
12033 $rm_try
12034
12035 echo "Checking the availability struct sockaddr_in6 ..." >&4
12036 $cat >try.c <<EOF
12037 #include <sys/types.h>
12038 #include <sys/socket.h>
12039 #include <netinet/in.h>
12040 int main() {
12041 struct sockaddr_in6 sin6;
12042 return (sin6.sin6_family);
12043 }
12044 EOF
12045 val="$undef"
12046 set try; if eval $compile; then
12047     val="$define"
12048 fi
12049 set d_sockaddr_in6; eval $setvar
12050 $rm_try
12051
12052 echo "Checking the availability struct sockaddr_storage ..." >&4
12053 $cat >try.c <<EOF
12054 #include <sys/types.h>
12055 #include <sys/socket.h>
12056 #include <netinet/in.h>
12057 int main() {
12058 struct sockaddr_storage sastor;
12059 return (sastor.ss_family);
12060 }
12061 EOF
12062 val="$undef"
12063 set try; if eval $compile; then
12064     val="$define"
12065 fi
12066 set d_sockaddr_storage; eval $setvar
12067 $rm_try
12068
12069 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
12070 $cat >try.c <<EOF
12071 #include <sys/types.h>
12072 #include <sys/socket.h>
12073 #include <netinet/in.h>
12074 int main() {
12075 struct sockaddr_in6 sin6;
12076 return (sin6.sin6_scope_id);
12077 }
12078 EOF
12079 val="$undef"
12080 set try; if eval $compile; then
12081     val="$define"
12082 fi
12083 set d_sin6_scope_id; eval $setvar
12084 $rm_try
12085
12086 echo "Checking the availability struct ip_mreq ..." >&4
12087 $cat >try.c <<EOF
12088 #include <sys/types.h>
12089 #include <sys/socket.h>
12090 #include <netinet/in.h>
12091 int main() {
12092 struct ip_mreq mreq;
12093 return (mreq.imr_multiaddr.s_addr);
12094 }
12095 EOF
12096 val="$undef"
12097 set try; if eval $compile; then
12098        val="$define"
12099 fi
12100 set d_ip_mreq; eval $setvar
12101 $rm_try
12102
12103 echo "Checking the availability struct ip_mreq_source ..." >&4
12104 $cat >try.c <<EOF
12105 #include <sys/types.h>
12106 #include <sys/socket.h>
12107 #include <netinet/in.h>
12108 int main() {
12109 struct ip_mreq_source mreq;
12110 return (mreq.imr_multiaddr.s_addr);
12111 }
12112 EOF
12113 val="$undef"
12114 set try; if eval $compile; then
12115        val="$define"
12116 fi
12117 set d_ip_mreq_source; eval $setvar
12118 $rm_try
12119
12120 echo "Checking the availability struct ipv6_mreq ..." >&4
12121 $cat >try.c <<EOF
12122 #include <sys/types.h>
12123 #include <sys/socket.h>
12124 #include <netinet/in.h>
12125 int main() {
12126 struct ipv6_mreq mreq;
12127 return (mreq.ipv6mr_interface);
12128 }
12129 EOF
12130 val="$undef"
12131 set try; if eval $compile; then
12132     val="$define"
12133 fi
12134 set d_ipv6_mreq; eval $setvar
12135 $rm_try
12136
12137 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12138 $cat >try.c <<EOF
12139 #include <sys/types.h>
12140 #include <sys/socket.h>
12141 #include <netinet/in.h>
12142 int main() {
12143 struct ipv6_mreq_source mreq;
12144 return (mreq.imr_multiaddr.s_addr);
12145 }
12146 EOF
12147 val="$undef"
12148 set try; if eval $compile; then
12149        val="$define"
12150 fi
12151 set d_ipv6_mreq_source; eval $setvar
12152 $rm_try
12153
12154 echo "Checking the availability of certain socket constants..." >&4
12155 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12156     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12157     $cat >try.c <<EOF
12158 #include <sys/types.h>
12159 #include <sys/socket.h>
12160 int main() {
12161     int i = $ENUM;
12162 }
12163 EOF
12164     val="$undef"
12165     set try; if eval $compile; then
12166         val="$define"
12167     fi
12168     set d_${enum}; eval $setvar
12169     $rm_try
12170 done
12171
12172 : see if this is a sys/uio.h system
12173 set sys/uio.h i_sysuio
12174 eval $inhdr
12175
12176 : Check for cmsghdr support
12177 echo " "
12178 echo "Checking to see if your system supports struct cmsghdr..." >&4
12179 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12180 eval $hasstruct
12181 case "$d_cmsghdr_s" in
12182 "$define")      echo "Yes, it does."   ;;
12183 *)              echo "No, it doesn't." ;;
12184 esac
12185
12186 : see if copysign exists
12187 set copysign d_copysign
12188 eval $inlibc
12189
12190 : see if copysignl exists
12191 set copysignl d_copysignl
12192 eval $inlibc
12193
12194 : see if crypt exists
12195 echo " "
12196 set crypt d_crypt
12197 eval $inlibc
12198 case "$d_crypt" in
12199 $define) cryptlib='' ;;
12200 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12201                 echo 'crypt() found.' >&4
12202                 val="$define"
12203                 cryptlib=''
12204         else
12205                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12206                 if $test -z "$cryptlib"; then
12207                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12208                 else
12209                         cryptlib=-lcrypt
12210                 fi
12211                 if $test -z "$cryptlib"; then
12212                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12213                 else
12214                         cryptlib=-lcrypt
12215                 fi
12216                 if $test -z "$cryptlib"; then
12217                         cryptlib=`./loc libcrypt$_a "" $libpth`
12218                 else
12219                         cryptlib=-lcrypt
12220                 fi
12221                 if $test -z "$cryptlib"; then
12222                         echo 'crypt() NOT found.' >&4
12223                         val="$undef"
12224                 else
12225                         val="$define"
12226                 fi
12227         fi
12228         set d_crypt
12229         eval $setvar
12230         ;;
12231 esac
12232
12233 : see if this is a crypt.h system
12234 set crypt.h i_crypt
12235 eval $inhdr
12236
12237 : see if crypt_r exists
12238 set crypt_r d_crypt_r
12239 eval $inlibc
12240 case "$d_crypt_r" in
12241 "$define")
12242         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12243         case "$d_crypt_r_proto:$usethreads" in
12244         ":define")      d_crypt_r_proto=define
12245                 set d_crypt_r_proto crypt_r $hdrs
12246                 eval $hasproto ;;
12247         *)      ;;
12248         esac
12249         case "$d_crypt_r_proto" in
12250         define)
12251         case "$crypt_r_proto" in
12252         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12253         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12254         esac
12255         case "$crypt_r_proto" in
12256         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12257         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12258         esac
12259         case "$crypt_r_proto" in
12260         ''|0)   d_crypt_r=undef
12261                 crypt_r_proto=0
12262                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12263         * )     case "$crypt_r_proto" in
12264                 REENTRANT_PROTO*) ;;
12265                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12266                 esac
12267                 echo "Prototype: $try" ;;
12268         esac
12269         ;;
12270         *)      case "$usethreads" in
12271                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12272                 esac
12273                 d_crypt_r=undef
12274                 crypt_r_proto=0
12275                 ;;
12276         esac
12277         ;;
12278 *)      crypt_r_proto=0
12279         ;;
12280 esac
12281
12282 : get csh whereabouts
12283 case "$csh" in
12284 'csh') val="$undef" ;;
12285 *) val="$define" ;;
12286 esac
12287 set d_csh
12288 eval $setvar
12289 : Respect a hint or command line value for full_csh.
12290 case "$full_csh" in
12291 '') full_csh=$csh ;;
12292 esac
12293
12294 : see if ctermid exists
12295 set ctermid d_ctermid
12296 eval $inlibc
12297
12298 : see if ctermid_r exists
12299 set ctermid_r d_ctermid_r
12300 eval $inlibc
12301 case "$d_ctermid_r" in
12302 "$define")
12303         hdrs="$i_systypes sys/types.h define stdio.h "
12304         case "$d_ctermid_r_proto:$usethreads" in
12305         ":define")      d_ctermid_r_proto=define
12306                 set d_ctermid_r_proto ctermid_r $hdrs
12307                 eval $hasproto ;;
12308         *)      ;;
12309         esac
12310         case "$d_ctermid_r_proto" in
12311         define)
12312         case "$ctermid_r_proto" in
12313         ''|0) try='char* ctermid_r(char*);'
12314         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12315         esac
12316         case "$ctermid_r_proto" in
12317         ''|0)   d_ctermid_r=undef
12318                 ctermid_r_proto=0
12319                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12320         * )     case "$ctermid_r_proto" in
12321                 REENTRANT_PROTO*) ;;
12322                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12323                 esac
12324                 echo "Prototype: $try" ;;
12325         esac
12326         ;;
12327         *)      case "$usethreads" in
12328                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12329                 esac
12330                 d_ctermid_r=undef
12331                 ctermid_r_proto=0
12332                 ;;
12333         esac
12334         ;;
12335 *)      ctermid_r_proto=0
12336         ;;
12337 esac
12338
12339 : see if ctime_r exists
12340 set ctime_r d_ctime_r
12341 eval $inlibc
12342 case "$d_ctime_r" in
12343 "$define")
12344         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12345         case "$d_ctime_r_proto:$usethreads" in
12346         ":define")      d_ctime_r_proto=define
12347                 set d_ctime_r_proto ctime_r $hdrs
12348                 eval $hasproto ;;
12349         *)      ;;
12350         esac
12351         case "$d_ctime_r_proto" in
12352         define)
12353         case "$ctime_r_proto" in
12354         ''|0) try='char* ctime_r(const time_t*, char*);'
12355         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12356         esac
12357         case "$ctime_r_proto" in
12358         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12359         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12360         esac
12361         case "$ctime_r_proto" in
12362         ''|0) try='int ctime_r(const time_t*, char*);'
12363         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12364         esac
12365         case "$ctime_r_proto" in
12366         ''|0) try='int ctime_r(const time_t*, char*, int);'
12367         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12368         esac
12369         case "$ctime_r_proto" in
12370         ''|0)   d_ctime_r=undef
12371                 ctime_r_proto=0
12372                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12373         * )     case "$ctime_r_proto" in
12374                 REENTRANT_PROTO*) ;;
12375                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12376                 esac
12377                 echo "Prototype: $try" ;;
12378         esac
12379         ;;
12380         *)      case "$usethreads" in
12381                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12382                 esac
12383                 d_ctime_r=undef
12384                 ctime_r_proto=0
12385                 ;;
12386         esac
12387         ;;
12388 *)      ctime_r_proto=0
12389         ;;
12390 esac
12391
12392 : see if cuserid exists
12393 set cuserid d_cuserid
12394 eval $inlibc
12395
12396 : see if dbm.h is available
12397 : see if dbmclose exists
12398 set dbmclose d_dbmclose
12399 eval $inlibc
12400
12401 case "$d_dbmclose" in
12402 $define)
12403         set dbm.h i_dbm
12404         eval $inhdr
12405         case "$i_dbm" in
12406         $define)
12407                 val="$undef"
12408                 set i_rpcsvcdbm
12409                 eval $setvar
12410                 ;;
12411         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12412                 eval $inhdr
12413                 ;;
12414         esac
12415         ;;
12416 *)      echo "We won't be including <dbm.h>"
12417         val="$undef"
12418         set i_dbm
12419         eval $setvar
12420         val="$undef"
12421         set i_rpcsvcdbm
12422         eval $setvar
12423         ;;
12424 esac
12425
12426 : see if prototype for dbminit is available
12427 echo " "
12428 set d_dbminitproto dbminit $i_dbm dbm.h
12429 eval $hasproto
12430
12431 : see if difftime exists
12432 set difftime d_difftime
12433 eval $inlibc
12434
12435 : see if this is a dirent system
12436 echo " "
12437 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12438         val="$define"
12439         echo "<dirent.h> found." >&4
12440 else
12441         val="$undef"
12442         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12443                 echo "<sys/dir.h> found." >&4
12444                 echo " "
12445         else
12446                 xinc=`./findhdr sys/ndir.h`
12447         fi
12448         echo "<dirent.h> NOT found." >&4
12449 fi
12450 set i_dirent
12451 eval $setvar
12452
12453 : Look for type of directory structure.
12454 echo " "
12455 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12456
12457 case "$direntrytype" in
12458 ''|' ')
12459         case "$i_dirent" in
12460         $define) guess1='struct dirent' ;;
12461         *) guess1='struct direct'  ;;
12462         esac
12463         ;;
12464 *)      guess1="$direntrytype"
12465         ;;
12466 esac
12467
12468 case "$guess1" in
12469 'struct dirent') guess2='struct direct' ;;
12470 *) guess2='struct dirent' ;;
12471 esac
12472
12473 if $contains "$guess1" try.c >/dev/null 2>&1; then
12474         direntrytype="$guess1"
12475         echo "Your directory entries are $direntrytype." >&4
12476 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12477         direntrytype="$guess2"
12478         echo "Your directory entries seem to be $direntrytype." >&4
12479 else
12480         echo "I don't recognize your system's directory entries." >&4
12481         rp="What type is used for directory entries on this system?"
12482         dflt="$guess1"
12483         . ./myread
12484         direntrytype="$ans"
12485 fi
12486 $rm_try
12487
12488 : see if the directory entry stores field length
12489 echo " "
12490 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12491 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12492         echo "Good, your directory entry keeps length information in d_namlen." >&4
12493         val="$define"
12494 else
12495         echo "Your directory entry does not know about the d_namlen field." >&4
12496         val="$undef"
12497 fi
12498 set d_dirnamlen
12499 eval $setvar
12500 $rm_try
12501
12502 : Look for DIR.dd_fd
12503 case "$i_dirent" in
12504 "$define")
12505     echo "Checking to see if DIR has a dd_fd member variable" >&4
12506     $cat >try.c <<EOCP
12507 #$i_stdlib I_STDLIB
12508 #ifdef I_STDLIB
12509 #include <stdlib.h>
12510 #endif
12511 #include <dirent.h>
12512
12513 int main() {
12514     DIR dir;
12515     dir.dd_fd = 1;
12516     return 0;
12517 }
12518 EOCP
12519     val=$undef
12520     set try
12521     if eval $compile; then
12522         echo "Yes, it does."
12523         val="$define"
12524     else
12525         echo "No, it does not."
12526         val="$undef"
12527     fi
12528     ;;
12529 *)
12530     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12531     val="$undef"
12532     ;;
12533 esac
12534 set d_dir_dd_fd
12535 eval $setvar
12536 $rm_try
12537
12538 : see if this is an sysdir system
12539 set sys/dir.h i_sysdir
12540 eval $inhdr
12541
12542 : see if this is an sysndir system
12543 set sys/ndir.h i_sysndir
12544 eval $inhdr
12545
12546 : Look for dirfd
12547 echo " "
12548 $cat >dirfd.c <<EOM
12549 #include <stdio.h>
12550 #$i_stdlib I_STDLIB
12551 #ifdef I_STDLIB
12552 #include <stdlib.h>
12553 #endif
12554 #$i_dirent I_DIRENT             /**/
12555 #$i_sysdir I_SYS_DIR            /**/
12556 #$i_sysndir I_SYS_NDIR          /**/
12557 #$i_systypes I_SYS_TYPES        /**/
12558 #if defined(I_SYS_TYPES)
12559 #include <sys/types.h>
12560 #endif
12561 #if defined(I_DIRENT)
12562 #include <dirent.h>
12563 #else
12564 #ifdef I_SYS_NDIR
12565 #include <sys/ndir.h>
12566 #else
12567 #ifdef I_SYS_DIR
12568 #include <sys/dir.h>
12569 #endif
12570 #endif
12571 #endif
12572 int main() {
12573         DIR *dirp = opendir(".");
12574         if (dirfd(dirp) >= 0)
12575                 exit(0);
12576         else
12577                 exit(1);
12578 }
12579 EOM
12580 val=$undef
12581 set dirfd
12582 if eval $compile; then
12583         val="$define"
12584 fi
12585 case "$val" in
12586 $define)        echo "dirfd() found." >&4       ;;
12587 *)              echo "dirfd() NOT found." >&4   ;;
12588 esac
12589 set d_dirfd
12590 eval $setvar
12591 $rm -f dirfd*
12592
12593 : see if dladdr exists
12594 set dladdr d_dladdr
12595 eval $inlibc
12596
12597 : see if dlerror exists
12598 xxx_runnm="$runnm"
12599 runnm=false
12600 set dlerror d_dlerror
12601 eval $inlibc
12602 runnm="$xxx_runnm"
12603
12604 : see if dlfcn is available
12605 set dlfcn.h i_dlfcn
12606 eval $inhdr
12607
12608 : Check what extension to use for shared libs
12609 case "$usedl" in
12610 $define|y|true)
12611         $cat << EOM
12612
12613 On a few systems, the dynamically loaded modules that perl generates and uses
12614 will need a different extension than shared libs. The default will probably
12615 be appropriate.
12616
12617 EOM
12618         case "$dlext" in
12619         '')     dflt="$so" ;;
12620         *)      dflt="$dlext" ;;
12621         esac
12622         rp='What is the extension of dynamically loaded modules'
12623         . ./myread
12624         dlext="$ans"
12625         ;;
12626 *)
12627         dlext="none"
12628         ;;
12629 esac
12630
12631 : Check if dlsym need a leading underscore
12632 echo " "
12633 val="$undef"
12634
12635 case "$dlsrc" in
12636 dl_dlopen.xs)
12637         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12638         $cat >dyna.c <<'EOM'
12639 void fred (void) { }
12640 EOM
12641
12642 $cat >fred.c<<EOM
12643
12644 #include <stdio.h>
12645 #$i_stdlib I_STDLIB
12646 #ifdef I_STDLIB
12647 #include <stdlib.h>
12648 #endif
12649 #$i_dlfcn I_DLFCN
12650 #ifdef I_DLFCN
12651 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12652 #else
12653 #include <sys/types.h>
12654 #include <nlist.h>
12655 #include <link.h>
12656 #endif
12657
12658 extern void fred(void) ;
12659
12660 int main()
12661 {
12662     void * handle ;
12663     void * symbol ;
12664 #ifndef RTLD_LAZY
12665     int mode = 1 ;
12666 #else
12667     int mode = RTLD_LAZY ;
12668 #endif
12669     handle = dlopen("./dyna.$dlext", mode) ;
12670     if (handle == NULL) {
12671         printf ("1\n") ;
12672         fflush (stdout) ;
12673         exit(0);
12674     }
12675     symbol = dlsym(handle, "fred") ;
12676     if (symbol == NULL) {
12677         /* try putting a leading underscore */
12678         symbol = dlsym(handle, "_fred") ;
12679         if (symbol == NULL) {
12680             printf ("2\n") ;
12681             fflush (stdout) ;
12682             exit(0);
12683         }
12684         printf ("3\n") ;
12685     }
12686     else
12687         printf ("4\n") ;
12688     fflush (stdout) ;
12689     exit(0);
12690 }
12691 EOM
12692         : Call the object file tmp-dyna.o in case dlext=o.
12693         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12694                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12695                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12696                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12697                 xxx=`$run ./fred`
12698                 case $xxx in
12699                 1)      echo "Test program failed using dlopen." >&4
12700                         echo "Perhaps you should not use dynamic loading." >&4;;
12701                 2)      echo "Test program failed using dlsym." >&4
12702                         echo "Perhaps you should not use dynamic loading." >&4;;
12703                 3)      echo "dlsym needs a leading underscore" >&4
12704                         val="$define" ;;
12705                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12706                 esac
12707         else
12708                 echo "I can't compile and run the test program." >&4
12709                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12710         fi
12711         ;;
12712 esac
12713
12714 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12715
12716 set d_dlsymun
12717 eval $setvar
12718
12719 : see if drand48_r exists
12720 set drand48_r d_drand48_r
12721 eval $inlibc
12722 case "$d_drand48_r" in
12723 "$define")
12724         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12725         case "$d_drand48_r_proto:$usethreads" in
12726         ":define")      d_drand48_r_proto=define
12727                 set d_drand48_r_proto drand48_r $hdrs
12728                 eval $hasproto ;;
12729         *)      ;;
12730         esac
12731         case "$d_drand48_r_proto" in
12732         define)
12733         case "$drand48_r_proto" in
12734         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12735         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12736         esac
12737         case "$drand48_r_proto" in
12738         ''|0)   d_drand48_r=undef
12739                 drand48_r_proto=0
12740                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12741         * )     case "$drand48_r_proto" in
12742                 REENTRANT_PROTO*) ;;
12743                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12744                 esac
12745                 echo "Prototype: $try" ;;
12746         esac
12747         ;;
12748         *)      case "$usethreads" in
12749                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12750                 esac
12751                 d_drand48_r=undef
12752                 drand48_r_proto=0
12753                 ;;
12754         esac
12755         ;;
12756 *)      drand48_r_proto=0
12757         ;;
12758 esac
12759
12760 : see if prototype for drand48 is available
12761 echo " "
12762 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12763 eval $hasproto
12764
12765 : see if dup2 exists
12766 set dup2 d_dup2
12767 eval $inlibc
12768
12769 : see if dup3 exists
12770 set dup3 d_dup3
12771 eval $inlibc
12772
12773 : see if localeconv_l exists
12774 set localeconv_l d_localeconv_l
12775 eval $inlibc
12776
12777 : see if this is an xlocale.h system
12778 set xlocale.h i_xlocale
12779 eval $inhdr
12780
12781 : see if newlocale exists
12782 set newlocale d_newlocale
12783 eval $inlibc
12784
12785 : see if freelocale exists
12786 set freelocale d_freelocale
12787 eval $inlibc
12788
12789 : see if uselocale exists
12790 set uselocale d_uselocale
12791 eval $inlibc
12792
12793 : see if duplocale exists
12794 set duplocale d_duplocale
12795 eval $inlibc
12796
12797 : see if querylocale exists
12798 set querylocale d_querylocale
12799 eval $inlibc
12800
12801 : if we have xlocale.h, check whether it is needed
12802 case "$i_xlocale$d_newlocale$xlocale_needed" in
12803 "$define$define")
12804         echo "Checking if xlocale.h is needed..." >&4
12805         $cat >try.c <<EOF
12806 #include <locale.h>
12807 #include <stdio.h>
12808 #ifdef TRY_XLOCALE
12809 #include <xlocale.h>
12810 #endif
12811 #$d_localeconv_l HAVE_LOCALECONV_L
12812
12813 #ifdef HAVE_LOCALECONV_L
12814 struct lconv *(*lcptr)(locale_t) = localeconv_l;
12815 #endif
12816
12817 int main(void) {
12818   locale_t lc = newlocale(LC_ALL_MASK, "C", (locale_t)0);
12819
12820 #ifdef HAVE_LOCALECONV_L
12821   /* FreeBSD hides only localeconv_l() in xlocale.h */
12822   struct lconv *lcbuf = localeconv_l(lc);
12823   printf("decimal: %s\n", lcbuf->decimal_point);
12824 #endif
12825
12826   freelocale(lc);
12827   return 0;
12828 }
12829 EOF
12830         set try
12831         if eval $compile && $run ./try > /dev/null 2>&1 ; then
12832                 echo "xlocale.h isn't needed" >&4
12833                 xlocale_needed=$undef
12834         else
12835                 set try -DTRY_XLOCALE
12836                 if eval $compile && $run ./try > /dev/null 2>&1 ; then
12837                         xlocale_needed=$define
12838                         echo "xlocale.h is needed" >&4
12839                 else
12840                         echo "I can't build my test either way" >&4
12841                         xlocale_needed=$undef
12842                 fi
12843         fi
12844         $rm_try
12845         ;;
12846 *) xlocale_needed=$undef ;;
12847 esac
12848
12849 : see if eaccess exists
12850 set eaccess d_eaccess
12851 eval $inlibc
12852
12853 : see if endgrent exists
12854 set endgrent d_endgrent
12855 eval $inlibc
12856
12857 : see if this is an grp system
12858 set grp.h i_grp
12859 eval $inhdr
12860
12861 case "$i_grp" in
12862 $define)
12863         xxx=`./findhdr grp.h`
12864         $cppstdin $cppflags $cppminus < $xxx >$$.h
12865
12866         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12867                 val="$define"
12868         else
12869                 val="$undef"
12870         fi
12871         set d_grpasswd
12872         eval $setvar
12873
12874         $rm -f $$.h
12875         ;;
12876 *)
12877         val="$undef";
12878         set d_grpasswd; eval $setvar
12879         ;;
12880 esac
12881
12882 : see if endgrent_r exists
12883 set endgrent_r d_endgrent_r
12884 eval $inlibc
12885 case "$d_endgrent_r" in
12886 "$define")
12887         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12888         case "$d_endgrent_r_proto:$usethreads" in
12889         ":define")      d_endgrent_r_proto=define
12890                 set d_endgrent_r_proto endgrent_r $hdrs
12891                 eval $hasproto ;;
12892         *)      ;;
12893         esac
12894         case "$d_endgrent_r_proto" in
12895         define)
12896         case "$endgrent_r_proto" in
12897         ''|0) try='int endgrent_r(FILE**);'
12898         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12899         esac
12900         case "$endgrent_r_proto" in
12901         ''|0) try='void endgrent_r(FILE**);'
12902         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12903         esac
12904         case "$endgrent_r_proto" in
12905         ''|0)   d_endgrent_r=undef
12906                 endgrent_r_proto=0
12907                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12908         * )     case "$endgrent_r_proto" in
12909                 REENTRANT_PROTO*) ;;
12910                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12911                 esac
12912                 echo "Prototype: $try" ;;
12913         esac
12914         ;;
12915         *)      case "$usethreads" in
12916                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12917                 esac
12918                 d_endgrent_r=undef
12919                 endgrent_r_proto=0
12920                 ;;
12921         esac
12922         ;;
12923 *)      endgrent_r_proto=0
12924         ;;
12925 esac
12926
12927 : see if endhostent exists
12928 set endhostent d_endhent
12929 eval $inlibc
12930
12931 : see if this is a netdb.h system
12932 set netdb.h i_netdb
12933 eval $inhdr
12934
12935 : see if endhostent_r exists
12936 set endhostent_r d_endhostent_r
12937 eval $inlibc
12938 case "$d_endhostent_r" in
12939 "$define")
12940         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12941         case "$d_endhostent_r_proto:$usethreads" in
12942         ":define")      d_endhostent_r_proto=define
12943                 set d_endhostent_r_proto endhostent_r $hdrs
12944                 eval $hasproto ;;
12945         *)      ;;
12946         esac
12947         case "$d_endhostent_r_proto" in
12948         define)
12949         case "$endhostent_r_proto" in
12950         ''|0) try='int endhostent_r(struct hostent_data*);'
12951         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12952         esac
12953         case "$endhostent_r_proto" in
12954         ''|0) try='void endhostent_r(struct hostent_data*);'
12955         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12956         esac
12957         case "$endhostent_r_proto" in
12958         ''|0)   d_endhostent_r=undef
12959                 endhostent_r_proto=0
12960                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12961         * )     case "$endhostent_r_proto" in
12962                 REENTRANT_PROTO*) ;;
12963                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12964                 esac
12965                 echo "Prototype: $try" ;;
12966         esac
12967         ;;
12968         *)      case "$usethreads" in
12969                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12970                 esac
12971                 d_endhostent_r=undef
12972                 endhostent_r_proto=0
12973                 ;;
12974         esac
12975         ;;
12976 *)      endhostent_r_proto=0
12977         ;;
12978 esac
12979
12980 : see if endnetent exists
12981 set endnetent d_endnent
12982 eval $inlibc
12983
12984 : see if endnetent_r exists
12985 set endnetent_r d_endnetent_r
12986 eval $inlibc
12987 case "$d_endnetent_r" in
12988 "$define")
12989         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12990         case "$d_endnetent_r_proto:$usethreads" in
12991         ":define")      d_endnetent_r_proto=define
12992                 set d_endnetent_r_proto endnetent_r $hdrs
12993                 eval $hasproto ;;
12994         *)      ;;
12995         esac
12996         case "$d_endnetent_r_proto" in
12997         define)
12998         case "$endnetent_r_proto" in
12999         ''|0) try='int endnetent_r(struct netent_data*);'
13000         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
13001         esac
13002         case "$endnetent_r_proto" in
13003         ''|0) try='void endnetent_r(struct netent_data*);'
13004         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
13005         esac
13006         case "$endnetent_r_proto" in
13007         ''|0)   d_endnetent_r=undef
13008                 endnetent_r_proto=0
13009                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
13010         * )     case "$endnetent_r_proto" in
13011                 REENTRANT_PROTO*) ;;
13012                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
13013                 esac
13014                 echo "Prototype: $try" ;;
13015         esac
13016         ;;
13017         *)      case "$usethreads" in
13018                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
13019                 esac
13020                 d_endnetent_r=undef
13021                 endnetent_r_proto=0
13022                 ;;
13023         esac
13024         ;;
13025 *)      endnetent_r_proto=0
13026         ;;
13027 esac
13028
13029 : see if endprotoent exists
13030 set endprotoent d_endpent
13031 eval $inlibc
13032
13033 : see if endprotoent_r exists
13034 set endprotoent_r d_endprotoent_r
13035 eval $inlibc
13036 case "$d_endprotoent_r" in
13037 "$define")
13038         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13039         case "$d_endprotoent_r_proto:$usethreads" in
13040         ":define")      d_endprotoent_r_proto=define
13041                 set d_endprotoent_r_proto endprotoent_r $hdrs
13042                 eval $hasproto ;;
13043         *)      ;;
13044         esac
13045         case "$d_endprotoent_r_proto" in
13046         define)
13047         case "$endprotoent_r_proto" in
13048         ''|0) try='int endprotoent_r(struct protoent_data*);'
13049         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
13050         esac
13051         case "$endprotoent_r_proto" in
13052         ''|0) try='void endprotoent_r(struct protoent_data*);'
13053         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
13054         esac
13055         case "$endprotoent_r_proto" in
13056         ''|0)   d_endprotoent_r=undef
13057                 endprotoent_r_proto=0
13058                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
13059         * )     case "$endprotoent_r_proto" in
13060                 REENTRANT_PROTO*) ;;
13061                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
13062                 esac
13063                 echo "Prototype: $try" ;;
13064         esac
13065         ;;
13066         *)      case "$usethreads" in
13067                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
13068                 esac
13069                 d_endprotoent_r=undef
13070                 endprotoent_r_proto=0
13071                 ;;
13072         esac
13073         ;;
13074 *)      endprotoent_r_proto=0
13075         ;;
13076 esac
13077
13078 : see if endpwent exists
13079 set endpwent d_endpwent
13080 eval $inlibc
13081
13082 : see if this is a pwd.h system
13083 set pwd.h i_pwd
13084 eval $inhdr
13085
13086 case "$i_pwd" in
13087 $define)
13088         xxx=`./findhdr pwd.h`
13089         $cppstdin $cppflags $cppminus < $xxx >$$.h
13090
13091         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
13092                 val="$define"
13093         else
13094                 val="$undef"
13095         fi
13096         set d_pwquota
13097         eval $setvar
13098
13099         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
13100                 val="$define"
13101         else
13102                 val="$undef"
13103         fi
13104         set d_pwage
13105         eval $setvar
13106
13107         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
13108                 val="$define"
13109         else
13110                 val="$undef"
13111         fi
13112         set d_pwchange
13113         eval $setvar
13114
13115         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
13116                 val="$define"
13117         else
13118                 val="$undef"
13119         fi
13120         set d_pwclass
13121         eval $setvar
13122
13123         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
13124                 val="$define"
13125         else
13126                 val="$undef"
13127         fi
13128         set d_pwexpire
13129         eval $setvar
13130
13131         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
13132                 val="$define"
13133         else
13134                 val="$undef"
13135         fi
13136         set d_pwcomment
13137         eval $setvar
13138
13139         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13140                 val="$define"
13141         else
13142                 val="$undef"
13143         fi
13144         set d_pwgecos
13145         eval $setvar
13146
13147         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13148                 val="$define"
13149         else
13150                 val="$undef"
13151         fi
13152         set d_pwpasswd
13153         eval $setvar
13154
13155         $rm -f $$.h
13156         ;;
13157 *)
13158         val="$undef";
13159         set d_pwquota; eval $setvar
13160         set d_pwage; eval $setvar
13161         set d_pwchange; eval $setvar
13162         set d_pwclass; eval $setvar
13163         set d_pwexpire; eval $setvar
13164         set d_pwcomment; eval $setvar
13165         set d_pwgecos; eval $setvar
13166         set d_pwpasswd; eval $setvar
13167         ;;
13168 esac
13169
13170 : see if endpwent_r exists
13171 set endpwent_r d_endpwent_r
13172 eval $inlibc
13173 case "$d_endpwent_r" in
13174 "$define")
13175         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13176         case "$d_endpwent_r_proto:$usethreads" in
13177         ":define")      d_endpwent_r_proto=define
13178                 set d_endpwent_r_proto endpwent_r $hdrs
13179                 eval $hasproto ;;
13180         *)      ;;
13181         esac
13182         case "$d_endpwent_r_proto" in
13183         define)
13184         case "$endpwent_r_proto" in
13185         ''|0) try='int endpwent_r(FILE**);'
13186         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13187         esac
13188         case "$endpwent_r_proto" in
13189         ''|0) try='void endpwent_r(FILE**);'
13190         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13191         esac
13192         case "$endpwent_r_proto" in
13193         ''|0)   d_endpwent_r=undef
13194                 endpwent_r_proto=0
13195                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13196         * )     case "$endpwent_r_proto" in
13197                 REENTRANT_PROTO*) ;;
13198                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13199                 esac
13200                 echo "Prototype: $try" ;;
13201         esac
13202         ;;
13203         *)      case "$usethreads" in
13204                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13205                 esac
13206                 d_endpwent_r=undef
13207                 endpwent_r_proto=0
13208                 ;;
13209         esac
13210         ;;
13211 *)      endpwent_r_proto=0
13212         ;;
13213 esac
13214
13215 : see if endservent exists
13216 set endservent d_endsent
13217 eval $inlibc
13218
13219 : see if endservent_r exists
13220 set endservent_r d_endservent_r
13221 eval $inlibc
13222 case "$d_endservent_r" in
13223 "$define")
13224         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13225         case "$d_endservent_r_proto:$usethreads" in
13226         ":define")      d_endservent_r_proto=define
13227                 set d_endservent_r_proto endservent_r $hdrs
13228                 eval $hasproto ;;
13229         *)      ;;
13230         esac
13231         case "$d_endservent_r_proto" in
13232         define)
13233         case "$endservent_r_proto" in
13234         ''|0) try='int endservent_r(struct servent_data*);'
13235         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13236         esac
13237         case "$endservent_r_proto" in
13238         ''|0) try='void endservent_r(struct servent_data*);'
13239         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13240         esac
13241         case "$endservent_r_proto" in
13242         ''|0)   d_endservent_r=undef
13243                 endservent_r_proto=0
13244                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13245         * )     case "$endservent_r_proto" in
13246                 REENTRANT_PROTO*) ;;
13247                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13248                 esac
13249                 echo "Prototype: $try" ;;
13250         esac
13251         ;;
13252         *)      case "$usethreads" in
13253                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13254                 esac
13255                 d_endservent_r=undef
13256                 endservent_r_proto=0
13257                 ;;
13258         esac
13259         ;;
13260 *)      endservent_r_proto=0
13261         ;;
13262 esac
13263
13264 : Locate the flags for 'open()'
13265 echo " "
13266 $cat >try.c <<EOCP
13267 #include <sys/types.h>
13268 #ifdef I_FCNTL
13269 #include <fcntl.h>
13270 #endif
13271 #ifdef I_SYS_FILE
13272 #include <sys/file.h>
13273 #endif
13274 #$i_stdlib I_STDLIB
13275 #ifdef I_STDLIB
13276 #include <stdlib.h>
13277 #endif
13278 int main() {
13279         if(O_RDONLY);
13280 #ifdef O_TRUNC
13281         exit(0);
13282 #else
13283         exit(1);
13284 #endif
13285 }
13286 EOCP
13287 : check sys/file.h first to get FREAD on Sun
13288 if $test `./findhdr sys/file.h` && \
13289                 set try -DI_SYS_FILE && eval $compile; then
13290         h_sysfile=true;
13291         echo "<sys/file.h> defines the O_* constants..." >&4
13292         if $run ./try; then
13293                 echo "and you have the 3 argument form of open()." >&4
13294                 val="$define"
13295         else
13296                 echo "but not the 3 argument form of open().  Oh, well." >&4
13297                 val="$undef"
13298         fi
13299 elif $test `./findhdr fcntl.h` && \
13300                 set try -DI_FCNTL && eval $compile; then
13301         h_fcntl=true;
13302         echo "<fcntl.h> defines the O_* constants..." >&4
13303         if $run ./try; then
13304                 echo "and you have the 3 argument form of open()." >&4
13305                 val="$define"
13306         else
13307                 echo "but not the 3 argument form of open().  Oh, well." >&4
13308                 val="$undef"
13309         fi
13310 else
13311         val="$undef"
13312         echo "I can't find the O_* constant definitions!  You got problems." >&4
13313 fi
13314 set d_open3
13315 eval $setvar
13316 $rm_try
13317
13318 : see if this is a sys/file.h system
13319 val=''
13320 set sys/file.h val
13321 eval $inhdr
13322
13323 : do we need to include sys/file.h ?
13324 case "$val" in
13325 "$define")
13326         echo " "
13327         if $h_sysfile; then
13328                 val="$define"
13329                 echo "We'll be including <sys/file.h>." >&4
13330         else
13331                 val="$undef"
13332                 echo "We won't be including <sys/file.h>." >&4
13333         fi
13334         ;;
13335 *)
13336         h_sysfile=false
13337         ;;
13338 esac
13339 set i_sysfile
13340 eval $setvar
13341
13342 : see if fcntl.h is there
13343 val=''
13344 set fcntl.h val
13345 eval $inhdr
13346
13347 : see if we can include fcntl.h
13348 case "$val" in
13349 "$define")
13350         echo " "
13351         if $h_fcntl; then
13352                 val="$define"
13353                 echo "We'll be including <fcntl.h>." >&4
13354         else
13355                 val="$undef"
13356                 if $h_sysfile; then
13357         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13358                 else
13359                         echo "We won't be including <fcntl.h>." >&4
13360                 fi
13361         fi
13362         ;;
13363 *)
13364         h_fcntl=false
13365         val="$undef"
13366         ;;
13367 esac
13368 set i_fcntl
13369 eval $setvar
13370
13371 : see if fork exists
13372 set fork d_fork
13373 eval $inlibc
13374
13375 : see if pipe exists
13376 set pipe d_pipe
13377 eval $inlibc
13378
13379 : check for non-blocking I/O stuff
13380 case "$h_sysfile" in
13381 true) echo "#include <sys/file.h>" > head.c;;
13382 *)
13383        case "$h_fcntl" in
13384        true) echo "#include <fcntl.h>" > head.c;;
13385        *) echo "#include <sys/fcntl.h>" > head.c;;
13386        esac
13387        ;;
13388 esac
13389 echo " "
13390 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13391 case "$o_nonblock" in
13392 '')
13393         $cat head.c > try.c
13394         $cat >>try.c <<EOCP
13395 #include <stdio.h>
13396 #$i_stdlib I_STDLIB
13397 #ifdef I_STDLIB
13398 #include <stdlib.h>
13399 #endif
13400 #$i_fcntl I_FCNTL
13401 #ifdef I_FCNTL
13402 #include <fcntl.h>
13403 #endif
13404 int main() {
13405 #ifdef O_NONBLOCK
13406         printf("O_NONBLOCK\n");
13407         exit(0);
13408 #endif
13409 #ifdef O_NDELAY
13410         printf("O_NDELAY\n");
13411         exit(0);
13412 #endif
13413 #ifdef FNDELAY
13414         printf("FNDELAY\n");
13415         exit(0);
13416 #endif
13417         exit(0);
13418 }
13419 EOCP
13420         set try
13421         if eval $compile_ok; then
13422                 o_nonblock=`$run ./try`
13423                 case "$o_nonblock" in
13424                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13425                 *) echo "Seems like we can use $o_nonblock.";;
13426                 esac
13427         else
13428                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13429         fi
13430         ;;
13431 *) echo "Using $hint value $o_nonblock.";;
13432 esac
13433 $rm_try
13434
13435 echo " "
13436 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13437 case "$eagain" in
13438 '')
13439         case "$d_fork:$d_pipe:$d_alarm" in
13440         define:define:define)
13441         $cat head.c > try.c
13442         $cat >>try.c <<EOCP
13443 #include <errno.h>
13444 #include <sys/types.h>
13445 #include <signal.h>
13446 #include <stdio.h>
13447 #$i_stdlib I_STDLIB
13448 #ifdef I_STDLIB
13449 #include <stdlib.h>
13450 #endif
13451 #$i_fcntl I_FCNTL
13452 #ifdef I_FCNTL
13453 #include <fcntl.h>
13454 #endif
13455 #define MY_O_NONBLOCK $o_nonblock
13456 #ifndef errno  /* XXX need better Configure test */
13457 extern int errno;
13458 #endif
13459 #$i_unistd I_UNISTD
13460 #ifdef I_UNISTD
13461 #include <unistd.h>
13462 #endif
13463 #include <string.h>
13464 $signal_t blech(int x) { exit(3); }
13465 EOCP
13466         $cat >> try.c <<'EOCP'
13467 int main()
13468 {
13469         int pd[2];
13470         int pu[2];
13471         char buf[1];
13472         char string[100];
13473         int ret;
13474
13475         ret = pipe(pd); /* Down: child -> parent */
13476         if (ret != 0)
13477                 exit(3);
13478         ret = pipe(pu); /* Up: parent -> child */
13479         if (ret != 0)
13480                 exit(3);
13481         if (0 != fork()) {
13482                 close(pd[1]);   /* Parent reads from pd[0] */
13483                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13484 #ifdef F_SETFL
13485                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13486                         exit(1);
13487 #else
13488                 exit(4);
13489 #endif
13490                 signal(SIGALRM, blech);
13491                 alarm(5);
13492                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13493                         exit(2);
13494                 sprintf(string, "%d\n", ret);
13495                 ret = write(2, string, strlen(string));
13496                 if (ret != strlen(string))
13497                         exit(3);
13498                 alarm(0);
13499 #ifdef EAGAIN
13500                 if (errno == EAGAIN) {
13501                         printf("EAGAIN\n");
13502                         goto ok;
13503                 }
13504 #endif
13505 #ifdef EWOULDBLOCK
13506                 if (errno == EWOULDBLOCK)
13507                         printf("EWOULDBLOCK\n");
13508 #endif
13509         ok:
13510                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13511                 if (ret != 1)
13512                         exit(3);
13513                 sleep(2);                               /* Give it time to close our pipe */
13514                 alarm(5);
13515                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13516                 alarm(0);
13517                 sprintf(string, "%d\n", ret);
13518                 ret = write(4, string, strlen(string));
13519                 if (ret != strlen(string))
13520                         exit(3);
13521                 exit(0);
13522         }
13523
13524         close(pd[0]);                   /* We write to pd[1] */
13525         close(pu[1]);                   /* We read from pu[0] */
13526         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13527         if (ret != 1)
13528                 exit(3);
13529         close(pd[1]);                   /* Pipe pd is now fully closed! */
13530         exit(0);                                /* Bye bye, thank you for playing! */
13531 }
13532 EOCP
13533         set try
13534         if eval $compile_ok; then
13535                 echo "$startsh" >mtry
13536                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13537                 chmod +x mtry
13538                 $run ./mtry >/dev/null 2>&1
13539                 case $? in
13540                 0) eagain=`$cat try.out`;;
13541                 1) echo "Could not perform non-blocking setting!";;
13542                 2) echo "I did a successful read() for something that was not there!";;
13543                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13544                 4) echo "Could not find F_SETFL!";;
13545                 *) echo "Something terribly wrong happened during testing.";;
13546                 esac
13547                 rd_nodata=`$cat try.ret`
13548                 echo "A read() system call with no data present returns $rd_nodata."
13549                 case "$rd_nodata" in
13550                 0|-1) ;;
13551                 *)
13552                         echo "(That's peculiar, fixing that to be -1.)"
13553                         rd_nodata=-1
13554                         ;;
13555                 esac
13556                 case "$eagain" in
13557                 '')
13558                         echo "Forcing errno EAGAIN on read() with no data available."
13559                         eagain=EAGAIN
13560                         ;;
13561                 *)
13562                         echo "Your read() sets errno to $eagain when no data is available."
13563                         ;;
13564                 esac
13565                 status=`$cat try.err`
13566                 case "$status" in
13567                 0) echo "And it correctly returns 0 to signal EOF.";;
13568                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13569                 *) echo "However, your read() returns '$status' on EOF??";;
13570                 esac
13571                 val="$define"
13572                 if test "$status" = "$rd_nodata"; then
13573                         echo "WARNING: you can't distinguish between EOF and no data!"
13574                         val="$undef"
13575                 fi
13576         else
13577                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13578                 eagain=EAGAIN
13579         fi
13580         ;;
13581         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13582                 eagain=EAGAIN
13583                 val="$define"
13584                 ;;
13585         esac
13586         set d_eofnblk
13587         eval $setvar
13588         ;;
13589 *)
13590         echo "Using $hint value $eagain."
13591         echo "Your read() returns $rd_nodata when no data is present."
13592         case "$d_eofnblk" in
13593         "$define") echo "And you can see EOF because read() returns 0.";;
13594         "$undef") echo "But you can't see EOF status from read() returned value.";;
13595         *)
13596                 echo "(Assuming you can't see EOF status from read anyway.)"
13597                 d_eofnblk=$undef
13598                 ;;
13599         esac
13600         ;;
13601 esac
13602 $rm_try head.c mtry
13603
13604 : see if erf exists
13605 set erf d_erf
13606 eval $inlibc
13607
13608 : see if erfc exists
13609 set erfc d_erfc
13610 eval $inlibc
13611
13612 : see if exp2 exists
13613 set exp2 d_exp2
13614 eval $inlibc
13615
13616 : see if expm1 exists
13617 set expm1 d_expm1
13618 eval $inlibc
13619
13620 : see if _ptr and _cnt from stdio act std
13621 echo " "
13622
13623 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13624         echo "(Looks like you have stdio.h from BSD.)"
13625         case "$stdio_ptr" in
13626         '') stdio_ptr='((fp)->_p)'
13627                 ptr_lval=$define
13628                 ;;
13629         *)      ptr_lval=$d_stdio_ptr_lval;;
13630         esac
13631         case "$stdio_cnt" in
13632         '') stdio_cnt='((fp)->_r)'
13633                 cnt_lval=$define
13634                 ;;
13635         *)      cnt_lval=$d_stdio_cnt_lval;;
13636         esac
13637         case "$stdio_base" in
13638         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13639         esac
13640         case "$stdio_bufsiz" in
13641         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13642         esac
13643 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13644         echo "(Looks like you have stdio.h from Linux.)"
13645         case "$stdio_ptr" in
13646         '') stdio_ptr='((fp)->_IO_read_ptr)'
13647                 ptr_lval=$define
13648                 ;;
13649         *)      ptr_lval=$d_stdio_ptr_lval;;
13650         esac
13651         case "$stdio_cnt" in
13652         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13653                 cnt_lval=$undef
13654                 ;;
13655         *)      cnt_lval=$d_stdio_cnt_lval;;
13656         esac
13657         case "$stdio_base" in
13658         '') stdio_base='((fp)->_IO_read_base)';;
13659         esac
13660         case "$stdio_bufsiz" in
13661         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13662         esac
13663 else
13664         case "$stdio_ptr" in
13665         '') stdio_ptr='((fp)->_ptr)'
13666                 ptr_lval=$define
13667                 ;;
13668         *)      ptr_lval=$d_stdio_ptr_lval;;
13669         esac
13670         case "$stdio_cnt" in
13671         '') stdio_cnt='((fp)->_cnt)'
13672                 cnt_lval=$define
13673                 ;;
13674         *)      cnt_lval=$d_stdio_cnt_lval;;
13675         esac
13676         case "$stdio_base" in
13677         '') stdio_base='((fp)->_base)';;
13678         esac
13679         case "$stdio_bufsiz" in
13680         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13681         esac
13682 fi
13683
13684 : test whether _ptr and _cnt really work
13685 echo "Checking how std your stdio is..." >&4
13686 $cat >try.c <<EOP
13687 #include <stdio.h>
13688 #$i_stdlib I_STDLIB
13689 #ifdef I_STDLIB
13690 #include <stdlib.h>
13691 #endif
13692 #include <string.h>
13693 #define FILE_ptr(fp)    $stdio_ptr
13694 #define FILE_cnt(fp)    $stdio_cnt
13695 int main() {
13696         FILE *fp = fopen("try.c", "r");
13697         char c = getc(fp);
13698         if (
13699                 18 <= FILE_cnt(fp) &&
13700                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13701         )
13702                 exit(0);
13703         exit(1);
13704 }
13705 EOP
13706 val="$undef"
13707 set try
13708 if eval $compile && $to try.c; then
13709         if $run ./try; then
13710                 echo "Your stdio acts pretty std."
13711                 val="$define"
13712         else
13713                 echo "Your stdio isn't very std."
13714         fi
13715 else
13716         echo "Your stdio doesn't appear very std."
13717 fi
13718 $rm_try
13719
13720 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13721 # direct buffer manipulation no longer works.  The Configure tests
13722 # should be changed to correctly detect this, but until then,
13723 # the following check should at least let perl compile and run.
13724 # (This quick fix should be updated before 5.8.1.)
13725 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13726 # A. Dougherty, June 3, 2002.
13727 case "$d_gnulibc" in
13728 $define)
13729         case "$gnulibc_version" in
13730         2.[01]*)  ;;
13731         2.2) ;;
13732         2.2.[0-9]) ;;
13733         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13734                 val="$undef"
13735                 ;;
13736         esac
13737         ;;
13738 esac
13739 set d_stdstdio
13740 eval $setvar
13741
13742 : Can _ptr be used as an lvalue?
13743 case "$d_stdstdio$ptr_lval" in
13744 $define$define) val=$define ;;
13745 *) val=$undef ;;
13746 esac
13747 set d_stdio_ptr_lval
13748 eval $setvar
13749
13750 : Can _cnt be used as an lvalue?
13751 case "$d_stdstdio$cnt_lval" in
13752 $define$define) val=$define ;;
13753 *) val=$undef ;;
13754 esac
13755 set d_stdio_cnt_lval
13756 eval $setvar
13757
13758
13759 : test whether setting _ptr sets _cnt as a side effect
13760 d_stdio_ptr_lval_sets_cnt="$undef"
13761 d_stdio_ptr_lval_nochange_cnt="$undef"
13762 case "$d_stdio_ptr_lval$d_stdstdio" in
13763 $define$define)
13764         echo "Checking to see what happens if we set the stdio ptr..." >&4
13765 $cat >try.c <<EOP
13766 #include <stdio.h>
13767 /* Can we scream? */
13768 /* Eat dust sed :-) */
13769 /* In the buffer space, no one can hear you scream. */
13770 #$i_stdlib I_STDLIB
13771 #ifdef I_STDLIB
13772 #include <stdlib.h>
13773 #endif
13774 #define FILE_ptr(fp)    $stdio_ptr
13775 #define FILE_cnt(fp)    $stdio_cnt
13776 #include <sys/types.h>
13777 int main() {
13778         FILE *fp = fopen("try.c", "r");
13779         int c;
13780         char *ptr;
13781         size_t cnt;
13782         if (!fp) {
13783             puts("Fail even to read");
13784             exit(1);
13785         }
13786         c = getc(fp); /* Read away the first # */
13787         if (c == EOF) {
13788             puts("Fail even to read");
13789             exit(1);
13790         }
13791         if (!(
13792                 18 <= FILE_cnt(fp) &&
13793                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13794         )) {
13795                 puts("Fail even to read");
13796                 exit (1);
13797         }
13798         ptr = (char*) FILE_ptr(fp);
13799         cnt = (size_t)FILE_cnt(fp);
13800
13801         FILE_ptr(fp) += 42;
13802
13803         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13804                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13805                 exit (1);
13806         }
13807         if (FILE_cnt(fp) <= 20) {
13808                 printf ("Fail (<20 chars to test)");
13809                 exit (1);
13810         }
13811         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13812                 puts("Fail compare");
13813                 exit (1);
13814         }
13815         if (cnt == FILE_cnt(fp)) {
13816                 puts("Pass_unchanged");
13817                 exit (0);
13818         }
13819         if (FILE_cnt(fp) == (cnt - 42)) {
13820                 puts("Pass_changed");
13821                 exit (0);
13822         }
13823         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13824         return 1;
13825
13826 }
13827 EOP
13828         set try
13829         if eval $compile && $to try.c; then
13830                 case `$run ./try` in
13831                 Pass_changed)
13832                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13833                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13834                 Pass_unchanged)
13835                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13836                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13837                 Fail*)
13838                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13839                 *)
13840                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13841         esac
13842         else
13843                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13844         fi
13845         $rm_try
13846         ;;
13847 esac
13848
13849 : see if _base is also standard
13850 val="$undef"
13851 case "$d_stdstdio" in
13852 $define)
13853         $cat >try.c <<EOP
13854 #include <stdio.h>
13855 #$i_stdlib I_STDLIB
13856 #ifdef I_STDLIB
13857 #include <stdlib.h>
13858 #endif
13859 #define FILE_base(fp)   $stdio_base
13860 #define FILE_bufsiz(fp) $stdio_bufsiz
13861 int main() {
13862         FILE *fp = fopen("try.c", "r");
13863         char c = getc(fp);
13864         if (
13865                 19 <= FILE_bufsiz(fp) &&
13866                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13867         )
13868                 exit(0);
13869         exit(1);
13870 }
13871 EOP
13872         set try
13873         if eval $compile && $to try.c; then
13874                 if $run ./try; then
13875                         echo "And its _base field acts std."
13876                         val="$define"
13877                 else
13878                         echo "But its _base field isn't std."
13879                 fi
13880         else
13881                 echo "However, it seems to be lacking the _base field."
13882         fi
13883         $rm_try
13884         ;;
13885 esac
13886 set d_stdiobase
13887 eval $setvar
13888
13889 : see if fast_stdio exists
13890 val="$undef"
13891 case "$d_stdstdio:$d_stdio_ptr_lval" in
13892 "$define:$define")
13893         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13894         *$define*)
13895                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >&4
13896                 val="$define"
13897                 ;;
13898         esac
13899         ;;
13900 esac
13901 set d_faststdio
13902 eval $setvar
13903
13904 : see if fchdir exists
13905 set fchdir d_fchdir
13906 eval $inlibc
13907
13908 : see if fchmod exists
13909 set fchmod d_fchmod
13910 eval $inlibc
13911
13912 : check for openat, unlinkat, renameat, linkat, fchmodat
13913 set openat d_openat
13914 eval $inlibc
13915
13916 set unlinkat d_unlinkat
13917 eval $inlibc
13918
13919 set renameat d_renameat
13920 eval $inlibc
13921
13922 set linkat d_linkat
13923 eval $inlibc
13924
13925 set fchmodat d_fchmodat
13926 eval $inlibc
13927
13928 : see if fchown exists
13929 set fchown d_fchown
13930 eval $inlibc
13931
13932 : see if this is an fcntl system
13933 set fcntl d_fcntl
13934 eval $inlibc
13935
13936 : See if fcntl-based locking works.
13937 echo " "
13938 $cat >try.c <<EOCP
13939 #$i_stdlib I_STDLIB
13940 #ifdef I_STDLIB
13941 #include <stdlib.h>
13942 #endif
13943 #include <unistd.h>
13944 #include <fcntl.h>
13945 #include <signal.h>
13946 $signal_t blech(int x) { exit(3); }
13947 int main() {
13948 #if defined(F_SETLK) && defined(F_SETLKW)
13949      struct flock flock;
13950      int retval, fd;
13951      fd = open("try.c", O_RDONLY);
13952      flock.l_type = F_RDLCK;
13953      flock.l_whence = SEEK_SET;
13954      flock.l_start = flock.l_len = 0;
13955      signal(SIGALRM, blech);
13956      alarm(10);
13957      retval = fcntl(fd, F_SETLK, &flock);
13958      close(fd);
13959      (retval < 0 ? exit(2) : exit(0));
13960 #else
13961      exit(2);
13962 #endif
13963 }
13964 EOCP
13965 echo "Checking if fcntl-based file locking works... "
13966 case "$d_fcntl" in
13967 "$define")
13968         set try
13969         if eval $compile_ok; then
13970                 if $run ./try; then
13971                         echo "Yes, it seems to work."
13972                         val="$define"
13973                 else
13974                         echo "Nope, it didn't work."
13975                         val="$undef"
13976                         case "$?" in
13977                         3) $cat >&4 <<EOM
13978 ***
13979 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13980 *** This is (almost) impossible.
13981 *** If your NFS lock daemons are not feeling well, something like
13982 *** this may happen, please investigate.  Cannot continue, aborting.
13983 ***
13984 EOM
13985                                 exit 1
13986                                 ;;
13987                         esac
13988                 fi
13989         else
13990                 echo "I'm unable to compile the test program, so I'll assume not."
13991                 val="$undef"
13992         fi
13993         ;;
13994 *) val="$undef";
13995         echo "Nope, since you don't even have fcntl()."
13996         ;;
13997 esac
13998 set d_fcntl_can_lock
13999 eval $setvar
14000 $rm_try
14001
14002 : check for fd_set items
14003 $cat <<EOM
14004
14005 Checking to see how well your C compiler handles fd_set and friends ...
14006 EOM
14007 $cat >try.c <<EOCP
14008 #$i_stdlib I_STDLIB
14009 #ifdef I_STDLIB
14010 #include <stdlib.h>
14011 #endif
14012 #$i_systime I_SYS_TIME
14013 #$i_sysselct I_SYS_SELECT
14014 #$d_socket HAS_SOCKET
14015 #include <sys/types.h>
14016 #ifdef HAS_SOCKET
14017 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14018 #endif
14019 #ifdef I_SYS_TIME
14020 #include <sys/time.h>
14021 #endif
14022 #ifdef I_SYS_SELECT
14023 #include <sys/select.h>
14024 #endif
14025 int main() {
14026         fd_set fds;
14027
14028 #ifdef TRYBITS
14029         if(fds.fds_bits);
14030 #endif
14031
14032 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
14033         exit(0);
14034 #else
14035         exit(1);
14036 #endif
14037 }
14038 EOCP
14039 set try -DTRYBITS
14040 if eval $compile; then
14041         d_fds_bits="$define"
14042         d_fd_set="$define"
14043         echo "Well, your system knows about the normal fd_set typedef..." >&4
14044         if $run ./try; then
14045                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14046                 d_fd_macros="$define"
14047         else
14048                 $cat >&4 <<'EOM'
14049 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
14050 EOM
14051                 d_fd_macros="$undef"
14052         fi
14053 else
14054         $cat <<'EOM'
14055 Hmm, your compiler has some difficulty with fd_set.  Checking further...
14056 EOM
14057         set try
14058         if eval $compile; then
14059                 d_fds_bits="$undef"
14060                 d_fd_set="$define"
14061                 echo "Well, your system has some sort of fd_set available..." >&4
14062                 if $run ./try; then
14063                         echo "and you have the normal fd_set macros." >&4
14064                         d_fd_macros="$define"
14065                 else
14066                         $cat <<'EOM'
14067 but not the normal fd_set macros!  Gross!  More work for me...
14068 EOM
14069                         d_fd_macros="$undef"
14070                 fi
14071         else
14072         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14073                 d_fd_set="$undef"
14074                 d_fds_bits="$undef"
14075                 d_fd_macros="$undef"
14076         fi
14077 fi
14078 $rm_try
14079
14080 : see if fdclose exists
14081 set fdclose d_fdclose
14082 eval $inlibc
14083
14084 : see if fdim exists
14085 set fdim d_fdim
14086 eval $inlibc
14087
14088 : see if fegetround exists
14089 set fegetround d_fegetround
14090 eval $inlibc
14091
14092 : see if ffs exists
14093 set ffs d_ffs
14094 eval $inlibc
14095 : see if ffsl exists
14096 set ffsl d_ffsl
14097 eval $inlibc
14098
14099 : see if fgetpos exists
14100 set fgetpos d_fgetpos
14101 eval $inlibc
14102
14103 : see if finite exists
14104 set finite d_finite
14105 eval $inlibc
14106
14107 : see if finitel exists
14108 set finitel d_finitel
14109 eval $inlibc
14110
14111 : see if flock exists
14112 set flock d_flock
14113 eval $inlibc
14114
14115 : see if prototype for flock is available
14116 echo " "
14117 set d_flockproto flock $i_sysfile sys/file.h
14118 eval $hasproto
14119
14120 : see if fma exists
14121 set fma d_fma
14122 eval $inlibc
14123
14124 : see if fmax exists
14125 set fmax d_fmax
14126 eval $inlibc
14127
14128 : see if fmin exists
14129 set fmin d_fmin
14130 eval $inlibc
14131
14132 : see if fp_class exists
14133 set fp_class d_fp_class
14134 eval $inlibc
14135
14136 : check for fpclassify
14137 echo "Checking to see if you have fpclassify..." >&4
14138 $cat >try.c <<EOCP
14139 #include <math.h>
14140 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14141 EOCP
14142 set try
14143 if eval $compile; then
14144         val="$define"
14145         echo "You have fpclassify."
14146 else
14147         val="$undef"
14148         echo "You do not have fpclassify."
14149 fi
14150 $rm_try
14151 set d_fpclassify
14152 eval $setvar
14153
14154 : see if fp_classify exists
14155 set fp_classify d_fp_classify
14156 eval $inlibc
14157
14158 : see if fp_classl exists
14159 set fp_classl d_fp_classl
14160 eval $inlibc
14161
14162 : see if pathconf exists
14163 set pathconf d_pathconf
14164 eval $inlibc
14165
14166 : see if fpathconf exists
14167 set fpathconf d_fpathconf
14168 eval $inlibc
14169
14170 : see if fpclass exists
14171 set fpclass d_fpclass
14172 eval $inlibc
14173
14174 : see if fpclassl exists
14175 set fpclassl d_fpclassl
14176 eval $inlibc
14177
14178 : see if fpgetround exists
14179 set fpgetround d_fpgetround
14180 eval $inlibc
14181
14182 : check for fpos64_t
14183 echo " "
14184 echo "Checking to see if you have fpos64_t..." >&4
14185 $cat >try.c <<EOCP
14186 #include <stdio.h>
14187 int main() { fpos64_t x = 7; }
14188 EOCP
14189 set try
14190 if eval $compile; then
14191         val="$define"
14192         echo "You have fpos64_t."
14193 else
14194         val="$undef"
14195         echo "You do not have fpos64_t."
14196         case "$fpossize" in
14197         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14198         esac
14199 fi
14200 $rm_try
14201 set d_fpos64_t
14202 eval $setvar
14203
14204 : see if frexpl exists
14205 set frexpl d_frexpl
14206 eval $inlibc
14207
14208 : see if this is a sys/param system
14209 set sys/param.h i_sysparam
14210 eval $inhdr
14211
14212 : see if this is a sys/mount.h system
14213 set sys/mount.h i_sysmount
14214 eval $inhdr
14215
14216 : Check for fs_data_s
14217 echo " "
14218 echo "Checking to see if your system supports struct fs_data..." >&4
14219 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14220 eval $hasstruct
14221 case "$d_fs_data_s" in
14222 "$define")      echo "Yes, it does."   ;;
14223 *)              echo "No, it doesn't." ;;
14224 esac
14225
14226 : see if fseeko exists
14227 set fseeko d_fseeko
14228 eval $inlibc
14229 case "$longsize" in
14230 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14231 esac
14232
14233 : see if fsetpos exists
14234 set fsetpos d_fsetpos
14235 eval $inlibc
14236
14237 : see if fstatfs exists
14238 set fstatfs d_fstatfs
14239 eval $inlibc
14240
14241 : see if statvfs exists
14242 set statvfs d_statvfs
14243 eval $inlibc
14244
14245 : see if fstatvfs exists
14246 set fstatvfs d_fstatvfs
14247 eval $inlibc
14248
14249 : see if fsync exists
14250 set fsync d_fsync
14251 eval $inlibc
14252
14253 : see if ftello exists
14254 set ftello d_ftello
14255 eval $inlibc
14256 case "$longsize" in
14257 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14258 esac
14259
14260 : check for a working futimes
14261 d_futimes="$undef"
14262 echo " "
14263 echo "Checking if you have a working futimes()" >&4
14264 $cat >try.c <<EOCP
14265 #include <stdio.h>
14266 #include <stdlib.h>
14267 #include <sys/time.h>
14268 #include <errno.h>
14269 #include <fcntl.h>
14270 #include <stdlib.h>
14271
14272 int main ()
14273 {
14274     int fd, rv;
14275     fd = open ("try.c", O_RDWR);
14276     if (-1 == fd) exit (1);
14277     rv = futimes (fd, NULL);
14278     exit (rv == -1 ? errno : 0);
14279 }
14280 EOCP
14281 set try
14282 if eval $compile; then
14283     `$run ./try`
14284     rc=$?
14285     case "$rc" in
14286         0)  echo "Yes, you have" >&4
14287             d_futimes="$define"
14288             ;;
14289         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14290             ;;
14291     esac
14292 else
14293     echo "No, it does not (probably harmless)" >&4
14294 fi
14295 $rm_try
14296
14297 : look for gai_strerror
14298 echo " "
14299 $cat >try.c <<'EOCP'
14300 #include <sys/types.h>
14301 #include <sys/socket.h>
14302 #include <netdb.h>
14303 int main ()
14304 {
14305     return (gai_strerror (0) ? 0 : 1);
14306     }
14307 EOCP
14308 set try
14309 val="$undef"
14310 if eval $compile; then
14311     `$run ./try`
14312     case "$?" in
14313         0)  echo "A working gai_strerror() found." >&4
14314             val="$define" ;;
14315         *)  echo "gai_strerror() found, but it doesn't work" >&4
14316             ;;
14317         esac
14318 else
14319     echo "gai_strerror() NOT found." >&4
14320     fi
14321 set d_gai_strerror
14322 eval $setvar
14323 $rm_try
14324
14325 : see if ndbm.h is available
14326 set ndbm.h i_ndbm
14327 eval $inhdr
14328 : Compatibility location for RedHat 7.1
14329 set gdbm/ndbm.h i_gdbmndbm
14330 eval $inhdr
14331 : Compatibility location for Debian 4.0
14332 set gdbm-ndbm.h i_gdbm_ndbm
14333 eval $inhdr
14334
14335 val="$undef"
14336 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14337         : see if dbm_open exists
14338         set dbm_open d_dbm_open
14339         eval $inlibc
14340         case "$d_dbm_open" in
14341         $undef)
14342                 i_ndbm="$undef"
14343                 i_gdbmndbm="$undef"
14344                 i_gdbm_ndbm="$undef"
14345                 echo "We won't be including <ndbm.h>"
14346                 val="$undef"
14347                 ;;
14348         *) val="$define"
14349            ;;
14350         esac
14351 fi
14352 set d_ndbm
14353 eval $setvar
14354
14355 ndbm_hdr_protochk='name=$1; hdr=$2;
14356 eval "ihdr=\$""i_$name";
14357 val="$undef";
14358 if $test "$ihdr" = "$define"; then
14359         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14360         case "$d_cplusplus" in
14361         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14362         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14363         esac;
14364         case "$val" in
14365         $define) $echo "Your <$hdr> seems to have prototypes";;
14366         *) $echo "Your <$hdr> does not seem to have prototypes";;
14367         esac;
14368 fi;
14369 set "d_${name}_h_uses_prototypes";
14370 eval $setvar'
14371
14372 set ndbm ndbm.h
14373 eval $ndbm_hdr_protochk
14374 set gdbmndbm gdbm/ndbm.h
14375 eval $ndbm_hdr_protochk
14376 set gdbm_ndbm gdbm-ndbm.h
14377 eval $ndbm_hdr_protochk
14378
14379 : see if getaddrinfo exists
14380 set getaddrinfo d_getaddrinfo
14381 eval $inlibc
14382
14383 : see if getcwd exists
14384 set getcwd d_getcwd
14385 eval $inlibc
14386
14387 : check for getenv behavior
14388 case "$d_getenv_preserves_other_thread" in
14389 '')
14390 $echo "Checking to see if getenv() preserves a different thread's results" >&4
14391 $cat >try.c <<EOCP
14392 #$i_stdlib I_STDLIB
14393 #ifdef I_STDLIB
14394 #  include <stdlib.h>
14395 #endif
14396 #include <stdio.h>
14397 #include <string.h>
14398 #$i_pthread I_PTHREAD
14399 #ifdef I_PTHREAD
14400 #  include <pthread.h>
14401 #endif
14402
14403 void *
14404 thread_start(void * arg)
14405 {
14406     return (void *) getenv("HOME");
14407 }
14408
14409 int main() {
14410     char * main_buffer;
14411     char save_main_buffer[1000];
14412     pthread_t subthread;
14413     pthread_attr_t attr;
14414
14415     main_buffer = getenv("PATH");
14416
14417     /* If too large for our generous allowance, return we couldn't figure it
14418      * out. */
14419     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
14420         exit(2);
14421     }
14422
14423     strcpy(save_main_buffer, main_buffer);
14424
14425     if (pthread_attr_init(&attr) != 0) {
14426         exit(2);
14427     }
14428
14429     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
14430         exit(2);
14431     }
14432
14433     if (pthread_join(subthread, NULL) != 0) {
14434         exit(2);
14435     }
14436
14437     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
14438 }
14439 EOCP
14440 val=
14441 set try
14442 if eval $compile_ok; then
14443     $run ./try
14444     rc=$?
14445     case "$rc" in
14446         0) echo "getenv() didn't destroy another thread's buffer" >&4
14447            val=$define
14448            ;;
14449         1) echo "getenv() does destroy another thread's buffer" >&4
14450            val=$undef
14451            ;;
14452         *) echo "Couldn't determine if getenv() destroys another thread's return value (code=$rc); assuming it does" >&4
14453            val=$undef
14454            ;;
14455     esac
14456 else
14457     echo "(I can't seem to compile the test program.)" >&4
14458     echo "Assuming that your C library's getenv destroys another thread's return value." >&4
14459     val=$undef
14460 fi
14461 set d_getenv_preserves_other_thread
14462 eval $setvar
14463 $rm_try
14464 ;;
14465 esac
14466
14467 : see if getespwnam exists
14468 set getespwnam d_getespwnam
14469 eval $inlibc
14470
14471 : see if getfsstat exists
14472 set getfsstat d_getfsstat
14473 eval $inlibc
14474
14475 : see if getgrent exists
14476 set getgrent d_getgrent
14477 eval $inlibc
14478
14479 : see if getgrent_r exists
14480 set getgrent_r d_getgrent_r
14481 eval $inlibc
14482 case "$d_getgrent_r" in
14483 "$define")
14484         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14485         case "$d_getgrent_r_proto:$usethreads" in
14486         ":define")      d_getgrent_r_proto=define
14487                 set d_getgrent_r_proto getgrent_r $hdrs
14488                 eval $hasproto ;;
14489         *)      ;;
14490         esac
14491         case "$d_getgrent_r_proto" in
14492         define)
14493         case "$getgrent_r_proto" in
14494         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14495         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14496         esac
14497         case "$getgrent_r_proto" in
14498         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14499         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14500         esac
14501         case "$getgrent_r_proto" in
14502         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14503         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14504         esac
14505         case "$getgrent_r_proto" in
14506         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14507         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14508         esac
14509         case "$getgrent_r_proto" in
14510         ''|0) try='int getgrent_r(struct group*, char*, int);'
14511         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14512         esac
14513         case "$getgrent_r_proto" in
14514         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14515         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14516         esac
14517         case "$getgrent_r_proto" in
14518         ''|0)   d_getgrent_r=undef
14519                 getgrent_r_proto=0
14520                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14521         * )     case "$getgrent_r_proto" in
14522                 REENTRANT_PROTO*) ;;
14523                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14524                 esac
14525                 echo "Prototype: $try" ;;
14526         esac
14527         ;;
14528         *)      case "$usethreads" in
14529                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14530                 esac
14531                 d_getgrent_r=undef
14532                 getgrent_r_proto=0
14533                 ;;
14534         esac
14535         ;;
14536 *)      getgrent_r_proto=0
14537         ;;
14538 esac
14539
14540 : see if getgrgid_r exists
14541 set getgrgid_r d_getgrgid_r
14542 eval $inlibc
14543 case "$d_getgrgid_r" in
14544 "$define")
14545         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14546         case "$d_getgrgid_r_proto:$usethreads" in
14547         ":define")      d_getgrgid_r_proto=define
14548                 set d_getgrgid_r_proto getgrgid_r $hdrs
14549                 eval $hasproto ;;
14550         *)      ;;
14551         esac
14552         case "$d_getgrgid_r_proto" in
14553         define)
14554         case "$getgrgid_r_proto" in
14555         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14556         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14557         esac
14558         case "$getgrgid_r_proto" in
14559         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14560         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14561         esac
14562         case "$getgrgid_r_proto" in
14563         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14564         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14565         esac
14566         case "$getgrgid_r_proto" in
14567         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14568         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14569         esac
14570         case "$getgrgid_r_proto" in
14571         ''|0)   d_getgrgid_r=undef
14572                 getgrgid_r_proto=0
14573                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14574         * )     case "$getgrgid_r_proto" in
14575                 REENTRANT_PROTO*) ;;
14576                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14577                 esac
14578                 echo "Prototype: $try" ;;
14579         esac
14580         ;;
14581         *)      case "$usethreads" in
14582                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14583                 esac
14584                 d_getgrgid_r=undef
14585                 getgrgid_r_proto=0
14586                 ;;
14587         esac
14588         ;;
14589 *)      getgrgid_r_proto=0
14590         ;;
14591 esac
14592
14593 : see if getgrnam_r exists
14594 set getgrnam_r d_getgrnam_r
14595 eval $inlibc
14596 case "$d_getgrnam_r" in
14597 "$define")
14598         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14599         case "$d_getgrnam_r_proto:$usethreads" in
14600         ":define")      d_getgrnam_r_proto=define
14601                 set d_getgrnam_r_proto getgrnam_r $hdrs
14602                 eval $hasproto ;;
14603         *)      ;;
14604         esac
14605         case "$d_getgrnam_r_proto" in
14606         define)
14607         case "$getgrnam_r_proto" in
14608         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14609         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14610         esac
14611         case "$getgrnam_r_proto" in
14612         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14613         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14614         esac
14615         case "$getgrnam_r_proto" in
14616         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14617         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14618         esac
14619         case "$getgrnam_r_proto" in
14620         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14621         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14622         esac
14623         case "$getgrnam_r_proto" in
14624         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14625         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14626         esac
14627         case "$getgrnam_r_proto" in
14628         ''|0)   d_getgrnam_r=undef
14629                 getgrnam_r_proto=0
14630                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14631         * )     case "$getgrnam_r_proto" in
14632                 REENTRANT_PROTO*) ;;
14633                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14634                 esac
14635                 echo "Prototype: $try" ;;
14636         esac
14637         ;;
14638         *)      case "$usethreads" in
14639                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14640                 esac
14641                 d_getgrnam_r=undef
14642                 getgrnam_r_proto=0
14643                 ;;
14644         esac
14645         ;;
14646 *)      getgrnam_r_proto=0
14647         ;;
14648 esac
14649
14650 : see if gethostbyaddr exists
14651 set gethostbyaddr d_gethbyaddr
14652 eval $inlibc
14653
14654 : see if gethostbyname exists
14655 set gethostbyname d_gethbyname
14656 eval $inlibc
14657
14658 : see if gethostent exists
14659 set gethostent d_gethent
14660 eval $inlibc
14661
14662 : see how we will look up host name
14663 echo " "
14664 call=''
14665 if set gethostname val -f d_gethname; eval $csym; $val; then
14666         echo 'gethostname() found.' >&4
14667         d_gethname="$define"
14668         call=gethostname
14669 fi
14670 if set uname val -f d_uname; eval $csym; $val; then
14671         if ./xenix; then
14672                 $cat <<'EOM'
14673 uname() was found, but you're running xenix, and older versions of xenix
14674 have a broken uname(). If you don't really know whether your xenix is old
14675 enough to have a broken system call, use the default answer.
14676
14677 EOM
14678                 dflt=y
14679                 case "$d_uname" in
14680                 "$define") dflt=n;;
14681                 esac
14682                 rp='Is your uname() broken?'
14683                 . ./myread
14684                 case "$ans" in
14685                 n*) d_uname="$define"; call=uname;;
14686                 esac
14687         else
14688                 echo 'uname() found.' >&4
14689                 d_uname="$define"
14690                 case "$call" in
14691                 '') call=uname ;;
14692                 esac
14693         fi
14694 fi
14695 case "$d_gethname" in
14696 '') d_gethname="$undef";;
14697 esac
14698 case "$d_uname" in
14699 '') d_uname="$undef";;
14700 esac
14701 case "$d_uname$d_gethname" in
14702 *define*)
14703         dflt=n
14704         cat <<EOM
14705
14706 Every now and then someone has a $call() that lies about the hostname
14707 but can't be fixed for political or economic reasons.  If you wish, I can
14708 pretend $call() isn't there and maybe compute hostname at run-time
14709 thanks to the '$phostname' command.
14710
14711 EOM
14712         rp="Shall I ignore $call() from now on?"
14713         . ./myread
14714         case "$ans" in
14715         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14716         esac;;
14717 esac
14718 case "$phostname" in
14719 '') aphostname='';;
14720 *) case "$aphostname" in
14721         /*) ;;
14722         *) set X $phostname
14723                 shift
14724                 file=$1
14725                 shift
14726                 file=`./loc $file $file $pth`
14727                 aphostname=`echo $file $*`
14728                 ;;
14729         esac
14730         ;;
14731 esac
14732 case "$d_uname$d_gethname" in
14733 *define*) ;;
14734 *)
14735         case "$phostname" in
14736         '')
14737                 echo "There will be no way for $package to get your hostname." >&4;;
14738         *)
14739         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14740                 ;;
14741         esac;;
14742 esac
14743 case "$d_phostname" in
14744 '') d_phostname="$undef";;
14745 esac
14746
14747 : see if gethostbyaddr_r exists
14748 set gethostbyaddr_r d_gethostbyaddr_r
14749 eval $inlibc
14750 case "$d_gethostbyaddr_r" in
14751 "$define")
14752         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14753         case "$d_gethostbyaddr_r_proto:$usethreads" in
14754         ":define")      d_gethostbyaddr_r_proto=define
14755                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14756                 eval $hasproto ;;
14757         *)      ;;
14758         esac
14759         case "$d_gethostbyaddr_r_proto" in
14760         define)
14761         case "$gethostbyaddr_r_proto" in
14762         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14763         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14764         esac
14765         case "$gethostbyaddr_r_proto" in
14766         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14767         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14768         esac
14769         case "$gethostbyaddr_r_proto" in
14770         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14771         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14772         esac
14773         case "$gethostbyaddr_r_proto" in
14774         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14775         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14776         esac
14777         case "$gethostbyaddr_r_proto" in
14778         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14779         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14780         esac
14781         case "$gethostbyaddr_r_proto" in
14782         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14783         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14784         esac
14785         case "$gethostbyaddr_r_proto" in
14786         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14787         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14788         esac
14789         case "$gethostbyaddr_r_proto" in
14790         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14791         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14792         esac
14793         case "$gethostbyaddr_r_proto" in
14794         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14795         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14796         esac
14797         case "$gethostbyaddr_r_proto" in
14798         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14799         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14800         esac
14801         case "$gethostbyaddr_r_proto" in
14802         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14803         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14804         esac
14805         case "$gethostbyaddr_r_proto" in
14806         ''|0)   d_gethostbyaddr_r=undef
14807                 gethostbyaddr_r_proto=0
14808                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14809         * )     case "$gethostbyaddr_r_proto" in
14810                 REENTRANT_PROTO*) ;;
14811                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14812                 esac
14813                 echo "Prototype: $try" ;;
14814         esac
14815         ;;
14816         *)      case "$usethreads" in
14817                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14818                 esac
14819                 d_gethostbyaddr_r=undef
14820                 gethostbyaddr_r_proto=0
14821                 ;;
14822         esac
14823         ;;
14824 *)      gethostbyaddr_r_proto=0
14825         ;;
14826 esac
14827
14828 : see if gethostbyname_r exists
14829 set gethostbyname_r d_gethostbyname_r
14830 eval $inlibc
14831 case "$d_gethostbyname_r" in
14832 "$define")
14833         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14834         case "$d_gethostbyname_r_proto:$usethreads" in
14835         ":define")      d_gethostbyname_r_proto=define
14836                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14837                 eval $hasproto ;;
14838         *)      ;;
14839         esac
14840         case "$d_gethostbyname_r_proto" in
14841         define)
14842         case "$gethostbyname_r_proto" in
14843         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14844         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14845         esac
14846         case "$gethostbyname_r_proto" in
14847         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14848         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14849         esac
14850         case "$gethostbyname_r_proto" in
14851         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14852         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14853         esac
14854         case "$gethostbyname_r_proto" in
14855         ''|0)   d_gethostbyname_r=undef
14856                 gethostbyname_r_proto=0
14857                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14858         * )     case "$gethostbyname_r_proto" in
14859                 REENTRANT_PROTO*) ;;
14860                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14861                 esac
14862                 echo "Prototype: $try" ;;
14863         esac
14864         ;;
14865         *)      case "$usethreads" in
14866                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14867                 esac
14868                 d_gethostbyname_r=undef
14869                 gethostbyname_r_proto=0
14870                 ;;
14871         esac
14872         ;;
14873 *)      gethostbyname_r_proto=0
14874         ;;
14875 esac
14876
14877 : see if gethostent_r exists
14878 set gethostent_r d_gethostent_r
14879 eval $inlibc
14880 case "$d_gethostent_r" in
14881 "$define")
14882         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14883         case "$d_gethostent_r_proto:$usethreads" in
14884         ":define")      d_gethostent_r_proto=define
14885                 set d_gethostent_r_proto gethostent_r $hdrs
14886                 eval $hasproto ;;
14887         *)      ;;
14888         esac
14889         case "$d_gethostent_r_proto" in
14890         define)
14891         case "$gethostent_r_proto" in
14892         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14893         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14894         esac
14895         case "$gethostent_r_proto" in
14896         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14897         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14898         esac
14899         case "$gethostent_r_proto" in
14900         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14901         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14902         esac
14903         case "$gethostent_r_proto" in
14904         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14905         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14906         esac
14907         case "$gethostent_r_proto" in
14908         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14909         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14910         esac
14911         case "$gethostent_r_proto" in
14912         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14913         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14914         esac
14915         case "$gethostent_r_proto" in
14916         ''|0)   d_gethostent_r=undef
14917                 gethostent_r_proto=0
14918                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14919         * )     case "$gethostent_r_proto" in
14920                 REENTRANT_PROTO*) ;;
14921                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14922                 esac
14923                 echo "Prototype: $try" ;;
14924         esac
14925         ;;
14926         *)      case "$usethreads" in
14927                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14928                 esac
14929                 d_gethostent_r=undef
14930                 gethostent_r_proto=0
14931                 ;;
14932         esac
14933         ;;
14934 *)      gethostent_r_proto=0
14935         ;;
14936 esac
14937
14938 : see if prototypes for various gethostxxx netdb.h functions are available
14939 echo " "
14940 set d_gethostprotos gethostent $i_netdb netdb.h
14941 eval $hasproto
14942
14943 : see if getitimer exists
14944 set getitimer d_getitimer
14945 eval $inlibc
14946
14947 : see if getlogin exists
14948 set getlogin d_getlogin
14949 eval $inlibc
14950
14951 : see if getlogin_r exists
14952 set getlogin_r d_getlogin_r
14953 eval $inlibc
14954 case "$d_getlogin_r" in
14955 "$define")
14956         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14957         case "$d_getlogin_r_proto:$usethreads" in
14958         ":define")      d_getlogin_r_proto=define
14959                 set d_getlogin_r_proto getlogin_r $hdrs
14960                 eval $hasproto ;;
14961         *)      ;;
14962         esac
14963         case "$d_getlogin_r_proto" in
14964         define)
14965         case "$getlogin_r_proto" in
14966         ''|0) try='int getlogin_r(char*, size_t);'
14967         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14968         esac
14969         case "$getlogin_r_proto" in
14970         ''|0) try='int getlogin_r(char*, int);'
14971         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14972         esac
14973         case "$getlogin_r_proto" in
14974         ''|0) try='char* getlogin_r(char*, size_t);'
14975         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14976         esac
14977         case "$getlogin_r_proto" in
14978         ''|0) try='char* getlogin_r(char*, int);'
14979         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14980         esac
14981         case "$getlogin_r_proto" in
14982         ''|0)   d_getlogin_r=undef
14983                 getlogin_r_proto=0
14984                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14985         * )     case "$getlogin_r_proto" in
14986                 REENTRANT_PROTO*) ;;
14987                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14988                 esac
14989                 echo "Prototype: $try" ;;
14990         esac
14991         ;;
14992         *)      case "$usethreads" in
14993                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14994                 esac
14995                 d_getlogin_r=undef
14996                 getlogin_r_proto=0
14997                 ;;
14998         esac
14999         ;;
15000 *)      getlogin_r_proto=0
15001         ;;
15002 esac
15003
15004 : see if getmnt exists
15005 set getmnt d_getmnt
15006 eval $inlibc
15007
15008 : see if getmntent exists
15009 set getmntent d_getmntent
15010 eval $inlibc
15011
15012 : see if getnameinfo exists
15013 set getnameinfo d_getnameinfo
15014 eval $inlibc
15015
15016 : see if getnetbyaddr exists
15017 set getnetbyaddr d_getnbyaddr
15018 eval $inlibc
15019
15020 : see if getnetbyname exists
15021 set getnetbyname d_getnbyname
15022 eval $inlibc
15023
15024 : see if getnetent exists
15025 set getnetent d_getnent
15026 eval $inlibc
15027
15028 : see if getnetbyaddr_r exists
15029 set getnetbyaddr_r d_getnetbyaddr_r
15030 eval $inlibc
15031 case "$d_getnetbyaddr_r" in
15032 "$define")
15033         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15034         case "$d_getnetbyaddr_r_proto:$usethreads" in
15035         ":define")      d_getnetbyaddr_r_proto=define
15036                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
15037                 eval $hasproto ;;
15038         *)      ;;
15039         esac
15040         case "$d_getnetbyaddr_r_proto" in
15041         define)
15042         case "$getnetbyaddr_r_proto" in
15043         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
15044         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
15045         esac
15046         case "$getnetbyaddr_r_proto" in
15047         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
15048         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
15049         esac
15050         case "$getnetbyaddr_r_proto" in
15051         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
15052         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
15053         esac
15054         case "$getnetbyaddr_r_proto" in
15055         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
15056         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
15057         esac
15058         case "$getnetbyaddr_r_proto" in
15059         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
15060         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
15061         esac
15062         case "$getnetbyaddr_r_proto" in
15063         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
15064         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
15065         esac
15066         case "$getnetbyaddr_r_proto" in
15067         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
15068         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
15069         esac
15070         case "$getnetbyaddr_r_proto" in
15071         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
15072         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
15073         esac
15074         case "$getnetbyaddr_r_proto" in
15075         ''|0)   d_getnetbyaddr_r=undef
15076                 getnetbyaddr_r_proto=0
15077                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
15078         * )     case "$getnetbyaddr_r_proto" in
15079                 REENTRANT_PROTO*) ;;
15080                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
15081                 esac
15082                 echo "Prototype: $try" ;;
15083         esac
15084         ;;
15085         *)      case "$usethreads" in
15086                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
15087                 esac
15088                 d_getnetbyaddr_r=undef
15089                 getnetbyaddr_r_proto=0
15090                 ;;
15091         esac
15092         ;;
15093 *)      getnetbyaddr_r_proto=0
15094         ;;
15095 esac
15096
15097 : see if getnetbyname_r exists
15098 set getnetbyname_r d_getnetbyname_r
15099 eval $inlibc
15100 case "$d_getnetbyname_r" in
15101 "$define")
15102         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15103         case "$d_getnetbyname_r_proto:$usethreads" in
15104         ":define")      d_getnetbyname_r_proto=define
15105                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
15106                 eval $hasproto ;;
15107         *)      ;;
15108         esac
15109         case "$d_getnetbyname_r_proto" in
15110         define)
15111         case "$getnetbyname_r_proto" in
15112         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
15113         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
15114         esac
15115         case "$getnetbyname_r_proto" in
15116         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
15117         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
15118         esac
15119         case "$getnetbyname_r_proto" in
15120         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
15121         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
15122         esac
15123         case "$getnetbyname_r_proto" in
15124         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
15125         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
15126         esac
15127         case "$getnetbyname_r_proto" in
15128         ''|0)   d_getnetbyname_r=undef
15129                 getnetbyname_r_proto=0
15130                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
15131         * )     case "$getnetbyname_r_proto" in
15132                 REENTRANT_PROTO*) ;;
15133                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
15134                 esac
15135                 echo "Prototype: $try" ;;
15136         esac
15137         ;;
15138         *)      case "$usethreads" in
15139                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
15140                 esac
15141                 d_getnetbyname_r=undef
15142                 getnetbyname_r_proto=0
15143                 ;;
15144         esac
15145         ;;
15146 *)      getnetbyname_r_proto=0
15147         ;;
15148 esac
15149
15150 : see if getnetent_r exists
15151 set getnetent_r d_getnetent_r
15152 eval $inlibc
15153 case "$d_getnetent_r" in
15154 "$define")
15155         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15156         case "$d_getnetent_r_proto:$usethreads" in
15157         ":define")      d_getnetent_r_proto=define
15158                 set d_getnetent_r_proto getnetent_r $hdrs
15159                 eval $hasproto ;;
15160         *)      ;;
15161         esac
15162         case "$d_getnetent_r_proto" in
15163         define)
15164         case "$getnetent_r_proto" in
15165         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
15166         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
15167         esac
15168         case "$getnetent_r_proto" in
15169         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
15170         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
15171         esac
15172         case "$getnetent_r_proto" in
15173         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15174         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15175         esac
15176         case "$getnetent_r_proto" in
15177         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15178         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15179         esac
15180         case "$getnetent_r_proto" in
15181         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15182         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15183         esac
15184         case "$getnetent_r_proto" in
15185         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15186         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15187         esac
15188         case "$getnetent_r_proto" in
15189         ''|0)   d_getnetent_r=undef
15190                 getnetent_r_proto=0
15191                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15192         * )     case "$getnetent_r_proto" in
15193                 REENTRANT_PROTO*) ;;
15194                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15195                 esac
15196                 echo "Prototype: $try" ;;
15197         esac
15198         ;;
15199         *)      case "$usethreads" in
15200                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15201                 esac
15202                 d_getnetent_r=undef
15203                 getnetent_r_proto=0
15204                 ;;
15205         esac
15206         ;;
15207 *)      getnetent_r_proto=0
15208         ;;
15209 esac
15210
15211 : see if prototypes for various getnetxxx netdb.h functions are available
15212 echo " "
15213 set d_getnetprotos getnetent $i_netdb netdb.h
15214 eval $hasproto
15215
15216 : see if getpagesize exists
15217 set getpagesize d_getpagsz
15218 eval $inlibc
15219
15220 : Optional checks for getprotobyname and getprotobynumber
15221
15222 : see if getprotobyname exists
15223 set getprotobyname d_getpbyname
15224 eval $inlibc
15225
15226 : see if getprotobynumber exists
15227 set getprotobynumber d_getpbynumber
15228 eval $inlibc
15229
15230 : see if getprotoent exists
15231 set getprotoent d_getpent
15232 eval $inlibc
15233
15234 : see if getpgid exists
15235 set getpgid d_getpgid
15236 eval $inlibc
15237
15238 : see if getpgrp2 exists
15239 set getpgrp2 d_getpgrp2
15240 eval $inlibc
15241
15242 : see if getppid exists
15243 set getppid d_getppid
15244 eval $inlibc
15245
15246 : see if getpriority exists
15247 set getpriority d_getprior
15248 eval $inlibc
15249
15250 : see if getprotobyname_r exists
15251 set getprotobyname_r d_getprotobyname_r
15252 eval $inlibc
15253 case "$d_getprotobyname_r" in
15254 "$define")
15255         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15256         case "$d_getprotobyname_r_proto:$usethreads" in
15257         ":define")      d_getprotobyname_r_proto=define
15258                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15259                 eval $hasproto ;;
15260         *)      ;;
15261         esac
15262         case "$d_getprotobyname_r_proto" in
15263         define)
15264         case "$getprotobyname_r_proto" in
15265         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15266         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15267         esac
15268         case "$getprotobyname_r_proto" in
15269         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15270         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15271         esac
15272         case "$getprotobyname_r_proto" in
15273         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15274         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15275         esac
15276         case "$getprotobyname_r_proto" in
15277         ''|0)   d_getprotobyname_r=undef
15278                 getprotobyname_r_proto=0
15279                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15280         * )     case "$getprotobyname_r_proto" in
15281                 REENTRANT_PROTO*) ;;
15282                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15283                 esac
15284                 echo "Prototype: $try" ;;
15285         esac
15286         ;;
15287         *)      case "$usethreads" in
15288                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15289                 esac
15290                 d_getprotobyname_r=undef
15291                 getprotobyname_r_proto=0
15292                 ;;
15293         esac
15294         ;;
15295 *)      getprotobyname_r_proto=0
15296         ;;
15297 esac
15298
15299 : see if getprotobynumber_r exists
15300 set getprotobynumber_r d_getprotobynumber_r
15301 eval $inlibc
15302 case "$d_getprotobynumber_r" in
15303 "$define")
15304         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15305         case "$d_getprotobynumber_r_proto:$usethreads" in
15306         ":define")      d_getprotobynumber_r_proto=define
15307                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15308                 eval $hasproto ;;
15309         *)      ;;
15310         esac
15311         case "$d_getprotobynumber_r_proto" in
15312         define)
15313         case "$getprotobynumber_r_proto" in
15314         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15315         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15316         esac
15317         case "$getprotobynumber_r_proto" in
15318         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15319         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15320         esac
15321         case "$getprotobynumber_r_proto" in
15322         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15323         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15324         esac
15325         case "$getprotobynumber_r_proto" in
15326         ''|0)   d_getprotobynumber_r=undef
15327                 getprotobynumber_r_proto=0
15328                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15329         * )     case "$getprotobynumber_r_proto" in
15330                 REENTRANT_PROTO*) ;;
15331                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15332                 esac
15333                 echo "Prototype: $try" ;;
15334         esac
15335         ;;
15336         *)      case "$usethreads" in
15337                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15338                 esac
15339                 d_getprotobynumber_r=undef
15340                 getprotobynumber_r_proto=0
15341                 ;;
15342         esac
15343         ;;
15344 *)      getprotobynumber_r_proto=0
15345         ;;
15346 esac
15347
15348 : see if getprotoent_r exists
15349 set getprotoent_r d_getprotoent_r
15350 eval $inlibc
15351 case "$d_getprotoent_r" in
15352 "$define")
15353         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15354         case "$d_getprotoent_r_proto:$usethreads" in
15355         ":define")      d_getprotoent_r_proto=define
15356                 set d_getprotoent_r_proto getprotoent_r $hdrs
15357                 eval $hasproto ;;
15358         *)      ;;
15359         esac
15360         case "$d_getprotoent_r_proto" in
15361         define)
15362         case "$getprotoent_r_proto" in
15363         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15364         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15365         esac
15366         case "$getprotoent_r_proto" in
15367         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15368         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15369         esac
15370         case "$getprotoent_r_proto" in
15371         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15372         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15373         esac
15374         case "$getprotoent_r_proto" in
15375         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15376         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15377         esac
15378         case "$getprotoent_r_proto" in
15379         ''|0)   d_getprotoent_r=undef
15380                 getprotoent_r_proto=0
15381                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15382         * )     case "$getprotoent_r_proto" in
15383                 REENTRANT_PROTO*) ;;
15384                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15385                 esac
15386                 echo "Prototype: $try" ;;
15387         esac
15388         ;;
15389         *)      case "$usethreads" in
15390                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15391                 esac
15392                 d_getprotoent_r=undef
15393                 getprotoent_r_proto=0
15394                 ;;
15395         esac
15396         ;;
15397 *)      getprotoent_r_proto=0
15398         ;;
15399 esac
15400
15401 : see if prototypes for various getprotoxxx netdb.h functions are available
15402 echo " "
15403 set d_getprotoprotos getprotoent $i_netdb netdb.h
15404 eval $hasproto
15405
15406 : see if getprpwnam exists
15407 set getprpwnam d_getprpwnam
15408 eval $inlibc
15409
15410 : see if getpwent exists
15411 set getpwent d_getpwent
15412 eval $inlibc
15413
15414 : see if getpwent_r exists
15415 set getpwent_r d_getpwent_r
15416 eval $inlibc
15417 case "$d_getpwent_r" in
15418 "$define")
15419         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15420         case "$d_getpwent_r_proto:$usethreads" in
15421         ":define")      d_getpwent_r_proto=define
15422                 set d_getpwent_r_proto getpwent_r $hdrs
15423                 eval $hasproto ;;
15424         *)      ;;
15425         esac
15426         case "$d_getpwent_r_proto" in
15427         define)
15428         case "$getpwent_r_proto" in
15429         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15430         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15431         esac
15432         case "$getpwent_r_proto" in
15433         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15434         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15435         esac
15436         case "$getpwent_r_proto" in
15437         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15438         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15439         esac
15440         case "$getpwent_r_proto" in
15441         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15442         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15443         esac
15444         case "$getpwent_r_proto" in
15445         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15446         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15447         esac
15448         case "$getpwent_r_proto" in
15449         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15450         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15451         esac
15452         case "$getpwent_r_proto" in
15453         ''|0)   d_getpwent_r=undef
15454                 getpwent_r_proto=0
15455                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15456         * )     case "$getpwent_r_proto" in
15457                 REENTRANT_PROTO*) ;;
15458                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15459                 esac
15460                 echo "Prototype: $try" ;;
15461         esac
15462         ;;
15463         *)      case "$usethreads" in
15464                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15465                 esac
15466                 d_getpwent_r=undef
15467                 getpwent_r_proto=0
15468                 ;;
15469         esac
15470         ;;
15471 *)      getpwent_r_proto=0
15472         ;;
15473 esac
15474
15475 : see if getpwnam_r exists
15476 set getpwnam_r d_getpwnam_r
15477 eval $inlibc
15478 case "$d_getpwnam_r" in
15479 "$define")
15480         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15481         case "$d_getpwnam_r_proto:$usethreads" in
15482         ":define")      d_getpwnam_r_proto=define
15483                 set d_getpwnam_r_proto getpwnam_r $hdrs
15484                 eval $hasproto ;;
15485         *)      ;;
15486         esac
15487         case "$d_getpwnam_r_proto" in
15488         define)
15489         case "$getpwnam_r_proto" in
15490         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15491         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15492         esac
15493         case "$getpwnam_r_proto" in
15494         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15495         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15496         esac
15497         case "$getpwnam_r_proto" in
15498         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15499         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15500         esac
15501         case "$getpwnam_r_proto" in
15502         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15503         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15504         esac
15505         case "$getpwnam_r_proto" in
15506         ''|0)   d_getpwnam_r=undef
15507                 getpwnam_r_proto=0
15508                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15509         * )     case "$getpwnam_r_proto" in
15510                 REENTRANT_PROTO*) ;;
15511                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15512                 esac
15513                 echo "Prototype: $try" ;;
15514         esac
15515         ;;
15516         *)      case "$usethreads" in
15517                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15518                 esac
15519                 d_getpwnam_r=undef
15520                 getpwnam_r_proto=0
15521                 ;;
15522         esac
15523         ;;
15524 *)      getpwnam_r_proto=0
15525         ;;
15526 esac
15527
15528 : see if getpwuid_r exists
15529 set getpwuid_r d_getpwuid_r
15530 eval $inlibc
15531 case "$d_getpwuid_r" in
15532 "$define")
15533         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15534         case "$d_getpwuid_r_proto:$usethreads" in
15535         ":define")      d_getpwuid_r_proto=define
15536                 set d_getpwuid_r_proto getpwuid_r $hdrs
15537                 eval $hasproto ;;
15538         *)      ;;
15539         esac
15540         case "$d_getpwuid_r_proto" in
15541         define)
15542         case "$getpwuid_r_proto" in
15543         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15544         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15545         esac
15546         case "$getpwuid_r_proto" in
15547         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15548         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15549         esac
15550         case "$getpwuid_r_proto" in
15551         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15552         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15553         esac
15554         case "$getpwuid_r_proto" in
15555         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15556         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15557         esac
15558         case "$getpwuid_r_proto" in
15559         ''|0)   d_getpwuid_r=undef
15560                 getpwuid_r_proto=0
15561                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15562         * )     case "$getpwuid_r_proto" in
15563                 REENTRANT_PROTO*) ;;
15564                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15565                 esac
15566                 echo "Prototype: $try" ;;
15567         esac
15568         ;;
15569         *)      case "$usethreads" in
15570                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15571                 esac
15572                 d_getpwuid_r=undef
15573                 getpwuid_r_proto=0
15574                 ;;
15575         esac
15576         ;;
15577 *)      getpwuid_r_proto=0
15578         ;;
15579 esac
15580
15581 : Optional checks for getsbyname and getsbyport
15582
15583 : see if getservbyname exists
15584 set getservbyname d_getsbyname
15585 eval $inlibc
15586
15587 : see if getservbyport exists
15588 set getservbyport d_getsbyport
15589 eval $inlibc
15590
15591 : see if getservent exists
15592 set getservent d_getsent
15593 eval $inlibc
15594
15595 : see if getservbyname_r exists
15596 set getservbyname_r d_getservbyname_r
15597 eval $inlibc
15598 case "$d_getservbyname_r" in
15599 "$define")
15600         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15601         case "$d_getservbyname_r_proto:$usethreads" in
15602         ":define")      d_getservbyname_r_proto=define
15603                 set d_getservbyname_r_proto getservbyname_r $hdrs
15604                 eval $hasproto ;;
15605         *)      ;;
15606         esac
15607         case "$d_getservbyname_r_proto" in
15608         define)
15609         case "$getservbyname_r_proto" in
15610         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15611         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15612         esac
15613         case "$getservbyname_r_proto" in
15614         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15615         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15616         esac
15617         case "$getservbyname_r_proto" in
15618         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15619         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15620         esac
15621         case "$getservbyname_r_proto" in
15622         ''|0)   d_getservbyname_r=undef
15623                 getservbyname_r_proto=0
15624                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15625         * )     case "$getservbyname_r_proto" in
15626                 REENTRANT_PROTO*) ;;
15627                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15628                 esac
15629                 echo "Prototype: $try" ;;
15630         esac
15631         ;;
15632         *)      case "$usethreads" in
15633                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15634                 esac
15635                 d_getservbyname_r=undef
15636                 getservbyname_r_proto=0
15637                 ;;
15638         esac
15639         ;;
15640 *)      getservbyname_r_proto=0
15641         ;;
15642 esac
15643
15644 : see if getservbyport_r exists
15645 set getservbyport_r d_getservbyport_r
15646 eval $inlibc
15647 case "$d_getservbyport_r" in
15648 "$define")
15649         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15650         case "$d_getservbyport_r_proto:$usethreads" in
15651         ":define")      d_getservbyport_r_proto=define
15652                 set d_getservbyport_r_proto getservbyport_r $hdrs
15653                 eval $hasproto ;;
15654         *)      ;;
15655         esac
15656         case "$d_getservbyport_r_proto" in
15657         define)
15658         case "$getservbyport_r_proto" in
15659         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15660         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15661         esac
15662         case "$getservbyport_r_proto" in
15663         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15664         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15665         esac
15666         case "$getservbyport_r_proto" in
15667         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15668         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15669         esac
15670         case "$getservbyport_r_proto" in
15671         ''|0)   d_getservbyport_r=undef
15672                 getservbyport_r_proto=0
15673                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15674         * )     case "$getservbyport_r_proto" in
15675                 REENTRANT_PROTO*) ;;
15676                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15677                 esac
15678                 echo "Prototype: $try" ;;
15679         esac
15680         ;;
15681         *)      case "$usethreads" in
15682                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15683                 esac
15684                 d_getservbyport_r=undef
15685                 getservbyport_r_proto=0
15686                 ;;
15687         esac
15688         ;;
15689 *)      getservbyport_r_proto=0
15690         ;;
15691 esac
15692
15693 : see if getservent_r exists
15694 set getservent_r d_getservent_r
15695 eval $inlibc
15696 case "$d_getservent_r" in
15697 "$define")
15698         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15699         case "$d_getservent_r_proto:$usethreads" in
15700         ":define")      d_getservent_r_proto=define
15701                 set d_getservent_r_proto getservent_r $hdrs
15702                 eval $hasproto ;;
15703         *)      ;;
15704         esac
15705         case "$d_getservent_r_proto" in
15706         define)
15707         case "$getservent_r_proto" in
15708         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15709         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15710         esac
15711         case "$getservent_r_proto" in
15712         ''|0) try='int getservent_r(struct servent*, char*, int);'
15713         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15714         esac
15715         case "$getservent_r_proto" in
15716         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15717         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15718         esac
15719         case "$getservent_r_proto" in
15720         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15721         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15722         esac
15723         case "$getservent_r_proto" in
15724         ''|0)   d_getservent_r=undef
15725                 getservent_r_proto=0
15726                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15727         * )     case "$getservent_r_proto" in
15728                 REENTRANT_PROTO*) ;;
15729                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15730                 esac
15731                 echo "Prototype: $try" ;;
15732         esac
15733         ;;
15734         *)      case "$usethreads" in
15735                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15736                 esac
15737                 d_getservent_r=undef
15738                 getservent_r_proto=0
15739                 ;;
15740         esac
15741         ;;
15742 *)      getservent_r_proto=0
15743         ;;
15744 esac
15745
15746 : see if prototypes for various getservxxx netdb.h functions are available
15747 echo " "
15748 set d_getservprotos getservent $i_netdb netdb.h
15749 eval $hasproto
15750
15751 : see if getspnam exists
15752 set getspnam d_getspnam
15753 eval $inlibc
15754
15755 : see if this is a shadow.h system
15756 set shadow.h i_shadow
15757 eval $inhdr
15758
15759 : see if getspnam_r exists
15760 set getspnam_r d_getspnam_r
15761 eval $inlibc
15762 case "$d_getspnam_r" in
15763 "$define")
15764         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15765         case "$d_getspnam_r_proto:$usethreads" in
15766         ":define")      d_getspnam_r_proto=define
15767                 set d_getspnam_r_proto getspnam_r $hdrs
15768                 eval $hasproto ;;
15769         *)      ;;
15770         esac
15771         case "$d_getspnam_r_proto" in
15772         define)
15773         case "$getspnam_r_proto" in
15774         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15775         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15776         esac
15777         case "$getspnam_r_proto" in
15778         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15779         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15780         esac
15781         case "$getspnam_r_proto" in
15782         ''|0)   d_getspnam_r=undef
15783                 getspnam_r_proto=0
15784                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15785         * )     case "$getspnam_r_proto" in
15786                 REENTRANT_PROTO*) ;;
15787                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15788                 esac
15789                 echo "Prototype: $try" ;;
15790         esac
15791         ;;
15792         *)      case "$usethreads" in
15793                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15794                 esac
15795                 d_getspnam_r=undef
15796                 getspnam_r_proto=0
15797                 ;;
15798         esac
15799         ;;
15800 *)      getspnam_r_proto=0
15801         ;;
15802 esac
15803
15804 : see if gettimeofday or ftime exists
15805 set gettimeofday d_gettimeod
15806 eval $inlibc
15807 case "$d_gettimeod" in
15808 "$undef")
15809         set ftime d_ftime 
15810         eval $inlibc
15811         ;;
15812 *)
15813         val="$undef"; set d_ftime; eval $setvar
15814         ;;
15815 esac
15816 case "$d_gettimeod$d_ftime" in
15817 "$undef$undef")
15818         echo " "
15819         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15820         ;;
15821 esac
15822
15823 : see if gmtime_r exists
15824 set gmtime_r d_gmtime_r
15825 eval $inlibc
15826 case "$d_gmtime_r" in
15827 "$define")
15828         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15829         case "$d_gmtime_r_proto:$usethreads" in
15830         ":define")      d_gmtime_r_proto=define
15831                 set d_gmtime_r_proto gmtime_r $hdrs
15832                 eval $hasproto ;;
15833         *)      ;;
15834         esac
15835         case "$d_gmtime_r_proto" in
15836         define)
15837         case "$gmtime_r_proto" in
15838         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15839         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15840         esac
15841         case "$gmtime_r_proto" in
15842         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15843         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15844         esac
15845         case "$gmtime_r_proto" in
15846         ''|0)   d_gmtime_r=undef
15847                 gmtime_r_proto=0
15848                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15849         * )     case "$gmtime_r_proto" in
15850                 REENTRANT_PROTO*) ;;
15851                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15852                 esac
15853                 echo "Prototype: $try" ;;
15854         esac
15855         ;;
15856         *)      case "$usethreads" in
15857                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15858                 esac
15859                 d_gmtime_r=undef
15860                 gmtime_r_proto=0
15861                 ;;
15862         esac
15863         ;;
15864 *)      gmtime_r_proto=0
15865         ;;
15866 esac
15867
15868 : see if hasmntopt exists
15869 set hasmntopt d_hasmntopt
15870 eval $inlibc
15871
15872 : see if this is a netinet/in.h or sys/in.h system
15873 set netinet/in.h i_niin sys/in.h i_sysin
15874 eval $inhdr
15875
15876 : see if arpa/inet.h has to be included
15877 set arpa/inet.h i_arpainet
15878 eval $inhdr
15879
15880 : see if htonl --and friends-- exists
15881 val=''
15882 set htonl val
15883 eval $inlibc
15884
15885 : Maybe they are macros.
15886 case "$val" in
15887 $undef)
15888         $cat >htonl.c <<EOM
15889 #include <stdio.h>
15890 #include <sys/types.h>
15891 #$i_niin I_NETINET_IN
15892 #$i_sysin I_SYS_IN
15893 #$i_arpainet I_ARPA_INET
15894 #ifdef I_NETINET_IN
15895 #include <netinet/in.h>
15896 #endif
15897 #ifdef I_SYS_IN
15898 #include <sys/in.h>
15899 #endif
15900 #ifdef I_ARPA_INET
15901 #include <arpa/inet.h>
15902 #endif
15903 #ifdef htonl
15904 printf("Defined as a macro.");
15905 #endif
15906 EOM
15907         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15908         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15909                 val="$define"
15910                 echo "But it seems to be defined as a macro." >&4
15911         fi
15912         $rm -f htonl.?
15913         ;;
15914 esac
15915 set d_htonl
15916 eval $setvar
15917
15918 : see if hypot exists
15919 set hypot d_hypot
15920 eval $inlibc
15921
15922 : see if ilogb exists
15923 set ilogb d_ilogb
15924 eval $inlibc
15925
15926 : see if ilogbl exists
15927 set ilogbl d_ilogbl
15928 eval $inlibc
15929
15930 : check whether inet_aton exists
15931 set inet_aton d_inetaton
15932 eval $inlibc
15933
15934 : see if inet_ntop exists
15935 set inet_ntop d_inetntop
15936 eval $inlibc
15937
15938 : see if inet_pton exists
15939 set inet_pton d_inetpton
15940 eval $inlibc
15941
15942 : Look for isascii
15943 echo " "
15944 $cat >isascii.c <<EOCP
15945 #include <stdio.h>
15946 #include <ctype.h>
15947 #$i_stdlib I_STDLIB
15948 #ifdef I_STDLIB
15949 #include <stdlib.h>
15950 #endif
15951 int main() {
15952         int c = 'A';
15953         if (isascii(c))
15954                 exit(0);
15955         else
15956                 exit(1);
15957 }
15958 EOCP
15959 set isascii
15960 if eval $compile; then
15961         echo "isascii() found." >&4
15962         val="$define"
15963 else
15964         echo "isascii() NOT found." >&4
15965         val="$undef"
15966 fi
15967 set d_isascii
15968 eval $setvar
15969 $rm -f isascii*
15970
15971 : Look for isblank
15972 echo " "
15973 $cat >isblank.c <<'EOCP'
15974 #include <stdio.h>
15975 #include <ctype.h>
15976 int main() {
15977         int c = ' ';
15978         if (isblank(c))
15979                 return 0 ;
15980         else
15981                 return 1 ;
15982 }
15983 EOCP
15984 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15985         echo "isblank() found." >&4
15986         val="$define"
15987 else
15988         echo "isblank() NOT found." >&4
15989         val="$undef"
15990 fi
15991 set d_isblank
15992 eval $setvar
15993 $rm -f isblank*
15994
15995 : check for isfinite
15996 echo "Checking to see if you have isfinite..." >&4
15997 $cat >try.c <<EOCP
15998 #include <math.h>
15999 int main() { return isfinite(0.0); }
16000 EOCP
16001 set try
16002 if eval $compile; then
16003         val="$define"
16004         echo "You have isfinite."
16005 else
16006         val="$undef"
16007         echo "You do not have isfinite."
16008 fi
16009 $rm_try
16010 set d_isfinite
16011 eval $setvar
16012
16013 : see if isfinitel exists
16014 set isfinitel d_isfinitel
16015 eval $inlibc
16016
16017 : check for isinf
16018 echo "Checking to see if you have isinf..." >&4
16019 $cat >try.c <<EOCP
16020 #include <math.h>
16021 int main() { return isinf(0.0); }
16022 EOCP
16023 set try
16024 if eval $compile; then
16025         val="$define"
16026         echo "You have isinf."
16027 else
16028         val="$undef"
16029         echo "You do not have isinf."
16030 fi
16031 $rm_try
16032 set d_isinf
16033 eval $setvar
16034
16035 : see if isinfl exists
16036 set isinfl d_isinfl
16037 eval $inlibc
16038
16039 : check for isless
16040 echo "Checking to see if you have isless..." >&4
16041 $cat >try.c <<EOCP
16042 #include <math.h>
16043 int main() { return isless(2.0, 1.0); }
16044 EOCP
16045 set try
16046 if eval $compile; then
16047         val="$define"
16048         echo "You have isless."
16049 else
16050         val="$undef"
16051         echo "You do not have isless."
16052 fi
16053 $rm_try
16054 set d_isless
16055 eval $setvar
16056
16057 : check for isnan
16058 echo "Checking to see if you have isnan..." >&4
16059 $cat >try.c <<EOCP
16060 #include <math.h>
16061 int main() { return isnan(0.0); }
16062 EOCP
16063 set try
16064 if eval $compile; then
16065         val="$define"
16066         echo "You have isnan."
16067 else
16068         val="$undef"
16069         echo "You do not have isnan."
16070 fi
16071 $rm_try
16072 set d_isnan
16073 eval $setvar
16074
16075 : see if isnanl exists
16076 set isnanl d_isnanl
16077 eval $inlibc
16078
16079 : check for isnormal
16080 echo "Checking to see if you have isnormal..." >&4
16081 $cat >try.c <<EOCP
16082 #include <math.h>
16083 int main() { return isnormal(0.0); }
16084 EOCP
16085 set try
16086 if eval $compile; then
16087         val="$define"
16088         echo "You have isnormal."
16089 else
16090         val="$undef"
16091         echo "You do not have isnormal."
16092 fi
16093 $rm_try
16094 set d_isnormal
16095 eval $setvar
16096
16097 : see if j0 exists
16098 set j0 d_j0
16099 eval $inlibc
16100
16101 : see if j0l exists
16102 set j0l d_j0l
16103 eval $inlibc
16104
16105 : see if killpg exists
16106 set killpg d_killpg
16107 eval $inlibc
16108
16109 : see if localeconv exists
16110 set localeconv d_locconv
16111 eval $inlibc
16112
16113 : see if libc has the POSIX.1-2008 currency locale rules
16114 case "$d_locconv:$d_lc_monetary_2008" in
16115 $define:)
16116         $cat >try.c <<EOCP
16117 #include <locale.h>
16118 int main() {
16119         struct lconv *lc = localeconv();
16120         char int_p_cs_precedes = lc->int_p_cs_precedes;
16121         return 0;
16122 }
16123 EOCP
16124         set try
16125         if eval $compile; then
16126                 d_lc_monetary_2008="$define"
16127         else
16128                 d_lc_monetary_2008="$undef"
16129         fi;
16130         $rm_try
16131         ;;
16132 esac
16133
16134 : see if lchown exists
16135 echo " "
16136 $cat > try.c <<EOCP
16137 #include <pwd.h>
16138 #include <stdio.h>
16139 #include <stdlib.h>
16140 #$i_unistd      I_UNISTD
16141 #ifdef I_UNISTD
16142 #  include <unistd.h>
16143 #endif
16144 int main(int argc, char *argv[])
16145 {
16146    if (lchown("./try.c", -1, getgid()) == -1) {
16147        exit(EXIT_FAILURE);
16148    }
16149    exit(EXIT_SUCCESS);
16150 }
16151 EOCP
16152 set try
16153 if eval $compile && ./try; then
16154     $echo "lchown() found." >&4
16155     val="$define"
16156 else
16157     $echo "lchown() NOT found." >&4
16158     val="$undef"
16159 fi
16160 set d_lchown
16161 eval $setvar
16162 $rm_try
16163
16164 : See if number of significant digits in a double precision number is known
16165 echo " "
16166 $cat >ldbl_dig.c <<EOM
16167 #include <limits.h>
16168 #include <float.h>
16169 #ifdef LDBL_DIG
16170 printf("Contains LDBL_DIG");
16171 #endif
16172 EOM
16173 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16174 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16175         echo "LDBL_DIG found." >&4
16176         val="$define"
16177 else
16178         echo "LDBL_DIG NOT found." >&4
16179         val="$undef"
16180 fi
16181 $rm -f ldbl_dig.?
16182 set d_ldbl_dig
16183 eval $setvar
16184
16185 : see if lgamma exists
16186 set lgamma d_lgamma
16187 eval $inlibc
16188
16189 : see if lgamma_r exists
16190 set lgamma_r d_lgamma_r
16191 eval $inlibc
16192
16193 : check to see if math.h defines _LIB_VERSION
16194 d_libm_lib_version="$undef"
16195 echo " "
16196 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16197 $cat >try.c <<EOCP
16198 #include <unistd.h>
16199 #include <math.h>
16200 #include <stdio.h>
16201 int main (int argc, char *argv[])
16202 {
16203     printf ("%d\n", _LIB_VERSION);
16204     return (0);
16205     } /* main */
16206 EOCP
16207 set try
16208 if eval $compile; then
16209     foo=`$run ./try`
16210     echo "Yes, it does ($foo)" >&4
16211     d_libm_lib_version="$define"
16212 else
16213     echo "No, it does not (probably harmless)" >&4
16214     fi
16215 $rm_try
16216
16217 : see if link exists
16218 set link d_link
16219 eval $inlibc
16220
16221 : see if llrint exists
16222 set llrint d_llrint
16223 eval $inlibc
16224
16225 : see if llrintl exists
16226 set llrintl d_llrintl
16227 eval $inlibc
16228
16229 : see if llround exists
16230 set llround d_llround
16231 eval $inlibc
16232
16233 : see if llroundl exists
16234 set llroundl d_llroundl
16235 eval $inlibc
16236
16237 : see if localtime_r exists
16238 set localtime_r d_localtime_r
16239 eval $inlibc
16240 case "$d_localtime_r" in
16241 "$define")
16242         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16243         case "$d_localtime_r_proto:$usethreads" in
16244         ":define")      d_localtime_r_proto=define
16245                 set d_localtime_r_proto localtime_r $hdrs
16246                 eval $hasproto ;;
16247         *)      ;;
16248         esac
16249         case "$d_localtime_r_proto" in
16250         define)
16251         case "$localtime_r_proto" in
16252         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16253         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16254         esac
16255         case "$localtime_r_proto" in
16256         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16257         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16258         esac
16259         case "$localtime_r_proto" in
16260         ''|0)   d_localtime_r=undef
16261                 localtime_r_proto=0
16262                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16263         * )     case "$localtime_r_proto" in
16264                 REENTRANT_PROTO*) ;;
16265                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16266                 esac
16267                 echo "Prototype: $try" ;;
16268         esac
16269         ;;
16270         *)      case "$usethreads" in
16271                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16272                 esac
16273                 d_localtime_r=undef
16274                 localtime_r_proto=0
16275                 ;;
16276         esac
16277         ;;
16278 *)      localtime_r_proto=0
16279         ;;
16280 esac
16281
16282 : see if localtime_r calls tzset
16283 case "$localtime_r_proto" in
16284 REENTRANT_PROTO*)
16285         $cat >try.c <<EOCP
16286 /*  Does our libc's localtime_r call tzset ?
16287  *  return 0 if so, 1 otherwise.
16288  */
16289 #$i_systypes    I_SYS_TYPES
16290 #$i_unistd      I_UNISTD
16291 #$i_time        I_TIME
16292 #$i_stdlib      I_STDLIB
16293 #$i_malloc      I_MALLOC
16294 #ifdef I_SYS_TYPES
16295 #  include <sys/types.h>
16296 #endif
16297 #ifdef I_UNISTD
16298 #  include <unistd.h>
16299 #endif
16300 #ifdef I_TIME
16301 #  include <time.h>
16302 #endif
16303 #ifdef I_STDLIB
16304 #include <stdlib.h>
16305 #endif
16306 #include <string.h>
16307 #ifdef I_MALLOC
16308 #  include <malloc.h>
16309 #endif
16310 int main()
16311 {
16312     int result = 0;
16313     time_t t = time(0L);
16314     char w_tz[]="TZ" "=GMT+5",
16315          e_tz[]="TZ" "=GMT-5",
16316         *tz_e = (char*)malloc(16),
16317         *tz_w = (char*)malloc(16);
16318     struct tm tm_e, tm_w;
16319     memset(&tm_e,'\0',sizeof(struct tm));
16320     memset(&tm_w,'\0',sizeof(struct tm));
16321     strcpy(tz_e,e_tz);
16322     strcpy(tz_w,w_tz);
16323
16324     putenv(tz_e);
16325     localtime_r(&t, &tm_e);
16326
16327     putenv(tz_w);
16328     localtime_r(&t, &tm_w);
16329
16330     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16331         result = 1;
16332
16333     free(tz_e);free(tz_w);
16334     return result;
16335 }
16336 EOCP
16337         set try
16338         if eval $compile; then
16339             if $run ./try; then
16340                 d_localtime_r_needs_tzset=undef;
16341             else
16342                 d_localtime_r_needs_tzset=define;
16343             fi;
16344         else
16345             d_localtime_r_needs_tzset=undef;
16346         fi;
16347      ;;
16348   *)
16349      d_localtime_r_needs_tzset=undef;
16350      ;;
16351 esac
16352 $rm_try
16353
16354 : see if lockf exists
16355 set lockf d_lockf
16356 eval $inlibc
16357
16358 : see if log1p exists
16359 set log1p d_log1p
16360 eval $inlibc
16361
16362 : see if log2 exists
16363 set log2 d_log2
16364 eval $inlibc
16365
16366 : see if logb exists
16367 set logb d_logb
16368 eval $inlibc
16369
16370 : see if lrint exists
16371 set lrint d_lrint
16372 eval $inlibc
16373
16374 : see if lrintl exists
16375 set lrintl d_lrintl
16376 eval $inlibc
16377
16378 : see if lround exists
16379 set lround d_lround
16380 eval $inlibc
16381
16382 : see if lroundl exists
16383 set lroundl d_lroundl
16384 eval $inlibc
16385
16386 : see if prototype for lseek is available
16387 echo " "
16388 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16389 eval $hasproto
16390
16391 : see if lstat exists
16392 set lstat d_lstat
16393 eval $inlibc
16394
16395 : see if madvise exists
16396 set madvise d_madvise
16397 eval $inlibc
16398
16399 : see if malloc_size exists
16400 set malloc_size d_malloc_size
16401 eval $inlibc
16402
16403 : see if malloc_size_good exists
16404 set malloc_good_size d_malloc_good_size
16405 eval $inlibc
16406
16407 : see if malloc_usable_size exists
16408 set malloc_usable_size d_malloc_usable_size
16409 eval $inlibc
16410
16411 : see if mblen exists
16412 set mblen d_mblen
16413 eval $inlibc
16414
16415 : see if mbrlen exists
16416 set mbrlen d_mbrlen
16417 eval $inlibc
16418
16419 : see if mbrtowc exists
16420 set mbrtowc d_mbrtowc
16421 eval $inlibc
16422
16423 : see if mbstowcs exists
16424 set mbstowcs d_mbstowcs
16425 eval $inlibc
16426
16427 : see if mbtowc exists
16428 set mbtowc d_mbtowc
16429 eval $inlibc
16430
16431 : see if memmem exists
16432 : We need both a prototype in string.h and the symbol in libc.
16433 echo " "
16434 d_memmem_proto=''
16435 xx1="#$d_gnulibc HAS_GNULIBC"
16436 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16437 xx3='#   define _GNU_SOURCE'
16438 xx4='#endif'
16439 set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16440 eval $hasproto
16441 case "$d_memmem_proto" in
16442     define) # see if memmem exists
16443         set memmem d_memmem
16444         eval $inlibc
16445         ;;
16446     *)  val=$undef
16447         set d_memmem
16448         eval $setvar
16449         ;;
16450 esac
16451
16452 : see if memrchr exists
16453 : We need both a prototype in string.h and the symbol in libc.
16454 echo " "
16455 d_memrchr_proto=''
16456 xx1="#$d_gnulibc HAS_GNULIBC"
16457 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16458 xx3='#   define _GNU_SOURCE'
16459 xx4='#endif'
16460 set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16461 eval $hasproto
16462 case "$d_memrchr_proto" in
16463     define) # see if memrchr exists
16464         set memrchr d_memrchr
16465         eval $inlibc
16466         ;;
16467     *)  val=$undef
16468         set d_memrchr
16469         eval $setvar
16470         ;;
16471 esac
16472
16473 : see if mkdir exists
16474 set mkdir d_mkdir
16475 eval $inlibc
16476
16477 : see if mkdtemp exists
16478 set mkdtemp d_mkdtemp
16479 eval $inlibc
16480
16481 : see if mkfifo exists
16482 set mkfifo d_mkfifo
16483 eval $inlibc
16484
16485 : see if mkostemp exists
16486 set mkostemp d_mkostemp
16487 eval $inlibc
16488
16489 : see if mkstemp exists
16490 set mkstemp d_mkstemp
16491 eval $inlibc
16492
16493 : see if mkstemps exists
16494 set mkstemps d_mkstemps
16495 eval $inlibc
16496
16497 : see if mktime exists
16498 set mktime d_mktime
16499 eval $inlibc
16500
16501 : see if sys/mman.h has to be included
16502 set sys/mman.h i_sysmman
16503 eval $inhdr
16504
16505 : see if mmap exists
16506 set mmap d_mmap
16507 eval $inlibc
16508 : see what shmat returns
16509 : default to something harmless
16510 mmaptype='void *'
16511 case "$i_sysmman$d_mmap" in
16512 "$define$define")
16513         $cat >mmap.c <<'END'
16514 #include <sys/mman.h>
16515 void *mmap();
16516 END
16517         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16518                 mmaptype='void *'
16519         else
16520                 mmaptype='caddr_t'
16521         fi
16522         echo "and it returns ($mmaptype)." >&4
16523         ;;
16524 esac
16525
16526 : see if sqrtl exists
16527 set sqrtl d_sqrtl
16528 eval $inlibc
16529
16530 : see if scalbnl exists
16531 set scalbnl d_scalbnl
16532 eval $inlibc
16533
16534 : see if truncl exists
16535 set truncl d_truncl
16536 eval $inlibc
16537
16538 : see if modfl exists
16539 set modfl d_modfl
16540 eval $inlibc
16541
16542 : see if prototype for modfl is available
16543 echo " "
16544 set d_modflproto modfl define math.h
16545 eval $hasproto
16546
16547 if $test "$uselongdouble" = "$define"; then
16548     message=""
16549     if $test "$d_sqrtl" != "$define"; then
16550         message="$message sqrtl"
16551     fi
16552     if $test "$d_modfl" != "$define"; then
16553         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16554             echo "You have both truncl and copysignl, so I can emulate modfl."
16555         else
16556             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16557                 echo "You have both aintl and copysignl, so I can emulate modfl."
16558             else
16559                 message="$message modfl"
16560             fi
16561         fi
16562     fi
16563     if $test "$d_frexpl" != "$define"; then
16564         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16565             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16566         else
16567             message="$message frexpl"
16568         fi
16569     fi
16570     if $test "$d_ldexpl" != "$define"; then
16571         message="$message ldexpl"
16572     fi
16573
16574     if $test "$message" != ""; then
16575         $cat <<EOM >&4
16576
16577 *** You requested the use of long doubles but you do not seem to have
16578 *** the following mathematical functions needed for long double support:
16579 ***    $message
16580 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16581 *** Cannot continue, aborting.
16582
16583 EOM
16584
16585         exit 1
16586     fi
16587 fi
16588
16589 : see if mprotect exists
16590 set mprotect d_mprotect
16591 eval $inlibc
16592
16593 : see if msgctl exists
16594 set msgctl d_msgctl
16595 eval $inlibc
16596
16597 : see if msgget exists
16598 set msgget d_msgget
16599 eval $inlibc
16600
16601 : see if msgsnd exists
16602 set msgsnd d_msgsnd
16603 eval $inlibc
16604
16605 : see if msgrcv exists
16606 set msgrcv d_msgrcv
16607 eval $inlibc
16608
16609 : see how much of the 'msg*(2)' library is present.
16610 h_msg=true
16611 echo " "
16612 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16613 *"$undef"*) h_msg=false;;
16614 esac
16615 case "$osname" in
16616 freebsd)
16617     case "`ipcs 2>&1`" in
16618     "SVID messages"*"not configured"*)
16619         echo "Your $osname does not have the msg*(2) configured." >&4
16620         h_msg=false
16621         val="$undef"
16622         set msgctl d_msgctl
16623         eval $setvar
16624         set msgget d_msgget
16625         eval $setvar
16626         set msgsnd d_msgsnd
16627         eval $setvar
16628         set msgrcv d_msgrcv
16629         eval $setvar
16630         ;;
16631     esac
16632     ;;
16633 esac
16634 : we could also check for sys/ipc.h ...
16635 if $h_msg && $test `./findhdr sys/msg.h`; then
16636         echo "You have the full msg*(2) library." >&4
16637         val="$define"
16638 else
16639         echo "You don't have the full msg*(2) library." >&4
16640         val="$undef"
16641 fi
16642 set d_msg
16643 eval $setvar
16644
16645 : Check for msghdr_s
16646 echo " "
16647 echo "Checking to see if your system supports struct msghdr..." >&4
16648 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16649 eval $hasstruct
16650 case "$d_msghdr_s" in
16651 "$define")      echo "Yes, it does."   ;;
16652 *)              echo "No, it doesn't." ;;
16653 esac
16654
16655 : see if msync exists
16656 set msync d_msync
16657 eval $inlibc
16658
16659 : see if munmap exists
16660 set munmap d_munmap
16661 eval $inlibc
16662
16663 : see if nan exists
16664 set nan d_nan
16665 eval $inlibc
16666
16667 : see if nanosleep exists
16668 set nanosleep d_nanosleep
16669 eval $inlibc
16670
16671 : see if nearbyint exists
16672 set nearbyint d_nearbyint
16673 eval $inlibc
16674
16675 : see if nextafter exists
16676 set nextafter d_nextafter
16677 eval $inlibc
16678
16679 : see if nexttoward exists
16680 set nexttoward d_nexttoward
16681 eval $inlibc
16682
16683 : see if nice exists
16684 set nice d_nice
16685 eval $inlibc
16686
16687 : see if this is a langinfo.h system
16688 set langinfo.h i_langinfo
16689 eval $inhdr
16690
16691 : see if nl_langinfo exists
16692 set nl_langinfo d_nl_langinfo
16693 eval $inlibc
16694
16695 : see if locale.h is available
16696 set locale.h i_locale
16697 eval $inhdr
16698
16699 : check for nl_langinfo_l item
16700 $cat <<EOM
16701
16702 Checking to see if you have nl_langinfo_l(), and that it is thread-safe
16703 EOM
16704 $cat >try.c <<EOCP
16705 #$i_stdlib I_STDLIB
16706 #ifdef I_STDLIB
16707 #  include <stdlib.h>
16708 #endif
16709 #include <string.h>
16710 #$i_langinfo I_LANGINFO
16711 #ifdef I_LANGINFO
16712 #  include <langinfo.h>
16713 #endif
16714 #$i_pthread I_PTHREAD
16715 #ifdef I_PTHREAD
16716 #  include <pthread.h>
16717 #endif
16718 #$i_locale I_LOCALE
16719 #ifdef I_LOCALE
16720 #  include <locale.h>
16721 #endif
16722
16723 void *
16724 thread_start(void * arg)
16725 {
16726     nl_langinfo(RADIXCHAR);
16727 }
16728
16729 int main() {
16730     char * main_buffer;
16731     char save_main_buffer[1000];
16732     pthread_t subthread;
16733     pthread_attr_t attr;
16734
16735     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
16736
16737     /* If too large for our generous allowance, just assume we don't have
16738      * it. */
16739     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
16740         exit(1);
16741     }
16742
16743     strcpy(save_main_buffer, main_buffer);
16744
16745     if (pthread_attr_init(&attr) != 0) {
16746         exit(1);
16747     }
16748
16749     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
16750         exit(1);
16751     }
16752
16753     if (pthread_join(subthread, NULL) != 0) {
16754         exit(1);
16755     }
16756
16757     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
16758 }
16759 EOCP
16760 case "$usethreads" in
16761     define)
16762         set try
16763         if eval $compile; then
16764             echo "Your system has nl_langinfo_l()..." >&4
16765             d_nl_langinfo_l="$define"
16766             echo "$d_nl_langinfo_l" >&4
16767             if $run ./try; then
16768                 echo "and it is thread-safe (just as I'd hoped)." >&4
16769                 d_thread_safe_nl_langinfo_l="$define"
16770                 echo "$d_thread_safe_nl_langinfo_l" >&4
16771             else
16772                 echo "but it isn't thread-safe." >&4
16773             fi
16774         else
16775             echo "your system does not have nl_langinfo_l()" >&4
16776         fi
16777         ;;
16778     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
16779 esac
16780 if test X"$d_nl_langinfo_l" = X; then
16781         d_nl_langinfo_l="$undef"
16782 fi
16783 if test X"$d_thread_safe_nl_langinfo_l" = X; then
16784         d_thread_safe_nl_langinfo_l="$undef"
16785 fi
16786 $rm_try
16787
16788 : Look for non 'int'-sized bitfields
16789 case "$d_non_int_bitfields" in
16790 '')
16791 echo " " >&4
16792 echo "Checking whether your compiler can handle struct bitfields that aren't 'int' or 'unsigned int' ..." >&4
16793 $cat >try.c <<'EOCP'
16794 #include <stdio.h>
16795 struct foo {
16796     unsigned char byte:1;
16797     unsigned short halfword:1;
16798 } bar;
16799 EOCP
16800 if $cc $ccflags -c try.c >try.out 2>&1 ; then
16801         if $compiler_warning try.out >/dev/null 2>&1; then
16802                 echo "Your C compiler doesn't support struct bitfields that aren't 'int' or 'unsigned int'." >&4
16803                 val="$undef"
16804         else
16805                 echo "Your C compiler supports struct bitfields besides 'int' and 'unsigned int'." >&4
16806                 val="$define"
16807         fi
16808 else
16809         echo "Your C compiler doesn't seem to understand struct bitfields that aren't 'int' or 'unsigned int' at all." >&4
16810         val="$undef"
16811 fi
16812 ;;
16813 *) val="$d_non_int_bitfields" ;;
16814 esac
16815 set d_non_int_bitfields
16816 eval $setvar
16817 $rm_try
16818
16819 : see if this is a quadmath.h system
16820 set quadmath.h i_quadmath
16821 eval $inhdr
16822
16823 : Check basic sizes
16824 echo " "
16825 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16826
16827 case "$use64bitint:$d_quad:$quadtype" in
16828 define:define:?*)
16829         ivtype="$quadtype"
16830         uvtype="$uquadtype"
16831         ivsize=8
16832         uvsize=8
16833         ;;
16834 *)      ivtype="long"
16835         uvtype="unsigned long"
16836         ivsize=$longsize
16837         uvsize=$longsize
16838         ;;
16839 esac
16840
16841 case "$uselongdouble:$d_longdbl" in
16842 define:define)
16843         nvtype="long double"
16844         nvsize=$longdblsize
16845         ;;
16846 *)      nvtype=double
16847         nvsize=$doublesize
16848         ;;
16849 esac
16850
16851 case "$usequadmath:$i_quadmath" in
16852 define:define)
16853   nvtype="__float128"
16854   nvsize=16
16855   case "$libs" in
16856   *quadmath*) ;;
16857   *) $cat <<EOM >&4
16858
16859 *** You requested the use of the quadmath library, but you
16860 *** do not seem to have the quadmath library installed.
16861 *** Cannot continue, aborting.
16862 EOM
16863     exit 1
16864     ;;
16865   esac
16866   ;;
16867 define:*) $cat <<EOM >&4
16868
16869 *** You requested the use of the quadmath library, but you
16870 *** do not seem to have the required header, <quadmath.h>.
16871 EOM
16872   case "$gccversion" in
16873   [23].*|4.[0-5]*)
16874    $cat <<EOM >&4
16875 *** Your gcc looks a bit old:
16876 *** $gccversion
16877 EOM
16878     ;;
16879   '')
16880    $cat <<EOM >&4
16881 *** You are not running a gcc.
16882 EOM
16883     ;;
16884   esac
16885   $cat <<EOM >&4
16886 *** For the quadmath library you need at least gcc 4.6.
16887 *** Cannot continue, aborting.
16888 EOM
16889   exit 1
16890   ;;
16891 esac
16892
16893 $echo "(IV will be "$ivtype", $ivsize bytes)"
16894 $echo "(UV will be "$uvtype", $uvsize bytes)"
16895 $echo "(NV will be "$nvtype", $nvsize bytes)"
16896
16897 $cat >try.c <<EOCP
16898 #$i_inttypes I_INTTYPES
16899 #ifdef I_INTTYPES
16900 #include <inttypes.h>
16901 #endif
16902 #include <stdio.h>
16903 int main() {
16904 #ifdef INT8
16905    int8_t i =  INT8_MAX;
16906   uint8_t u = UINT8_MAX;
16907   printf("int8_t\n");
16908 #endif
16909 #ifdef INT16
16910    int16_t i =  INT16_MAX;
16911   uint16_t u = UINT16_MAX;
16912   printf("int16_t\n");
16913 #endif
16914 #ifdef INT32
16915    int32_t i =  INT32_MAX;
16916   uint32_t u = UINT32_MAX;
16917   printf("int32_t\n");
16918 #endif
16919 }
16920 EOCP
16921
16922 i8type="signed char"
16923 u8type="unsigned char"
16924 i8size=1
16925 u8size=1
16926
16927 case "$i16type" in
16928 '')     case "$shortsize" in
16929         2)      i16type=short
16930                 u16type="unsigned short"
16931                 i16size=$shortsize
16932                 u16size=$shortsize
16933                 ;;
16934         esac
16935         ;;
16936 esac
16937 case "$i16type" in
16938 '')     set try -DINT16
16939         if eval $compile; then
16940                 case "`$run ./try`" in
16941                 int16_t)
16942                         i16type=int16_t
16943                         u16type=uint16_t
16944                         i16size=2
16945                         u16size=2
16946                         ;;
16947                 esac
16948         fi
16949         ;;
16950 esac
16951 case "$i16type" in
16952 '')     if $test $shortsize -ge 2; then
16953                 i16type=short
16954                 u16type="unsigned short"
16955                 i16size=$shortsize
16956                 u16size=$shortsize
16957         fi
16958         ;;
16959 esac
16960
16961 case "$i32type" in
16962 '')     case "$longsize" in
16963         4)      i32type=long
16964                 u32type="unsigned long"
16965                 i32size=$longsize
16966                 u32size=$longsize
16967                 ;;
16968         *)      case "$intsize" in
16969                 4)      i32type=int
16970                         u32type="unsigned int"
16971                         i32size=$intsize
16972                         u32size=$intsize
16973                         ;;
16974                 esac
16975                 ;;
16976         esac
16977         ;;
16978 esac
16979 case "$i32type" in
16980 '')     set try -DINT32
16981         if eval $compile; then
16982                 case "`$run ./try`" in
16983                 int32_t)
16984                         i32type=int32_t
16985                         u32type=uint32_t
16986                         i32size=4
16987                         u32size=4
16988                         ;;
16989                 esac
16990         fi
16991         ;;
16992 esac
16993 case "$i32type" in
16994 '')     if $test $intsize -ge 4; then
16995                 i32type=int
16996                 u32type="unsigned int"
16997                 i32size=$intsize
16998                 u32size=$intsize
16999         fi
17000         ;;
17001 esac
17002
17003 case "$i64type" in
17004 '')     case "$d_quad:$quadtype" in
17005         define:?*)
17006                 i64type="$quadtype"
17007                 u64type="$uquadtype"
17008                 i64size=8
17009                 u64size=8
17010                 ;;
17011         esac
17012         ;;
17013 esac
17014
17015 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
17016 $cat <<EOP >try.c
17017 #include <stdio.h>
17018 #$i_stdlib I_STDLIB
17019 #ifdef I_STDLIB
17020 #include <stdlib.h>
17021 #endif
17022 #$i_inttypes I_INTTYPES
17023 #ifdef I_INTTYPES
17024 #include <inttypes.h>
17025 #endif
17026 #include <sys/types.h>
17027 #include <signal.h>
17028 #ifdef SIGFPE
17029 /* volatile so that the compiler has to store it out to memory */
17030 volatile int bletched = 0;
17031 $signal_t blech(int s) { bletched = 1; }
17032 #endif
17033 int main() {
17034     $uvtype u = 0;
17035     $nvtype d;
17036     int     n = 8 * $uvsize;
17037     int     i;
17038 #ifdef SIGFPE
17039     signal(SIGFPE, blech);
17040 #endif
17041
17042     for (i = 0; i < n; i++) {
17043       u = u << 1 | ($uvtype)1;
17044       d = ($nvtype)u;
17045       if (($uvtype)d != u)
17046         break;
17047       if (d <= 0)
17048         break;
17049       d = ($nvtype)(u - 1);
17050       if (($uvtype)d != (u - 1))
17051         break;
17052 #ifdef SIGFPE
17053       if (bletched)
17054         break;
17055 #endif
17056     }
17057     printf("%d\n", ((i == n) ? -n : i));
17058     exit(0);
17059 }
17060 EOP
17061 set try
17062
17063 d_nv_preserves_uv="$undef"
17064 if eval $compile; then
17065         nv_preserves_uv_bits="`$run ./try`"
17066 fi
17067 case "$nv_preserves_uv_bits" in
17068 \-[1-9]*)
17069         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
17070         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  >&4
17071         d_nv_preserves_uv="$define"
17072         ;;
17073 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  >&4
17074         d_nv_preserves_uv="$undef" ;;
17075 *)      $echo "Can't figure out how many bits your NVs preserve." >&4
17076         nv_preserves_uv_bits="0" ;;
17077 esac
17078 $rm_try
17079
17080 $echo "Checking to find the largest integer value your NVs can hold..." >&4
17081 $cat <<EOP >try.c
17082 #include <stdio.h>
17083
17084 typedef $nvtype NV;
17085
17086 int
17087 main() {
17088   NV value = 2;
17089   int count = 1;
17090
17091   while(count < 256) {
17092     /* volatile so that the compiler has to store it out to memory */
17093     volatile NV up = value + 1.0;
17094     volatile NV negated = -value;
17095     volatile NV down = negated - 1.0;
17096     volatile NV got_up = up - value;
17097     int up_good = got_up == 1.0;
17098     int got_down = down - negated;
17099     int down_good = got_down == -1.0;
17100
17101     if (down_good != up_good) {
17102       fprintf(stderr,
17103               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
17104               up_good, (double) got_up, down_good, (double) got_down,
17105               count, (double) value);
17106       return 1;
17107     }
17108     if (!up_good) {
17109       while (1) {
17110         if (count > 8) {
17111           count -= 8;
17112           fputs("256.0", stdout);
17113         } else {
17114           count--;
17115           fputs("2.0", stdout);
17116         }
17117         if (!count) {
17118           puts("");
17119           return 0;
17120         }
17121         fputs("*", stdout);
17122       }
17123     }
17124     value *= 2;
17125     ++count;
17126   }
17127   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
17128           count, (double) value);
17129   return 1;
17130 }
17131 EOP
17132 set try
17133
17134 nv_overflows_integers_at='0'
17135 if eval $compile; then
17136     xxx="`$run ./try`"
17137     case "$?" in
17138         0)
17139             case "$xxx" in
17140                 2*)  cat >&4 <<EOM
17141 The largest integer your NVs can preserve is equal to $xxx
17142 EOM
17143                     nv_overflows_integers_at="$xxx"
17144                     ;;
17145                 *)  cat >&4 <<EOM
17146 Cannot determine the largest integer value your NVs can hold, unexpected output
17147 '$xxx'
17148 EOM
17149                     ;;
17150             esac
17151             ;;
17152         *)  cat >&4 <<EOM
17153 Cannot determine the largest integer value your NVs can hold
17154 EOM
17155             ;;
17156     esac
17157 fi
17158 $rm_try
17159
17160 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
17161 $cat <<EOP >try.c
17162 #include <stdio.h>
17163 #$i_stdlib I_STDLIB
17164 #ifdef I_STDLIB
17165 #include <stdlib.h>
17166 #endif
17167 #include <string.h>
17168 #include <sys/types.h>
17169 #include <signal.h>
17170 #ifdef SIGFPE
17171 /* volatile so that the compiler has to store it out to memory */
17172 volatile int bletched = 0;
17173 $signal_t blech(int s) { bletched = 1; }
17174 #endif
17175
17176 int checkit($nvtype d, const char *where) {
17177     void *v = &d;
17178     unsigned char *p = (unsigned char *)v;
17179     unsigned char *end = p + sizeof(d);
17180     int fail = 0;
17181
17182     while (p < end)
17183         fail += *p++;
17184
17185     if (!fail)
17186         return 0;
17187
17188     p = (unsigned char *)v;
17189     printf("No - %s: 0x", where);
17190     while (p < end)
17191         printf ("%02X", *p++);
17192     printf("\n");
17193     return 1;
17194 }
17195
17196 int main(int argc, char **argv) {
17197     $nvtype d = 0.0;
17198     int fail = 0;
17199     fail += checkit(d, "0.0");
17200
17201     /* The compiler shouldn't be assuming that bletched is 0  */
17202     d = bletched;
17203
17204     fail += checkit(d, "bleched");
17205
17206 #ifdef SIGFPE
17207     signal(SIGFPE, blech);
17208 #endif
17209
17210     /* Paranoia - the compiler should have no way of knowing that ANSI says
17211        that argv[argc] will always be NULL.  Actually, if it did assume this it
17212        would be buggy, as this is C and main() can be called from elsewhere in
17213        the program.  */
17214     d = argv[argc] ? 1 : 0;
17215
17216     if (d) {
17217         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17218     }
17219
17220     fail += checkit(d, "ternary");
17221
17222     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17223
17224     if (d != 0.0) {
17225         printf("No - memset doesn't give 0.0\n");
17226         /* This might just blow up:  */
17227         printf("(gives %g)\n", d);
17228         return 1;
17229     }
17230
17231 #ifdef SIGFPE
17232     if (bletched) {
17233         printf("No - something bleched\n");
17234         return 1;
17235     }
17236 #endif
17237     if (fail) {
17238       printf("No - %d fail(s)\n", fail);
17239       return 1;
17240     }
17241     printf("Yes\n");
17242     return 0;
17243 }
17244 EOP
17245 set try
17246
17247 d_nv_zero_is_allbits_zero="$undef"
17248 if eval $compile; then
17249     xxx="`$run ./try`"
17250     case "$?" in
17251         0)
17252             case "$xxx" in
17253                 Yes)  cat >&4 <<EOM
17254 0.0 is represented as all bits zero in memory
17255 EOM
17256                     d_nv_zero_is_allbits_zero="$define"
17257                     ;;
17258                 *)  cat >&4 <<EOM
17259 0.0 is not represented as all bits zero in memory
17260 EOM
17261                     d_nv_zero_is_allbits_zero="$undef"
17262                     ;;
17263             esac
17264             ;;
17265         *)  cat >&4 <<EOM
17266 0.0 is not represented as all bits zero in memory
17267 EOM
17268             d_nv_zero_is_allbits_zero="$undef"
17269             ;;
17270     esac
17271 fi
17272 $rm_try
17273
17274 : check for off64_t
17275 echo " "
17276 echo "Checking to see if you have off64_t..." >&4
17277 $cat >try.c <<EOCP
17278 #include <sys/types.h>
17279 #include <unistd.h>
17280 int main() { off64_t x = 7; }
17281 EOCP
17282 set try
17283 if eval $compile; then
17284         val="$define"
17285         echo "You have off64_t."
17286 else
17287         val="$undef"
17288         echo "You do not have off64_t."
17289         case "$lseeksize" in
17290         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17291         esac
17292 fi
17293 $rm_try
17294 set d_off64_t
17295 eval $setvar
17296
17297 : how to create joinable pthreads
17298 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17299         echo " "
17300         echo "Checking what constant to use for creating joinable pthreads..." >&4
17301         $cat >try.c <<'EOCP'
17302 #include <pthread.h>
17303 int main() {
17304     int detachstate = JOINABLE;
17305 }
17306 EOCP
17307         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17308         if eval $compile; then
17309                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17310                 val="$undef" # Yes, undef.
17311                 set d_old_pthread_create_joinable
17312                 eval $setvar
17313                 val=""
17314                 set old_pthread_create_joinable
17315                 eval $setvar
17316         else
17317                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17318                 if eval $compile; then
17319                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17320                         val="$define"
17321                         set d_old_pthread_create_joinable
17322                         eval $setvar
17323                         val=PTHREAD_CREATE_UNDETACHED
17324                         set old_pthread_create_joinable
17325                         eval $setvar
17326                 else
17327                         set try -DJOINABLE=__UNDETACHED
17328                         if eval $compile; then
17329                                 echo "You seem to use __UNDETACHED." >&4
17330                                 val="$define"
17331                                 set d_old_pthread_create_joinable
17332                                 eval $setvar
17333                                 val=__UNDETACHED
17334                                 set old_pthread_create_joinable
17335                                 eval $setvar
17336                         else
17337                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17338                                 val="$define"
17339                                 set d_old_pthread_create_joinable
17340                                 eval $setvar
17341                                 val=0
17342                                 set old_pthread_create_joinable
17343                                 eval $setvar
17344                         fi
17345                 fi
17346         fi
17347         $rm_try
17348 else
17349     d_old_pthread_create_joinable="$undef"
17350     old_pthread_create_joinable=""
17351 fi
17352
17353 : see if pause exists
17354 set pause d_pause
17355 eval $inlibc
17356
17357 : see if pipe2 exists
17358 set pipe2 d_pipe2
17359 eval $inlibc
17360
17361 : see if poll exists
17362 set poll d_poll
17363 eval $inlibc
17364
17365 : see if prctl exists
17366 set prctl d_prctl
17367 eval $inlibc
17368
17369 : see if prctl supports PR_SET_NAME
17370 d_prctl_set_name=$undef
17371 case $d_prctl in
17372     $define)
17373         $cat >try.c <<EOM
17374 #ifdef __ANDROID__
17375 #include <unistd.h>
17376 #endif
17377 #include <sys/prctl.h>
17378
17379 int main (int argc, char *argv[])
17380 {
17381     return (prctl (PR_SET_NAME, "Test"));
17382     } /* main */
17383 EOM
17384         set try
17385         if eval $compile_ok && $run ./try; then
17386             echo "Your prctl (PR_SET_NAME, ...) works"
17387             d_prctl_set_name=$define
17388             fi
17389         $rm_try
17390         ;;
17391     esac
17392
17393 : see if readlink exists
17394 set readlink d_readlink
17395 eval $inlibc
17396
17397 : Check if there is a /proc symlink to the abs path of
17398 : the executing program.  We will honor hints of d_procselfexe=$undef
17399 : or procselfexe being non-empty, otherwise will try to determine both
17400 : if we have readlink.
17401 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17402 : referenced, and AmigaOS does not have a proc filesystem anyway.
17403 echo " "
17404 val="$undef"
17405 if $test "X$d_procselfexe" = Xundef; then
17406         procselfexe=''
17407 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17408         val="$define"
17409 elif $test "X$d_readlink" = Xdefine; then
17410         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17411         : and it feels more tidy to avoid an extra level of symlink
17412         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17413         while test $# -gt 0; do
17414             type=$1; try=$2
17415             shift; shift
17416             if $issymlink $try; then
17417                 $ls -l $try > reflect
17418                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17419                     echo "You have $type-like $try."
17420                     procselfexe='"'$try'"'
17421                     val="$define"
17422                     : This will break out of the loop
17423                     set X; shift
17424                 fi
17425             fi
17426         done
17427 fi
17428 $rm -f reflect
17429 set d_procselfexe
17430 eval $setvar
17431
17432 : backward compatibility for d_hvfork
17433 if test X$d_hvfork != X; then
17434         d_vfork="$d_hvfork"
17435         d_hvfork=''
17436 fi
17437 : see if there is a vfork
17438 val=''
17439 set vfork val
17440 eval $inlibc
17441
17442 d_pseudofork=$undef
17443
17444 : Ok, but do we want to use it. vfork is reportedly unreliable in
17445 : perl on Solaris 2.x, and probably elsewhere.
17446 case "$val" in
17447 $define)
17448         echo " "
17449         case "$usevfork" in
17450         false) dflt='n';;
17451         *) dflt='y';;
17452         esac
17453         cat <<'EOM'
17454
17455 Perl can only use a vfork() that doesn't suffer from strict
17456 restrictions on calling functions or modifying global data in
17457 the child.  For example, glibc-2.1 contains such a vfork()
17458 that is unsuitable.  If your system provides a proper fork()
17459 call, chances are that you do NOT want perl to use vfork().
17460
17461 EOM
17462         rp="Do you still want to use vfork()?"
17463         . ./myread
17464         case "$ans" in
17465         y|Y) ;;
17466         *)
17467                 echo "Ok, we won't use vfork()."
17468                 val="$undef"
17469                 ;;
17470         esac
17471         ;;
17472 esac
17473 set d_vfork
17474 eval $setvar
17475 case "$d_vfork" in
17476 $define) usevfork='true';;
17477 *) usevfork='false';;
17478 esac
17479
17480 : see whether the pthread_atfork exists
17481 $cat >try.c <<EOP
17482 #include <pthread.h>
17483 #include <stdio.h>
17484 int main() {
17485 #ifdef  PTHREAD_ATFORK
17486         pthread_atfork(NULL,NULL,NULL);
17487 #endif
17488 }
17489 EOP
17490
17491 : see if pthread_atfork exists
17492 set try -DPTHREAD_ATFORK
17493 if eval $compile; then
17494     val="$define"
17495 else
17496     val="$undef"
17497 fi
17498 case "$usethreads" in
17499 $define)
17500         case "$val" in
17501         $define) echo 'pthread_atfork found.' >&4        ;;
17502         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17503         esac
17504 esac
17505 set d_pthread_atfork
17506 eval $setvar
17507
17508 : see if pthread_attr_setscope exists
17509 set pthread_attr_setscope d_pthread_attr_setscope
17510 eval $inlibc
17511
17512 : see whether the various POSIXish _yields exist
17513 $cat >try.c <<EOP
17514 #include <pthread.h>
17515 #include <stdio.h>
17516 int main() {
17517 #ifdef SCHED_YIELD
17518         sched_yield();
17519 #else
17520 #ifdef PTHREAD_YIELD
17521         pthread_yield();
17522 #else
17523 #ifdef PTHREAD_YIELD_NULL
17524         pthread_yield(NULL);
17525 #endif
17526 #endif
17527 #endif
17528 }
17529 EOP
17530 : see if sched_yield exists
17531 set try -DSCHED_YIELD
17532 if eval $compile; then
17533     val="$define"
17534     sched_yield='sched_yield()'
17535 else
17536     val="$undef"
17537 fi
17538 case "$usethreads" in
17539 $define)
17540         case "$val" in
17541         $define) echo 'sched_yield() found.' >&4        ;;
17542         *)       echo 'sched_yield() NOT found.' >&4    ;;
17543         esac
17544 esac
17545 set d_sched_yield
17546 eval $setvar
17547
17548 : see if pthread_yield exists
17549 set try -DPTHREAD_YIELD
17550 if eval $compile; then
17551     val="$define"
17552     case "$sched_yield" in
17553     '') sched_yield='pthread_yield()' ;;
17554     esac
17555 else
17556     set try -DPTHREAD_YIELD_NULL
17557     if eval $compile; then
17558         val="$define"
17559         case "$sched_yield" in
17560         '') sched_yield='pthread_yield(NULL)' ;;
17561         esac
17562     else
17563         val="$undef"
17564     fi
17565 fi
17566 case "$usethreads" in
17567 $define)
17568         case "$val" in
17569         $define) echo 'pthread_yield() found.' >&4      ;;
17570         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17571         esac
17572         ;;
17573 esac
17574 set d_pthread_yield
17575 eval $setvar
17576 case "$sched_yield" in
17577 '') sched_yield=undef ;;
17578 esac
17579 $rm_try
17580
17581 : check for ptrdiff_t
17582 echo " "
17583 echo "Checking to see if you have ptrdiff_t..." >&4
17584 $cat >try.c <<EOCP
17585 #include <stddef.h>
17586 int main() { ptrdiff_t x = 7; }
17587 EOCP
17588 set try
17589 if eval $compile; then
17590         val="$define"
17591         echo "You have ptrdiff_t."
17592 else
17593         val="$undef"
17594         echo "You do not have ptrdiff_t."
17595 fi
17596 $rm_try
17597 set d_ptrdiff_t
17598 eval $setvar
17599
17600 : see if random_r exists
17601 set random_r d_random_r
17602 eval $inlibc
17603 case "$d_random_r" in
17604 "$define")
17605         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17606         case "$d_random_r_proto:$usethreads" in
17607         ":define")      d_random_r_proto=define
17608                 set d_random_r_proto random_r $hdrs
17609                 eval $hasproto ;;
17610         *)      ;;
17611         esac
17612         case "$d_random_r_proto" in
17613         define)
17614         case "$random_r_proto" in
17615         ''|0) try='int random_r(int*, struct random_data*);'
17616         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17617         esac
17618         case "$random_r_proto" in
17619         ''|0) try='int random_r(long*, struct random_data*);'
17620         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17621         esac
17622         case "$random_r_proto" in
17623         ''|0) try='int random_r(struct random_data*, int32_t*);'
17624         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17625         esac
17626         case "$random_r_proto" in
17627         ''|0)   d_random_r=undef
17628                 random_r_proto=0
17629                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17630         * )     case "$random_r_proto" in
17631                 REENTRANT_PROTO*) ;;
17632                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17633                 esac
17634                 echo "Prototype: $try" ;;
17635         esac
17636         ;;
17637         *)      case "$usethreads" in
17638                 define) echo "random_r has no prototype, not using it." >&4 ;;
17639                 esac
17640                 d_random_r=undef
17641                 random_r_proto=0
17642                 ;;
17643         esac
17644         ;;
17645 *)      random_r_proto=0
17646         ;;
17647 esac
17648
17649 : see if readdir and friends exist
17650 set readdir d_readdir
17651 eval $inlibc
17652 set seekdir d_seekdir
17653 eval $inlibc
17654 set telldir d_telldir
17655 eval $inlibc
17656 set rewinddir d_rewinddir
17657 eval $inlibc
17658
17659 : see if readdir64_r exists
17660 set readdir64_r d_readdir64_r
17661 eval $inlibc
17662 case "$d_readdir64_r" in
17663 "$define")
17664         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17665         case "$d_readdir64_r_proto:$usethreads" in
17666         ":define")      d_readdir64_r_proto=define
17667                 set d_readdir64_r_proto readdir64_r $hdrs
17668                 eval $hasproto ;;
17669         *)      ;;
17670         esac
17671         case "$d_readdir64_r_proto" in
17672         define)
17673         case "$readdir64_r_proto" in
17674         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17675         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17676         esac
17677         case "$readdir64_r_proto" in
17678         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17679         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17680         esac
17681         case "$readdir64_r_proto" in
17682         ''|0)   d_readdir64_r=undef
17683                 readdir64_r_proto=0
17684                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17685         * )     case "$readdir64_r_proto" in
17686                 REENTRANT_PROTO*) ;;
17687                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17688                 esac
17689                 echo "Prototype: $try" ;;
17690         esac
17691         ;;
17692         *)      case "$usethreads" in
17693                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17694                 esac
17695                 d_readdir64_r=undef
17696                 readdir64_r_proto=0
17697                 ;;
17698         esac
17699         ;;
17700 *)      readdir64_r_proto=0
17701         ;;
17702 esac
17703
17704 : see if readdir_r exists
17705 set readdir_r d_readdir_r
17706 eval $inlibc
17707 case "$d_readdir_r" in
17708 "$define")
17709         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17710         case "$d_readdir_r_proto:$usethreads" in
17711         ":define")      d_readdir_r_proto=define
17712                 set d_readdir_r_proto readdir_r $hdrs
17713                 eval $hasproto ;;
17714         *)      ;;
17715         esac
17716         case "$d_readdir_r_proto" in
17717         define)
17718         case "$readdir_r_proto" in
17719         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17720         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17721         esac
17722         case "$readdir_r_proto" in
17723         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17724         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17725         esac
17726         case "$readdir_r_proto" in
17727         ''|0)   d_readdir_r=undef
17728                 readdir_r_proto=0
17729                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17730         * )     case "$readdir_r_proto" in
17731                 REENTRANT_PROTO*) ;;
17732                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17733                 esac
17734                 echo "Prototype: $try" ;;
17735         esac
17736         ;;
17737         *)      case "$usethreads" in
17738                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17739                 esac
17740                 d_readdir_r=undef
17741                 readdir_r_proto=0
17742                 ;;
17743         esac
17744         ;;
17745 *)      readdir_r_proto=0
17746         ;;
17747 esac
17748
17749 : see if readv exists
17750 set readv d_readv
17751 eval $inlibc
17752
17753 : see if recvmsg exists
17754 set recvmsg d_recvmsg
17755 eval $inlibc
17756
17757 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17758 echo " "
17759 if set regcomp val -f d_regcomp; eval $csym; $val; then
17760         echo 'regcomp() found.' >&4
17761         d_regcomp="$define"
17762         d_regcmp="$undef"
17763         d_re_comp="$undef"
17764 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17765         echo 'regcmp() found.' >&4
17766         d_regcmp="$define"
17767         d_regcomp="$undef"
17768         d_re_comp="$undef"
17769 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17770         echo 're_comp() found, assuming re_exec() also exists.' >&4
17771         d_re_comp="$define"
17772         d_regcomp="$undef"
17773         d_regcmp="$undef"
17774 else
17775         $cat >&4 <<EOM
17776 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17777 EOM
17778         d_regcmp="$undef"
17779         d_re_comp="$undef"
17780         d_regcomp="$undef"
17781 fi
17782
17783 : see if remainder exists
17784 set remainder d_remainder
17785 eval $inlibc
17786
17787 : see if remquo exists
17788 set remquo d_remquo
17789 eval $inlibc
17790
17791 : see if rename exists
17792 set rename d_rename
17793 eval $inlibc
17794
17795 : see if rint exists
17796 set rint d_rint
17797 eval $inlibc
17798
17799 : see if rmdir exists
17800 set rmdir d_rmdir
17801 eval $inlibc
17802
17803 : see if round exists
17804 set round d_round
17805 eval $inlibc
17806
17807 : see if prototype for sbrk is available
17808 echo " "
17809 set d_sbrkproto sbrk $i_unistd unistd.h
17810 eval $hasproto
17811
17812 : see if scalbn exists
17813 set scalbn d_scalbn
17814 eval $inlibc
17815
17816 : see if select exists
17817 set select d_select
17818 eval $inlibc
17819
17820 : see if semctl exists
17821 set semctl d_semctl
17822 eval $inlibc
17823
17824 : see if semget exists
17825 set semget d_semget
17826 eval $inlibc
17827
17828 : see if semop exists
17829 set semop d_semop
17830 eval $inlibc
17831
17832 : see how much of the 'sem*(2)' library is present.
17833 h_sem=true
17834 echo " "
17835 case "$d_semctl$d_semget$d_semop" in
17836 *"$undef"*) h_sem=false;;
17837 esac
17838 case "$osname" in
17839 freebsd)
17840     case "`ipcs 2>&1`" in
17841     "SVID messages"*"not configured"*)
17842         echo "Your $osname does not have the sem*(2) configured." >&4
17843         h_sem=false
17844         val="$undef"
17845         set semctl d_semctl
17846         eval $setvar
17847         set semget d_semget
17848         eval $setvar
17849         set semop d_semop
17850         eval $setvar
17851         ;;
17852     esac
17853     ;;
17854 esac
17855 : we could also check for sys/ipc.h ...
17856 if $h_sem && $test `./findhdr sys/sem.h`; then
17857         echo "You have the full sem*(2) library." >&4
17858         val="$define"
17859 else
17860         echo "You don't have the full sem*(2) library." >&4
17861         val="$undef"
17862 fi
17863 set d_sem
17864 eval $setvar
17865
17866 : see whether sys/sem.h defines union semun
17867 echo " "
17868 $cat > try.c <<'END'
17869 #include <sys/types.h>
17870 #include <sys/ipc.h>
17871 #include <sys/sem.h>
17872 int main () { union semun semun; semun.buf = 0; }
17873 END
17874 set try
17875 if eval $compile; then
17876     echo "You have union semun in <sys/sem.h>." >&4
17877     val="$define"
17878 else
17879     echo "You do not have union semun in <sys/sem.h>." >&4
17880     val="$undef"
17881 fi
17882 $rm_try
17883 set d_union_semun
17884 eval $setvar
17885
17886 : see how to do semctl IPC_STAT
17887 case "$d_sem" in
17888 $define)
17889     echo " "
17890     $cat > tryh.h <<END
17891 #ifndef S_IRUSR
17892 #   ifdef S_IREAD
17893 #       define S_IRUSR S_IREAD
17894 #       define S_IWUSR S_IWRITE
17895 #       define S_IXUSR S_IEXEC
17896 #   else
17897 #       define S_IRUSR 0400
17898 #       define S_IWUSR 0200
17899 #       define S_IXUSR 0100
17900 #   endif
17901 #   define S_IRGRP (S_IRUSR>>3)
17902 #   define S_IWGRP (S_IWUSR>>3)
17903 #   define S_IXGRP (S_IXUSR>>3)
17904 #   define S_IROTH (S_IRUSR>>6)
17905 #   define S_IWOTH (S_IWUSR>>6)
17906 #   define S_IXOTH (S_IXUSR>>6)
17907 #endif
17908 #ifndef S_IRWXU
17909 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17910 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17911 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17912 #endif
17913 END
17914     : see whether semctl IPC_STAT can use union semun
17915     case "$d_semctl_semun" in
17916     '')
17917       val="$undef"
17918       $cat > try.c <<END
17919 #include <sys/types.h>
17920 #include <sys/ipc.h>
17921 #include <sys/sem.h>
17922 #include <sys/stat.h>
17923 #include <stdio.h>
17924 #include <errno.h>
17925 #include "tryh.h"
17926 #ifndef errno
17927 extern int errno;
17928 #endif
17929 #$d_union_semun HAS_UNION_SEMUN
17930 int main() {
17931     union semun
17932 #ifndef HAS_UNION_SEMUN
17933     {
17934         int val;
17935         struct semid_ds *buf;
17936         unsigned short *array;
17937     }
17938 #endif
17939     arg;
17940     int sem, st;
17941
17942 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17943     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17944     if (sem > -1) {
17945         struct semid_ds argbuf;
17946         arg.buf = &argbuf;
17947 #       ifdef IPC_STAT
17948         st = semctl(sem, 0, IPC_STAT, arg);
17949         if (st == 0)
17950             printf("semun\n");
17951         else
17952 #       endif /* IPC_STAT */
17953             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17954 #       ifdef IPC_RMID
17955         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17956 #       endif /* IPC_RMID */
17957             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17958     } else
17959 #endif /* IPC_PRIVATE && ... */
17960         printf("semget failed: errno = %d\n", errno);
17961   return 0;
17962 }
17963 END
17964       set try
17965       if eval $compile; then
17966           xxx=`$run ./try`
17967           case "$xxx" in
17968           semun) val="$define" ;;
17969           esac
17970       fi
17971       $rm_try
17972       set d_semctl_semun
17973       eval $setvar
17974       ;;
17975     esac
17976     case "$d_semctl_semun" in
17977     $define)
17978         echo "You can use union semun for semctl IPC_STAT." >&4
17979         also='also'
17980         ;;
17981     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17982         also=''
17983         ;;
17984     esac
17985
17986     : see whether semctl IPC_STAT can use struct semid_ds pointer
17987     case "$d_semctl_semid_ds" in
17988     '')
17989       val="$undef"
17990       $cat > try.c <<'END'
17991 #include <sys/types.h>
17992 #include <sys/ipc.h>
17993 #include <sys/sem.h>
17994 #include <sys/stat.h>
17995 #include "tryh.h"
17996 #include <stdio.h>
17997 #include <errno.h>
17998 #ifndef errno
17999 extern int errno;
18000 #endif
18001 int main() {
18002     union semun
18003 #ifndef HAS_UNION_SEMUN
18004     {
18005         int val;
18006         struct semid_ds *buf;
18007         unsigned short *array;
18008     }
18009 #endif
18010     arg;
18011     struct semid_ds argbuf;
18012     int sem, st;
18013
18014 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18015     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18016     if (sem > -1) {
18017         arg.buf = &argbuf;
18018 #       ifdef IPC_STAT
18019         st = semctl(sem, 0, IPC_STAT, arg);
18020         if (st == 0)
18021             printf("semid_ds\n");
18022         else
18023 #       endif /* IPC_STAT */
18024             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18025 #       ifdef IPC_RMID
18026         if (semctl(sem, 0, IPC_RMID, arg) != 0)
18027 #       endif /* IPC_RMID */
18028             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18029     } else
18030 #endif /* IPC_PRIVATE && ... */
18031         printf("semget failed: errno = %d\n", errno);
18032
18033     return 0;
18034 }
18035 END
18036       set try
18037       if eval $compile; then
18038           xxx=`$run ./try`
18039           case "$xxx" in
18040           semid_ds) val="$define" ;;
18041           esac
18042       fi
18043       $rm_try
18044       set d_semctl_semid_ds
18045       eval $setvar
18046       ;;
18047     esac
18048     case "$d_semctl_semid_ds" in
18049     $define)
18050         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18051         ;;
18052     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18053         ;;
18054     esac
18055     ;;
18056 *)  val="$undef"
18057
18058     # We do not have the full sem*(2) library, so assume we can not
18059     # use either.
18060
18061     set d_semctl_semun
18062     eval $setvar
18063
18064     set d_semctl_semid_ds
18065     eval $setvar
18066     ;;
18067 esac
18068 $rm_try tryh.h
18069
18070 : see if sendmsg exists
18071 set sendmsg d_sendmsg
18072 eval $inlibc
18073
18074 : see if setegid exists
18075 set setegid d_setegid
18076 eval $inlibc
18077
18078 : see if setenv exists
18079 set setenv d_setenv
18080 eval $inlibc
18081
18082 : see if seteuid exists
18083 set seteuid d_seteuid
18084 eval $inlibc
18085
18086 : see if setgrent exists
18087 set setgrent d_setgrent
18088 eval $inlibc
18089
18090 : see if setgrent_r exists
18091 set setgrent_r d_setgrent_r
18092 eval $inlibc
18093 case "$d_setgrent_r" in
18094 "$define")
18095         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18096         case "$d_setgrent_r_proto:$usethreads" in
18097         ":define")      d_setgrent_r_proto=define
18098                 set d_setgrent_r_proto setgrent_r $hdrs
18099                 eval $hasproto ;;
18100         *)      ;;
18101         esac
18102         case "$d_setgrent_r_proto" in
18103         define)
18104         case "$setgrent_r_proto" in
18105         ''|0) try='int setgrent_r(FILE**);'
18106         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18107         esac
18108         case "$setgrent_r_proto" in
18109         ''|0) try='void setgrent_r(FILE**);'
18110         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18111         esac
18112         case "$setgrent_r_proto" in
18113         ''|0)   d_setgrent_r=undef
18114                 setgrent_r_proto=0
18115                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18116         * )     case "$setgrent_r_proto" in
18117                 REENTRANT_PROTO*) ;;
18118                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18119                 esac
18120                 echo "Prototype: $try" ;;
18121         esac
18122         ;;
18123         *)      case "$usethreads" in
18124                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18125                 esac
18126                 d_setgrent_r=undef
18127                 setgrent_r_proto=0
18128                 ;;
18129         esac
18130         ;;
18131 *)      setgrent_r_proto=0
18132         ;;
18133 esac
18134
18135 : see if sethostent exists
18136 set sethostent d_sethent
18137 eval $inlibc
18138
18139 : see if sethostent_r exists
18140 set sethostent_r d_sethostent_r
18141 eval $inlibc
18142 case "$d_sethostent_r" in
18143 "$define")
18144         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18145         case "$d_sethostent_r_proto:$usethreads" in
18146         ":define")      d_sethostent_r_proto=define
18147                 set d_sethostent_r_proto sethostent_r $hdrs
18148                 eval $hasproto ;;
18149         *)      ;;
18150         esac
18151         case "$d_sethostent_r_proto" in
18152         define)
18153         case "$sethostent_r_proto" in
18154         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18155         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18156         esac
18157         case "$sethostent_r_proto" in
18158         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18159         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18160         esac
18161         case "$sethostent_r_proto" in
18162         ''|0)   d_sethostent_r=undef
18163                 sethostent_r_proto=0
18164                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18165         * )     case "$sethostent_r_proto" in
18166                 REENTRANT_PROTO*) ;;
18167                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18168                 esac
18169                 echo "Prototype: $try" ;;
18170         esac
18171         ;;
18172         *)      case "$usethreads" in
18173                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18174                 esac
18175                 d_sethostent_r=undef
18176                 sethostent_r_proto=0
18177                 ;;
18178         esac
18179         ;;
18180 *)      sethostent_r_proto=0
18181         ;;
18182 esac
18183
18184 : see if setitimer exists
18185 set setitimer d_setitimer
18186 eval $inlibc
18187
18188 : see if setlinebuf exists
18189 set setlinebuf d_setlinebuf
18190 eval $inlibc
18191
18192 : see if this system has wctype.h
18193 set wctype.h i_wctype
18194 eval $inhdr
18195
18196 : see if towupper exists
18197 set towupper d_towupper
18198 eval $inlibc
18199
18200 : check for setlocale function and behavior
18201 case "$d_setlocale" in
18202 '')
18203 $cat >&4 <<EOM
18204
18205 Checking to see if you have setlocale() and its behavior
18206 EOM
18207 $cat >try.c <<EOCP
18208 #include <stdlib.h>
18209 #include <string.h>
18210 #$i_locale I_LOCALE
18211 #ifdef I_LOCALE
18212 #  include <locale.h>
18213 #endif
18214 #$i_wctype I_WCTYPE
18215 #ifdef I_WCTYPE
18216 #  include <wctype.h>
18217 #endif
18218
18219 int main() {
18220     const char * invalid_name = "\a";   /* This is really invalid! */
18221     int accepts_any_locale_name = 0;
18222     int has_C_UTF8 = 0;
18223     unsigned char bad_setlocale = 255;
18224
18225     /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
18226      * disabled.  It's hard to imagine an instance where meaningful locale
18227      * handling could be done without LC_CTYPE */
18228     const char *  name = setlocale(LC_CTYPE, "C");
18229
18230     if (name == NULL || strcmp(name, "C") != 0) {
18231         exit(bad_setlocale);
18232     }
18233
18234     name = setlocale(LC_CTYPE, invalid_name);
18235     if (name != NULL) {
18236
18237         /* Let it pass if it accepts the name but gives back one of the C
18238          * locales */
18239         if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
18240             accepts_any_locale_name = 1;
18241         }
18242     }
18243
18244     name = setlocale(LC_CTYPE, "C.UTF-8");
18245     if (name != NULL) {
18246         unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
18247
18248 #$d_towupper HAS_TOWUPPER
18249 #ifdef HAS_TOWUPPER
18250
18251         /* We assume that if the machine doesn't have the C99 towupper, it
18252          * doesn't have C.UTF-8, even if we successfully changed locales to
18253          * include it.  This seems safer even on platforms that didn't accept
18254          * the really invalid name */
18255
18256         if (towupper(y_with_diaeresis) == 0x178) {
18257             has_C_UTF8 = 1;
18258         }
18259
18260 #endif
18261
18262     }
18263
18264 #if 0
18265
18266     /* Currently unused code to determine if LC_ALL with disparate values uses
18267      * category = value pairs or positional, and to determine the separator
18268      * between the categories.  We could add code so that if the separator were
18269      * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
18270      * every possible ASCII separator would fit in the 5 bits available in the
18271      * exit code.  This would not be true in EBCDIC.  And then if LC_ALL is
18272      * positional, we probably would want to know the order of the categories.
18273      * Using a file between the C program and the shell script would really be
18274      * require to do that */
18275 #ifdef LC_ALL
18276
18277     unsigned char min_separator = ' ' - 1;
18278     unsigned char separator = min_separator;
18279     int uses_name_value_pair_names = 0;
18280
18281     name = setlocale(LC_ALL, "C");
18282     if (name == NULL || strcmp(name, "C") != 0) {
18283         exit(bad_setlocale);
18284     }
18285
18286     if (has_C_UTF8) {
18287         char * pos;
18288
18289         name = setlocale(LC_CTYPE, "C.UTF-8");
18290         if (name == NULL) {
18291             exit(bad_setlocale);
18292         }
18293         name = setlocale(LC_ALL, NULL);
18294         if (name == NULL) {
18295             exit(bad_setlocale);
18296         }
18297
18298         pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
18299         if (pos != NULL) {
18300             uses_name_value_pair_names = 1;
18301             if (pos == name) {
18302                 separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
18303             }
18304             else {
18305                 separator = *(pos - 1);
18306             }
18307         }
18308         else {
18309             pos = strstr(name, "C.UTF-8");
18310             if (pos == NULL) {
18311                 /* bad */
18312             }
18313             else if (pos == name) {
18314                 separator = name[sizeof("C.UTF-8") - 1];
18315             }
18316             else {
18317                 separator = *(pos - 1);
18318             }
18319         }
18320     }
18321
18322 #endif
18323 #endif
18324
18325     exit( 0 /* (separator - min_separator) << 3
18326         | uses_name_value_pair_names      << 2
18327           */
18328         | has_C_UTF8                      << 1
18329         | accepts_any_locale_name);
18330
18331 }
18332 EOCP
18333 val=
18334 set d_setlocale
18335 eval $setvar
18336 case $d_setlocale in
18337     $undef) d_setlocale_accepts_any_locale_name="$undef"
18338             d_has_C_UTF8="false"
18339             ;;
18340     *) set try
18341        if eval $compile; then
18342            echo "Your system has setlocale()..." >&4
18343            $run ./try
18344            case $? in
18345                0) echo "and it seems sane; you don't have a C.UTF-8 locale" >&4
18346                   d_setlocale="$define"
18347                   d_setlocale_accepts_any_locale_name="$undef"
18348                   d_has_C_UTF8="false"
18349                   ;;
18350                1) echo "and it seems sane, but accepts any locale name as valid" >&4
18351                   d_setlocale="$define"
18352                   d_setlocale_accepts_any_locale_name="$define"
18353                   d_has_C_UTF8="false"
18354                   ;;
18355                2) echo "and it seems sane; you have a C.UTF-8 locale" >&4
18356                   d_setlocale="$define"
18357                   d_setlocale_accepts_any_locale_name="$undef"
18358                   d_has_C_UTF8="true"
18359                   ;;
18360                3) echo "and it seems sane, but accepts any locale name as valid" >&4
18361                   d_setlocale="$define"
18362                   d_setlocale_accepts_any_locale_name="$define"
18363                   d_has_C_UTF8="true"
18364                   ;;
18365                *) echo "but it doesn't seem to work, so we won't use it." >&4
18366                   d_setlocale="$undef"
18367                   d_setlocale_accepts_any_locale_name="$undef"
18368                   d_has_C_UTF8="false"
18369                   ;;
18370            esac
18371        else
18372            echo "your system does not have setlocale()" >&4
18373            d_setlocale="$undef"
18374            d_setlocale_accepts_any_locale_name="$undef"
18375            d_has_C_UTF8="false"
18376        fi
18377 esac
18378 $rm_try
18379 ;;
18380 *) val="$d_setlocale"
18381     set d_setlocale
18382     eval $setvar
18383     case "$d_setlocale" in
18384         $undef) echo "There may be other ways to set the locale on your system, so we need to ask:" >&4
18385         ;;
18386     esac
18387     rp="Does your system have the C.UTF-8 locale?"
18388     dflt=n
18389     . ./myread
18390     case "$ans" in
18391         [Yy]*) d_has_C_UTF8="true"
18392                c_utf8_locale=" or C.UTF-8"
18393                ;;
18394         *)     d_has_C_UTF8="false"
18395                c_utf8_locale=""
18396                ;;
18397     esac
18398     case "$d_setlocale" in
18399         $define)
18400             rp="When you set your locale to something besides C$c_utf8_locale, does it do so, or just pretend to?" >&4
18401             dflt=n
18402             . ./myread
18403             case "$ans" in
18404                 true|[Yy]*)
18405                    d_setlocale_accepts_any_locale_name="$undef"
18406                    ;;
18407                 *) d_setlocale_accepts_any_locale_name="$define"
18408                    ;;
18409             esac
18410             ;;
18411         *) d_setlocale_accepts_any_locale_name="$undef"
18412            ;;
18413     esac
18414 esac
18415
18416 : see if setlocale_r exists
18417 set setlocale_r d_setlocale_r
18418 eval $inlibc
18419 case "$d_setlocale_r" in
18420 "$define")
18421         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18422         case "$d_setlocale_r_proto:$usethreads" in
18423         ":define")      d_setlocale_r_proto=define
18424                 set d_setlocale_r_proto setlocale_r $hdrs
18425                 eval $hasproto ;;
18426         *)      ;;
18427         esac
18428         case "$d_setlocale_r_proto" in
18429         define)
18430         case "$setlocale_r_proto" in
18431         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18432         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18433         esac
18434         case "$setlocale_r_proto" in
18435         ''|0)   d_setlocale_r=undef
18436                 setlocale_r_proto=0
18437                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18438         * )     case "$setlocale_r_proto" in
18439                 REENTRANT_PROTO*) ;;
18440                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18441                 esac
18442                 echo "Prototype: $try" ;;
18443         esac
18444         ;;
18445         *)      case "$usethreads" in
18446                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18447                 esac
18448                 d_setlocale_r=undef
18449                 setlocale_r_proto=0
18450                 ;;
18451         esac
18452         ;;
18453 *)      setlocale_r_proto=0
18454         ;;
18455 esac
18456
18457 : see if setnetent exists
18458 set setnetent d_setnent
18459 eval $inlibc
18460
18461 : see if setnetent_r exists
18462 set setnetent_r d_setnetent_r
18463 eval $inlibc
18464 case "$d_setnetent_r" in
18465 "$define")
18466         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18467         case "$d_setnetent_r_proto:$usethreads" in
18468         ":define")      d_setnetent_r_proto=define
18469                 set d_setnetent_r_proto setnetent_r $hdrs
18470                 eval $hasproto ;;
18471         *)      ;;
18472         esac
18473         case "$d_setnetent_r_proto" in
18474         define)
18475         case "$setnetent_r_proto" in
18476         ''|0) try='int setnetent_r(int, struct netent_data*);'
18477         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18478         esac
18479         case "$setnetent_r_proto" in
18480         ''|0) try='void setnetent_r(int, struct netent_data*);'
18481         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18482         esac
18483         case "$setnetent_r_proto" in
18484         ''|0)   d_setnetent_r=undef
18485                 setnetent_r_proto=0
18486                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18487         * )     case "$setnetent_r_proto" in
18488                 REENTRANT_PROTO*) ;;
18489                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18490                 esac
18491                 echo "Prototype: $try" ;;
18492         esac
18493         ;;
18494         *)      case "$usethreads" in
18495                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18496                 esac
18497                 d_setnetent_r=undef
18498                 setnetent_r_proto=0
18499                 ;;
18500         esac
18501         ;;
18502 *)      setnetent_r_proto=0
18503         ;;
18504 esac
18505
18506 : see if setprotoent exists
18507 set setprotoent d_setpent
18508 eval $inlibc
18509
18510 : see if setpgid exists
18511 set setpgid d_setpgid
18512 eval $inlibc
18513
18514 : see if setpgrp2 exists
18515 set setpgrp2 d_setpgrp2
18516 eval $inlibc
18517
18518 : see if setpriority exists
18519 set setpriority d_setprior
18520 eval $inlibc
18521
18522 : see if setproctitle exists
18523 set setproctitle d_setproctitle
18524 eval $inlibc
18525
18526 : see if setprotoent_r exists
18527 set setprotoent_r d_setprotoent_r
18528 eval $inlibc
18529 case "$d_setprotoent_r" in
18530 "$define")
18531         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18532         case "$d_setprotoent_r_proto:$usethreads" in
18533         ":define")      d_setprotoent_r_proto=define
18534                 set d_setprotoent_r_proto setprotoent_r $hdrs
18535                 eval $hasproto ;;
18536         *)      ;;
18537         esac
18538         case "$d_setprotoent_r_proto" in
18539         define)
18540         case "$setprotoent_r_proto" in
18541         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18542         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18543         esac
18544         case "$setprotoent_r_proto" in
18545         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18546         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18547         esac
18548         case "$setprotoent_r_proto" in
18549         ''|0)   d_setprotoent_r=undef
18550                 setprotoent_r_proto=0
18551                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18552         * )     case "$setprotoent_r_proto" in
18553                 REENTRANT_PROTO*) ;;
18554                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18555                 esac
18556                 echo "Prototype: $try" ;;
18557         esac
18558         ;;
18559         *)      case "$usethreads" in
18560                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18561                 esac
18562                 d_setprotoent_r=undef
18563                 setprotoent_r_proto=0
18564                 ;;
18565         esac
18566         ;;
18567 *)      setprotoent_r_proto=0
18568         ;;
18569 esac
18570
18571 : see if setpwent exists
18572 set setpwent d_setpwent
18573 eval $inlibc
18574
18575 : see if setpwent_r exists
18576 set setpwent_r d_setpwent_r
18577 eval $inlibc
18578 case "$d_setpwent_r" in
18579 "$define")
18580         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18581         case "$d_setpwent_r_proto:$usethreads" in
18582         ":define")      d_setpwent_r_proto=define
18583                 set d_setpwent_r_proto setpwent_r $hdrs
18584                 eval $hasproto ;;
18585         *)      ;;
18586         esac
18587         case "$d_setpwent_r_proto" in
18588         define)
18589         case "$setpwent_r_proto" in
18590         ''|0) try='int setpwent_r(FILE**);'
18591         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18592         esac
18593         case "$setpwent_r_proto" in
18594         ''|0) try='void setpwent_r(FILE**);'
18595         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18596         esac
18597         case "$setpwent_r_proto" in
18598         ''|0)   d_setpwent_r=undef
18599                 setpwent_r_proto=0
18600                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18601         * )     case "$setpwent_r_proto" in
18602                 REENTRANT_PROTO*) ;;
18603                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18604                 esac
18605                 echo "Prototype: $try" ;;
18606         esac
18607         ;;
18608         *)      case "$usethreads" in
18609                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18610                 esac
18611                 d_setpwent_r=undef
18612                 setpwent_r_proto=0
18613                 ;;
18614         esac
18615         ;;
18616 *)      setpwent_r_proto=0
18617         ;;
18618 esac
18619
18620 : see if setregid exists
18621 set setregid d_setregid
18622 eval $inlibc
18623 set setresgid d_setresgid
18624 eval $inlibc
18625
18626 : see if setreuid exists
18627 set setreuid d_setreuid
18628 eval $inlibc
18629 set setresuid d_setresuid
18630 eval $inlibc
18631
18632 : see if setrgid exists
18633 set setrgid d_setrgid
18634 eval $inlibc
18635
18636 : see if setruid exists
18637 set setruid d_setruid
18638 eval $inlibc
18639
18640 : see if setservent exists
18641 set setservent d_setsent
18642 eval $inlibc
18643
18644 : see if setservent_r exists
18645 set setservent_r d_setservent_r
18646 eval $inlibc
18647 case "$d_setservent_r" in
18648 "$define")
18649         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18650         case "$d_setservent_r_proto:$usethreads" in
18651         ":define")      d_setservent_r_proto=define
18652                 set d_setservent_r_proto setservent_r $hdrs
18653                 eval $hasproto ;;
18654         *)      ;;
18655         esac
18656         case "$d_setservent_r_proto" in
18657         define)
18658         case "$setservent_r_proto" in
18659         ''|0) try='int setservent_r(int, struct servent_data*);'
18660         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18661         esac
18662         case "$setservent_r_proto" in
18663         ''|0) try='void setservent_r(int, struct servent_data*);'
18664         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18665         esac
18666         case "$setservent_r_proto" in
18667         ''|0)   d_setservent_r=undef
18668                 setservent_r_proto=0
18669                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18670         * )     case "$setservent_r_proto" in
18671                 REENTRANT_PROTO*) ;;
18672                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18673                 esac
18674                 echo "Prototype: $try" ;;
18675         esac
18676         ;;
18677         *)      case "$usethreads" in
18678                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18679                 esac
18680                 d_setservent_r=undef
18681                 setservent_r_proto=0
18682                 ;;
18683         esac
18684         ;;
18685 *)      setservent_r_proto=0
18686         ;;
18687 esac
18688
18689 : see if setsid exists
18690 set setsid d_setsid
18691 eval $inlibc
18692
18693 : see if setvbuf exists
18694 set setvbuf d_setvbuf
18695 eval $inlibc
18696
18697 : see if shmctl exists
18698 set shmctl d_shmctl
18699 eval $inlibc
18700
18701 : see if shmget exists
18702 set shmget d_shmget
18703 eval $inlibc
18704
18705 : see if shmat exists
18706 set shmat d_shmat
18707 eval $inlibc
18708 : see what shmat returns
18709 case "$d_shmat" in
18710 "$define")
18711         $cat >shmat.c <<'END'
18712 #include <sys/shm.h>
18713 void *shmat();
18714 END
18715         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18716                 shmattype='void *'
18717         else
18718                 shmattype='char *'
18719         fi
18720         echo "and it returns ($shmattype)." >&4
18721         : see if a prototype for shmat is available
18722         xxx=`./findhdr sys/shm.h`
18723         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18724         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18725                 val="$define"
18726         else
18727                 val="$undef"
18728         fi
18729         $rm -f shmat.[co]
18730         ;;
18731 *)
18732         val="$undef"
18733         ;;
18734 esac
18735 set d_shmatprototype
18736 eval $setvar
18737
18738 : see if shmdt exists
18739 set shmdt d_shmdt
18740 eval $inlibc
18741
18742 : see how much of the 'shm*(2)' library is present.
18743 h_shm=true
18744 echo " "
18745 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18746 *"$undef"*) h_shm=false;;
18747 esac
18748 case "$osname" in
18749 freebsd)
18750     case "`ipcs 2>&1`" in
18751     "SVID shared memory"*"not configured"*)
18752         echo "Your $osname does not have the shm*(2) configured." >&4
18753         h_shm=false
18754         val="$undef"
18755         set shmctl d_shmctl
18756         eval $setvar
18757         set shmget d_shmget
18758         eval $setvar
18759         set shmat d_shmat
18760         eval $setvar
18761         set shmdt d_shmdt
18762         eval $setvar
18763         ;;
18764     esac
18765     ;;
18766 esac
18767 : we could also check for sys/ipc.h ...
18768 if $h_shm && $test `./findhdr sys/shm.h`; then
18769         echo "You have the full shm*(2) library." >&4
18770         val="$define"
18771 else
18772         echo "You don't have the full shm*(2) library." >&4
18773         val="$undef"
18774 fi
18775 set d_shm
18776 eval $setvar
18777
18778 : see if we have sigaction
18779 echo " "
18780 if set sigaction val -f d_sigaction; eval $csym; $val; then
18781         echo 'sigaction() found.' >&4
18782         $cat > try.c <<EOP
18783 #include <stdio.h>
18784 #include <sys/types.h>
18785 #include <signal.h>
18786 #$i_stdlib I_STDLIB
18787 #ifdef I_STDLIB
18788 #include <stdlib.h>
18789 #endif
18790 int main()
18791 {
18792     struct sigaction act, oact;
18793     act.sa_flags = 0;
18794     oact.sa_handler = 0;
18795     /* so that act and oact are used */
18796     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18797 }
18798 EOP
18799         set try
18800         if eval $compile_ok; then
18801                 val="$define"
18802         else
18803                 echo "But you don't seem to have a usable struct sigaction." >&4
18804                 val="$undef"
18805         fi
18806 else
18807         echo 'sigaction NOT found.' >&4
18808         val="$undef"
18809 fi
18810 set d_sigaction; eval $setvar
18811 $rm_try
18812
18813 : see what type pids are declared as in the kernel
18814 rp="What is the type of process ids on this system?"
18815 set pid_t pidtype int stdio.h sys/types.h
18816 eval $typedef_ask
18817
18818 : see what type uids are declared as in the kernel
18819 echo " "
18820 echo "Looking for the type for user ids returned by getuid()."
18821 set uid_t uidtype xxx stdio.h sys/types.h
18822 eval $typedef
18823 case "$uidtype" in
18824 xxx)
18825         xxx=`./findhdr sys/user.h`
18826         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18827         case $1 in
18828         unsigned) dflt="$1 $2" ;;
18829         *) dflt="$1" ;;
18830         esac
18831         ;;
18832 *) dflt="$uidtype";;
18833 esac
18834 case "$uidtype" in
18835 uid_t)  echo "uid_t found." ;;
18836 *)      rp="What is the type for user ids returned by getuid()?"
18837         . ./myread
18838         uidtype="$ans"
18839         ;;
18840 esac
18841
18842 : Define hasfield_t macro for Configure internal use
18843 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18844 while $test $# -ge 2; do
18845     case "$1" in
18846         $define) echo "#include <$2>";;
18847     esac ;
18848     shift 2;
18849 done > try.c;
18850 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18851 set try;
18852 if eval $compile; then
18853         val="$define";
18854 else
18855         val="$undef";
18856 fi;
18857 set $varname;
18858 eval $setvar;
18859 $rm_try'
18860
18861 : see what siginfo fields we have
18862 case "$d_sigaction" in
18863 "$define")
18864         echo "Checking if your siginfo_t has si_errno field...">&4
18865         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18866         eval $hasfield_t;
18867
18868         echo "Checking if your siginfo_t has si_pid field...">&4
18869         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18870         eval $hasfield_t;
18871
18872         echo "Checking if your siginfo_t has si_uid field...">&4
18873         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18874         eval $hasfield_t;
18875
18876         echo "Checking if your siginfo_t has si_addr field...">&4
18877         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18878         eval $hasfield_t;
18879
18880         echo "Checking if your siginfo_t has si_status field...">&4
18881         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18882         eval $hasfield_t;
18883
18884         echo "Checking if your siginfo_t has si_band field...">&4
18885         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18886         eval $hasfield_t;
18887
18888         echo "Checking if your siginfo_t has si_value field...">&4
18889         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18890         eval $hasfield_t;
18891
18892         echo "Checking if your siginfo_t has si_fd field...">&4
18893         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18894         eval $hasfield_t;
18895
18896         ;;
18897 *)
18898         d_siginfo_si_errno="$undef"
18899         d_siginfo_si_pid="$undef"
18900         d_siginfo_si_uid="$undef"
18901         d_siginfo_si_addr="$undef"
18902         d_siginfo_si_status="$undef"
18903         d_siginfo_si_band="$undef"
18904         d_siginfo_si_value="$undef"
18905         d_siginfo_si_fd="$undef"
18906         ;;
18907 esac
18908
18909 : see if this is a sunmath.h system
18910 set sunmath.h i_sunmath
18911 eval $inhdr
18912
18913 : see if signbit exists
18914 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18915 $cat >try.c <<EOCP
18916 #$i_sunmath I_SUNMATH
18917 #include <math.h>
18918 #ifdef I_SUNMATH  /* Solaris special math library */
18919 #  include <sunmath.h>
18920 #endif
18921 #define NV $nvtype
18922 int main(int argc, char **argv)
18923 {
18924     NV x = 0.0;
18925     NV y = -1.0;
18926     if ((signbit(x) == 0) && (signbit(y) != 0))
18927         return 0;
18928     else
18929         return 1;
18930 }
18931 EOCP
18932 val="$undef"
18933 set try
18934 if eval $compile; then
18935     if $run ./try; then
18936         $echo "Yes." >&4
18937         val="$define"
18938     else
18939         $echo "Signbit seems to be available, but doesn't work as I expected."
18940         $echo "I won't use it." >&4
18941         val="$undef"
18942     fi
18943 else
18944     $echo "Nope." >&4
18945     dflt="$undef"
18946 fi
18947 set d_signbit
18948 eval $setvar
18949 $rm_try
18950
18951 : see if sigprocmask exists
18952 set sigprocmask d_sigprocmask
18953 eval $inlibc
18954
18955 : see if sigsetjmp exists
18956 echo " "
18957 case "$d_sigsetjmp" in
18958 '')
18959         $cat >try.c <<EOP
18960 #include <setjmp.h>
18961 #$i_stdlib I_STDLIB
18962 #ifdef I_STDLIB
18963 #include <stdlib.h>
18964 #endif
18965 sigjmp_buf env;
18966 int set = 1;
18967 int main()
18968 {
18969         if (sigsetjmp(env,1))
18970                 exit(set);
18971         set = 0;
18972         siglongjmp(env, 1);
18973         exit(1);
18974 }
18975 EOP
18976         set try
18977         if eval $compile; then
18978                 if $run ./try >/dev/null 2>&1; then
18979                         echo "POSIX sigsetjmp found." >&4
18980                         val="$define"
18981                 else
18982                         $cat >&4 <<EOM
18983 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18984 I'll ignore them.
18985 EOM
18986                         val="$undef"
18987                 fi
18988         else
18989                 echo "sigsetjmp not found." >&4
18990                 val="$undef"
18991         fi
18992         ;;
18993 *) val="$d_sigsetjmp"
18994         case "$d_sigsetjmp" in
18995         $define) echo "POSIX sigsetjmp found." >&4;;
18996         $undef) echo "sigsetjmp not found." >&4;;
18997         esac
18998         ;;
18999 esac
19000 set d_sigsetjmp
19001 eval $setvar
19002 $rm_try
19003
19004 : see if snprintf exists
19005 set snprintf d_snprintf
19006 eval $inlibc
19007
19008 : see if vsnprintf exists
19009 set vsnprintf d_vsnprintf
19010 eval $inlibc
19011
19012 case "$d_snprintf-$d_vsnprintf" in
19013 "$define-$define")
19014     $cat <<EOM
19015 Checking whether your snprintf() and vsnprintf() work okay...
19016 EOM
19017     $cat >try.c <<'EOCP'
19018 /* v?snprintf testing logic courtesy of Russ Allbery.
19019  * According to C99:
19020  * - if the buffer is too short it still must be \0-terminated
19021  * - if the buffer is too short the potentially required length
19022  *   must be returned and not -1
19023  * - if the buffer is NULL the potentially required length
19024  *   must be returned and not -1 or core dump
19025  */
19026 #include <stdio.h>
19027 #include <stdarg.h>
19028
19029 char buf[2];
19030
19031 int test (char *format, ...)
19032 {
19033     va_list args;
19034     int count;
19035
19036     va_start (args, format);
19037     count = vsnprintf (buf, sizeof buf, format, args);
19038     va_end (args);
19039     return count;
19040 }
19041
19042 int main ()
19043 {
19044     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
19045              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
19046 }
19047 EOCP
19048     set try
19049     if eval $compile; then
19050         `$run ./try`
19051         case "$?" in
19052         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
19053         *) cat <<EOM >&4
19054 Your snprintf() and snprintf() don't seem to be working okay.
19055 EOM
19056            d_snprintf="$undef"
19057            d_vsnprintf="$undef"
19058            ;;
19059         esac
19060     else
19061         echo "(I can't seem to compile the test program--assuming they don't)"
19062         d_snprintf="$undef"
19063         d_vsnprintf="$undef"
19064     fi
19065     $rm_try
19066     ;;
19067 esac
19068
19069 : see if sockatmark exists
19070 set sockatmark d_sockatmark
19071 eval $inlibc
19072
19073 : see if prototype for sockatmark is available
19074 echo " "
19075 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
19076 eval $hasproto
19077
19078 : see if socks5_init exists
19079 set socks5_init d_socks5_init
19080 eval $inlibc
19081
19082 : see if srand48_r exists
19083 set srand48_r d_srand48_r
19084 eval $inlibc
19085 case "$d_srand48_r" in
19086 "$define")
19087         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19088         case "$d_srand48_r_proto:$usethreads" in
19089         ":define")      d_srand48_r_proto=define
19090                 set d_srand48_r_proto srand48_r $hdrs
19091                 eval $hasproto ;;
19092         *)      ;;
19093         esac
19094         case "$d_srand48_r_proto" in
19095         define)
19096         case "$srand48_r_proto" in
19097         ''|0) try='int srand48_r(long, struct drand48_data*);'
19098         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
19099         esac
19100         case "$srand48_r_proto" in
19101         ''|0)   d_srand48_r=undef
19102                 srand48_r_proto=0
19103                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
19104         * )     case "$srand48_r_proto" in
19105                 REENTRANT_PROTO*) ;;
19106                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
19107                 esac
19108                 echo "Prototype: $try" ;;
19109         esac
19110         ;;
19111         *)      case "$usethreads" in
19112                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
19113                 esac
19114                 d_srand48_r=undef
19115                 srand48_r_proto=0
19116                 ;;
19117         esac
19118         ;;
19119 *)      srand48_r_proto=0
19120         ;;
19121 esac
19122
19123 : see if srandom_r exists
19124 set srandom_r d_srandom_r
19125 eval $inlibc
19126 case "$d_srandom_r" in
19127 "$define")
19128         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
19129         case "$d_srandom_r_proto:$usethreads" in
19130         ":define")      d_srandom_r_proto=define
19131                 set d_srandom_r_proto srandom_r $hdrs
19132                 eval $hasproto ;;
19133         *)      ;;
19134         esac
19135         case "$d_srandom_r_proto" in
19136         define)
19137         case "$srandom_r_proto" in
19138         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
19139         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
19140         esac
19141         case "$srandom_r_proto" in
19142         ''|0)   d_srandom_r=undef
19143                 srandom_r_proto=0
19144                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
19145         * )     case "$srandom_r_proto" in
19146                 REENTRANT_PROTO*) ;;
19147                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
19148                 esac
19149                 echo "Prototype: $try" ;;
19150         esac
19151         ;;
19152         *)      case "$usethreads" in
19153                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
19154                 esac
19155                 d_srandom_r=undef
19156                 srandom_r_proto=0
19157                 ;;
19158         esac
19159         ;;
19160 *)      srandom_r_proto=0
19161         ;;
19162 esac
19163
19164 : see if prototype for setresgid is available
19165 echo " "
19166 set d_sresgproto setresgid $i_unistd unistd.h
19167 eval $hasproto
19168
19169 : see if prototype for setresuid is available
19170 echo " "
19171 set d_sresuproto setresuid $i_unistd unistd.h
19172 eval $hasproto
19173
19174 : see if stat exists
19175 set stat d_stat
19176 eval $inlibc
19177
19178 : see if sys/stat.h is available
19179 set sys/stat.h i_sysstat
19180 eval $inhdr
19181
19182 : see if stat knows about block sizes
19183 echo " "
19184 echo "Checking to see if your struct stat has st_blocks field..." >&4
19185 set d_statblks stat st_blocks $i_sysstat sys/stat.h
19186 eval $hasfield
19187
19188 : see if this is a sys/vfs.h system
19189 set sys/vfs.h i_sysvfs
19190 eval $inhdr
19191
19192 : see if this is a sys/statfs.h system
19193 set sys/statfs.h i_sysstatfs
19194 eval $inhdr
19195
19196 : Check for statfs_s
19197 echo " "
19198 echo "Checking to see if your system supports struct statfs..." >&4
19199 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
19200 eval $hasstruct
19201 case "$d_statfs_s" in
19202 "$define")      echo "Yes, it does."   ;;
19203 *)              echo "No, it doesn't." ;;
19204 esac
19205
19206 : see if struct statfs knows about f_flags
19207 case "$d_statfs_s" in
19208 define)
19209         echo " "
19210         echo "Checking to see if your struct statfs has f_flags field..." >&4
19211         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
19212         eval $hasfield
19213         ;;
19214 *)      val="$undef"
19215         set d_statfs_f_flags
19216         eval $setvar
19217         ;;
19218 esac
19219 case "$d_statfs_f_flags" in
19220 "$define")      echo "Yes, it does."   ;;
19221 *)              echo "No, it doesn't." ;;
19222 esac
19223
19224 : see what flavor, if any, of static inline is supported
19225 echo " "
19226 echo "Checking to see if your system supports static inline..."
19227 $cat > try.c <<'EOCP'
19228 #include <stdlib.h>
19229 extern int f_via_a(int x);
19230 extern int f_via_b(int x);
19231 int main(int argc, char **argv)
19232 {
19233     int y;
19234
19235     y = f_via_a(0);
19236 #ifdef USE_B
19237     y = f_via_b(0);
19238 #endif
19239     if (y == 42) {
19240         return EXIT_SUCCESS;
19241     }
19242     else {
19243         return EXIT_FAILURE;
19244     }
19245 }
19246 EOCP
19247 $cat > a.c <<'EOCP'
19248 static INLINE int f(int x) {
19249     int y;
19250     y = x + 42;
19251     return y;
19252 }
19253
19254 int f_via_a(int x)
19255 {
19256     return f(x);
19257 }
19258 EOCP
19259 $cat > b.c <<'EOCP'
19260 extern int f(int x);
19261
19262 int f_via_b(int x)
19263 {
19264     return f(x);
19265 }
19266 EOCP
19267
19268 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19269 case "$perl_static_inline" in
19270 '')     # Check the various possibilities, and break out on success.
19271         # For gcc, prefer __inline__, which will still permit
19272         # cflags.SH to add in -ansi.
19273         case "$gccversion" in
19274                 '') xxx="inline __inline__ __inline _inline";;
19275                 *)  xxx="__inline__ inline __inline _inline";;
19276         esac
19277         for inline in $xxx; do
19278                 set try -DINLINE=$inline a.c
19279                 if eval $compile && $run ./try; then
19280                         # Now make sure there is no external linkage of static
19281                         # functions
19282                         set try -DINLINE=$inline -DUSE_B a.c b.c
19283                         if eval $compile && $run ./try; then
19284                                 $echo "Your compiler supports static $inline, " >&4
19285                                 $echo "but it also creates an external definition," >&4
19286                                 $echo "so I won't use it." >&4
19287                                 val=$undef
19288                         else
19289                                 $echo "Your compiler supports static $inline." >&4
19290                                 val=$define
19291                                 perl_static_inline="static $inline";
19292                                 break;
19293                         fi
19294                 else
19295                         $echo "Your compiler does NOT support static $inline." >&4
19296                         val="$undef"
19297                 fi
19298         done
19299         ;;
19300 *inline*) # Some variant of inline exists.
19301         echo "Keeping your $hint value of $perl_static_inline."
19302         val=$define
19303         ;;
19304 static)  # No inline capabilities
19305         echo "Keeping your $hint value of $perl_static_inline."
19306         val=$undef
19307         ;;
19308 *)  # Unrecognized previous value -- blindly trust the supplied
19309         # value and hope it makes sense.  Use old value for
19310         # d_static_inline, if there is one.
19311         echo "Keeping your $hint value of $perl_static_inline."
19312         case "$d_static_inline" in
19313                 '') val=$define ;;
19314                 *)  val=$d_static_inline ;;
19315         esac
19316         ;;
19317 esac
19318 # Fallback to plain 'static' if nothing worked.
19319 case "$perl_static_inline" in
19320 '')
19321         perl_static_inline="static"
19322         val=$undef
19323         ;;
19324 esac
19325 set d_static_inline
19326 eval $setvar
19327 $rm -f a.[co] b.[co]
19328 $rm_try
19329
19330 : Check stream access
19331 $cat >&4 <<EOM
19332 Checking how to access stdio streams by file descriptor number...
19333 EOM
19334 case "$stdio_stream_array" in
19335 '')     $cat >try.c <<EOCP
19336 #include <stdio.h>
19337 int main() {
19338   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19339     printf("yes\n");
19340 }
19341 EOCP
19342         for s in _iob __iob __sF
19343         do
19344                 set try -DSTDIO_STREAM_ARRAY=$s
19345                 if eval $compile; then
19346                         case "`$run ./try`" in
19347                         yes)    stdio_stream_array=$s; break ;;
19348                         esac
19349                 fi
19350         done
19351         $rm_try
19352 esac
19353 case "$stdio_stream_array" in
19354 '')     $cat >&4 <<EOM
19355 I can't figure out how to access stdio streams by file descriptor number.
19356 EOM
19357         d_stdio_stream_array="$undef"
19358         ;;
19359 *)      $cat >&4 <<EOM
19360 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19361 EOM
19362         d_stdio_stream_array="$define"
19363         ;;
19364 esac
19365
19366 : see if strcoll exists
19367 set strcoll d_strcoll
19368 eval $inlibc
19369
19370 : see if strerror_l exists
19371 set strerror_l d_strerror_l
19372 eval $inlibc
19373
19374 : see if strerror_r exists
19375 set strerror_r d_strerror_r
19376 eval $inlibc
19377 case "$d_strerror_r" in
19378 "$define")
19379         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
19380         case "$d_strerror_r_proto:$usethreads" in
19381         ":define")      d_strerror_r_proto=define
19382                 set d_strerror_r_proto strerror_r $hdrs
19383                 eval $hasproto ;;
19384         *)      ;;
19385         esac
19386         case "$d_strerror_r_proto" in
19387         define)
19388         case "$strerror_r_proto" in
19389         ''|0) try='int strerror_r(int, char*, size_t);'
19390         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19391         esac
19392         case "$strerror_r_proto" in
19393         ''|0) try='int strerror_r(int, char*, int);'
19394         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19395         esac
19396         case "$strerror_r_proto" in
19397         ''|0) try='char* strerror_r(int, char*, size_t);'
19398         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19399         esac
19400         case "$strerror_r_proto" in
19401         ''|0)   d_strerror_r=undef
19402                 strerror_r_proto=0
19403                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19404         * )     case "$strerror_r_proto" in
19405                 REENTRANT_PROTO*) ;;
19406                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19407                 esac
19408                 echo "Prototype: $try" ;;
19409         esac
19410         ;;
19411         *)      case "$usethreads" in
19412                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19413                 esac
19414                 d_strerror_r=undef
19415                 strerror_r_proto=0
19416                 ;;
19417         esac
19418         ;;
19419 *)      strerror_r_proto=0
19420         ;;
19421 esac
19422
19423 : see if strftime exists
19424 set strftime d_strftime
19425 eval $inlibc
19426
19427 : see if strlcat exists
19428 : We need both a prototype in string.h and the symbol in libc.
19429 echo " "
19430 d_strlcat_proto=''
19431 xx1="#$d_gnulibc HAS_GNULIBC"
19432 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19433 xx3='#   define _GNU_SOURCE'
19434 xx4='#endif'
19435 set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19436 eval $hasproto
19437 case "$d_strlcat_proto" in
19438     define) # see if strlcat exists
19439         set strlcat d_strlcat
19440         eval $inlibc
19441         ;;
19442     *)  val=$undef
19443         set d_strlcat
19444         eval $setvar
19445         ;;
19446 esac
19447
19448 : see if strlcpy exists
19449 : We need both a prototype in string.h and the symbol in libc.
19450 echo " "
19451 d_strlcpy_proto=''
19452 xx1="#$d_gnulibc HAS_GNULIBC"
19453 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19454 xx3='#   define _GNU_SOURCE'
19455 xx4='#endif'
19456 set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19457 eval $hasproto
19458 case "$d_strlcpy_proto" in
19459     define) # see if strlcpy exists
19460         set strlcpy d_strlcpy
19461         eval $inlibc
19462         ;;
19463     *)  val=$undef
19464         set d_strlcpy
19465         eval $setvar
19466         ;;
19467 esac
19468
19469 : see if strnlen exists
19470 set strnlen d_strnlen
19471 eval $inlibc
19472
19473 : see if strtod exists
19474 set strtod d_strtod
19475 eval $inlibc
19476
19477 : see if strtod_l exists
19478 set strtod_l d_strtod_l
19479 eval $inlibc
19480
19481 : see if strtol exists
19482 set strtol d_strtol
19483 eval $inlibc
19484
19485 : see if strtold exists
19486 set strtold d_strtold
19487 eval $inlibc
19488
19489 : see if strtold_l exists
19490 set strtold_l d_strtold_l
19491 eval $inlibc
19492
19493 : see if strtoll exists
19494 set strtoll d_strtoll
19495 eval $inlibc
19496
19497 case "$d_longlong-$d_strtoll" in
19498 "$define-$define")
19499         $cat <<EOM
19500 Checking whether your strtoll() works okay...
19501 EOM
19502         $cat >try.c <<'EOCP'
19503 #include <errno.h>
19504 #ifdef __hpux
19505 #define strtoll __strtoll
19506 #endif
19507 #ifdef __EMX__
19508 #define strtoll _strtoll
19509 #endif
19510 #include <stdio.h>
19511 #include <stdlib.h>
19512 static int bad = 0;
19513 void check(const char *s, long long ell, int een) {
19514         long long gll;
19515         errno = 0;
19516         gll = strtoll(s, 0, 10);
19517         if (!((gll == ell) && (errno == een)))
19518                 bad++;
19519 }
19520 int main() {
19521         check(" 1",                                      1LL, 0);
19522         check(" 0",                                      0LL, 0);
19523         check("-1",                                     -1LL, 0);
19524         check("-9223372036854775808", -9223372036854775808LL, 0);
19525         check("-9223372036854775808", -9223372036854775808LL, 0);
19526         check(" 9223372036854775807",  9223372036854775807LL, 0);
19527         check("-9223372036854775808", -9223372036854775808LL, 0);
19528         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19529         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19530         if (!bad)
19531                 printf("ok\n");
19532 }
19533 EOCP
19534         set try
19535         if eval $compile; then
19536                 yyy=`$run ./try`
19537                 case "$yyy" in
19538                 ok) echo "Your strtoll() seems to be working okay." ;;
19539                 *) cat <<EOM >&4
19540 Your strtoll() doesn't seem to be working okay.
19541 EOM
19542                    d_strtoll="$undef"
19543                    ;;
19544                 esac
19545         else
19546                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19547                 d_strtoll="$undef"
19548         fi
19549         ;;
19550 esac
19551
19552 : see if strtoq exists
19553 set strtoq d_strtoq
19554 eval $inlibc
19555
19556 : see if strtoul exists
19557 set strtoul d_strtoul
19558 eval $inlibc
19559
19560 case "$d_strtoul" in
19561 "$define")
19562         $cat <<EOM
19563 Checking whether your strtoul() works okay...
19564 EOM
19565         $cat >try.c <<'EOCP'
19566 #include <stdlib.h>
19567 #include <errno.h>
19568 #include <stdio.h>
19569 static int bad = 0;
19570 void check(const char *s, unsigned long eul, int een) {
19571         unsigned long gul;
19572         errno = 0;
19573         gul = strtoul(s, 0, 10);
19574         if (!((gul == eul) && (errno == een)))
19575                 bad++;
19576 }
19577 int main() {
19578         check(" 1", 1L, 0);
19579         check(" 0", 0L, 0);
19580 EOCP
19581         case "$longsize" in
19582         8)
19583             $cat >>try.c <<'EOCP'
19584         check("18446744073709551615", 18446744073709551615UL, 0);
19585         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19586 #if 0 /* strtoul() for /^-/ strings is undefined. */
19587         check("-1", 18446744073709551615UL, 0);
19588         check("-18446744073709551614", 2, 0);
19589         check("-18446744073709551615", 1, 0);
19590         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19591         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19592 #endif
19593 EOCP
19594                 ;;
19595         4)
19596                     $cat >>try.c <<'EOCP'
19597         check("4294967295", 4294967295UL, 0);
19598         check("4294967296", 4294967295UL, ERANGE);
19599 #if 0 /* strtoul() for /^-/ strings is undefined. */
19600         check("-1", 4294967295UL, 0);
19601         check("-4294967294", 2, 0);
19602         check("-4294967295", 1, 0);
19603         check("-4294967296", 4294967295UL, ERANGE);
19604         check("-4294967297", 4294967295UL, ERANGE);
19605 #endif
19606 EOCP
19607                 ;;
19608         *)
19609 : Should we write these tests to be more portable by sprintf-ing
19610 : ~0 and then manipulating that char string as input for strtol?
19611                 ;;
19612         esac
19613         $cat >>try.c <<'EOCP'
19614         if (!bad)
19615                 printf("ok\n");
19616         return 0;
19617 }
19618 EOCP
19619         set try
19620         if eval $compile; then
19621                 case "`$run ./try`" in
19622                 ok) echo "Your strtoul() seems to be working okay." ;;
19623                 *) cat <<EOM >&4
19624 Your strtoul() doesn't seem to be working okay.
19625 EOM
19626                    d_strtoul="$undef"
19627                    ;;
19628                 esac
19629         else
19630                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19631                 d_strtoul="$undef"
19632         fi
19633         ;;
19634 esac
19635
19636 : see if strtoull exists
19637 set strtoull d_strtoull
19638 eval $inlibc
19639
19640 case "$d_longlong-$d_strtoull" in
19641 "$define-$define")
19642         $cat <<EOM
19643 Checking whether your strtoull() works okay...
19644 EOM
19645         $cat >try.c <<'EOCP'
19646 #include <stdlib.h>
19647 #include <errno.h>
19648 #ifdef __hpux
19649 #define strtoull __strtoull
19650 #endif
19651 #include <stdio.h>
19652 static int bad = 0;
19653 void check(const char *s, long long eull, int een) {
19654         long long gull;
19655         errno = 0;
19656         gull = strtoull(s, 0, 10);
19657         if (!((gull == eull) && (errno == een)))
19658                 bad++;
19659 }
19660 int main() {
19661         check(" 1",                                        1LL, 0);
19662         check(" 0",                                        0LL, 0);
19663         check("18446744073709551615",  18446744073709551615ULL, 0);
19664         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19665 #if 0 /* strtoull() for /^-/ strings is undefined. */
19666         check("-1",                    18446744073709551615ULL, 0);
19667         check("-18446744073709551614",                     2LL, 0);
19668         check("-18446744073709551615",                     1LL, 0);
19669         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19670         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19671 #endif
19672         if (!bad)
19673                 printf("ok\n");
19674 }
19675 EOCP
19676         set try
19677         if eval $compile; then
19678                 case "`$run ./try`" in
19679                 ok) echo "Your strtoull() seems to be working okay." ;;
19680                 *) cat <<EOM >&4
19681 Your strtoull() doesn't seem to be working okay.
19682 EOM
19683                    d_strtoull="$undef"
19684                    ;;
19685                 esac
19686         else
19687                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19688                 d_strtoull="$undef"
19689         fi
19690         ;;
19691 esac
19692
19693 : see if strtouq exists
19694 set strtouq d_strtouq
19695 eval $inlibc
19696
19697 case "$d_strtouq" in
19698 "$define")
19699         $cat <<EOM
19700 Checking whether your strtouq() works okay...
19701 EOM
19702         $cat >try.c <<'EOCP'
19703 #include <stdlib.h>
19704 #include <errno.h>
19705 #include <stdio.h>
19706 static int bad = 0;
19707 void check(const char *s, unsigned long long eull, int een) {
19708         unsigned long long gull;
19709         errno = 0;
19710         gull = strtouq(s, 0, 10);
19711         if (!((gull == eull) && (errno == een)))
19712                 bad++;
19713 }
19714 int main() {
19715         check(" 1",                                        1LL, 0);
19716         check(" 0",                                        0LL, 0);
19717         check("18446744073709551615",  18446744073709551615ULL, 0);
19718         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19719 #if 0 /* strtouq() for /^-/ strings is undefined. */
19720         check("-1",                    18446744073709551615ULL, 0);
19721         check("-18446744073709551614",                     2LL, 0);
19722         check("-18446744073709551615",                     1LL, 0);
19723         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19724         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19725 #endif
19726         if (!bad)
19727                 printf("ok\n");
19728         return 0;
19729 }
19730 EOCP
19731         set try
19732         if eval $compile; then
19733                 case "`$run ./try`" in
19734                 ok) echo "Your strtouq() seems to be working okay." ;;
19735                 *) cat <<EOM >&4
19736 Your strtouq() doesn't seem to be working okay.
19737 EOM
19738                    d_strtouq="$undef"
19739                    ;;
19740                 esac
19741         else
19742                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19743                 d_strtouq="$undef"
19744         fi
19745         ;;
19746 esac
19747
19748 : see if strxfrm exists
19749 set strxfrm d_strxfrm
19750 eval $inlibc
19751
19752 : see if strxfrm_l exists
19753 set strxfrm_l d_strxfrm_l
19754 eval $inlibc
19755
19756 : see if symlink exists
19757 set symlink d_symlink
19758 eval $inlibc
19759
19760 : see if syscall exists
19761 set syscall d_syscall
19762 eval $inlibc
19763
19764 : see if prototype for syscall is available
19765 echo " "
19766 set d_syscallproto syscall $i_unistd unistd.h
19767 eval $hasproto
19768
19769 : see if sysconf exists
19770 set sysconf d_sysconf
19771 eval $inlibc
19772
19773 : see if sys_errlist[] exists
19774 echo " "
19775 if test "X$d_syserrlst" = X; then
19776         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19777                 echo "You have sys_errlist[], so we could roll our own strerror."
19778                 d_syserrlst="$define"
19779         else
19780                 echo "You don't have sys_errlist[], so strerror() is welcome."
19781                 d_syserrlst="$undef"
19782         fi
19783 fi
19784
19785 : see if system exists
19786 set system d_system
19787 eval $inlibc
19788
19789 : see if tcgetpgrp exists
19790 set tcgetpgrp d_tcgetpgrp
19791 eval $inlibc
19792
19793 : see if tcsetpgrp exists
19794 set tcsetpgrp d_tcsetpgrp
19795 eval $inlibc
19796
19797 : see if prototype for telldir is available
19798 echo " "
19799 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19800 eval $hasproto
19801
19802 : see if tgamma exists
19803 set tgamma d_tgamma
19804 eval $inlibc
19805
19806 : see what flavor, if any, of thread local storage is supported
19807 echo " "
19808 echo "Checking to see if your system supports C11 thread local storage..."
19809 $cat > try.c <<'EOCP'
19810 #include <stdio.h>
19811 #include <stdlib.h>
19812 #include <pthread.h>
19813
19814 static int plus_one = 1;
19815 static int minus_one = -1;
19816
19817 PROBE_MACRO int *minion;
19818
19819 int callback (const void *a, const void *b) {
19820     int val_a = *minion * *(const int *)a;
19821     int val_b = *minion * *(const int *)b;
19822     return val_a < val_b ? -1 : val_a > val_b;
19823 }
19824
19825 #define SIZE 8
19826
19827 void *thread_function(void *arg) {
19828     /* thread local variables should start zeroed in each thread. */
19829     if (minion != NULL) {
19830         fprintf(stderr, "__thread variable started with %p, should be NULL\n",
19831                 minion);
19832         exit(2);
19833     }
19834     minion = &minus_one;
19835
19836     int array[SIZE];
19837     unsigned int i;
19838     for (i = 0; i < SIZE; ++i) {
19839         /* "Hash randomisation" - this array isn't in sorted order: */
19840         array[i ^ 5] = i * i;
19841     }
19842
19843     qsort(array, SIZE, sizeof(int), callback);
19844
19845     int bad = 0;
19846     for (i = 0; i < SIZE; ++i) {
19847         int want = (SIZE - 1 - i) * (SIZE - 1 - i);
19848         int have = array[i];
19849         if (want != have) {
19850             ++bad;
19851             fprintf(stderr, "array[%u] - want %i, have %i\n", i, want, have);
19852         }
19853     }
19854     if (bad)
19855         exit(3);
19856
19857     return NULL;
19858 }
19859
19860 int main(int argc, char **argv) {
19861     if (minion != NULL) {
19862         fprintf(stderr, "__thread variable started with %p, should be NULL\n",
19863                 minion);
19864         exit(4);
19865     }
19866
19867     minion = &plus_one;
19868
19869     pthread_t tid;
19870     int result = pthread_create(&tid, NULL, thread_function, NULL);
19871     if (result) {
19872         fprintf(stderr, "pthread_create failed (%d)\n", result);
19873         exit(5);
19874     }
19875
19876     result = pthread_join(tid, NULL);
19877     if (result) {
19878         fprintf(stderr, "pthread_join failed (%d)\n", result);
19879         exit(6);
19880     }
19881
19882     if (minion == NULL) {
19883         fprintf(stderr, "__thread variable should not be NULL\n");
19884         exit(7);
19885     }
19886     if (!(minion == &plus_one && *minion == 1)) {
19887         fprintf(stderr, "__thread variable should be %d @ %p, not %d @ %p\n",
19888                 1, &plus_one, *minion, minion);
19889         exit(8);
19890     }
19891
19892     return 0;
19893 }
19894 EOCP
19895
19896 # Respect a hint (or previous) value for perl_thread_local, if there is one.
19897 case "$perl_thread_local" in
19898 '')     # Check the various possibilities, and break out on success.
19899         for thread_local in _Thread_local __thread; do
19900                 set try -DPROBE_MACRO=$thread_local
19901                 if eval $compile && $run ./try; then
19902                         $echo "Your compiler supports $thread_local." >&4
19903                         val=$define
19904                         perl_thread_local="$thread_local";
19905                         break;
19906                 fi
19907                 $echo "Your compiler does NOT support $thread_local." >&4
19908                 val="$undef"
19909         done
19910         ;;
19911 *thread*|*Thread*) # Some variant of thread local exists.
19912         echo "Keeping your $hint value of $perl_thread_local."
19913         val=$define
19914         ;;
19915 *)  # Unrecognized previous value -- blindly trust the supplied
19916         # value and hope it makes sense.  Use old value for
19917         # d_thread_local, if there is one.
19918         echo "Keeping your $hint value of $perl_thread_local."
19919         case "$d_thread_local" in
19920                 '') val=$define ;;
19921                 *)  val=$d_thread_local ;;
19922         esac
19923         ;;
19924 esac
19925 set d_thread_local
19926 eval $setvar
19927 $rm_try
19928
19929 : see if time exists
19930 echo " "
19931 if test "X$d_time" = X -o X"$timetype" = X; then
19932     if set time val -f d_time; eval $csym; $val; then
19933                 echo 'time() found.' >&4
19934                 val="$define"
19935                 rp="What is the type returned by time() on this system?"
19936                 set time_t timetype long stdio.h sys/types.h
19937                 eval $typedef_ask
19938     else
19939                 echo 'time() not found, hope that will do.' >&4
19940                 val="$undef"
19941                 timetype='int';
19942     fi
19943     set d_time
19944     eval $setvar
19945 fi
19946
19947 : see if timegm exists
19948 set timegm d_timegm
19949 eval $inlibc
19950
19951 : see if this is a sys/times.h system
19952 set sys/times.h i_systimes
19953 eval $inhdr
19954
19955 : see if times exists
19956 echo " "
19957 if set times val -f d_times; eval $csym; $val; then
19958         echo 'times() found.' >&4
19959         d_times="$define"
19960         inc=''
19961         case "$i_systimes" in
19962         "$define") inc='sys/times.h';;
19963         esac
19964         rp="What is the type returned by times() on this system?"
19965         set clock_t clocktype long stdio.h sys/types.h $inc
19966         eval $typedef_ask
19967 else
19968         echo 'times() NOT found, hope that will do.' >&4
19969         d_times="$undef"
19970         clocktype='int'
19971 fi
19972
19973 : see if tmpnam_r exists
19974 set tmpnam_r d_tmpnam_r
19975 eval $inlibc
19976 case "$d_tmpnam_r" in
19977 "$define")
19978         hdrs="$i_systypes sys/types.h define stdio.h "
19979         case "$d_tmpnam_r_proto:$usethreads" in
19980         ":define")      d_tmpnam_r_proto=define
19981                 set d_tmpnam_r_proto tmpnam_r $hdrs
19982                 eval $hasproto ;;
19983         *)      ;;
19984         esac
19985         case "$d_tmpnam_r_proto" in
19986         define)
19987         case "$tmpnam_r_proto" in
19988         ''|0) try='char* tmpnam_r(char*);'
19989         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19990         esac
19991         case "$tmpnam_r_proto" in
19992         ''|0)   d_tmpnam_r=undef
19993                 tmpnam_r_proto=0
19994                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19995         * )     case "$tmpnam_r_proto" in
19996                 REENTRANT_PROTO*) ;;
19997                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19998                 esac
19999                 echo "Prototype: $try" ;;
20000         esac
20001         ;;
20002         *)      case "$usethreads" in
20003                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
20004                 esac
20005                 d_tmpnam_r=undef
20006                 tmpnam_r_proto=0
20007                 ;;
20008         esac
20009         ;;
20010 *)      tmpnam_r_proto=0
20011         ;;
20012 esac
20013
20014 : see if towlower exists
20015 set towlower d_towlower
20016 eval $inlibc
20017
20018 : see if trunc exists
20019 set trunc d_trunc
20020 eval $inlibc
20021
20022 : see if truncate exists
20023 set truncate d_truncate
20024 eval $inlibc
20025
20026 : see if ttyname_r exists
20027 set ttyname_r d_ttyname_r
20028 eval $inlibc
20029 case "$d_ttyname_r" in
20030 "$define")
20031         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
20032         case "$d_ttyname_r_proto:$usethreads" in
20033         ":define")      d_ttyname_r_proto=define
20034                 set d_ttyname_r_proto ttyname_r $hdrs
20035                 eval $hasproto ;;
20036         *)      ;;
20037         esac
20038         case "$d_ttyname_r_proto" in
20039         define)
20040         case "$ttyname_r_proto" in
20041         ''|0) try='int ttyname_r(int, char*, size_t);'
20042         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
20043         esac
20044         case "$ttyname_r_proto" in
20045         ''|0) try='int ttyname_r(int, char*, int);'
20046         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
20047         esac
20048         case "$ttyname_r_proto" in
20049         ''|0) try='char* ttyname_r(int, char*, int);'
20050         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
20051         esac
20052         case "$ttyname_r_proto" in
20053         ''|0)   d_ttyname_r=undef
20054                 ttyname_r_proto=0
20055                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
20056         * )     case "$ttyname_r_proto" in
20057                 REENTRANT_PROTO*) ;;
20058                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
20059                 esac
20060                 echo "Prototype: $try" ;;
20061         esac
20062         ;;
20063         *)      case "$usethreads" in
20064                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
20065                 esac
20066                 d_ttyname_r=undef
20067                 ttyname_r_proto=0
20068                 ;;
20069         esac
20070         ;;
20071 *)      ttyname_r_proto=0
20072         ;;
20073 esac
20074
20075 : see if tzname[] exists
20076 echo " "
20077 if set tzname val -a d_tzname; eval $csym; $val; then
20078         val="$define"
20079         echo 'tzname[] found.' >&4
20080 else
20081         val="$undef"
20082         echo 'tzname[] NOT found.' >&4
20083 fi
20084 set d_tzname
20085 eval $setvar
20086
20087 : Check if is a multiplatform env
20088 case "$osname" in
20089 darwin) multiarch="$define" ;;
20090 esac
20091 case "$multiarch" in
20092 ''|[nN]*) multiarch="$undef" ;;
20093 esac
20094
20095 : check for ordering of bytes in a UV
20096 echo " "
20097 case "$multiarch" in
20098 *$define*)
20099         $cat <<EOM
20100 You seem to be doing a multiarchitecture build,
20101 skipping the byteorder check.
20102
20103 EOM
20104         byteorder='ffff'
20105         ;;
20106 *)
20107         case "$byteorder" in
20108         '')
20109                 $cat <<'EOM'
20110 In the following, larger digits indicate more significance.  A big-endian
20111 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
20112 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
20113 machines may have weird orders like 3412.  A Cray will report 87654321,
20114 an Alpha will report 12345678. If the test program works the default is
20115 probably right.
20116 I'm now running the test program...
20117 EOM
20118                 $cat >try.c <<EOCP
20119 #include <stdio.h>
20120 #$i_stdlib I_STDLIB
20121 #ifdef I_STDLIB
20122 #include <stdlib.h>
20123 #endif
20124 #$i_inttypes I_INTTYPES
20125 #ifdef I_INTTYPES
20126 #include <inttypes.h>
20127 #endif
20128 #include <sys/types.h>
20129 typedef $uvtype UV;
20130 int main()
20131 {
20132         int i;
20133         union {
20134                 UV l;
20135                 char c[$uvsize];
20136         } u;
20137
20138         if ($uvsize > 4)
20139                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
20140         else
20141                 u.l = (UV)0x04030201;
20142         for (i = 0; i < $uvsize; i++)
20143                 printf("%c", u.c[i]+'0');
20144         printf("\n");
20145         exit(0);
20146 }
20147 EOCP
20148                 xxx_prompt=y
20149                 set try
20150                 if eval $compile && $run ./try > /dev/null; then
20151                         dflt=`$run ./try`
20152                         case "$dflt" in
20153                         [1-4][1-4][1-4][1-4]|12345678|87654321)
20154                                 echo "(The test program ran ok.)"
20155                                 echo "byteorder=$dflt"
20156                                 xxx_prompt=n
20157                         ;;
20158                         ????|????????) echo "(The test program ran ok.)" ;;
20159                         *) echo "(The test program didn't run right for some reason.)" ;;
20160                         esac
20161                 else
20162                         dflt='4321'
20163                         cat <<'EOM'
20164 (I can't seem to compile the test program.  Guessing big-endian...)
20165 EOM
20166                 fi
20167                 case "$xxx_prompt" in
20168                 y)
20169                         rp="What is the order of bytes in $uvtype?"
20170                         . ./myread
20171                         byteorder="$ans"
20172                         ;;
20173                 *)      byteorder=$dflt
20174                         ;;
20175                 esac
20176                 ;;
20177         esac
20178         $rm_try
20179         ;;
20180 esac
20181
20182 : Checking 32bit alignedness
20183 $cat <<EOM
20184
20185 Checking to see whether you can access character data unalignedly...
20186 EOM
20187 case "$d_u32align" in
20188 '')   $cat >try.c <<EOCP
20189 #include <stdio.h>
20190 #$i_stdlib I_STDLIB
20191 #ifdef I_STDLIB
20192 #include <stdlib.h>
20193 #endif
20194 #define U32 $u32type
20195 #define BYTEORDER 0x$byteorder
20196 #define U8 $u8type
20197 #include <signal.h>
20198 #ifdef SIGBUS
20199 $signal_t bletch(int s) { exit(4); }
20200 #endif
20201 int main() {
20202 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
20203     volatile U8 buf[8];
20204     volatile U32 *up;
20205     int i;
20206
20207     if (sizeof(U32) != 4) {
20208         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
20209         exit(1);
20210     }
20211
20212     fflush(stdout);
20213
20214 #ifdef SIGBUS
20215     signal(SIGBUS, bletch);
20216 #endif
20217
20218     buf[0] = 0;
20219     buf[1] = 0;
20220     buf[2] = 0;
20221     buf[3] = 1;
20222     buf[4] = 0;
20223     buf[5] = 0;
20224     buf[6] = 0;
20225     buf[7] = 1;
20226
20227     for (i = 0; i < 4; i++) {
20228         up = (U32*)(buf + i);
20229         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
20230                (*up == 1 << (8*(3-i)))  /* little-endian */
20231               )
20232            )
20233         {
20234             printf("read failed (%x)\n", *up);
20235             exit(2);
20236         }
20237     }
20238
20239     /* write test */
20240     for (i = 0; i < 4; i++) {
20241         up = (U32*)(buf + i);
20242         *up = 0xBeef;
20243         if (*up != 0xBeef) {
20244             printf("write failed (%x)\n", *up);
20245             exit(3);
20246         }
20247     }
20248
20249     exit(0);
20250 #else
20251     printf("1\n");
20252     exit(1);
20253 #endif
20254     return 0;
20255 }
20256 EOCP
20257 set try
20258 if eval $compile_ok; then
20259         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
20260         $run ./try 2>&1 >/dev/null
20261         case "$?" in
20262         0)      cat >&4 <<EOM
20263 You can access character data pretty unalignedly.
20264 EOM
20265                 d_u32align="$undef"
20266                 ;;
20267         *)      cat >&4 <<EOM
20268 It seems that you must access character data in an aligned manner.
20269 EOM
20270                 d_u32align="$define"
20271                 ;;
20272         esac
20273 else
20274         rp='Can you access character data at unaligned addresses?'
20275         dflt='n'
20276         . ./myread
20277         case "$ans" in
20278         [yY]*)  d_u32align="$undef"  ;;
20279         *)      d_u32align="$define" ;;
20280         esac
20281 fi
20282 $rm_try
20283 ;;
20284 esac
20285
20286 : see if ualarm exists
20287 set ualarm d_ualarm
20288 eval $inlibc
20289
20290 : see if umask exists
20291 set umask d_umask
20292 eval $inlibc
20293
20294 : see if unordered exists
20295 set unordered d_unordered
20296 eval $inlibc
20297
20298 : see if unsetenv exists
20299 set unsetenv d_unsetenv
20300 eval $inlibc
20301
20302 : see if usleep exists
20303 set usleep d_usleep
20304 eval $inlibc
20305
20306 : see if prototype for usleep is available
20307 echo " "
20308 set d_usleepproto usleep $i_unistd unistd.h
20309 eval $hasproto
20310
20311 : see if ustat exists
20312 set ustat d_ustat
20313 eval $inlibc
20314
20315 : see if closedir exists
20316 set closedir d_closedir
20317 eval $inlibc
20318
20319 case "$d_closedir" in
20320 "$define")
20321         echo " "
20322         echo "Checking whether closedir() returns a status..." >&4
20323         cat > try.c <<EOM
20324 #$i_dirent I_DIRENT             /**/
20325 #$i_sysdir I_SYS_DIR            /**/
20326 #$i_sysndir I_SYS_NDIR          /**/
20327 #$i_systypes I_SYS_TYPES        /**/
20328
20329 #if defined(I_SYS_TYPES)
20330 #include <sys/types.h>
20331 #endif
20332 #if defined(I_DIRENT)
20333 #include <dirent.h>
20334 #else
20335 #ifdef I_SYS_NDIR
20336 #include <sys/ndir.h>
20337 #else
20338 #ifdef I_SYS_DIR
20339 #include <sys/dir.h>
20340 #endif
20341 #endif
20342 #endif
20343 int main() { return closedir(opendir(".")); }
20344 EOM
20345         set try
20346         if eval $compile_ok; then
20347                 if $run ./try > /dev/null 2>&1 ; then
20348                         echo "Yes, it does."
20349                         val="$undef"
20350                 else
20351                         echo "No, it doesn't."
20352                         val="$define"
20353                 fi
20354         else
20355                 echo "(I can't seem to compile the test program--assuming it doesn't)"
20356                 val="$define"
20357         fi
20358         ;;
20359 *)
20360         val="$undef";
20361         ;;
20362 esac
20363 set d_void_closedir
20364 eval $setvar
20365 $rm_try
20366
20367 : see if there is a wait4
20368 set wait4 d_wait4
20369 eval $inlibc
20370
20371 : see if waitpid exists
20372 set waitpid d_waitpid
20373 eval $inlibc
20374
20375 : see if wcrtomb exists
20376 set wcrtomb d_wcrtomb
20377 eval $inlibc
20378
20379 : look for wcscmp
20380 echo " "
20381 $cat >try.c <<'EOCP'
20382 #include <stdio.h>
20383 #include <wchar.h>
20384 int main ()
20385 {
20386     wchar_t *s = L" ";
20387     return (wcscmp (s, s) ? 1 : 0);
20388     }
20389 EOCP
20390 set try
20391 val="$undef"
20392 if eval $compile; then
20393     `$run ./try`
20394     case "$?" in
20395         0)  echo "A working wcscmp() found." >&4
20396             val="$define" ;;
20397         *)  echo "wcscmp() found, but it doesn't work" >&4
20398             ;;
20399         esac
20400 else
20401     echo "wcscmp() NOT found." >&4
20402     fi
20403 set d_wcscmp
20404 eval $setvar
20405 $rm_try
20406
20407 : see if wcstombs exists
20408 set wcstombs d_wcstombs
20409 eval $inlibc
20410
20411 : look for wcsxfrm
20412 echo " "
20413 $cat >try.c <<'EOCP'
20414 #include <errno.h>
20415 #include <wchar.h>
20416 int main ()
20417 {
20418     wchar_t dst[4], *src = L" ";
20419     errno = 0;
20420     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20421     }
20422 EOCP
20423 set try
20424 val="$undef"
20425 if eval $compile; then
20426     `$run ./try`
20427     case "$?" in
20428         0)  echo "A working wcsxfrm() found." >&4
20429             val="$define" ;;
20430         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20431             ;;
20432         esac
20433 else
20434     echo "wcsxfrm() NOT found." >&4
20435     fi
20436 set d_wcsxfrm
20437 eval $setvar
20438 $rm_try
20439
20440 : see if wctomb exists
20441 set wctomb d_wctomb
20442 eval $inlibc
20443
20444 : see if writev exists
20445 set writev d_writev
20446 eval $inlibc
20447
20448 : check for alignment requirements
20449 echo " "
20450 case "$alignbytes" in
20451     '') echo "Checking alignment constraints..." >&4
20452         $cat >try.c <<EOCP
20453 #include <stdio.h>
20454 struct foobar {
20455     char foo;
20456     $nvtype bar;
20457 } try_algn;
20458 int main()
20459 {
20460     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20461     return(0);
20462 }
20463 EOCP
20464         set try
20465         if eval $compile_ok; then
20466             dflt=`$run ./try`
20467         else
20468             dflt='8'
20469             echo "(I can't seem to compile the test program...)"
20470         fi
20471         case "$multiarch" in
20472             *$define*)
20473                 : The usual safe value is 8, but Darwin with -Duselongdouble
20474                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20475                 : Configure to pick a larger value if needed.
20476                 if $test "$dflt" -lt 8; then
20477                     dflt='8'
20478                     echo "Setting alignment to 8 for multiarch support.">&4
20479                 fi
20480                 ;;
20481         esac
20482         ;;
20483     *) dflt="$alignbytes"
20484         ;;
20485 esac
20486 rp="Doubles must be aligned on a how-many-byte boundary?"
20487 . ./myread
20488 alignbytes="$ans"
20489 $rm_try
20490
20491 : set the base revision
20492 baserev=5.0
20493
20494 : length of character in bytes. Is always 1, otherwise it is not C
20495 : This used to be a test using sizeof
20496 charsize=1
20497
20498 : Check for the number of bits in a character
20499 case "$charbits" in
20500 '')     echo "Checking how long a character is (in bits)..." >&4
20501         $cat >try.c <<EOCP
20502 #include <stdio.h>
20503 int main ()
20504 {
20505     int n;
20506     unsigned char c;
20507     for (c = 1, n = 0; c; c <<= 1, n++) ;
20508     printf ("%d\n", n);
20509     return (0);
20510     }
20511 EOCP
20512         set try
20513         if eval $compile_ok; then
20514                 dflt=`$run ./try`
20515         else
20516                 dflt='8'
20517                 echo "(I can't seem to compile the test program.  Guessing...)"
20518         fi
20519         ;;
20520 *)
20521         dflt="$charbits"
20522         ;;
20523 esac
20524 rp="What is the length of a character (in bits)?"
20525 . ./myread
20526 charbits="$ans"
20527 $rm_try
20528 case "$charbits" in
20529 8)      ;;
20530 *)      cat >&4 << EOM
20531 Your system has an unsigned character size of $charbits bits, which
20532 is rather unusual (normally it is 8 bits).  Perl likely will not work
20533 correctly on your system, with subtle bugs in various places.
20534 EOM
20535         rp='Do you really want to continue?'
20536         dflt='n'
20537         . ./myread
20538         case "$ans" in
20539                 [yY])   echo >&4 "Okay, continuing."    ;;
20540                 *)      exit 1                          ;;
20541         esac
20542 esac
20543
20544 : how do we concatenate cpp tokens here?
20545 echo " "
20546 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20547 $cat >cpp_stuff.c <<'EOCP'
20548 #define RCAT(a,b)a/**/b
20549 #define ACAT(a,b)a ## b
20550 RCAT(Rei,ser)
20551 ACAT(Cir,cus)
20552 EOCP
20553 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20554 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20555         echo "Oh!  Smells like ANSI's been here." >&4
20556         echo "We can catify or stringify, separately or together!"
20557         cpp_stuff=42
20558 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20559         echo "Ah, yes!  The good old days!" >&4
20560         echo "However, in the good old days we don't know how to stringify and"
20561         echo "catify at the same time."
20562         cpp_stuff=1
20563 else
20564         $cat >&4 <<EOM
20565 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20566 You're going to have to edit the values of CAT[2-5] in config.h...
20567 EOM
20568         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20569 fi
20570 $rm -f cpp_stuff.*
20571
20572 : see if this is a db.h system
20573 set db.h i_db
20574 eval $inhdr
20575
20576 case "$i_db" in
20577 $define)
20578         : Check db version.
20579         echo " "
20580         echo "Checking Berkeley DB version ..." >&4
20581         $cat >try.c <<EOCP
20582 #include <sys/types.h>
20583 #include <stdio.h>
20584 #$i_stdlib I_STDLIB
20585 #ifdef I_STDLIB
20586 #include <stdlib.h>
20587 #endif
20588 #include <db.h>
20589 int main(int argc, char *argv[])
20590 {
20591 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20592     int Major, Minor, Patch ;
20593     unsigned long Version ;
20594     (void)db_version(&Major, &Minor, &Patch) ;
20595     if (argc == 2) {
20596         printf("%d %d %d %d %d %d\n",
20597                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20598                Major, Minor, Patch);
20599         exit(0);
20600     }
20601     printf("You have Berkeley DB Version 2 or greater.\n");
20602
20603     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20604                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20605     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20606                 Major, Minor, Patch) ;
20607
20608     /* check that db.h & libdb are compatible */
20609     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20610         printf("db.h and libdb are incompatible.\n") ;
20611         exit(3);
20612     }
20613
20614     printf("db.h and libdb are compatible.\n") ;
20615
20616     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20617                 + DB_VERSION_PATCH ;
20618
20619     /* needs to be >= 2.3.4 */
20620     if (Version < 2003004) {
20621     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20622         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20623         exit(2);
20624     }
20625
20626     exit(0);
20627 #else
20628 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20629     if (argc == 2) {
20630         printf("1 0 0\n");
20631         exit(0);
20632     }
20633     printf("You have Berkeley DB Version 1.\n");
20634     exit(0);    /* DB version < 2: the coast is clear. */
20635 #else
20636     exit(1);    /* <db.h> not Berkeley DB? */
20637 #endif
20638 #endif
20639 }
20640 EOCP
20641         set try
20642         if eval $compile_ok && $run ./try; then
20643                 echo 'Looks OK.' >&4
20644                 set `$run ./try 1`
20645                 db_version_major=$1
20646                 db_version_minor=$2
20647                 db_version_patch=$3
20648         else
20649                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20650                 i_db=$undef
20651                 case " $libs " in
20652                 *"-ldb "*)
20653                         : Remove db from list of libraries to use
20654                         echo "Removing unusable -ldb from library list" >&4
20655                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20656                         shift
20657                         libs="$*"
20658                         echo "libs = $libs" >&4
20659                         ;;
20660                 esac
20661         fi
20662         $rm_try
20663         ;;
20664 esac
20665
20666 case "$i_db" in
20667 define)
20668         : Check the return type needed for hash
20669         echo " "
20670         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20671         $cat >try.c <<EOCP
20672 #include <sys/types.h>
20673 #include <db.h>
20674
20675 #ifndef DB_VERSION_MAJOR
20676 u_int32_t hash_cb (const void* ptr, size_t size)
20677 {
20678         return 0;
20679 }
20680 HASHINFO info;
20681 int main()
20682 {
20683         info.hash = hash_cb;
20684 }
20685 #endif
20686 EOCP
20687         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20688                 if $compiler_warning try.out >>/dev/null 2>&1 ; then
20689                         db_hashtype='int'
20690                 else
20691                         db_hashtype='u_int32_t'
20692                 fi
20693         else
20694                 : XXX Maybe we should just give up here.
20695                 db_hashtype=u_int32_t
20696                 $cat try.out >&4
20697                 echo "Help:  I can't seem to compile the db test program." >&4
20698                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20699         fi
20700         $rm_try
20701         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20702         ;;
20703 *)      db_hashtype=u_int32_t
20704         ;;
20705 esac
20706 case "$i_db" in
20707 define)
20708         : Check the return type needed for prefix
20709         echo " "
20710         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20711         cat >try.c <<EOCP
20712 #include <sys/types.h>
20713 #include <db.h>
20714
20715 #ifndef DB_VERSION_MAJOR
20716 size_t prefix_cb (const DBT *key1, const DBT *key2)
20717 {
20718         return 0;
20719 }
20720 BTREEINFO info;
20721 int main()
20722 {
20723         info.prefix = prefix_cb;
20724 }
20725 #endif
20726 EOCP
20727         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20728                 if $compiler_warning try.out >>/dev/null 2>&1 ; then
20729                         db_prefixtype='int'
20730                 else
20731                         db_prefixtype='size_t'
20732                 fi
20733         else
20734                 db_prefixtype='size_t'
20735                 : XXX Maybe we should just give up here.
20736                 $cat try.out >&4
20737                 echo "Help:  I can't seem to compile the db test program." >&4
20738                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20739         fi
20740         $rm_try
20741         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20742         ;;
20743 *)      db_prefixtype='size_t'
20744         ;;
20745 esac
20746
20747 : Include . in @INC
20748 $cat <<EOM
20749
20750 Historically Perl has provided a final fallback of the current working
20751 directory '.' when searching for a library. This, however, can lead to
20752 problems when a Perl program which loads optional modules is called from
20753 a shared directory. This can lead to executing unexpected code.
20754
20755 EOM
20756
20757 # When changing to exclude by default:
20758 case "$default_inc_excludes_dot" in
20759     $undef|false|[nN]*) dflt="n" ;;
20760     *)                  dflt="y" ;;
20761 esac
20762 # To turn exclude off by default:
20763 #case "$default_inc_excludes_dot" in
20764 #    $define|true|[yY]*) dflt="y" ;;
20765 #    *)                  dflt="n" ;;
20766 #esac
20767
20768 rp='Exclude '.' from @INC by default? '
20769 . ./myread
20770 case "$ans" in
20771     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20772     *)          default_inc_excludes_dot="$define" ;;
20773 esac
20774
20775 : Check what kind of inf/nan your system has
20776 $echo "Checking the kind of infinities and nans you have..." >&4
20777 $echo "(The following tests may crash.  That's okay.)" >&4
20778 $cat >try.c <<EOP
20779 #define DOUBLESIZE $doublesize
20780 #$d_longdbl HAS_LONG_DOUBLE
20781 #ifdef HAS_LONG_DOUBLE
20782 #define LONG_DOUBLESIZE $longdblsize
20783 #define LONG_DOUBLEKIND $longdblkind
20784 #endif
20785 #include <math.h>
20786 #include <string.h>
20787 #include <stdio.h>
20788 /* Note that whether the sign bit is on or off
20789  * for NaN depends on the CPU/FPU, and possibly
20790  * can be affected by the build toolchain.
20791  *
20792  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20793  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20794  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20795  * (respectively) as opposed to the more usual
20796  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20797  *
20798  * Pre-IEEE-754 floating point format do not even have inf/nan support
20799  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20800  * to even mention, causing immediate SIGFPE or equivalent: this is
20801  * the case with VAX floating point, for example.
20802  */
20803 static void bytes(void *v, unsigned int n) {
20804   unsigned char *p = (unsigned char *)v;
20805   int i;
20806   for (i = 0; i < n; i++) {
20807     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20808   }
20809 }
20810 int main(int argc, char *argv[]) {
20811    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20812     * because some compilers are 'smart' and not only warn but refuse to
20813     * compile such 'illegal' values. */
20814    double dinf = exp(1e9);
20815    double dnan = sqrt(-1.0);
20816 #ifdef HAS_LONG_DOUBLE
20817    long double ldinf = (long double)exp(1e9);
20818    long double ldnan = (long double)sqrt(-1.0);
20819 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20820 /* the 80-bit long doubles might have garbage in their excess bytes */
20821     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20822     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20823 # endif
20824 #endif
20825   if (argc == 2) {
20826     switch (argv[1][0]) {
20827     case '1': bytes(&dinf, sizeof(dinf)); break;
20828     case '2': bytes(&dnan, sizeof(dnan)); break;
20829 #ifdef HAS_LONG_DOUBLE
20830     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20831     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20832 #endif
20833     }
20834   }
20835   return 0;
20836 }
20837 EOP
20838 set try
20839 if eval $compile; then
20840     doubleinfbytes=`$run ./try 1`
20841     doublenanbytes=`$run ./try 2`
20842     case "$d_longdbl" in
20843     $define)
20844       longdblinfbytes=`$run ./try 3`
20845       longdblnanbytes=`$run ./try 4`
20846       ;;
20847     esac
20848 else
20849     # Defaults in case the above test program failed.
20850     case "$doublekind" in
20851     1) # IEEE 754 32-bit LE
20852        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20853        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20854        ;;
20855     2) # IEEE 754 32-bit BE
20856        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20857        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20858        ;;
20859     3) # IEEE 754 64-bit LE
20860        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20861        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20862        ;;
20863     4) # IEEE 754 64-bit BE
20864        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20865        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20866        ;;
20867     5) # IEEE 754 128-bit LE
20868        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20869        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20870        ;;
20871     6) # IEEE 754 128-bit BE
20872        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20873        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20874        ;;
20875     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20876        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20877        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20878        ;;
20879     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20880        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20881        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20882        ;;
20883     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20884        doubleinfbytes=$undef
20885        doublenanbytes=$undef
20886        ;;
20887     *) # No idea.
20888        doubleinfbytes=$undef
20889        doublenanbytes=$undef
20890        ;;
20891     esac
20892     case "$longdblkind" in
20893     1) # IEEE 754 128-bit LE
20894        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20895        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20896        ;;
20897     2) # IEEE 754 128-bit BE
20898        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20899        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20900        ;;
20901     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20902        case "$longdblsize" in
20903        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20904            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20905            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20906            ;;
20907        16) # x86_64
20908            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20909            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20910            ;;
20911        *)  # No idea.
20912            longdblinfbytes=$undef
20913            longdblnanbytes=$undef
20914        ;;
20915        esac
20916        ;;
20917     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20918        case "$longdblsize" in
20919        12) # 32-bit system
20920            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20921            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20922            ;;
20923        16) # 64-bit system
20924            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20925            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20926            ;;
20927        *)  # No idea.
20928            longdblinfbytes=$undef
20929            longdblnanbytes=$undef
20930        ;;
20931        esac
20932        ;;
20933     5) # 128-bit LE-LE "double double"
20934        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20935        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20936        ;;
20937     6) # 128-bit BE-BE "double double"
20938        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20939        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20940        ;;
20941     7) # 128-bit LE-BE "double double"
20942        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20943        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20944        ;;
20945     8) # 128-bit BE-LE "double double"
20946        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20947        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20948        ;;
20949     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20950        longdblinfbytes=$undef
20951        longdblnanbytes=$undef
20952        ;;
20953     *) # No idea.
20954        longdblinfbytes=$undef
20955        longdblnanbytes=$undef
20956        ;;
20957     esac
20958 fi
20959 # In case the program crashed the values are empty, turn them undef.
20960 case "$doubleinfbytes" in
20961 '') doubleinfbytes=$undef ;;
20962 esac
20963 case "$doublenanbytes" in
20964 '') doublenanbytes=$undef ;;
20965 esac
20966 case "$longdblinfbytes" in
20967 '') longdblinfbytes=$undef ;;
20968 esac
20969 case "$longdblnanbytes" in
20970 '') longdblnanbytes=$undef ;;
20971 esac
20972 $rm_try
20973
20974 : Check the length of the double mantissa
20975 $echo "Checking how many mantissa bits your doubles have..." >&4
20976 $cat >try.c <<EOP
20977 #$i_sunmath I_SUNMATH
20978 #include <float.h>
20979 #ifdef I_SUNMATH
20980 # include <sunmath.h>
20981 #endif
20982 #ifdef DBL_MANT_DIG
20983 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20984 #endif
20985 #include <stdio.h>
20986 int main(int argc, char *argv[]) {
20987 #ifdef BITS
20988   printf("%d\n", BITS);
20989 #endif
20990   return 0;
20991 }
20992 EOP
20993 set try
20994 if eval $compile; then
20995     doublemantbits=`$run ./try`
20996 else
20997     doublemantbits="$undef"
20998 fi
20999 $rm_try
21000
21001 : Check the length of the longdouble mantissa
21002 $echo "Checking how many mantissa bits your long doubles have..." >&4
21003 $cat >try.c <<EOP
21004 #$i_sunmath I_SUNMATH
21005 #include <float.h>
21006 #ifdef I_SUNMATH
21007 # include <sunmath.h>
21008 #endif
21009 #$d_longdbl HAS_LONG_DOUBLE
21010 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
21011 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
21012 /* This format has no implicit bit.  Beware, however, that for
21013  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
21014  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
21015  * and the top bit must have been one since 387, zero is plain invalid.
21016  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
21017 #  define BITS LDBL_MANT_DIG
21018 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
21019 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
21020  * reason e.g. Irix thinks 107.  But in any case, we want only
21021  * the number of real bits, the implicit bits are of no interest.  */
21022 #  define BITS 2 * (DBL_MANT_DIG - 1)
21023 # else
21024 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
21025 # endif
21026 #endif
21027 #include <stdio.h>
21028 int main(int argc, char *argv[]) {
21029 #ifdef BITS
21030   printf("%d\n", BITS);
21031 #endif
21032   return 0;
21033 }
21034 EOP
21035 set try
21036 if eval $compile; then
21037     longdblmantbits=`$run ./try`
21038 else
21039     longdblmantbits="$undef"
21040 fi
21041 $rm_try
21042
21043 : Check the length of the NV mantissa
21044 $echo "Checking how many mantissa bits your NVs have..." >&4
21045 if test "X$usequadmath" = "X$define"; then
21046   nvmantbits=112 # 128-1-15
21047 else
21048   if test "X$nvsize" = "X$doublesize"; then
21049     nvmantbits="$doublemantbits"
21050   else
21051      if test "X$nvsize" = "X$longdblsize"; then
21052        nvmantbits="$longdblmantbits"
21053      else
21054        nvmantbits="$undef"
21055      fi
21056   fi
21057 fi
21058
21059 : How can we generate normalized random numbers ?
21060 echo " "
21061 echo "Using our internal random number implementation..." >&4
21062
21063 case "$ccflags" in
21064 *-Dmy_rand=*|*-Dmy_srand=*)
21065         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
21066         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
21067         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
21068         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
21069         ;;
21070 esac
21071
21072 randfunc=Perl_drand48
21073 drand01="Perl_drand48()"
21074 seedfunc="Perl_drand48_init"
21075 randbits=48
21076 randseedtype=U32
21077
21078 : Probe whether dtrace builds an object, as newer Illumos requires an input
21079 : object file that uses at least one of the probes defined in the .d file
21080 case "$usedtrace" in
21081 $define)
21082     case "$dtracexnolibs" in
21083     $define|true|[yY]*)
21084         dtracexnolibs=$define
21085         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
21086         ;;
21087     ' '|'')
21088         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
21089              dtracexnolibs=$define
21090              echo "Your dtrace accepts -xnolibs"
21091         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
21092              dtracexnolibs=$undef
21093              echo "Your dtrace doesn't accept -xnolibs"
21094         else
21095              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
21096              exit 1
21097         fi
21098         ;;
21099     *)
21100         dtracexnolibs=$undef
21101         $dtrace -h -s ../perldtrace.d -o perldtrace.h
21102         ;;
21103     esac
21104     case $dtracexnolibs in
21105     $define) xnolibs=-xnolibs ;;
21106     *) xnolibs= ;;
21107     esac
21108
21109     case "$dtraceobject" in
21110     $define|true|[yY]*)
21111         dtraceobject=$define
21112         ;;
21113     ' '|'')
21114         $cat >try.c <<EOM
21115 #include "perldtrace.h"
21116 int main(void) {
21117     PERL_LOADED_FILE("dummy");
21118     return 0;
21119 }
21120 EOM
21121         dtraceobject=$undef
21122         if $cc -c -o try.o $optimize $ccflags try.c \
21123                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
21124                 dtraceobject=$define
21125             echo "Your dtrace builds an object file"
21126         fi
21127         ;;
21128     *) dtraceobject=$undef ;;
21129     esac
21130     $rm_try perldtrace.o perldtrace.h
21131 esac
21132
21133 : Determine if this is an EBCDIC system
21134 echo " "
21135 echo "Determining whether or not we are on an EBCDIC system..." >&4
21136 $cat >try.c <<'EOM'
21137 int main()
21138 {
21139   if ('M'==0xd4) return 0;
21140   return 1;
21141 }
21142 EOM
21143
21144 val=$undef
21145 set try
21146 if eval $compile_ok; then
21147         if $run ./try; then
21148                 echo "You seem to speak EBCDIC." >&4
21149                 val="$define"
21150         else
21151                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
21152         fi
21153 else
21154         echo "I'm unable to compile the test program." >&4
21155         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
21156 fi
21157 $rm_try
21158 set ebcdic
21159 eval $setvar
21160
21161 : Check how to flush
21162 echo " "
21163 $cat >&4 <<EOM
21164 Checking how to flush all pending stdio output...
21165 EOM
21166 # I only know how to find the first 32 possibly open files on SunOS.
21167 # See also hints/sunos_4_1.sh and util.c  --AD
21168 case "$osname" in
21169 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
21170 esac
21171 $cat >>try.c <<EOCP
21172 #include <stdio.h>
21173 #$i_stdlib I_STDLIB
21174 #ifdef I_STDLIB
21175 #include <stdlib.h>
21176 #endif
21177 #$i_unistd I_UNISTD
21178 #ifdef I_UNISTD
21179 # include <unistd.h>
21180 #endif
21181 #$d_sysconf HAS_SYSCONF
21182 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
21183 #ifdef HAS_STDIO_STREAM_ARRAY
21184 # define STDIO_STREAM_ARRAY $stdio_stream_array
21185 #endif
21186 int main() {
21187   FILE* p;
21188   unlink("try.out");
21189   p = fopen("try.out", "w");
21190 #ifdef TRY_FPUTC
21191   fputc('x', p);
21192 #else
21193 # ifdef TRY_FPRINTF
21194   fprintf(p, "x");
21195 # endif
21196 #endif
21197 #ifdef TRY_FFLUSH_NULL
21198   fflush(NULL);
21199 #endif
21200 #ifdef TRY_FFLUSH_ALL
21201   {
21202     long open_max = -1;
21203 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
21204     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
21205 # else
21206 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
21207     open_max = sysconf(_SC_OPEN_MAX);
21208 #  else
21209 #   ifdef FOPEN_MAX
21210     open_max = FOPEN_MAX;
21211 #   else
21212 #    ifdef OPEN_MAX
21213     open_max = OPEN_MAX;
21214 #    else
21215 #     ifdef _NFILE
21216     open_max = _NFILE;
21217 #     endif
21218 #    endif
21219 #   endif
21220 #  endif
21221 # endif
21222 # ifdef HAS_STDIO_STREAM_ARRAY
21223     if (open_max > 0) {
21224       long i;
21225       for (i = 0; i < open_max; i++)
21226             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
21227                 STDIO_STREAM_ARRAY[i]._file < open_max &&
21228                 STDIO_STREAM_ARRAY[i]._flag)
21229                 fflush(&STDIO_STREAM_ARRAY[i]);
21230     }
21231   }
21232 # endif
21233 #endif
21234   _exit(42);
21235 }
21236 EOCP
21237 : first we have to find out how _not_ to flush
21238 $to try.c
21239 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
21240     output=''
21241     set try -DTRY_FPUTC
21242     if eval $compile; then
21243             $run ./try 2>/dev/null
21244             code="$?"
21245             $from try.out
21246             if $test ! -s try.out -a "X$code" = X42; then
21247                 output=-DTRY_FPUTC
21248             fi
21249     fi
21250     case "$output" in
21251     '')
21252             set try -DTRY_FPRINTF
21253             if eval $compile; then
21254                     $run ./try 2>/dev/null
21255                     code="$?"
21256                     $from try.out
21257                     if $test ! -s try.out -a "X$code" = X42; then
21258                         output=-DTRY_FPRINTF
21259                     fi
21260             fi
21261         ;;
21262     esac
21263 fi
21264 : check for fflush NULL behavior
21265 case "$fflushNULL" in
21266 '')     set try -DTRY_FFLUSH_NULL $output
21267         if eval $compile; then
21268                 $run ./try 2>/dev/null
21269                 code="$?"
21270                 $from try.out
21271                 if $test -s try.out -a "X$code" = X42; then
21272                         fflushNULL="`$cat try.out`"
21273                 else
21274                         if $test "X$code" != X42; then
21275                                 $cat >&4 <<EOM
21276 (If this test failed, don't worry, we'll try another method shortly.)
21277 EOM
21278                         fi
21279                 fi
21280         fi
21281         $rm -f core try.core core.try.*
21282         case "$fflushNULL" in
21283         x)      $cat >&4 <<EOM
21284 Your fflush(NULL) works okay for output streams.
21285 Let's see if it clobbers input pipes...
21286 EOM
21287 # As of mid-March 2000 all versions of Solaris appear to have a stdio
21288 # bug that improperly flushes the input end of pipes.  So we avoid the
21289 # autoflush on fork/system/exec support for now. :-(
21290 $cat >tryp.c <<EOCP
21291 #include <stdio.h>
21292 int
21293 main(int argc, char **argv)
21294 {
21295     char buf[1024];
21296     int i;
21297     char *bp = buf;
21298     while (1) {
21299         while ((i = getc(stdin)) != -1
21300                && (*bp++ = i) != '\n'
21301                && bp < &buf[1024])
21302         /* DO NOTHING */ ;
21303         *bp = '\0';
21304         fprintf(stdout, "%s", buf);
21305         fflush(NULL);
21306         if (i == -1)
21307             return 0;
21308         bp = buf;
21309     }
21310 }
21311 EOCP
21312                 fflushNULL="$define"
21313                 set tryp
21314                 if eval $compile; then
21315                     $rm -f tryp.out
21316                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
21317                     if $test "X$targethost" != X; then
21318                         $to tryp.c
21319                         $to tryp
21320                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21321                     else
21322                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21323                     fi
21324                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
21325                        $cat >&4 <<EOM
21326 fflush(NULL) seems to behave okay with input streams.
21327 EOM
21328                         fflushNULL="$define"
21329                     else
21330                         $cat >&4 <<EOM
21331 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
21332 EOM
21333                         fflushNULL="$undef"
21334                     fi
21335                 fi
21336                 $rm -f core tryp.c tryp.core core.tryp.*
21337                 ;;
21338         '')     $cat >&4 <<EOM
21339 Your fflush(NULL) isn't working (contrary to ANSI C).
21340 EOM
21341                 fflushNULL="$undef"
21342                 ;;
21343         *)      $cat >&4 <<EOM
21344 Cannot figure out whether your fflush(NULL) works or not.
21345 I'm assuming it doesn't (contrary to ANSI C).
21346 EOM
21347                 fflushNULL="$undef"
21348                 ;;
21349         esac
21350         ;;
21351 $define|true|[yY]*)
21352         fflushNULL="$define"
21353         ;;
21354 *)
21355         fflushNULL="$undef"
21356         ;;
21357 esac
21358 : check explicit looping only if NULL did not work, and if the pipe
21359 : bug does not show up on an explicit flush too
21360 case "$fflushNULL" in
21361 "$undef")
21362         $cat >tryp.c <<EOCP
21363 #include <stdio.h>
21364 int
21365 main(int argc, char **argv)
21366 {
21367     char buf[1024];
21368     int i;
21369     char *bp = buf;
21370     while (1) {
21371         while ((i = getc(stdin)) != -1
21372                && (*bp++ = i) != '\n'
21373                && bp < &buf[1024])
21374         /* DO NOTHING */ ;
21375         *bp = '\0';
21376         fprintf(stdout, "%s", buf);
21377         fflush(stdin);
21378         if (i == -1)
21379             return 0;
21380         bp = buf;
21381     }
21382 }
21383 EOCP
21384         set tryp
21385         if eval $compile; then
21386             $rm -f tryp.out
21387             if $test "X$targethost" != X; then
21388                 $to tryp.c
21389                 $to tryp
21390                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
21391             else
21392                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
21393             fi
21394             if cmp tryp.c tryp.out >/dev/null 2>&1; then
21395                $cat >&4 <<EOM
21396 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
21397 EOM
21398                 : now check for fflushall behaviour
21399                 case "$fflushall" in
21400                 '')     set try -DTRY_FFLUSH_ALL $output
21401                         if eval $compile; then
21402                                 $cat >&4 <<EOM
21403 (Now testing the other method--but note that this also may fail.)
21404 EOM
21405                                 $run ./try 2>/dev/null
21406                                 code=$?
21407                                 $from try.out
21408                                 if $test -s try.out -a "X$code" = X42; then
21409                                         fflushall="`$cat try.out`"
21410                                 fi
21411                         fi
21412                         $rm_try
21413                         case "$fflushall" in
21414                         x)      $cat >&4 <<EOM
21415 Whew. Flushing explicitly all the stdio streams works.
21416 EOM
21417                                 fflushall="$define"
21418                                 ;;
21419                         '')     $cat >&4 <<EOM
21420 Sigh. Flushing explicitly all the stdio streams doesn't work.
21421 EOM
21422                                 fflushall="$undef"
21423                                 ;;
21424                         *)      $cat >&4 <<EOM
21425 Cannot figure out whether flushing stdio streams explicitly works or not.
21426 I'm assuming it doesn't.
21427 EOM
21428                                 fflushall="$undef"
21429                                 ;;
21430                         esac
21431                         ;;
21432                 "$define"|true|[yY]*)
21433                         fflushall="$define"
21434                         ;;
21435                 *)
21436                         fflushall="$undef"
21437                         ;;
21438                 esac
21439             else
21440                 $cat >&4 <<EOM
21441 All is futile.  Even fflush(stdin) clobbers input pipes!
21442 EOM
21443                 fflushall="$undef"
21444             fi
21445         else
21446             fflushall="$undef"
21447         fi
21448         $rm -f core tryp.c tryp.core core.tryp.*
21449         ;;
21450 *)      fflushall="$undef"
21451         ;;
21452 esac
21453
21454 case "$fflushNULL$fflushall" in
21455 undefundef)
21456         $cat <<EOM
21457 OK, I give up.  I cannot figure out how to flush pending stdio output.
21458 We won't be flushing handles at all before fork/exec/popen.
21459 EOM
21460         ;;
21461 esac
21462 $rm_try tryp
21463
21464 : Store the full pathname to the ar program for use in the C program
21465 : Respect a hint or command line value for full_ar.
21466 case "$full_ar" in
21467 '') full_ar=$ar ;;
21468 esac
21469
21470 : Store the full pathname to the sed program for use in the C program
21471 full_sed=$sed
21472
21473 : see what type gids are declared as in the kernel
21474 echo " "
21475 echo "Looking for the type for group ids returned by getgid()."
21476 set gid_t gidtype xxx stdio.h sys/types.h
21477 eval $typedef
21478 case "$gidtype" in
21479 xxx)
21480         xxx=`./findhdr sys/user.h`
21481         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21482         case $1 in
21483         unsigned) dflt="$1 $2" ;;
21484         *) dflt="$1" ;;
21485         esac
21486         ;;
21487 *) dflt="$gidtype";;
21488 esac
21489 case "$gidtype" in
21490 gid_t) echo "gid_t found." ;;
21491 *)      rp="What is the type for group ids returned by getgid()?"
21492         . ./myread
21493         gidtype="$ans"
21494         ;;
21495 esac
21496
21497 : Check the size of GID
21498 echo " "
21499 case "$gidtype" in
21500 *_t) zzz="$gidtype"     ;;
21501 *)   zzz="gid"          ;;
21502 esac
21503 echo "Checking the size of $zzz..." >&4
21504 cat > try.c <<EOCP
21505 #include <sys/types.h>
21506 #include <stdio.h>
21507 #$i_stdlib I_STDLIB
21508 #ifdef I_STDLIB
21509 #include <stdlib.h>
21510 #endif
21511 int main() {
21512     printf("%d\n", (int)sizeof($gidtype));
21513     exit(0);
21514 }
21515 EOCP
21516 set try
21517 if eval $compile_ok; then
21518         yyy=`$run ./try`
21519         case "$yyy" in
21520         '')     gidsize=4
21521                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21522                 ;;
21523         *)      gidsize=$yyy
21524                 echo "Your $zzz is $gidsize bytes long."
21525                 ;;
21526         esac
21527 else
21528         gidsize=4
21529         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21530 fi
21531
21532 : Check if GID is signed
21533 echo " "
21534 case "$gidtype" in
21535 *_t) zzz="$gidtype"     ;;
21536 *)   zzz="gid"          ;;
21537 esac
21538 echo "Checking the sign of $zzz..." >&4
21539 cat > try.c <<EOCP
21540 #include <sys/types.h>
21541 #include <stdio.h>
21542 int main() {
21543         $gidtype foo = -1;
21544         if (foo < 0)
21545                 printf("-1\n");
21546         else
21547                 printf("1\n");
21548 }
21549 EOCP
21550 set try
21551 if eval $compile; then
21552         yyy=`$run ./try`
21553         case "$yyy" in
21554         '')     gidsign=1
21555                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21556                 ;;
21557         *)      gidsign=$yyy
21558                 case "$gidsign" in
21559                  1) echo "Your $zzz is unsigned." ;;
21560                 -1) echo "Your $zzz is signed."   ;;
21561                 esac
21562                 ;;
21563         esac
21564 else
21565         gidsign=1
21566         echo "(I can't compile the test program--guessing unsigned.)" >&4
21567 fi
21568
21569 : Check 64bit sizes
21570 echo " "
21571
21572 if $test X"$quadtype" != X; then
21573
21574 echo "Checking how to print 64-bit integers..." >&4
21575
21576 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21577         $cat >try.c <<'EOCP'
21578 #include <sys/types.h>
21579 #include <stdio.h>
21580 int main() {
21581   int q = 12345678901;
21582   printf("%ld\n", q);
21583 }
21584 EOCP
21585         set try
21586         if eval $compile; then
21587                 yyy=`$run ./try`
21588                 case "$yyy" in
21589                 12345678901)
21590                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21591                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21592                         echo "We will use %d."
21593                         ;;
21594                 esac
21595         fi
21596 fi
21597
21598 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21599         $cat >try.c <<'EOCP'
21600 #include <sys/types.h>
21601 #include <stdio.h>
21602 int main() {
21603   long q = 12345678901;
21604   printf("%ld\n", q);
21605 }
21606 EOCP
21607         set try
21608         if eval $compile; then
21609                 yyy=`$run ./try`
21610                 case "$yyy" in
21611                 12345678901)
21612                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21613                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21614                         echo "We will use %ld."
21615                         ;;
21616                 esac
21617         fi
21618 fi
21619
21620 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21621         $cat >try.c <<'EOCP'
21622 #include <sys/types.h>
21623 #include <inttypes.h>
21624 #include <stdio.h>
21625 int main() {
21626   int64_t q = 12345678901;
21627   printf("%" PRId64 "\n", q);
21628 }
21629 EOCP
21630         set try
21631         if eval $compile; then
21632                 yyy=`$run ./try`
21633                 case "$yyy" in
21634                 12345678901)
21635                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21636                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIX64;
21637                         echo "We will use the C9X style."
21638                         ;;
21639                 esac
21640         fi
21641 fi
21642
21643 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21644         $cat >try.c <<EOCP
21645 #include <sys/types.h>
21646 #include <stdio.h>
21647 int main() {
21648   $quadtype q = 12345678901;
21649   printf("%Ld\n", q);
21650 }
21651 EOCP
21652         set try
21653         if eval $compile; then
21654                 yyy=`$run ./try`
21655                 case "$yyy" in
21656                 12345678901)
21657                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21658                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21659                         echo "We will use %Ld."
21660                         ;;
21661                 esac
21662         fi
21663 fi
21664
21665 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21666         $cat >try.c <<'EOCP'
21667 #include <sys/types.h>
21668 #include <stdio.h>
21669 int main() {
21670   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21671   printf("%lld\n", q);
21672 }
21673 EOCP
21674         set try
21675         if eval $compile; then
21676                 yyy=`$run ./try`
21677                 case "$yyy" in
21678                 12345678901)
21679                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21680                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21681                         echo "We will use the %lld style."
21682                         ;;
21683                 esac
21684         fi
21685 fi
21686
21687 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21688         $cat >try.c <<EOCP
21689 #include <sys/types.h>
21690 #include <stdio.h>
21691 int main() {
21692   $quadtype q = 12345678901;
21693   printf("%qd\n", q);
21694 }
21695 EOCP
21696         set try
21697         if eval $compile; then
21698                 yyy=`$run ./try`
21699                 case "$yyy" in
21700                 12345678901)
21701                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21702                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21703                         echo "We will use %qd."
21704                         ;;
21705                 esac
21706         fi
21707 fi
21708
21709 if $test X"$sPRId64" = X; then
21710         echo "Cannot figure out how to print 64-bit integers." >&4
21711 fi
21712 $rm_try
21713
21714 fi
21715
21716 case "$sPRId64" in
21717 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21718         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21719         ;;
21720 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21721         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21722         ;;
21723 esac
21724
21725 : Check format strings for internal types
21726 echo " "
21727 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21728
21729 if $test X"$ivsize" = X8; then
21730         ivdformat="$sPRId64"
21731         uvuformat="$sPRIu64"
21732         uvoformat="$sPRIo64"
21733         uvxformat="$sPRIx64"
21734         uvXUformat="$sPRIXU64"
21735 else
21736         if $test X"$ivsize" = X"$longsize"; then
21737                 ivdformat='"ld"'
21738                 uvuformat='"lu"'
21739                 uvoformat='"lo"'
21740                 uvxformat='"lx"'
21741                 uvXUformat='"lX"'
21742         else
21743                 if $test X"$ivsize" = X"$intsize"; then
21744                         ivdformat='"d"'
21745                         uvuformat='"u"'
21746                         uvoformat='"o"'
21747                         uvxformat='"x"'
21748                         uvXUformat='"X"'
21749                 else
21750                         : far out
21751                         if $test X"$ivsize" = X"$shortsize"; then
21752                                 ivdformat='"hd"'
21753                                 uvuformat='"hu"'
21754                                 uvoformat='"ho"'
21755                                 uvxformat='"hx"'
21756                                 uvXUformat='"hX"'
21757                         fi
21758                 fi
21759         fi
21760 fi
21761
21762 if $test X"$usequadmath" = X"$define"; then
21763     nveformat='"Qe"'
21764     nvfformat='"Qf"'
21765     nvgformat='"Qg"'
21766     nvEUformat='"QE"'
21767     nvFUformat='"QF"'
21768     nvGUformat='"QG"'
21769 else
21770     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21771         nveformat="$sPRIeldbl"
21772         nvfformat="$sPRIfldbl"
21773         nvgformat="$sPRIgldbl"
21774         nvEUformat="$sPRIEUldbl"
21775         nvFUformat="$sPRIFUldbl"
21776         nvGUformat="$sPRIGUldbl"
21777     else
21778         nveformat='"e"'
21779         nvfformat='"f"'
21780         nvgformat='"g"'
21781         nvEUformat='"E"'
21782         nvFUformat='"F"'
21783         nvGUformat='"G"'
21784     fi
21785 fi
21786
21787 case "$ivdformat" in
21788 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21789     exit 1
21790     ;;
21791 esac
21792
21793 case "$i32dformat" in
21794 '')     case "$i32type" in
21795         int)
21796                 i32dformat='"d"'
21797                 u32uformat='"u"'
21798                 u32oformat='"o"'
21799                 u32xformat='"x"'
21800                 u32XUformat='"X"'
21801                 ;;
21802         long)
21803                 i32dformat='"ld"'
21804                 u32uformat='"lu"'
21805                 u32oformat='"lo"'
21806                 u32xformat='"lx"'
21807                 u32XUformat='"lX"'
21808                 ;;
21809         int_least32_t)                  : will not happen currently
21810                 i32dformat=PRIdLEAST32
21811                 u32uformat=PRIuLEAST32
21812                 u32oformat=PRIoLEAST32
21813                 u32xformat=PRIxLEAST32
21814                 u32XUformat=PRIXLEAST32
21815                 ;;
21816         int32_t)
21817                 i32dformat=PRId32
21818                 u32uformat=PRIu32
21819                 u32oformat=PRIo32
21820                 u32xformat=PRIx32
21821                 u32XUformat=PRIX32
21822                 ;;
21823         esac ;;
21824 esac
21825
21826 case "$i32dformat" in
21827 '') echo "$0: Fatal: failed to find format strings for 32-bit integers, cannot continue." >&4
21828     exit 1
21829     ;;
21830 esac
21831
21832 : Check format string for GID
21833
21834 echo " "
21835 $echo "Checking the format string to be used for gids..." >&4
21836
21837 case "$gidsign" in
21838 -1)     if $test X"$gidsize" = X"$ivsize"; then
21839                 gidformat="$ivdformat"
21840         else
21841                 if $test X"$gidsize" = X"$longsize"; then
21842                         gidformat='"ld"'
21843                 else
21844                         if $test X"$gidsize" = X"$intsize"; then
21845                                 gidformat='"d"'
21846                         else
21847                                 if $test X"$gidsize" = X"$shortsize"; then
21848                                         gidformat='"hd"'
21849                                 fi
21850                         fi
21851                 fi
21852         fi
21853         ;;
21854 *)      if $test X"$gidsize" = X"$uvsize"; then
21855                 gidformat="$uvuformat"
21856         else
21857                 if $test X"$gidsize" = X"$longsize"; then
21858                         gidformat='"lu"'
21859                 else
21860                         if $test X"$gidsize" = X"$intsize"; then
21861                                 gidformat='"u"'
21862                         else
21863                                 if $test X"$gidsize" = X"$shortsize"; then
21864                                         gidformat='"hu"'
21865                                 fi
21866                         fi
21867                 fi
21868         fi
21869         ;;
21870 esac
21871
21872 : see if getgroups exists
21873 set getgroups d_getgrps
21874 eval $inlibc
21875
21876 : see if setgroups exists
21877 set setgroups d_setgrps
21878 eval $inlibc
21879
21880 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21881 echo " "
21882 case "$d_getgrps$d_setgrps" in
21883 *define*)
21884         case "$groupstype" in
21885         '') dflt="$gidtype" ;;
21886         *)  dflt="$groupstype" ;;
21887         esac
21888         $cat <<EOM
21889 What type of pointer is the second argument to getgroups() and setgroups()?
21890 Usually this is the same as group ids, $gidtype, but not always.
21891
21892 EOM
21893         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21894         . ./myread
21895         groupstype="$ans"
21896         ;;
21897 *)  groupstype="$gidtype";;
21898 esac
21899
21900 : check whether make sets MAKE
21901 echo " "
21902 echo "Checking if your $make program sets \$(MAKE)..." >&4
21903 case "$make_set_make" in
21904 '')
21905         $sed 's/^X //' > testmake.mak << 'EOF'
21906 Xall:
21907 X       @echo 'maketemp="$(MAKE)"'
21908 EOF
21909         case "`$make -f testmake.mak 2>/dev/null`" in
21910         *maketemp=*) make_set_make='#' ;;
21911         *)      make_set_make="MAKE=$make" ;;
21912         esac
21913         $rm -f testmake.mak
21914         ;;
21915 esac
21916 case "$make_set_make" in
21917 '#') echo "Yup, it does.";;
21918 *) echo "Nope, it doesn't.";;
21919 esac
21920
21921 : see what type is used for mode_t
21922 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21923 set mode_t modetype int stdio.h sys/types.h
21924 eval $typedef_ask
21925
21926 : see if we need va_copy
21927 echo " "
21928 $cat >try.c <<EOCP
21929 #include <stdarg.h>
21930 #include <stdio.h>
21931 #include <stdlib.h>
21932 #include <signal.h>
21933
21934 int
21935 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21936 {
21937   return vfprintf(f, fmt, *valp);
21938 }
21939
21940 int
21941 myvfprintf(FILE *f, const  char *fmt, va_list val)
21942 {
21943   return ivfprintf(f, fmt, &val);
21944 }
21945
21946 int
21947 myprintf(char *fmt, ...)
21948 {
21949   va_list val;
21950   va_start(val, fmt);
21951   return myvfprintf(stdout, fmt, val);
21952 }
21953
21954 int
21955 main(int ac, char **av)
21956 {
21957   signal(SIGSEGV, exit);
21958 #ifdef SIGBUS
21959   signal(SIGBUS,  exit);
21960 #endif
21961
21962   myprintf("%s%cs all right, then\n", "that", '\'');
21963   exit(0);
21964 }
21965 EOCP
21966 set try
21967 if eval $compile && $run ./try 2>&1 >/dev/null; then
21968         case "`$run ./try`" in
21969         "that's all right, then")
21970                 okay=yes
21971                 ;;
21972         esac
21973 fi
21974 case "$okay" in
21975 yes)    echo "It seems that you don't need va_copy()." >&4
21976         need_va_copy="$undef"
21977         ;;
21978 *)      echo "It seems that va_copy() or similar will be needed." >&4
21979         need_va_copy="$define"
21980         ;;
21981 esac
21982 $rm_try
21983
21984 : see what type is used for size_t
21985 rp="What is the type used for the length parameter for string functions?"
21986 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21987 eval $typedef_ask
21988
21989 : check for type of arguments to gethostbyaddr.
21990 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21991         case "$d_gethbyaddr" in
21992         $define)
21993                 $cat <<EOM
21994
21995 Checking to see what type of arguments are accepted by gethostbyaddr().
21996 EOM
21997                 hdrs="$define sys/types.h
21998                         $d_socket sys/socket.h
21999                         $i_niin netinet/in.h
22000                         $i_netdb netdb.h
22001                         $i_unistd unistd.h"
22002                 : The first arg can 'char *' or 'void *'
22003                 : The second arg is some of integral type
22004                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
22005                         for yyy in size_t long int; do
22006                                 case "$netdb_host_type" in
22007                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
22008                                         if ./protochk "$try" $hdrs; then
22009                                                 echo "Your system accepts $xxx for the first arg."
22010                                                 echo "...and $yyy for the second arg."
22011                                                 netdb_host_type="$xxx"
22012                                                 netdb_hlen_type="$yyy"
22013                                         fi
22014                                         ;;
22015                                 esac
22016                         done
22017                 done
22018                 : In case none of those worked, prompt the user.
22019                 case "$netdb_host_type" in
22020                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
22021                         dflt='char *'
22022                         . ./myread
22023                         netdb_host_type=$ans
22024                         rp='What is the type for the 2nd argument to gethostbyaddr?'
22025                         dflt="$sizetype"
22026                         . ./myread
22027                         netdb_hlen_type=$ans
22028                         ;;
22029                 esac
22030                 ;;
22031         *)      : no gethostbyaddr, so pick harmless defaults
22032                 netdb_host_type='char *'
22033                 netdb_hlen_type="$sizetype"
22034                 ;;
22035         esac
22036         # Remove the "const" if needed. -- but then we'll have a
22037         # prototype clash!
22038         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
22039 fi
22040
22041 : check for type of argument to gethostbyname.
22042 if test "X$netdb_name_type" = X ; then
22043         case "$d_gethbyname" in
22044         $define)
22045                 $cat <<EOM
22046
22047 Checking to see what type of argument is accepted by gethostbyname().
22048 EOM
22049                 hdrs="$define sys/types.h
22050                         $d_socket sys/socket.h
22051                         $i_niin netinet/in.h
22052                         $i_netdb netdb.h
22053                         $i_unistd unistd.h"
22054                 for xxx in "const char *" "char *"; do
22055                         case "$netdb_name_type" in
22056                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
22057                                 if ./protochk "$try" $hdrs; then
22058                                         echo "Your system accepts $xxx."
22059                                         netdb_name_type="$xxx"
22060                                 fi
22061                                 ;;
22062                         esac
22063                 done
22064                 : In case none of those worked, prompt the user.
22065                 case "$netdb_name_type" in
22066                 '')     rp='What is the type for the 1st argument to gethostbyname?'
22067                         dflt='char *'
22068                         . ./myread
22069                         netdb_name_type=$ans
22070                         ;;
22071                 esac
22072                 ;;
22073         *)      : no gethostbyname, so pick harmless default
22074                 netdb_name_type='char *'
22075                 ;;
22076         esac
22077 fi
22078
22079 : check for type of 1st argument to getnetbyaddr.
22080 if test "X$netdb_net_type" = X ; then
22081         case "$d_getnbyaddr" in
22082         $define)
22083                 $cat <<EOM
22084
22085 Checking to see what type of 1st argument is accepted by getnetbyaddr().
22086 EOM
22087                 hdrs="$define sys/types.h
22088                         $d_socket sys/socket.h
22089                         $i_niin netinet/in.h
22090                         $i_netdb netdb.h
22091                         $i_unistd unistd.h"
22092                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
22093                         case "$netdb_net_type" in
22094                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
22095                                 if ./protochk "$try" $hdrs; then
22096                                         echo "Your system accepts $xxx."
22097                                         netdb_net_type="$xxx"
22098                                 fi
22099                                 ;;
22100                         esac
22101                 done
22102                 : In case none of those worked, prompt the user.
22103                 case "$netdb_net_type" in
22104                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
22105                         dflt='long'
22106                         . ./myread
22107                         netdb_net_type=$ans
22108                         ;;
22109                 esac
22110                 ;;
22111         *)      : no getnetbyaddr, so pick harmless default
22112                 netdb_net_type='long'
22113                 ;;
22114         esac
22115 fi
22116 : locate the preferred pager for this system
22117 fn=f/
22118 case "$pager" in
22119 '')
22120         dflt=''
22121         case "$pg" in
22122         /*) dflt=$pg;;
22123         [a-zA-Z]:/*) dflt=$pg;;
22124         esac
22125         case "$more" in
22126         /*) dflt=$more;;
22127         [a-zA-Z]:/*) dflt=$more;;
22128         esac
22129         case "$less" in
22130         /*) dflt=$less;;
22131         [a-zA-Z]:/*) dflt=$less;;
22132         esac
22133         case "$dflt" in
22134         '') dflt=/usr/ucb/more;;
22135         esac
22136         ;;
22137 *)      dflt="$pager"
22138         ;;
22139 esac
22140 fn="f/($dflt)"
22141 echo " "
22142 rp='What pager is used on your system?'
22143 . ./getfile
22144 pager="$ans"
22145
22146 : see if ar generates random libraries by itself
22147 echo " "
22148 echo "Checking how to generate random libraries on your machine..." >&4
22149 echo 'extern int bar2(); int bar1() { return bar2(); }' > bar1.c
22150 echo 'int bar2() { return 2; }' > bar2.c
22151 $cat > foo.c <<EOP
22152 #$i_stdlib I_STDLIB
22153 #ifdef I_STDLIB
22154 #include <stdlib.h>
22155 #endif
22156 #include <stdio.h>
22157 extern int bar1();
22158 int main() { printf("%d\n", bar1()); exit(0); }
22159 EOP
22160 $cc $ccflags -c bar1.c >/dev/null 2>&1
22161 $cc $ccflags -c bar2.c >/dev/null 2>&1
22162 $cc $ccflags -c foo.c >/dev/null 2>&1
22163 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
22164 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22165         $run ./foobar >/dev/null 2>&1; then
22166         echo "$ar appears to generate random libraries itself."
22167         orderlib=false
22168         if [ "X$ranlib" = "X" ]; then
22169             ranlib=":"
22170         fi
22171 elif $ar s bar$_a >/dev/null 2>&1 &&
22172         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22173         $run ./foobar >/dev/null 2>&1; then
22174                 echo "a table of contents needs to be added with '$ar s'."
22175                 orderlib=false
22176                 ranlib="$ar s"
22177 elif $ar ts bar$_a >/dev/null 2>&1 &&
22178         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
22179         $run ./foobar >/dev/null 2>&1; then
22180                 echo "a table of contents needs to be added with '$ar ts'."
22181                 orderlib=false
22182                 ranlib="$ar ts"
22183 else
22184         case "$ranlib" in
22185         :) ranlib='';;
22186         '')
22187                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
22188                 $test -f $ranlib || ranlib=''
22189                 ;;
22190         esac
22191         if $test -n "$ranlib"; then
22192                 echo "your system has '$ranlib'; we'll use that."
22193                 orderlib=false
22194         else
22195                 echo "your system doesn't seem to support random libraries"
22196                 echo "so we'll use lorder and tsort to order the libraries."
22197                 orderlib=true
22198                 ranlib=":"
22199         fi
22200 fi
22201 $rm -f foo* bar*
22202
22203 : Check the max offset that gmtime and localtime accept
22204 echo "Checking max offsets that gmtime () accepts"
22205
22206 case "$sGMTIME_min/$sGMTIME_max" in
22207     0/0|/)
22208         $cat >try.c <<EOCP
22209 #include <sys/types.h>
22210 #include <stdio.h>
22211 #include <time.h>
22212
22213 int i;
22214 struct tm *tmp;
22215 time_t pt;
22216
22217 void gm_check (time_t t, int min_year, int max_year)
22218 {
22219     tmp = gmtime (&t);
22220     if ( tmp == NULL ||
22221         /* Check tm_year overflow */
22222          tmp->tm_year < min_year || tmp->tm_year > max_year)
22223         tmp = NULL;
22224     else
22225         pt = t;
22226     } /* gm_check */
22227
22228 int check_max ()
22229 {
22230     tmp = NULL;
22231     pt  = 0;
22232 #ifdef MAXLONG
22233     gm_check (MAXLONG, 69, 0x7fffffff);
22234 #endif
22235     if (tmp == NULL || tmp->tm_year < 0) {
22236         for (i = 63; i >= 0; i--) {
22237             time_t x = pt | ((time_t)1 << i);
22238             if (x < 0 || x < pt) continue;
22239             gm_check (x, 69, 0x7fffffff);
22240             }
22241         }
22242     printf ("sGMTIME_max=%ld\n", pt);
22243     return (0);
22244     } /* check_max */
22245
22246 int check_min ()
22247 {
22248     tmp = NULL;
22249     pt  = 0;
22250 #ifdef MINLONG
22251     gm_check (MINLONG, -1900, 70);
22252 #endif
22253     if (tmp == NULL) {
22254         for (i = 36; i >= 0; i--) {
22255             time_t x = pt - ((time_t)1 << i);
22256             if (x > 0) continue;
22257             gm_check (x, -1900, 70);
22258             }
22259         }
22260     printf ("sGMTIME_min=%ld\n", pt);
22261     return (0);
22262     } /* check_min */
22263
22264 int main (int argc, char *argv[])
22265 {
22266     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
22267     check_max ();
22268     check_min ();
22269     return (0);
22270     } /* main */
22271 EOCP
22272         set try
22273         if eval $compile; then
22274             eval `$run ./try 2>/dev/null`
22275         else
22276             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
22277             fi
22278         $rm_try
22279         ;;
22280     esac
22281
22282 echo "Checking max offsets that localtime () accepts"
22283
22284 case "$sLOCALTIME_min/$sLOCALTIME_max" in
22285     0/0|/)
22286         $cat >try.c <<EOCP
22287 #include <sys/types.h>
22288 #include <stdio.h>
22289 #include <time.h>
22290
22291 int i;
22292 struct tm *tmp;
22293 time_t pt;
22294
22295 void local_check (time_t t, int min_year, int max_year)
22296 {
22297     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
22298         tmp = NULL;
22299     else
22300         tmp = localtime (&t);
22301     if ( tmp == NULL ||
22302         /* Check tm_year overflow */
22303          tmp->tm_year < min_year || tmp->tm_year > max_year)
22304         tmp = NULL;
22305     else
22306         pt = t;
22307     } /* local_check */
22308
22309 int check_max ()
22310 {
22311     tmp = NULL;
22312     pt  = 0;
22313 #ifdef MAXLONG
22314     local_check (MAXLONG, 69, 0x7fffffff);
22315 #endif
22316     if (tmp == NULL || tmp->tm_year < 0) {
22317         for (i = 63; i >= 0; i--) {
22318             time_t x = pt | ((time_t)1 << i);
22319             if (x < 0 || x < pt) continue;
22320             local_check (x, 69, 0x7fffffff);
22321             }
22322         }
22323     printf ("sLOCALTIME_max=%ld\n", pt);
22324     return (0);
22325    } /* check_max */
22326
22327 int check_min ()
22328 {
22329     tmp = NULL;
22330     pt  = 0;
22331 #ifdef MINLONG
22332     local_check (MINLONG, -1900, 70);
22333 #endif
22334     if (tmp == NULL) {
22335         for (i = 36; i >= 0; i--) {
22336             time_t x = pt - ((time_t)1 << i);
22337             if (x > 0) continue;
22338             local_check (x, -1900, 70);
22339             }
22340         }
22341     printf ("sLOCALTIME_min=%ld\n", pt);
22342     return (0);
22343     } /* check_min */
22344
22345 int main (int argc, char *argv[])
22346 {
22347     check_max ();
22348     check_min ();
22349     return (0);
22350     } /* main */
22351 EOCP
22352         set try
22353         if eval $compile; then
22354             eval `$run ./try 2>/dev/null`
22355         else
22356             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
22357             fi
22358         $rm_try
22359         ;;
22360     esac
22361
22362 : check for type of arguments to select.
22363 case "$selecttype" in
22364 '') case "$d_select" in
22365         $define)
22366                 echo " "
22367                 $cat <<EOM
22368 Checking to see what type of arguments are accepted by select().
22369 EOM
22370                 hdrs="$define sys/types.h
22371                         $i_systime sys/time.h
22372                         $i_sysselct sys/select.h
22373                         $d_socket sys/socket.h"
22374                 : The first arg can be int, unsigned, or size_t
22375                 : The last arg may or may not be 'const'
22376                 val=''
22377                 : void pointer has been seen but using that
22378                 : breaks the selectminbits test
22379                 for xxx in 'fd_set *' 'int *'; do
22380                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
22381                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
22382                                         case "$val" in
22383                                         '')     try="$extern_C int select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
22384                                                 if ./protochk "$try" $hdrs; then
22385                                                         echo "Your system accepts $xxx."
22386                                                         val="$xxx"
22387                                                 fi
22388                                                 ;;
22389                                         esac
22390                                 done
22391                         done
22392                 done
22393                 case "$val" in
22394                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
22395                         case "$d_fd_set" in
22396                                 $define) dflt="fd_set *" ;;
22397                                 *)              dflt="int *" ;;
22398                         esac
22399                         . ./myread
22400                         val=$ans
22401                         ;;
22402                 esac
22403                 selecttype="$val"
22404                 ;;
22405         *)      : no select, so pick a harmless default
22406                 selecttype='int *'
22407                 ;;
22408         esac
22409         ;;
22410 esac
22411
22412 : check for the select 'width'
22413 case "$selectminbits" in
22414 '') safebits=`expr $ptrsize \* 8`
22415     case "$d_select" in
22416         $define)
22417                 $cat <<EOM
22418
22419 Checking to see on how many bits at a time your select() operates...
22420 EOM
22421                 $cat >try.c <<EOCP
22422 #include <sys/types.h>
22423 #$i_time I_TIME
22424 #$i_systime I_SYS_TIME
22425 #$i_systimek I_SYS_TIME_KERNEL
22426 #ifdef I_TIME
22427 #   include <time.h>
22428 #endif
22429 #ifdef I_SYS_TIME
22430 #   ifdef I_SYS_TIME_KERNEL
22431 #       define KERNEL
22432 #   endif
22433 #   include <sys/time.h>
22434 #   ifdef I_SYS_TIME_KERNEL
22435 #       undef KERNEL
22436 #   endif
22437 #endif
22438 #$i_sysselct I_SYS_SELECT
22439 #ifdef I_SYS_SELECT
22440 #include <sys/select.h>
22441 #endif
22442 #$d_socket HAS_SOCKET
22443 #ifdef HAS_SOCKET
22444 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
22445 #endif
22446 #include <stdio.h>
22447 #$i_stdlib I_STDLIB
22448 #ifdef I_STDLIB
22449 #include <stdlib.h>
22450 #endif
22451 $selecttype b;
22452 #define S sizeof(*(b))
22453 #define MINBITS 64
22454 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
22455 #define NBITS  (NBYTES * 8)
22456 int main() {
22457     char *s = (char *)malloc(NBYTES);
22458     struct timeval t;
22459     int i;
22460     FILE* fp;
22461     int fd;
22462
22463     if (!s)
22464         exit(1);
22465     fclose(stdin);
22466     fp = fopen("try.c", "r");
22467     if (fp == 0)
22468       exit(2);
22469     fd = fileno(fp);
22470     if (fd < 0)
22471       exit(3);
22472     b = ($selecttype)s;
22473     for (i = 0; i < NBITS; i++)
22474         FD_SET(i, b);
22475     t.tv_sec  = 0;
22476     t.tv_usec = 0;
22477     select(fd + 1, b, 0, 0, &t);
22478     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22479     free(s);
22480     printf("%d\n", i + 1);
22481     return 0;
22482 }
22483 EOCP
22484                 set try
22485                 if eval $compile_ok; then
22486                         selectminbits=`$run ./try 2>/dev/null`
22487                         case "$selectminbits" in
22488                         '')     cat >&4 <<EOM
22489 Cannot figure out on how many bits at a time your select() operates.
22490 I'll play safe and guess it is $safebits bits.
22491 EOM
22492                                 selectminbits=$safebits
22493                                 bits="$safebits bits"
22494                                 ;;
22495                         1)      bits="1 bit" ;;
22496                         *)      bits="$selectminbits bits" ;;
22497                         esac
22498                         echo "Your select() operates on $bits at a time." >&4
22499                 else
22500                         rp='What is the minimum number of bits your select() operates on?'
22501                         case "$byteorder" in
22502                         12345678)       dflt=64 ;;
22503                         1234)           dflt=32 ;;
22504                         *)              dflt=1  ;;
22505                         esac
22506                         . ./myread
22507                         val=$ans
22508                         selectminbits="$val"
22509                 fi
22510                 $rm_try
22511                 ;;
22512         *)      : no select, so pick a harmless default
22513                 selectminbits=$safebits
22514                 ;;
22515         esac
22516         ;;
22517 esac
22518
22519 : Trace out the files included by signal.h, then look for SIGxxx names.
22520 case "$sig_num_init" in
22521 '')
22522 if [ "X$fieldn" = X ]; then
22523         : Just make some guesses.  We check them later.
22524         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22525 else
22526         xxx=`echo '#include <signal.h>' |
22527         $cppstdin $cppminus $cppflags 2>/dev/null |
22528         $grep '^[       ]*#.*include' |
22529         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22530                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22531 fi
22532 xxxfiles=''
22533 for xx in $xxx /dev/null ; do
22534         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22535 done
22536 case "$xxxfiles" in
22537 '')     xxxfiles=`./findhdr signal.h` ;;
22538 esac
22539 xxx=`awk '
22540 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22541         print substr($2, 4, 20)
22542 }
22543 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22544         print substr($3, 4, 20)
22545 }' $xxxfiles`
22546 : Append some common names just in case the awk scan failed.
22547 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22548 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22549 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22550 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22551 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22552
22553 : generate a few handy files for later
22554 $cat > signal.c <<EOCP
22555 #include <sys/types.h>
22556 #include <signal.h>
22557 #$i_stdlib I_STDLIB
22558 #ifdef I_STDLIB
22559 #include <stdlib.h>
22560 #endif
22561 #include <stdio.h>
22562 int main() {
22563
22564 /* Strange style to avoid deeply-nested #if/#else/#endif */
22565 #ifndef NSIG
22566 #  ifdef _NSIG
22567 #    define NSIG (_NSIG)
22568 #  endif
22569 #endif
22570
22571 #ifndef NSIG
22572 #  ifdef SIGMAX
22573 #    define NSIG (SIGMAX+1)
22574 #  endif
22575 #endif
22576
22577 #ifndef NSIG
22578 #  ifdef SIG_MAX
22579 #    define NSIG (SIG_MAX+1)
22580 #  endif
22581 #endif
22582
22583 #ifndef NSIG
22584 #  ifdef _SIG_MAX
22585 #    define NSIG (_SIG_MAX+1)
22586 #  endif
22587 #endif
22588
22589 #ifndef NSIG
22590 #  ifdef MAXSIG
22591 #    define NSIG (MAXSIG+1)
22592 #  endif
22593 #endif
22594
22595 #ifndef NSIG
22596 #  ifdef MAX_SIG
22597 #    define NSIG (MAX_SIG+1)
22598 #  endif
22599 #endif
22600
22601 #ifndef NSIG
22602 #  ifdef SIGARRAYSIZE
22603 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22604 #  endif
22605 #endif
22606
22607 #ifndef NSIG
22608 #  ifdef _sys_nsig
22609 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22610 #  endif
22611 #endif
22612
22613 /* Default to some arbitrary number that's big enough to get most
22614    of the common signals.
22615 */
22616 #ifndef NSIG
22617 #    define NSIG 50
22618 #endif
22619
22620 printf("NSIG %d\n", NSIG);
22621
22622 #ifndef JUST_NSIG
22623
22624 EOCP
22625
22626 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22627 {
22628         printf "#ifdef SIG"; printf $1; printf "\n"
22629         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22630         printf $1; printf ");\n"
22631         printf "#endif\n"
22632 }
22633 END {
22634         printf "#endif /* JUST_NSIG */\n";
22635         printf "exit(0);\n}\n";
22636 }
22637 ' >>signal.c
22638 $cat >signal.awk <<'EOP'
22639 BEGIN { ndups = 0 }
22640 $1 ~ /^NSIG$/ { nsig = $2 }
22641 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22642     if ($2 > maxsig) { maxsig = $2 }
22643     if (sig_name[$2]) {
22644         dup_name[ndups] = $1
22645         dup_num[ndups] = $2
22646         ndups++
22647     }
22648     else {
22649         sig_name[$2] = $1
22650         sig_num[$2] = $2
22651     }
22652 }
22653 END {
22654     if (nsig == 0) {
22655         nsig = maxsig + 1
22656     }
22657     printf("NSIG %d\n", nsig);
22658     for (n = 1; n < nsig; n++) {
22659         if (sig_name[n]) {
22660             printf("%s %d\n", sig_name[n], sig_num[n])
22661         }
22662         else {
22663             printf("NUM%d %d\n", n, n)
22664         }
22665     }
22666     for (n = 0; n < ndups; n++) {
22667         printf("%s %d\n", dup_name[n], dup_num[n])
22668     }
22669 }
22670 EOP
22671 $cat >signal_cmd <<EOS
22672 $startsh
22673 if $test -s signal.lst; then
22674     echo "Using your existing signal.lst file"
22675         exit 0
22676 fi
22677 xxx="$xxx"
22678 EOS
22679 $cat >>signal_cmd <<'EOS'
22680
22681 set signal
22682 if eval $compile_ok; then
22683         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22684                 $uniq | $awk -f signal.awk >signal.lst
22685 else
22686         echo "(I can't seem be able to compile the whole test program)" >&4
22687         echo "(I'll try it in little pieces.)" >&4
22688         set signal -DJUST_NSIG
22689         if eval $compile_ok; then
22690                 $run ./signal$_exe > signal.nsg
22691                 $cat signal.nsg
22692         else
22693                 echo "I can't seem to figure out how many signals you have." >&4
22694                 echo "Guessing 50." >&4
22695                 echo 'NSIG 50' > signal.nsg
22696         fi
22697         : Now look at all the signal names, one at a time.
22698         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22699                 $cat > signal.c <<EOCP
22700 #include <sys/types.h>
22701 #include <signal.h>
22702 #include <stdio.h>
22703 int main() {
22704 printf("$xx %d\n", SIG${xx});
22705 return 0;
22706 }
22707 EOCP
22708                 set signal
22709                 if eval $compile; then
22710                         echo "SIG${xx} found."
22711                         $run ./signal$_exe  >> signal.ls1
22712                 else
22713                         echo "SIG${xx} NOT found."
22714                 fi
22715         done
22716         if $test -s signal.ls1; then
22717                 $cat signal.nsg signal.ls1 |
22718                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22719         fi
22720
22721 fi
22722 if $test -s signal.lst; then
22723         :
22724 else
22725         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22726         echo 'kill -l' >signal
22727         set X `csh -f <signal`
22728         $rm -f signal
22729         shift
22730         case $# in
22731         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22732         esac
22733         echo $@ | $tr ' ' $trnl | \
22734             $awk '{ printf "%s %d\n", $1, ++s; }
22735                   END { printf "NSIG %d\n", ++s }' >signal.lst
22736 fi
22737 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22738 EOS
22739 chmod a+x signal_cmd
22740 $eunicefix signal_cmd
22741 ;;
22742 esac
22743
22744 : generate list of signal names
22745 case "$sig_num_init" in
22746 '')
22747 echo " "
22748 case "$sig_name_init" in
22749 '') doinit=yes ;;
22750 *)  case "$sig_num_init" in
22751     ''|*,*) doinit=yes ;;
22752     esac ;;
22753 esac
22754 case "$doinit" in
22755 yes)
22756         echo "Generating a list of signal names and numbers..." >&4
22757         . ./signal_cmd
22758         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22759         sig_name=`$awk 'BEGIN { printf "ZERO " }
22760                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22761         sig_num=`$awk  'BEGIN { printf "0 " }
22762                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22763         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22764                              !/^NSIG/   { printf "\"%s\", ", $1 }
22765                              END        { printf "0\n" }' signal.lst`
22766         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22767                              !/^NSIG/   { printf "%d, ", $2}
22768                              END        { printf "0\n"}' signal.lst`
22769         ;;
22770 esac
22771 echo "The following $sig_count signals are available:"
22772 echo " "
22773 echo $sig_name | $awk \
22774 'BEGIN { linelen = 0 }
22775 {
22776         for (i = 1; i <= NF; i++) {
22777                 name = "SIG" $i " "
22778                 linelen = linelen + length(name)
22779                 if (linelen > 70) {
22780                         printf "\n"
22781                         linelen = length(name)
22782                 }
22783                 printf "%s", name
22784         }
22785         printf "\n"
22786 }'
22787 sig_size=`echo $sig_name | awk '{print NF}'`
22788 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22789 ;;
22790 esac
22791
22792 : Check size of size
22793 echo " "
22794 case "$sizetype" in
22795 *_t) zzz="$sizetype"    ;;
22796 *)   zzz="filesize"     ;;
22797 esac
22798 echo "Checking the size of $zzz..." >&4
22799 cat > try.c <<EOCP
22800 #include <sys/types.h>
22801 #include <stdio.h>
22802 #$i_stdlib I_STDLIB
22803 #ifdef I_STDLIB
22804 #include <stdlib.h>
22805 #endif
22806 int main() {
22807     printf("%d\n", (int)sizeof($sizetype));
22808     exit(0);
22809 }
22810 EOCP
22811 set try
22812 if eval $compile_ok; then
22813         yyy=`$run ./try`
22814         case "$yyy" in
22815         '')     sizesize=4
22816                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22817                 ;;
22818         *)      sizesize=$yyy
22819                 echo "Your $zzz size is $sizesize bytes."
22820                 ;;
22821         esac
22822 else
22823         sizesize=4
22824         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22825 fi
22826
22827 : check for socklen_t
22828 echo " "
22829 echo "Checking to see if you have socklen_t..." >&4
22830 $cat >try.c <<EOCP
22831 #include <sys/types.h>
22832 #$d_socket HAS_SOCKET
22833 #ifdef HAS_SOCKET
22834 #include <sys/socket.h>
22835 #endif
22836 int main() { socklen_t x = 16; }
22837 EOCP
22838 set try
22839 if eval $compile; then
22840         val="$define"
22841         echo "You have socklen_t."
22842 else
22843         val="$undef"
22844         echo "You do not have socklen_t."
22845         case "$sizetype" in
22846         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22847         esac
22848 fi
22849 $rm_try
22850 set d_socklen_t
22851 eval $setvar
22852
22853 : see if this is a socks.h system
22854 set socks.h i_socks
22855 eval $inhdr
22856
22857 : check for type of the size argument to socket calls
22858 case "$d_socket" in
22859 "$define")
22860         $cat <<EOM
22861
22862 Checking to see what type is the last argument of accept().
22863 EOM
22864         yyy=''
22865         case "$d_socklen_t" in
22866         "$define") yyy="$yyy socklen_t"
22867         esac
22868         yyy="$yyy $sizetype int long unsigned"
22869         for xxx in $yyy; do
22870                 case "$socksizetype" in
22871                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22872                         case "$usesocks" in
22873                         "$define")
22874                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22875                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22876                                         socksizetype="$xxx"
22877                                 fi
22878                                 ;;
22879                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22880                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22881                                         socksizetype="$xxx"
22882                                 fi
22883                                 ;;
22884                         esac
22885                         ;;
22886                 esac
22887         done
22888 : In case none of those worked, prompt the user.
22889         case "$socksizetype" in
22890         '')     rp='What is the type for socket address structure sizes?'
22891                 dflt='int'
22892                 . ./myread
22893                 socksizetype=$ans
22894                 ;;
22895         esac
22896         ;;
22897 *)      : no sockets, so pick relatively harmless default
22898         socksizetype='int'
22899         ;;
22900 esac
22901
22902 : see what type is used for signed size_t
22903 set ssize_t ssizetype int stdio.h sys/types.h
22904 eval $typedef
22905 dflt="$ssizetype"
22906 $cat > try.c <<EOM
22907 #include <stdio.h>
22908 #$i_stdlib I_STDLIB
22909 #ifdef I_STDLIB
22910 #include <stdlib.h>
22911 #endif
22912 #include <sys/types.h>
22913 #define Size_t $sizetype
22914 #define SSize_t $dflt
22915 int main()
22916 {
22917         if (sizeof(Size_t) == sizeof(SSize_t))
22918                 printf("$dflt\n");
22919         else if (sizeof(Size_t) == sizeof(int))
22920                 printf("int\n");
22921         else
22922                 printf("long\n");
22923         exit(0);
22924 }
22925 EOM
22926 echo " "
22927 set try
22928 if eval $compile_ok && $run ./try > /dev/null; then
22929         ssizetype=`$run ./try`
22930         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22931 else
22932         $cat >&4 <<EOM
22933 Help! I can't compile and run the ssize_t test program: please enlighten me!
22934 (This is probably a misconfiguration in your system or libraries, and
22935 you really ought to fix it.  Still, I'll try anyway.)
22936
22937 I need a type that is the same size as $sizetype, but is guaranteed to
22938 be signed.  Common values are ssize_t, int and long.
22939
22940 EOM
22941         rp="What signed type is the same size as $sizetype?"
22942         . ./myread
22943         ssizetype="$ans"
22944 fi
22945 $rm_try
22946
22947 : Check the size of st_dev
22948 $echo " "
22949 $echo "Checking the size of st_dev..." >&4
22950 $cat > try.c <<EOCP
22951 #include <sys/stat.h>
22952 #include <stdio.h>
22953 #$i_stdlib I_STDLIB
22954 #ifdef I_STDLIB
22955 #include <stdlib.h>
22956 #endif
22957 int main() {
22958     struct stat st;
22959     printf("%d\n", (int)sizeof(st.st_dev));
22960     exit(0);
22961 }
22962 EOCP
22963 set try
22964 if eval $compile_ok; then
22965         val=`$run ./try`
22966         case "$val" in
22967         '')     st_dev_size=4
22968                 $echo "(I can't execute the test program--guessing $st_dev_size.)" >&4
22969                 ;;
22970         *)      st_dev_size=$val
22971                 $echo "Your st_dev is $st_dev_size bytes long."
22972                 ;;
22973         esac
22974 else
22975         st_dev_size=4
22976         $echo "(I can't compile the test program--guessing $st_dev_size.)" >&4
22977 fi
22978 $rm_try
22979
22980 : Check if st_dev is signed
22981 $echo " "
22982 $echo "Checking the sign of st_dev..." >&4
22983 $cat > try.c <<EOCP
22984 #include <sys/stat.h>
22985 #include <stdio.h>
22986 int main() {
22987         struct stat foo;
22988         foo.st_dev = -1;
22989         if (foo.st_dev < 0)
22990                 printf("-1\n");
22991         else
22992                 printf("1\n");
22993 }
22994 EOCP
22995 set try
22996 if eval $compile; then
22997         val=`$run ./try`
22998         case "$val" in
22999         '')     st_dev_sign=1
23000                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
23001                 ;;
23002         *)      st_dev_sign=$val
23003                 case "$st_dev_sign" in
23004                  1) $echo "Your st_dev is unsigned." ;;
23005                 -1) $echo "Your st_dev is signed."   ;;
23006                 esac
23007                 ;;
23008         esac
23009 else
23010         st_dev_sign=1
23011         $echo "(I can't compile the test program--guessing unsigned.)" >&4
23012 fi
23013 $rm_try
23014
23015 : Check the size of st_ino
23016 $echo " "
23017 $echo "Checking the size of st_ino..." >&4
23018 $cat > try.c <<EOCP
23019 #include <sys/stat.h>
23020 #include <stdio.h>
23021 #$i_stdlib I_STDLIB
23022 #ifdef I_STDLIB
23023 #include <stdlib.h>
23024 #endif
23025 int main() {
23026     struct stat st;
23027     printf("%d\n", (int)sizeof(st.st_ino));
23028     exit(0);
23029 }
23030 EOCP
23031 set try
23032 if eval $compile_ok; then
23033         val=`$run ./try`
23034         case "$val" in
23035         '')     st_ino_size=4
23036                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
23037                 ;;
23038         *)      st_ino_size=$val
23039                 $echo "Your st_ino is $st_ino_size bytes long."
23040                 ;;
23041         esac
23042 else
23043         st_ino_size=4
23044         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
23045 fi
23046 $rm_try
23047
23048 : Check if st_ino is signed
23049 $echo " "
23050 $echo "Checking the sign of st_ino..." >&4
23051 $cat > try.c <<EOCP
23052 #include <sys/stat.h>
23053 #include <stdio.h>
23054 int main() {
23055         struct stat foo;
23056         foo.st_ino = -1;
23057         if (foo.st_ino < 0)
23058                 printf("-1\n");
23059         else
23060                 printf("1\n");
23061 }
23062 EOCP
23063 set try
23064 if eval $compile; then
23065         val=`$run ./try`
23066         case "$val" in
23067         '')     st_ino_sign=1
23068                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
23069                 ;;
23070         *)      st_ino_sign=$val
23071                 case "$st_ino_sign" in
23072                  1) $echo "Your st_ino is unsigned." ;;
23073                 -1) $echo "Your st_ino is signed."   ;;
23074                 esac
23075                 ;;
23076         esac
23077 else
23078         st_ino_sign=1
23079         $echo "(I can't compile the test program--guessing unsigned.)" >&4
23080 fi
23081 $rm_try
23082
23083 : see what type of char stdio uses.
23084 echo " "
23085 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
23086 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
23087         echo "Your stdio uses unsigned chars." >&4
23088         stdchar="unsigned char"
23089 else
23090         echo "Your stdio uses signed chars." >&4
23091         stdchar="char"
23092 fi
23093 $rm -f stdioh
23094
23095 : Check size of UID
23096 echo " "
23097 case "$uidtype" in
23098 *_t) zzz="$uidtype"     ;;
23099 *)   zzz="uid"          ;;
23100 esac
23101 echo "Checking the size of $zzz..." >&4
23102 cat > try.c <<EOCP
23103 #include <sys/types.h>
23104 #include <stdio.h>
23105 #$i_stdlib I_STDLIB
23106 #ifdef I_STDLIB
23107 #include <stdlib.h>
23108 #endif
23109 int main() {
23110     printf("%d\n", (int)sizeof($uidtype));
23111     exit(0);
23112 }
23113 EOCP
23114 set try
23115 if eval $compile_ok; then
23116         yyy=`$run ./try`
23117         case "$yyy" in
23118         '')     uidsize=4
23119                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
23120                 ;;
23121         *)      uidsize=$yyy
23122                 echo "Your $zzz is $uidsize bytes long."
23123                 ;;
23124         esac
23125 else
23126         uidsize=4
23127         echo "(I can't compile the test program--guessing $uidsize.)" >&4
23128 fi
23129
23130 : Check if UID is signed
23131 echo " "
23132 case "$uidtype" in
23133 *_t) zzz="$uidtype"     ;;
23134 *)   zzz="uid"          ;;
23135 esac
23136 echo "Checking the sign of $zzz..." >&4
23137 cat > try.c <<EOCP
23138 #include <sys/types.h>
23139 #include <stdio.h>
23140 int main() {
23141         $uidtype foo = -1;
23142         if (foo < 0)
23143                 printf("-1\n");
23144         else
23145                 printf("1\n");
23146 }
23147 EOCP
23148 set try
23149 if eval $compile; then
23150         yyy=`$run ./try`
23151         case "$yyy" in
23152         '')     uidsign=1
23153                 echo "(I can't execute the test program--guessing unsigned.)" >&4
23154                 ;;
23155         *)      uidsign=$yyy
23156                 case "$uidsign" in
23157                  1) echo "Your $zzz is unsigned." ;;
23158                 -1) echo "Your $zzz is signed."   ;;
23159                 esac
23160                 ;;
23161         esac
23162 else
23163         uidsign=1
23164         echo "(I can't compile the test program--guessing unsigned.)" >&4
23165 fi
23166
23167 : Check format string for UID
23168 echo " "
23169 $echo "Checking the format string to be used for uids..." >&4
23170
23171 case "$uidsign" in
23172 -1)     if $test X"$uidsize" = X"$ivsize"; then
23173                 uidformat="$ivdformat"
23174         else
23175                 if $test X"$uidsize" = X"$longsize"; then
23176                         uidformat='"ld"'
23177                 else
23178                         if $test X"$uidsize" = X"$intsize"; then
23179                                 uidformat='"d"'
23180                         else
23181                                 if $test X"$uidsize" = X"$shortsize"; then
23182                                         uidformat='"hd"'
23183                                 fi
23184                         fi
23185                 fi
23186         fi
23187         ;;
23188 *)      if $test X"$uidsize" = X"$uvsize"; then
23189                 uidformat="$uvuformat"
23190         else
23191                 if $test X"$uidsize" = X"$longsize"; then
23192                         uidformat='"lu"'
23193                 else
23194                         if $test X"$uidsize" = X"$intsize"; then
23195                                 uidformat='"u"'
23196                         else
23197                                 if $test X"$uidsize" = X"$shortsize"; then
23198                                         uidformat='"hu"'
23199                                 fi
23200                         fi
23201                 fi
23202         fi
23203         ;;
23204 esac
23205
23206 : Ask about strict by default.
23207 case "$usedefaultstrict" in
23208     $define|true|[Yy]*)
23209        dflt="y"
23210        ;;
23211     *)
23212        dflt="n"
23213        ;;
23214     esac
23215
23216 cat <<EOM
23217
23218 EXPERIMENTAL: Perl can now be built with strict on by default when not
23219 invoked with -e or -E. This is a diagnostic tool for development.
23220
23221 Unless you are familiar with this feature, you should probably answer 'no'.
23222
23223 EOM
23224
23225 rp='Would you like to build perl with strict enabled by default?'
23226 . ./myread
23227 case "$ans" in
23228 y|Y) val="$define" ;;
23229 *)   val="$undef"  ;;
23230 esac
23231 set usedefaultstrict
23232 eval $setvar
23233
23234 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
23235 echo " "
23236 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
23237 $cat >try.c <<'EOM'
23238 /* Intentionally a long probe as I'd like to sanity check that the exact
23239    approach is going to work, as thinking it will work, but only having it
23240    part working at runtime is worse than not having it.  */
23241
23242 #include <sys/types.h>
23243 #include <sys/sysctl.h>
23244 #include <sys/param.h>
23245 #include <stdio.h>
23246 #include <string.h>
23247 #include <stdlib.h>
23248 #include <unistd.h>
23249
23250 int
23251 main(int argc, char **argv) {
23252     char *buffer;
23253     char *argv_leaf = strrchr(argv[0], '/');
23254     char *buffer_leaf;
23255     size_t size = 0;
23256     int mib[4];
23257
23258     mib[0] = CTL_KERN;
23259     mib[1] = KERN_PROC;
23260     mib[2] = KERN_PROC_PATHNAME;
23261     mib[3] = -1;
23262
23263     if (!argv_leaf) {
23264         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23265         return 1;
23266     }
23267
23268     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
23269         perror("sysctl");
23270         return 2;
23271     }
23272
23273     if (size < strlen(argv_leaf) + 1) {
23274         fprintf(stderr, "size %lu is too short for a path\n",
23275                 (unsigned long) size);
23276         return 3;
23277     }
23278
23279     if (size > MAXPATHLEN * MAXPATHLEN) {
23280         fprintf(stderr, "size %lu is too long for a path\n",
23281                 (unsigned long) size);
23282         return 4;
23283     }
23284
23285     buffer = (char *)malloc(size);
23286     if (!buffer) {
23287         perror("malloc");
23288         return 5;
23289     }
23290
23291     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
23292         perror("sysctl");
23293         return 6;
23294     }
23295
23296     if (strlen(buffer) + 1 != size) {
23297         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
23298                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
23299         return 7;
23300     }
23301
23302
23303     if (*buffer != '/') {
23304         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
23305         return 8;
23306     }
23307
23308     if (strstr(buffer, "/./")) {
23309         fprintf(stderr, "Contains /./: '%s'\n", buffer);
23310         return 9;
23311     }
23312
23313     if (strstr(buffer, "/../")) {
23314         fprintf(stderr, "Contains /../: '%s'\n", buffer);
23315         return 10;
23316     }
23317
23318     buffer_leaf = strrchr(buffer, '/');
23319     if (strcmp(buffer_leaf, argv_leaf) != 0) {
23320         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
23321         return 11;
23322     }
23323
23324     free(buffer);
23325
23326     return 0;
23327 }
23328 EOM
23329
23330 val=$undef
23331 set try
23332 if eval $compile; then
23333         if $run ./try; then
23334                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
23335                 val="$define"
23336         else
23337                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
23338                 val="$undef"
23339         fi
23340 else
23341         echo "I'm unable to compile the test program." >&4
23342         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
23343         val="$undef"
23344 fi
23345 $rm_try
23346 set usekernprocpathname
23347 eval $setvar
23348
23349 : Determine if we can use _NSGetExecutablePath to find executing program
23350 echo " "
23351 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
23352 $cat >try.c <<'EOM'
23353 /* Intentionally a long probe as I'd like to sanity check that the exact
23354    approach is going to work, as thinking it will work, but only having it
23355    part working at runtime is worse than not having it.  */
23356 #include <mach-o/dyld.h>
23357 #include <stdio.h>
23358 #include <stdlib.h>
23359 #include <sys/param.h>
23360 #include <string.h>
23361
23362 int
23363 main(int argc, char **argv) {
23364     char buf[1];
23365     uint32_t size = sizeof(buf);
23366     int result;
23367     char *buffer;
23368     char *tidied;
23369     char *argv_leaf = strrchr(argv[0], '/');
23370     char *tidied_leaf;
23371
23372     if (!argv_leaf) {
23373         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
23374         return 1;
23375     }
23376
23377     _NSGetExecutablePath(buf, &size);
23378     if (size > MAXPATHLEN * MAXPATHLEN) {
23379         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
23380                 (unsigned int) size);
23381         return 2;
23382     }
23383
23384     buffer = (char *)malloc(size);
23385     if (!buffer) {
23386         perror("malloc");
23387         return 3;
23388     }
23389
23390     result = _NSGetExecutablePath(buffer, &size);
23391     if (result != 0) {
23392         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
23393                 result, (unsigned int) size);
23394         return 4;
23395     }
23396
23397     tidied = realpath(buffer, NULL);
23398     if (!tidied) {
23399         perror("realpath");
23400         return 5;
23401     }
23402
23403     free(buffer);
23404
23405     if (*tidied != '/') {
23406         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
23407         return 6;
23408     }
23409
23410     if (strstr(tidied, "/./")) {
23411         fprintf(stderr, "Contains /./: '%s'\n", tidied);
23412         return 7;
23413     }
23414
23415     if (strstr(tidied, "/../")) {
23416         fprintf(stderr, "Contains /../: '%s'\n", tidied);
23417         return 8;
23418     }
23419
23420     tidied_leaf = strrchr(tidied, '/');
23421     if (strcmp(tidied_leaf, argv_leaf) != 0) {
23422         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
23423         return 9;
23424     }
23425
23426     free(tidied);
23427
23428     return 0;
23429 }
23430 EOM
23431
23432 val=$undef
23433 set try
23434 if eval $compile; then
23435         if $run ./try; then
23436                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
23437                 val="$define"
23438         else
23439                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
23440         fi
23441 else
23442         echo "I'm unable to compile the test program." >&4
23443         echo "I'll assume no _NSGetExecutablePath here." >&4
23444 fi
23445 $rm_try
23446 set usensgetexecutablepath
23447 eval $setvar
23448
23449 : Check if site customization support was requested
23450 case "$usesitecustomize" in
23451     $define|true|[Yy]*)
23452         usesitecustomize="$define"
23453         ;;
23454     *)
23455         usesitecustomize="$undef"
23456         ;;
23457     esac
23458
23459 : determine compiler compiler
23460 case "$yacc" in
23461 '')
23462         dflt=yacc;;
23463 *)
23464         dflt="$yacc";;
23465 esac
23466 echo " "
23467 comp='yacc'
23468 if $test -f "$byacc$_exe"; then
23469         dflt="$byacc"
23470         comp="byacc or $comp"
23471 fi
23472 if $test -f "$bison$_exe"; then
23473         comp="$comp or bison -y"
23474 fi
23475 rp="Which compiler compiler ($comp) shall I use?"
23476 . ./myread
23477 yacc="$ans"
23478 case "$yacc" in
23479 *bis*)
23480         case "$yacc" in
23481         *-y*) ;;
23482         *)
23483                 yacc="$yacc -y"
23484                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
23485                 ;;
23486         esac
23487         ;;
23488 esac
23489
23490 : see if this is a bfd.h system
23491 set bfd.h i_bfd
23492 eval $inhdr
23493
23494 : see if this is an execinfo.h system
23495 set execinfo.h i_execinfo
23496 eval $inhdr
23497
23498 : see if this is a fenv.h system
23499 set fenv.h i_fenv
23500 eval $inhdr
23501
23502 : see if this is a fp.h system
23503 set fp.h i_fp
23504 eval $inhdr
23505
23506 : see if this is a fp_class.h system
23507 set fp_class.h i_fp_class
23508 eval $inhdr
23509
23510 : see if gdbm.h is available
23511 set gdbm.h t_gdbm
23512 eval $inhdr
23513 case "$t_gdbm" in
23514 $define)
23515         : see if gdbm_open exists
23516         set gdbm_open d_gdbm_open
23517         eval $inlibc
23518         case "$d_gdbm_open" in
23519         $undef)
23520                 t_gdbm="$undef"
23521                 echo "We won't be including <gdbm.h>"
23522                 ;;
23523         esac
23524         ;;
23525 esac
23526 val="$t_gdbm"
23527 set i_gdbm
23528 eval $setvar
23529
23530 : see if this is a ieeefp.h system
23531 case "$i_ieeefp" in
23532 '' ) set ieeefp.h i_ieeefp
23533      eval $inhdr
23534      ;;
23535 esac
23536
23537 : see if this is a libutil.h system
23538 set libutil.h i_libutil
23539 eval $inhdr
23540
23541 : see if mach cthreads are available
23542 if test "X$usethreads" = "X$define"; then
23543         set mach/cthreads.h i_machcthr
23544         eval $inhdr
23545 else
23546         i_machcthr="$undef"
23547 fi
23548
23549 : see if this is a mntent.h system
23550 set mntent.h i_mntent
23551 eval $inhdr
23552
23553 : see if net/errno.h is available
23554 val=''
23555 set net/errno.h val
23556 eval $inhdr
23557
23558 : Unfortunately, it causes problems on some systems.  Arrgh.
23559 case "$val" in
23560 $define)
23561         cat > try.c <<'EOM'
23562 #include <stdio.h>
23563 #include <errno.h>
23564 #include <net/errno.h>
23565 int func()
23566 {
23567         return ENOTSOCK;
23568 }
23569 EOM
23570         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23571                 echo "We'll be including <net/errno.h>." >&4
23572         else
23573                 echo "We won't be including <net/errno.h>." >&4
23574                 val="$undef"
23575         fi
23576         $rm_try
23577         ;;
23578 esac
23579 set i_neterrno
23580 eval $setvar
23581
23582 : see if netinet/tcp.h is available
23583 set netinet/tcp.h i_netinettcp
23584 eval $inhdr
23585
23586 : see if this is a poll.h system
23587 set poll.h i_poll
23588 eval $inhdr
23589
23590 : see if this is a prot.h system
23591 set prot.h i_prot
23592 eval $inhdr
23593
23594 : Preprocessor symbols
23595 echo " "
23596 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23597 $cat <<'EOSH' > Cppsym.know
23598 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23599 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23600 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23601 arch_pwr ardent ARM ARM32 atarist att386 att3b
23602 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23603 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23604 byteorder byte_order
23605 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23606 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23607 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23608 ELF encore EPI EXTENSIONS
23609 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23610 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23611 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23612 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23613 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
23614 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23615 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23616 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23617 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23618 ksr1
23619 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23620 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23621 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23622 luna88k Lynx
23623 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23624 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23625 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23626 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23627 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23628 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23629 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23630 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23631 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23632 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23633 ns32000 ns32016 ns32332 ns32k nsc32000
23634 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23635 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23636 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23637 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23638 QK_USER QNX
23639 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23640 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23641 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23642 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23643 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23644 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23645 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23646 SYSV4 SYSV5 sysV68 sysV88
23647 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23648 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23649 tower32_800 tower32_850 tss
23650 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23651 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23652 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23653 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23654 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23655 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23656 uxpm uxps
23657 vax venix VMESA vms
23658 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23659 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23660 z8000 zarch
23661 EOSH
23662 # Maybe put other stuff here too.
23663 ./tr '-' '_' <<EOSH >>Cppsym.know
23664 $osname
23665 EOSH
23666 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23667 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23668 $cat Cppsym.know > Cppsym.c
23669 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23670 $rm -f Cppsym.a Cppsym.b Cppsym.c
23671 cat <<EOSH > Cppsym
23672 $startsh
23673 if $test \$# -gt 0; then
23674     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23675     if $test -s Cppsym.got; then
23676         $rm -f Cppsym.got
23677         exit 0
23678     fi
23679     $rm -f Cppsym.got
23680     exit 1
23681 else
23682     $tr " " "$trnl" | ./Cppsym.try
23683     exit 0
23684 fi
23685 EOSH
23686 chmod +x Cppsym
23687 $eunicefix Cppsym
23688 cat <<EOSH > Cppsym.try
23689 $startsh
23690 cat <<'EOCP' > try.c
23691 #include <stdio.h>
23692 #if cpp_stuff == 1
23693 #define STRINGIFY(a)    "a"
23694 #endif
23695 #if cpp_stuff == 42
23696 #define StGiFy(a)  #a
23697 #define STRINGIFY(a)    StGiFy(a)
23698 #endif
23699 #if $cpp_stuff != 1 && $cpp_stuff != 42
23700 #   include "Bletch: How does this C preprocessor stringify macros?"
23701 #endif
23702 int main() {
23703 EOCP
23704 $awk \\
23705 EOSH
23706 cat <<'EOSH' >> Cppsym.try
23707 'length($1) > 0 {
23708     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23709     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23710     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23711     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23712 }' >> try.c
23713 echo 'return 0;}' >> try.c
23714 EOSH
23715 cat <<EOSH >> Cppsym.try
23716 ccflags="$ccflags"
23717 case "$osname-$gccversion" in
23718 irix-) ccflags="\$ccflags -woff 1178" ;;
23719 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23720 esac
23721 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23722 EOSH
23723 chmod +x Cppsym.try
23724 $eunicefix Cppsym.try
23725 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23726 : Add in any Linux cpp "predefined macros":
23727 case "$osname::$gccversion" in
23728   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23729     tHdrH=_tmpHdr
23730     rm -f $tHdrH'.h' $tHdrH
23731     touch $tHdrH'.h'
23732     # Filter out macro arguments, such as Linux's __INT8_C(c)
23733     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23734        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23735        if [ -s $tHdrH'_cppsym.real' ]; then
23736           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23737        fi
23738     fi
23739     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23740   ;;
23741 esac
23742 : now check the C compiler for additional symbols
23743 postprocess_cc_v=''
23744 case "$osname" in
23745 aix) postprocess_cc_v="|$tr , ' '" ;;
23746 esac
23747 $cat >ccsym <<EOS
23748 $startsh
23749 $cat >tmp.c <<EOF
23750 extern int foo;
23751 EOF
23752 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23753 do
23754         case "\$i" in
23755         -D*) echo "\$i" | $sed 's/^-D//;s/['\''\"]//g';;
23756         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23757         esac
23758 done
23759 $rm_try
23760 EOS
23761 postprocess_cc_v=''
23762 chmod +x ccsym
23763 $eunicefix ccsym
23764 ./ccsym > ccsym1.raw
23765 if $test -s ccsym1.raw; then
23766     $sort ccsym1.raw | $uniq >ccsym.raw
23767 else
23768     mv ccsym1.raw ccsym.raw
23769 fi
23770
23771 $awk '/\=/ { print $0; next }
23772         { print $0"=1" }' ccsym.raw >ccsym.list
23773 $comm -13 Cppsym.true ccsym.list >ccsym.own
23774 $comm -12 Cppsym.true ccsym.list >ccsym.com
23775 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23776 also=''
23777 if $test -z ccsym.raw; then
23778         echo "Your C compiler doesn't seem to define any symbols!" >&4
23779         echo " "
23780         echo "However, your C preprocessor defines the following symbols:"
23781         $cat Cppsym.true
23782         ccsymbols=''
23783         cppsymbols=`$cat Cppsym.true`
23784         cppsymbols=`echo $cppsymbols`
23785         cppccsymbols="$cppsymbols"
23786 else
23787         if $test -s ccsym.com; then
23788                 echo "Your C compiler and pre-processor define these symbols:"
23789                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23790                 also='also '
23791                 symbols='ones'
23792                 cppccsymbols=`$cat ccsym.com`
23793                 cppccsymbols=`echo $cppccsymbols`
23794                 $test "$silent" || sleep 1
23795         fi
23796         if $test -s ccsym.cpp; then
23797                 $test "$also" && echo " "
23798                 echo "Your C pre-processor ${also}defines the following symbols:"
23799                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23800                 also='further '
23801                 cppsymbols=`$cat ccsym.cpp`
23802                 cppsymbols=`echo $cppsymbols`
23803                 $test "$silent" || sleep 1
23804         fi
23805         if $test -s ccsym.own; then
23806                 $test "$also" && echo " "
23807                 echo "Your C compiler ${also}defines the following cpp symbols:"
23808                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23809                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23810                 ccsymbols=`$cat ccsym.own`
23811                 ccsymbols=`echo $ccsymbols`
23812                 $test "$silent" || sleep 1
23813         fi
23814 fi
23815
23816 : add -D_FORTIFY_SOURCE if feasible and not already there
23817 case "$gccversion" in
23818 [456789].*|[1-9][0-9]*) case "$optimize$ccflags" in
23819         *-O*)   case "$ccflags$cppsymbols" in
23820                 *_FORTIFY_SOURCE=*) # Don't add it again.
23821                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23822                         ;;
23823                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23824                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23825                         ;;
23826                 esac
23827                 ;;
23828         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23829                 ;;
23830         esac
23831         ;;
23832 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23833         ;;
23834 esac
23835
23836 : script used to emit important warnings
23837 cat >warn <<EOS
23838 $startsh
23839 if test \$# -gt 0; then
23840         echo "\$@" >msg
23841 else
23842         cat >msg
23843 fi
23844 echo "*** WARNING:" >&4
23845 sed -e 's/^/*** /' <msg >&4
23846 echo "*** " >&4
23847 cat msg >>config.msg
23848 echo " " >>config.msg
23849 rm -f msg
23850 EOS
23851 chmod +x warn
23852 $eunicefix warn
23853
23854 : see if this is a termio system
23855 val="$undef"
23856 val2="$undef"
23857 val3="$undef"
23858 if $test `./findhdr termios.h`; then
23859     set tcsetattr i_termios
23860     eval $inlibc
23861     val3="$i_termios"
23862 fi
23863 echo " "
23864 case "$val3" in
23865     "$define") echo "You have POSIX termios.h... good!" >&4;;
23866     *)  if ./Cppsym pyr; then
23867             case "`$run /bin/universe`" in
23868                 ucb) if $test `./findhdr sgtty.h`; then
23869                         val2="$define"
23870                         echo "<sgtty.h> found." >&4
23871                     else
23872                         echo "System is pyramid with BSD universe."
23873                         ./warn "<sgtty.h> not found--you could have problems."
23874                     fi;;
23875                 *)  if $test `./findhdr termio.h`; then
23876                         val="$define"
23877                         echo "<termio.h> found." >&4
23878                     else
23879                         echo "System is pyramid with USG universe."
23880                         ./warn "<termio.h> not found--you could have problems."
23881                     fi;;
23882             esac
23883         elif ./usg; then
23884             if $test `./findhdr termio.h`; then
23885                 echo "<termio.h> found." >&4
23886                 val="$define"
23887             elif $test `./findhdr sgtty.h`; then
23888                 echo "<sgtty.h> found." >&4
23889                 val2="$define"
23890             else
23891                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23892             fi
23893         else
23894             if $test `./findhdr sgtty.h`; then
23895                 echo "<sgtty.h> found." >&4
23896                 val2="$define"
23897             elif $test `./findhdr termio.h`; then
23898                 echo "<termio.h> found." >&4
23899                 val="$define"
23900             else
23901                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23902             fi
23903         fi;;
23904 esac
23905 set i_termio; eval $setvar
23906 val=$val2; set i_sgtty; eval $setvar
23907 val=$val3; set i_termios; eval $setvar
23908
23909 : see if stdbool is available
23910 : we want a real compile instead of Inhdr because some Solaris systems
23911 : have stdbool.h, but it can only be used if the compiler indicates it
23912 : is sufficiently c99-compliant.
23913 echo " "
23914 $cat >try.c <<EOCP
23915 #include <stdio.h>
23916 #include <stdbool.h>
23917 int func(bool x)
23918 {
23919     return x ? 1 : 0;
23920 }
23921 int main(int argc, char **argv)
23922 {
23923     return func(0);
23924 }
23925 EOCP
23926 set try
23927 if eval $compile; then
23928         echo "<stdbool.h> found." >&4
23929         val="$define"
23930 else
23931         echo "<stdbool.h> NOT found." >&4
23932         val="$undef"
23933 fi
23934 $rm_try
23935 set i_stdbool
23936 eval $setvar
23937
23938 : see if stdint is available
23939 set stdint.h i_stdint
23940 eval $inhdr
23941
23942 : see if sys/access.h is available
23943 set sys/access.h i_sysaccess
23944 eval $inhdr
23945
23946 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23947 set sys/filio.h i_sysfilio
23948 eval $inhdr
23949 echo " "
23950 if $test `./findhdr sys/ioctl.h`; then
23951         val="$define"
23952         echo '<sys/ioctl.h> found.' >&4
23953 else
23954         val="$undef"
23955         if $test $i_sysfilio = "$define"; then
23956             echo '<sys/ioctl.h> NOT found.' >&4
23957         else
23958                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23959                 $test $i_termio = "$define" && xxx="termio.h"
23960                 $test $i_termios = "$define" && xxx="termios.h"
23961 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23962         fi
23963 fi
23964 set i_sysioctl
23965 eval $setvar
23966
23967 : see if socket ioctl defs are in sys/sockio.h
23968 echo " "
23969 xxx=`./findhdr sys/sockio.h`
23970 if $test "$xxx"; then
23971         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23972                 val="$define"
23973                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23974         else
23975                 val="$undef"
23976                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23977         fi
23978 else
23979         val="$undef"
23980         $cat <<EOM
23981 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23982 EOM
23983 fi
23984 set i_syssockio
23985 eval $setvar
23986
23987 : see if this is a syslog.h system
23988 set syslog.h i_syslog
23989 eval $inhdr
23990
23991 : see if this is a sys/mode.h system
23992 set sys/mode.h i_sysmode
23993 eval $inhdr
23994
23995 : see if there is a sys/poll.h file
23996 set sys/poll.h i_syspoll
23997 eval $inhdr
23998
23999 : see if sys/resource.h has to be included
24000 set sys/resource.h i_sysresrc
24001 eval $inhdr
24002
24003 : see if sys/security.h is available
24004 set sys/security.h i_syssecrt
24005 eval $inhdr
24006
24007 : see if this is a sys/statvfs.h system
24008 set sys/statvfs.h i_sysstatvfs
24009 eval $inhdr
24010
24011 : see if this is a sys/un.h system
24012 set sys/un.h i_sysun
24013 eval $inhdr
24014
24015 : see if this is a sys/utsname.h system
24016 set sys/utsname.h i_sysutsname
24017 eval $inhdr
24018
24019 : see if this is a syswait system
24020 set sys/wait.h i_syswait
24021 eval $inhdr
24022
24023 : see if this is a ustat.h system
24024 set ustat.h i_ustat
24025 eval $inhdr
24026
24027 : see if this is an utime system
24028 set utime.h i_utime
24029 eval $inhdr
24030
24031 : see if this is a vfork system
24032 case "$d_vfork" in
24033 "$define")
24034         set vfork.h i_vfork
24035         eval $inhdr
24036         ;;
24037 *)
24038         i_vfork="$undef"
24039         ;;
24040 esac
24041
24042 : see if wchar.h is present
24043 set wchar.h i_wchar
24044 eval $inhdr
24045
24046 : Check extensions
24047 echo " "
24048 echo "Looking for extensions..." >&4
24049 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
24050 : contain old or inaccurate or duplicate values.
24051 nonxs_extensions=''
24052 xs_extensions=''
24053 : We do not use find because it might not be available.
24054 : We do not just use MANIFEST because the user may have dropped
24055 : some additional extensions into the source tree and expect them
24056 : to be built.
24057
24058 : Function to recursively find available extensions, ignoring DynaLoader
24059 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
24060 : In 5.10.1 and later, extensions are stored in directories
24061 : like File-Glob instead of the older File/Glob/.
24062 find_extensions='
24063     for xxx in *; do
24064         case "$xxx" in
24065             DynaLoader|dynaload) ;;
24066             *)
24067             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
24068             case "$this_ext" in
24069                 Scalar/List/Utils) this_ext="List/Util" ;;
24070                 PathTools)         this_ext="Cwd"       ;;
24071             esac;
24072             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
24073             if $contains " $this_ext " "$tdir/$$.tmp"; then
24074                 echo >&4;
24075                 echo "Duplicate directories detected for extension $xxx" >&4;
24076                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
24077                 case "$knowitall" in
24078                 "") dflt=y;;
24079                 *) dflt=n;;
24080                 esac;
24081                 . ../UU/myread;
24082                 case "$ans" in
24083                 n*|N*) ;;
24084                 *) echo >&4;
24085                     echo "Ok.  Stopping Configure." >&4;
24086                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
24087                     exit 1;;
24088                 esac;
24089                 echo "Ok.  You will need to correct config.sh before running make." >&4;
24090             fi;
24091             $ls -1 "$xxx" > "$tdir/$$.tmp";
24092             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
24093                 xs_extensions="$xs_extensions $this_ext";
24094             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
24095                 xs_extensions="$xs_extensions $this_ext";
24096             elif $test -d "$xxx"; then
24097                 nonxs_extensions="$nonxs_extensions $this_ext";
24098             fi;
24099             $rm -f "$tdir/$$.tmp";
24100             ;;
24101         esac;
24102     done'
24103 tdir=`pwd`
24104 cd "$rsrc/cpan"
24105 set X
24106 shift
24107 eval $find_extensions
24108 cd "$rsrc/dist"
24109 set X
24110 shift
24111 eval $find_extensions
24112 cd "$rsrc/ext"
24113 set X
24114 shift
24115 eval $find_extensions
24116 set X $xs_extensions
24117 shift
24118 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
24119 set X $nonxs_extensions
24120 shift
24121 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
24122 cd "$tdir"
24123 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
24124
24125 : Now see which are supported on this system.
24126 avail_ext=''
24127 for xxx in $xs_extensions ; do
24128         case "$xxx" in
24129         Amiga*)
24130                 case "$osname" in
24131                 amigaos) avail_ext="$avail_ext $xxx" ;;
24132                 esac
24133                 ;;
24134         DB_File|db_file)
24135                 case "$i_db" in
24136                 $define) avail_ext="$avail_ext $xxx" ;;
24137                 esac
24138                 ;;
24139         GDBM_File|gdbm_fil)
24140                 case "$i_gdbm" in
24141                 $define) avail_ext="$avail_ext $xxx" ;;
24142                 esac
24143                 ;;
24144         IPC/SysV|ipc/sysv)
24145                 : XXX Do we need a useipcsysv variable here
24146                 case "${d_msg}${d_sem}${d_shm}" in
24147                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
24148                 esac
24149                 ;;
24150         NDBM_File|ndbm_fil)
24151                 case "$d_ndbm" in
24152                 $define)
24153                     case "$osname-$use64bitint" in
24154                     hpux-define)
24155                         case "$libs" in
24156                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
24157                         esac
24158                         ;;
24159                     *) avail_ext="$avail_ext $xxx" ;;
24160                     esac
24161                     ;;
24162                 esac
24163                 ;;
24164         ODBM_File|odbm_fil)
24165                 case "${i_dbm}${i_rpcsvcdbm}" in
24166                 *"${define}"*)
24167                     case "$d_cplusplus" in
24168                     define) ;; # delete as a function name will not work
24169                     *)  case "$osname-$use64bitint" in
24170                         hpux-define)
24171                             case "$libs" in
24172                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
24173                             esac
24174                             ;;
24175                         *) avail_ext="$avail_ext $xxx" ;;
24176                         esac
24177                         ;;
24178                     esac
24179                     ;;
24180                 esac
24181                 ;;
24182         Opcode|opcode)
24183                 case "$useopcode" in
24184                 true|define|y) avail_ext="$avail_ext $xxx" ;;
24185                 esac
24186                 ;;
24187         POSIX|posix)
24188                 case "$useposix" in
24189                 true|define|y) avail_ext="$avail_ext $xxx" ;;
24190                 esac
24191                 ;;
24192         Socket|socket)
24193                 case "$d_socket" in
24194                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
24195                 esac
24196                 ;;
24197         I18N/Langinfo|langinfo)
24198                 case "$uselanginfo" in
24199                 true|define|y) avail_ext="$avail_ext $xxx" ;;
24200                 esac
24201                 ;;
24202         Sys/Syslog|sys/syslog)
24203                 case $osname in
24204                         amigaos) ;; # not really very useful on AmigaOS
24205                         *)
24206                         : XXX syslog requires socket
24207                         case "$d_socket" in
24208                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
24209                         esac
24210                         ;;
24211                 esac
24212                 ;;
24213         threads|threads/shared)
24214                 # threads and threads::shared are special cases.
24215                 # To stop people from asking "Perl 5.8.0 was supposed
24216                 # to have this new fancy threads implementation but my
24217                 # perl doesn't have it" and from people trying to
24218                 # (re)install the threads module using CPAN.pm and
24219                 # CPAN.pm then offering to reinstall Perl 5.8.0,
24220                 # the threads.pm and threads/shared.pm will always be
24221                 # there, croaking informatively ("you need to rebuild
24222                 # all of Perl with threads, sorry") when threads haven't
24223                 # been compiled in.
24224                 # --jhi
24225                 avail_ext="$avail_ext $xxx"
24226                 ;;
24227         VMS*)
24228                 ;;
24229         Win32*)
24230                 case "$osname" in
24231                 cygwin) avail_ext="$avail_ext $xxx" ;;
24232                 esac
24233                 ;;
24234         XS/APItest|xs/apitest)
24235                 # This is just for testing.  Skip it unless we have dynamic loading.
24236
24237                 case "$usedl" in
24238                 $define) avail_ext="$avail_ext $xxx" ;;
24239                 esac
24240                 ;;
24241         XS/Typemap|xs/typemap)
24242                 # This is just for testing.  Skip it unless we have dynamic loading.
24243                 case "$usedl" in
24244                 $define) avail_ext="$avail_ext $xxx" ;;
24245                 esac
24246                 ;;
24247         *)      avail_ext="$avail_ext $xxx"
24248                 ;;
24249         esac
24250 done
24251
24252 set X $avail_ext
24253 shift
24254 avail_ext="$*"
24255
24256 case "$onlyextensions" in
24257 '') ;;
24258 *)  keepextensions=''
24259     echo "You have requested that only certain extensions be included..." >&4
24260     for i in $onlyextensions; do
24261         case " $avail_ext " in
24262         *" $i "*)
24263             echo "Keeping extension $i."
24264             keepextensions="$keepextensions $i"
24265             ;;
24266         *) echo "Ignoring extension $i." ;;
24267         esac
24268     done
24269     avail_ext="$keepextensions"
24270     ;;
24271 esac
24272
24273 case "$noextensions" in
24274 '') ;;
24275 *)  keepextensions=''
24276     echo "You have requested that certain extensions be ignored..." >&4
24277     for i in $avail_ext; do
24278         case " $noextensions " in
24279         *" $i "*) echo "Ignoring extension $i." ;;
24280         *) echo "Keeping extension $i.";
24281            keepextensions="$keepextensions $i"
24282            ;;
24283         esac
24284     done
24285     avail_ext="$keepextensions"
24286     ;;
24287 esac
24288
24289 : Now see which nonxs extensions are supported on this system.
24290 : For now assume all are.
24291 nonxs_ext=''
24292 for xxx in $nonxs_extensions ; do
24293         case "$xxx" in
24294         VMS*)
24295                 ;;
24296         *)      nonxs_ext="$nonxs_ext $xxx"
24297                 ;;
24298         esac
24299 done
24300
24301 set X $nonxs_ext
24302 shift
24303 nonxs_ext="$*"
24304
24305 case $usedl in
24306 $define)
24307         $cat <<EOM
24308 A number of extensions are supplied with $package.  You may choose to
24309 compile these extensions for dynamic loading (the default), compile
24310 them into the $package executable (static loading), or not include
24311 them at all.  Answer "none" to include no extensions.
24312 Note that DynaLoader is always built and need not be mentioned here.
24313
24314 EOM
24315         case "$dynamic_ext" in
24316         '')
24317                 : Exclude those listed in static_ext
24318                 dflt=''
24319                 for xxx in $avail_ext; do
24320                         case " $static_ext " in
24321                         *" $xxx "*) ;;
24322                         *) dflt="$dflt $xxx" ;;
24323                         esac
24324                 done
24325                 set X $dflt
24326                 shift
24327                 dflt="$*"
24328                 ;;
24329         *)      dflt="$dynamic_ext"
24330                 # Perhaps we are reusing an old out-of-date config.sh.
24331                 case "$hint" in
24332                 previous)
24333                         if test X"$dynamic_ext" != X"$avail_ext"; then
24334                                 $cat <<EOM
24335 NOTICE:  Your previous config.sh list may be incorrect.
24336 The extensions now available to you are
24337         ${avail_ext}
24338 but the default list from your previous config.sh is
24339         ${dynamic_ext}
24340
24341 EOM
24342                         fi
24343                         ;;
24344                 esac
24345                 ;;
24346         esac
24347         case "$dflt" in
24348         '')     dflt=none;;
24349         esac
24350         rp="What extensions do you wish to load dynamically?"
24351         . ./myread
24352         case "$ans" in
24353         none) dynamic_ext=' ' ;;
24354         *) dynamic_ext="$ans" ;;
24355         esac
24356
24357         case "$static_ext" in
24358         '')
24359                 : Exclude those already listed in dynamic linking
24360                 dflt=''
24361                 for xxx in $avail_ext; do
24362                         case " $dynamic_ext " in
24363                         *" $xxx "*) ;;
24364                         *) dflt="$dflt $xxx" ;;
24365                         esac
24366                 done
24367                 set X $dflt
24368                 shift
24369                 dflt="$*"
24370                 ;;
24371         *)  dflt="$static_ext"
24372                 ;;
24373         esac
24374
24375         case "$dflt" in
24376         '')     dflt=none;;
24377         esac
24378         rp="What extensions do you wish to load statically?"
24379         . ./myread
24380         case "$ans" in
24381         none) static_ext=' ' ;;
24382         *) static_ext="$ans" ;;
24383         esac
24384         ;;
24385 *)
24386         $cat <<EOM
24387 A number of extensions are supplied with $package.  Answer "none"
24388 to include no extensions.
24389 Note that DynaLoader is always built and need not be mentioned here.
24390
24391 EOM
24392         case "$static_ext" in
24393         '') dflt="$avail_ext" ;;
24394         *)      dflt="$static_ext"
24395                 # Perhaps we are reusing an old out-of-date config.sh.
24396                 case "$hint" in
24397                 previous)
24398                         if test X"$static_ext" != X"$avail_ext"; then
24399                                 $cat <<EOM
24400 NOTICE:  Your previous config.sh list may be incorrect.
24401 The extensions now available to you are
24402         ${avail_ext}
24403 but the default list from your previous config.sh is
24404         ${static_ext}
24405
24406 EOM
24407                         fi
24408                         ;;
24409                 esac
24410                 ;;
24411         esac
24412         : Exclude those that are not xs extensions
24413         case "$dflt" in
24414         '')     dflt=none;;
24415         esac
24416         rp="What extensions do you wish to include?"
24417         . ./myread
24418         case "$ans" in
24419         none) static_ext=' ' ;;
24420         *) static_ext="$ans" ;;
24421         esac
24422         ;;
24423 esac
24424 #
24425 # Encode is a special case.  If we are building Encode as a static
24426 # extension, we need to explicitly list its subextensions as well.
24427 # For other nested extensions, this is handled automatically by
24428 # the appropriate Makefile.PL.
24429 case " $static_ext " in
24430         *" Encode "*) # Add the subextensions of Encode
24431         cd "$rsrc/cpan"
24432         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
24433                 static_ext="$static_ext Encode/$xxx"
24434                 known_extensions="$known_extensions Encode/$xxx"
24435         done
24436         cd "$tdir"
24437         ;;
24438 esac
24439
24440 set X $dynamic_ext $static_ext $nonxs_ext
24441 shift
24442 extensions="$*"
24443
24444 # Sanity check:  We require an extension suitable for use with
24445 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
24446 # should show up as failures in the test suite, but it's helpful to
24447 # catch them now.) The 'extensions' list is normally sorted
24448 # alphabetically, so we need to accept either
24449 #    DB_File ... Fcntl ... IO  ....
24450 # or something like
24451 #    Fcntl ... NDBM_File ... IO  ....
24452 case " $extensions"  in
24453 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
24454 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
24455 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
24456 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
24457    echo "WARNING: The Perl you are building will be quite crippled." >& 4
24458    ;;
24459 esac
24460
24461 : Remove libraries needed only for extensions
24462 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
24463 : The exception is SunOS 4.x, which needs them.
24464 case "${osname}X${osvers}" in
24465 sunos*X4*)
24466     perllibs="$libs"
24467     ;;
24468 *) case "$usedl" in
24469     $define|true|[yY]*)
24470             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
24471             shift
24472             perllibs="$*"
24473             ;;
24474     *)  perllibs="$libs"
24475             ;;
24476     esac
24477     ;;
24478 esac
24479
24480 : Remove build directory name from cppstdin so it can be used from
24481 : either the present location or the final installed location.
24482 echo " "
24483 : Get out of the UU directory to get correct path name.
24484 cd ..
24485 case "$cppstdin" in
24486 `pwd`/cppstdin)
24487         echo "Stripping down cppstdin path name"
24488         cppstdin=cppstdin
24489         ;;
24490 esac
24491 cd UU
24492
24493 : end of configuration questions
24494 echo " "
24495 echo "End of configuration questions."
24496 echo " "
24497
24498 : back to where it started
24499 if test -d ../UU; then
24500         cd ..
24501 fi
24502
24503 : configuration may be unconditionally patched via a 'config.arch' file
24504 if $test -f config.arch; then
24505         echo "I see a config.arch file, loading it." >&4
24506         . ./config.arch
24507 fi
24508
24509 : configuration may be patched via a 'config.over' file
24510 if $test -f config.over; then
24511         echo " "
24512         dflt=y
24513         rp='I see a config.over file.  Do you wish to load it?'
24514         . UU/myread
24515         case "$ans" in
24516         n*) echo "OK, I'll ignore it.";;
24517         *)      . ./config.over
24518                 echo "Configuration override changes have been loaded."
24519                 ;;
24520         esac
24521 fi
24522
24523 : in case they want portability, strip down executable paths
24524 case "$d_portable" in
24525 "$define")
24526         echo " "
24527         echo "Stripping down executable paths..." >&4
24528         for file in $loclist $trylist; do
24529                 eval temp=\$$file
24530                 eval $file=`basename $temp`
24531         done
24532         ;;
24533 esac
24534
24535 : create config.sh file
24536 echo " "
24537 echo "Creating config.sh..." >&4
24538 $spitshell <<EOT >config.sh
24539 $startsh
24540 #
24541 # This file was produced by running the Configure script. It holds all the
24542 # definitions figured out by Configure. Should you modify one of these values,
24543 # do not forget to propagate your changes by running "Configure -der". You may
24544 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24545 #
24546
24547 # Package name      : $package
24548 # Source directory  : $src
24549 # Configuration time: $cf_time
24550 # Configured by     : $cf_by
24551 # Target system     : $myuname
24552
24553 EOT
24554 : Add in command line options if available
24555 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24556
24557 $spitshell <<EOT >>config.sh
24558
24559 Author='$Author'
24560 Date='$Date'
24561 Header='$Header'
24562 Id='$Id'
24563 Locker='$Locker'
24564 Log='$Log'
24565 RCSfile='$RCSfile'
24566 Revision='$Revision'
24567 Source='$Source'
24568 State='$State'
24569 _a='$_a'
24570 _exe='$_exe'
24571 _o='$_o'
24572 afs='$afs'
24573 afsroot='$afsroot'
24574 alignbytes='$alignbytes'
24575 aphostname='$aphostname'
24576 api_revision='$api_revision'
24577 api_subversion='$api_subversion'
24578 api_version='$api_version'
24579 api_versionstring='$api_versionstring'
24580 ar='$ar'
24581 archlib='$archlib'
24582 archlibexp='$archlibexp'
24583 archname64='$archname64'
24584 archname='$archname'
24585 archobjs='$archobjs'
24586 asctime_r_proto='$asctime_r_proto'
24587 awk='$awk'
24588 baserev='$baserev'
24589 bash='$bash'
24590 bin='$bin'
24591 bin_ELF='$bin_ELF'
24592 binexp='$binexp'
24593 bison='$bison'
24594 byacc='$byacc'
24595 byteorder='$byteorder'
24596 c='$c'
24597 castflags='$castflags'
24598 cat='$cat'
24599 cc='$cc'
24600 cccdlflags='$cccdlflags'
24601 ccdlflags='$ccdlflags'
24602 ccflags='$ccflags'
24603 ccflags_uselargefiles='$ccflags_uselargefiles'
24604 ccname='$ccname'
24605 ccsymbols='$ccsymbols'
24606 ccversion='$ccversion'
24607 cf_by='$cf_by'
24608 cf_email='$cf_email'
24609 cf_time='$cf_time'
24610 charbits='$charbits'
24611 charsize='$charsize'
24612 chgrp='$chgrp'
24613 chmod='$chmod'
24614 chown='$chown'
24615 clocktype='$clocktype'
24616 comm='$comm'
24617 compiler_warning='$compiler_warning'
24618 compress='$compress'
24619 contains='$contains'
24620 cp='$cp'
24621 cpio='$cpio'
24622 cpp='$cpp'
24623 cpp_stuff='$cpp_stuff'
24624 cppccsymbols='$cppccsymbols'
24625 cppflags='$cppflags'
24626 cpplast='$cpplast'
24627 cppminus='$cppminus'
24628 cpprun='$cpprun'
24629 cppstdin='$cppstdin'
24630 cppsymbols='$cppsymbols'
24631 crypt_r_proto='$crypt_r_proto'
24632 cryptlib='$cryptlib'
24633 csh='$csh'
24634 ctermid_r_proto='$ctermid_r_proto'
24635 ctime_r_proto='$ctime_r_proto'
24636 d_Gconvert='$d_Gconvert'
24637 d_PRIEUldbl='$d_PRIEUldbl'
24638 d_PRIFUldbl='$d_PRIFUldbl'
24639 d_PRIGUldbl='$d_PRIGUldbl'
24640 d_PRIXU64='$d_PRIXU64'
24641 d_PRId64='$d_PRId64'
24642 d_PRIeldbl='$d_PRIeldbl'
24643 d_PRIfldbl='$d_PRIfldbl'
24644 d_PRIgldbl='$d_PRIgldbl'
24645 d_PRIi64='$d_PRIi64'
24646 d_PRIo64='$d_PRIo64'
24647 d_PRIu64='$d_PRIu64'
24648 d_PRIx64='$d_PRIx64'
24649 d_SCNfldbl='$d_SCNfldbl'
24650 d__fwalk='$d__fwalk'
24651 d_accept4='$d_accept4'
24652 d_access='$d_access'
24653 d_accessx='$d_accessx'
24654 d_acosh='$d_acosh'
24655 d_aintl='$d_aintl'
24656 d_alarm='$d_alarm'
24657 d_archlib='$d_archlib'
24658 d_asctime64='$d_asctime64'
24659 d_asctime_r='$d_asctime_r'
24660 d_asinh='$d_asinh'
24661 d_atanh='$d_atanh'
24662 d_atolf='$d_atolf'
24663 d_atoll='$d_atoll'
24664 d_attribute_always_inline='$d_attribute_always_inline'
24665 d_attribute_deprecated='$d_attribute_deprecated'
24666 d_attribute_format='$d_attribute_format'
24667 d_attribute_malloc='$d_attribute_malloc'
24668 d_attribute_nonnull='$d_attribute_nonnull'
24669 d_attribute_noreturn='$d_attribute_noreturn'
24670 d_attribute_pure='$d_attribute_pure'
24671 d_attribute_unused='$d_attribute_unused'
24672 d_attribute_visibility='$d_attribute_visibility'
24673 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24674 d_backtrace='$d_backtrace'
24675 d_bsd='$d_bsd'
24676 d_bsdgetpgrp='$d_bsdgetpgrp'
24677 d_bsdsetpgrp='$d_bsdsetpgrp'
24678 d_builtin_add_overflow='$d_builtin_add_overflow'
24679 d_builtin_choose_expr='$d_builtin_choose_expr'
24680 d_builtin_expect='$d_builtin_expect'
24681 d_builtin_mul_overflow='$d_builtin_mul_overflow'
24682 d_builtin_sub_overflow='$d_builtin_sub_overflow'
24683 d_c99_variadic_macros='$d_c99_variadic_macros'
24684 d_casti32='$d_casti32'
24685 d_castneg='$d_castneg'
24686 d_cbrt='$d_cbrt'
24687 d_chown='$d_chown'
24688 d_chroot='$d_chroot'
24689 d_chsize='$d_chsize'
24690 d_class='$d_class'
24691 d_clearenv='$d_clearenv'
24692 d_closedir='$d_closedir'
24693 d_cmsghdr_s='$d_cmsghdr_s'
24694 d_copysign='$d_copysign'
24695 d_copysignl='$d_copysignl'
24696 d_cplusplus='$d_cplusplus'
24697 d_crypt='$d_crypt'
24698 d_crypt_r='$d_crypt_r'
24699 d_csh='$d_csh'
24700 d_ctermid='$d_ctermid'
24701 d_ctermid_r='$d_ctermid_r'
24702 d_ctime64='$d_ctime64'
24703 d_ctime_r='$d_ctime_r'
24704 d_cuserid='$d_cuserid'
24705 d_dbminitproto='$d_dbminitproto'
24706 d_difftime64='$d_difftime64'
24707 d_difftime='$d_difftime'
24708 d_dir_dd_fd='$d_dir_dd_fd'
24709 d_dirfd='$d_dirfd'
24710 d_dirnamlen='$d_dirnamlen'
24711 d_dladdr='$d_dladdr'
24712 d_dlerror='$d_dlerror'
24713 d_dlopen='$d_dlopen'
24714 d_dlsymun='$d_dlsymun'
24715 d_dosuid='$d_dosuid'
24716 d_double_has_inf='$d_double_has_inf'
24717 d_double_has_nan='$d_double_has_nan'
24718 d_double_has_negative_zero='$d_double_has_negative_zero'
24719 d_double_has_subnormals='$d_double_has_subnormals'
24720 d_double_style_cray='$d_double_style_cray'
24721 d_double_style_ibm='$d_double_style_ibm'
24722 d_double_style_ieee='$d_double_style_ieee'
24723 d_double_style_vax='$d_double_style_vax'
24724 d_drand48_r='$d_drand48_r'
24725 d_drand48proto='$d_drand48proto'
24726 d_dup2='$d_dup2'
24727 d_dup3='$d_dup3'
24728 d_duplocale='$d_duplocale'
24729 d_eaccess='$d_eaccess'
24730 d_endgrent='$d_endgrent'
24731 d_endgrent_r='$d_endgrent_r'
24732 d_endhent='$d_endhent'
24733 d_endhostent_r='$d_endhostent_r'
24734 d_endnent='$d_endnent'
24735 d_endnetent_r='$d_endnetent_r'
24736 d_endpent='$d_endpent'
24737 d_endprotoent_r='$d_endprotoent_r'
24738 d_endpwent='$d_endpwent'
24739 d_endpwent_r='$d_endpwent_r'
24740 d_endsent='$d_endsent'
24741 d_endservent_r='$d_endservent_r'
24742 d_eofnblk='$d_eofnblk'
24743 d_erf='$d_erf'
24744 d_erfc='$d_erfc'
24745 d_eunice='$d_eunice'
24746 d_exp2='$d_exp2'
24747 d_expm1='$d_expm1'
24748 d_faststdio='$d_faststdio'
24749 d_fchdir='$d_fchdir'
24750 d_fchmod='$d_fchmod'
24751 d_fchmodat='$d_fchmodat'
24752 d_fchown='$d_fchown'
24753 d_fcntl='$d_fcntl'
24754 d_fcntl_can_lock='$d_fcntl_can_lock'
24755 d_fd_macros='$d_fd_macros'
24756 d_fd_set='$d_fd_set'
24757 d_fdclose='$d_fdclose'
24758 d_fdim='$d_fdim'
24759 d_fds_bits='$d_fds_bits'
24760 d_fegetround='$d_fegetround'
24761 d_ffs='$d_ffs'
24762 d_ffsl='$d_ffsl'
24763 d_fgetpos='$d_fgetpos'
24764 d_finite='$d_finite'
24765 d_finitel='$d_finitel'
24766 d_flexfnam='$d_flexfnam'
24767 d_flock='$d_flock'
24768 d_flockproto='$d_flockproto'
24769 d_fma='$d_fma'
24770 d_fmax='$d_fmax'
24771 d_fmin='$d_fmin'
24772 d_fork='$d_fork'
24773 d_fp_class='$d_fp_class'
24774 d_fp_classify='$d_fp_classify'
24775 d_fp_classl='$d_fp_classl'
24776 d_fpathconf='$d_fpathconf'
24777 d_fpclass='$d_fpclass'
24778 d_fpclassify='$d_fpclassify'
24779 d_fpclassl='$d_fpclassl'
24780 d_fpgetround='$d_fpgetround'
24781 d_fpos64_t='$d_fpos64_t'
24782 d_freelocale='$d_freelocale'
24783 d_frexpl='$d_frexpl'
24784 d_fs_data_s='$d_fs_data_s'
24785 d_fseeko='$d_fseeko'
24786 d_fsetpos='$d_fsetpos'
24787 d_fstatfs='$d_fstatfs'
24788 d_fstatvfs='$d_fstatvfs'
24789 d_fsync='$d_fsync'
24790 d_ftello='$d_ftello'
24791 d_ftime='$d_ftime'
24792 d_futimes='$d_futimes'
24793 d_gai_strerror='$d_gai_strerror'
24794 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24795 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24796 d_getaddrinfo='$d_getaddrinfo'
24797 d_getcwd='$d_getcwd'
24798 d_getenv_preserves_other_thread='$d_getenv_preserves_other_thread'
24799 d_getespwnam='$d_getespwnam'
24800 d_getfsstat='$d_getfsstat'
24801 d_getgrent='$d_getgrent'
24802 d_getgrent_r='$d_getgrent_r'
24803 d_getgrgid_r='$d_getgrgid_r'
24804 d_getgrnam_r='$d_getgrnam_r'
24805 d_getgrps='$d_getgrps'
24806 d_gethbyaddr='$d_gethbyaddr'
24807 d_gethbyname='$d_gethbyname'
24808 d_gethent='$d_gethent'
24809 d_gethname='$d_gethname'
24810 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24811 d_gethostbyname_r='$d_gethostbyname_r'
24812 d_gethostent_r='$d_gethostent_r'
24813 d_gethostprotos='$d_gethostprotos'
24814 d_getitimer='$d_getitimer'
24815 d_getlogin='$d_getlogin'
24816 d_getlogin_r='$d_getlogin_r'
24817 d_getmnt='$d_getmnt'
24818 d_getmntent='$d_getmntent'
24819 d_getnameinfo='$d_getnameinfo'
24820 d_getnbyaddr='$d_getnbyaddr'
24821 d_getnbyname='$d_getnbyname'
24822 d_getnent='$d_getnent'
24823 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24824 d_getnetbyname_r='$d_getnetbyname_r'
24825 d_getnetent_r='$d_getnetent_r'
24826 d_getnetprotos='$d_getnetprotos'
24827 d_getpagsz='$d_getpagsz'
24828 d_getpbyname='$d_getpbyname'
24829 d_getpbynumber='$d_getpbynumber'
24830 d_getpent='$d_getpent'
24831 d_getpgid='$d_getpgid'
24832 d_getpgrp2='$d_getpgrp2'
24833 d_getpgrp='$d_getpgrp'
24834 d_getppid='$d_getppid'
24835 d_getprior='$d_getprior'
24836 d_getprotobyname_r='$d_getprotobyname_r'
24837 d_getprotobynumber_r='$d_getprotobynumber_r'
24838 d_getprotoent_r='$d_getprotoent_r'
24839 d_getprotoprotos='$d_getprotoprotos'
24840 d_getprpwnam='$d_getprpwnam'
24841 d_getpwent='$d_getpwent'
24842 d_getpwent_r='$d_getpwent_r'
24843 d_getpwnam_r='$d_getpwnam_r'
24844 d_getpwuid_r='$d_getpwuid_r'
24845 d_getsbyname='$d_getsbyname'
24846 d_getsbyport='$d_getsbyport'
24847 d_getsent='$d_getsent'
24848 d_getservbyname_r='$d_getservbyname_r'
24849 d_getservbyport_r='$d_getservbyport_r'
24850 d_getservent_r='$d_getservent_r'
24851 d_getservprotos='$d_getservprotos'
24852 d_getspnam='$d_getspnam'
24853 d_getspnam_r='$d_getspnam_r'
24854 d_gettimeod='$d_gettimeod'
24855 d_gmtime64='$d_gmtime64'
24856 d_gmtime_r='$d_gmtime_r'
24857 d_gnulibc='$d_gnulibc'
24858 d_grpasswd='$d_grpasswd'
24859 d_has_C_UTF8='$d_has_C_UTF8'
24860 d_hasmntopt='$d_hasmntopt'
24861 d_htonl='$d_htonl'
24862 d_hypot='$d_hypot'
24863 d_ilogb='$d_ilogb'
24864 d_ilogbl='$d_ilogbl'
24865 d_inc_version_list='$d_inc_version_list'
24866 d_inetaton='$d_inetaton'
24867 d_inetntop='$d_inetntop'
24868 d_inetpton='$d_inetpton'
24869 d_int64_t='$d_int64_t'
24870 d_ip_mreq='$d_ip_mreq'
24871 d_ip_mreq_source='$d_ip_mreq_source'
24872 d_ipv6_mreq='$d_ipv6_mreq'
24873 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24874 d_isascii='$d_isascii'
24875 d_isblank='$d_isblank'
24876 d_isfinite='$d_isfinite'
24877 d_isfinitel='$d_isfinitel'
24878 d_isinf='$d_isinf'
24879 d_isinfl='$d_isinfl'
24880 d_isless='$d_isless'
24881 d_isnan='$d_isnan'
24882 d_isnanl='$d_isnanl'
24883 d_isnormal='$d_isnormal'
24884 d_j0='$d_j0'
24885 d_j0l='$d_j0l'
24886 d_killpg='$d_killpg'
24887 d_lc_monetary_2008='$d_lc_monetary_2008'
24888 d_lchown='$d_lchown'
24889 d_ldbl_dig='$d_ldbl_dig'
24890 d_ldexpl='$d_ldexpl'
24891 d_lgamma='$d_lgamma'
24892 d_lgamma_r='$d_lgamma_r'
24893 d_libm_lib_version='$d_libm_lib_version'
24894 d_libname_unique='$d_libname_unique'
24895 d_link='$d_link'
24896 d_linkat='$d_linkat'
24897 d_llrint='$d_llrint'
24898 d_llrintl='$d_llrintl'
24899 d_llround='$d_llround'
24900 d_llroundl='$d_llroundl'
24901 d_localeconv_l='$d_localeconv_l'
24902 d_localtime64='$d_localtime64'
24903 d_localtime_r='$d_localtime_r'
24904 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24905 d_locconv='$d_locconv'
24906 d_lockf='$d_lockf'
24907 d_log1p='$d_log1p'
24908 d_log2='$d_log2'
24909 d_logb='$d_logb'
24910 d_long_double_style_ieee='$d_long_double_style_ieee'
24911 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24912 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24913 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24914 d_long_double_style_vax='$d_long_double_style_vax'
24915 d_longdbl='$d_longdbl'
24916 d_longlong='$d_longlong'
24917 d_lrint='$d_lrint'
24918 d_lrintl='$d_lrintl'
24919 d_lround='$d_lround'
24920 d_lroundl='$d_lroundl'
24921 d_lseekproto='$d_lseekproto'
24922 d_lstat='$d_lstat'
24923 d_madvise='$d_madvise'
24924 d_malloc_good_size='$d_malloc_good_size'
24925 d_malloc_size='$d_malloc_size'
24926 d_malloc_usable_size='$d_malloc_usable_size'
24927 d_mblen='$d_mblen'
24928 d_mbrlen='$d_mbrlen'
24929 d_mbrtowc='$d_mbrtowc'
24930 d_mbstowcs='$d_mbstowcs'
24931 d_mbtowc='$d_mbtowc'
24932 d_memmem='$d_memmem'
24933 d_memrchr='$d_memrchr'
24934 d_mkdir='$d_mkdir'
24935 d_mkdtemp='$d_mkdtemp'
24936 d_mkfifo='$d_mkfifo'
24937 d_mkostemp='$d_mkostemp'
24938 d_mkstemp='$d_mkstemp'
24939 d_mkstemps='$d_mkstemps'
24940 d_mktime64='$d_mktime64'
24941 d_mktime='$d_mktime'
24942 d_mmap='$d_mmap'
24943 d_modfl='$d_modfl'
24944 d_modflproto='$d_modflproto'
24945 d_mprotect='$d_mprotect'
24946 d_msg='$d_msg'
24947 d_msg_ctrunc='$d_msg_ctrunc'
24948 d_msg_dontroute='$d_msg_dontroute'
24949 d_msg_oob='$d_msg_oob'
24950 d_msg_peek='$d_msg_peek'
24951 d_msg_proxy='$d_msg_proxy'
24952 d_msgctl='$d_msgctl'
24953 d_msgget='$d_msgget'
24954 d_msghdr_s='$d_msghdr_s'
24955 d_msgrcv='$d_msgrcv'
24956 d_msgsnd='$d_msgsnd'
24957 d_msync='$d_msync'
24958 d_munmap='$d_munmap'
24959 d_mymalloc='$d_mymalloc'
24960 d_nan='$d_nan'
24961 d_nanosleep='$d_nanosleep'
24962 d_ndbm='$d_ndbm'
24963 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24964 d_nearbyint='$d_nearbyint'
24965 d_newlocale='$d_newlocale'
24966 d_nextafter='$d_nextafter'
24967 d_nexttoward='$d_nexttoward'
24968 d_nice='$d_nice'
24969 d_nl_langinfo='$d_nl_langinfo'
24970 d_nl_langinfo_l='$d_nl_langinfo_l'
24971 d_non_int_bitfields='$d_non_int_bitfields'
24972 d_nv_preserves_uv='$d_nv_preserves_uv'
24973 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24974 d_off64_t='$d_off64_t'
24975 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24976 d_oldpthreads='$d_oldpthreads'
24977 d_oldsock='$d_oldsock'
24978 d_open3='$d_open3'
24979 d_openat='$d_openat'
24980 d_pathconf='$d_pathconf'
24981 d_pause='$d_pause'
24982 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24983 d_phostname='$d_phostname'
24984 d_pipe2='$d_pipe2'
24985 d_pipe='$d_pipe'
24986 d_poll='$d_poll'
24987 d_portable='$d_portable'
24988 d_prctl='$d_prctl'
24989 d_prctl_set_name='$d_prctl_set_name'
24990 d_printf_format_null='$d_printf_format_null'
24991 d_procselfexe='$d_procselfexe'
24992 d_pseudofork='$d_pseudofork'
24993 d_pthread_atfork='$d_pthread_atfork'
24994 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24995 d_pthread_yield='$d_pthread_yield'
24996 d_ptrdiff_t='$d_ptrdiff_t'
24997 d_pwage='$d_pwage'
24998 d_pwchange='$d_pwchange'
24999 d_pwclass='$d_pwclass'
25000 d_pwcomment='$d_pwcomment'
25001 d_pwexpire='$d_pwexpire'
25002 d_pwgecos='$d_pwgecos'
25003 d_pwpasswd='$d_pwpasswd'
25004 d_pwquota='$d_pwquota'
25005 d_qgcvt='$d_qgcvt'
25006 d_quad='$d_quad'
25007 d_querylocale='$d_querylocale'
25008 d_random_r='$d_random_r'
25009 d_re_comp='$d_re_comp'
25010 d_readdir64_r='$d_readdir64_r'
25011 d_readdir='$d_readdir'
25012 d_readdir_r='$d_readdir_r'
25013 d_readlink='$d_readlink'
25014 d_readv='$d_readv'
25015 d_recvmsg='$d_recvmsg'
25016 d_regcmp='$d_regcmp'
25017 d_regcomp='$d_regcomp'
25018 d_remainder='$d_remainder'
25019 d_remquo='$d_remquo'
25020 d_rename='$d_rename'
25021 d_renameat='$d_renameat'
25022 d_rewinddir='$d_rewinddir'
25023 d_rint='$d_rint'
25024 d_rmdir='$d_rmdir'
25025 d_round='$d_round'
25026 d_sbrkproto='$d_sbrkproto'
25027 d_scalbn='$d_scalbn'
25028 d_scalbnl='$d_scalbnl'
25029 d_sched_yield='$d_sched_yield'
25030 d_scm_rights='$d_scm_rights'
25031 d_seekdir='$d_seekdir'
25032 d_select='$d_select'
25033 d_sem='$d_sem'
25034 d_semctl='$d_semctl'
25035 d_semctl_semid_ds='$d_semctl_semid_ds'
25036 d_semctl_semun='$d_semctl_semun'
25037 d_semget='$d_semget'
25038 d_semop='$d_semop'
25039 d_sendmsg='$d_sendmsg'
25040 d_setegid='$d_setegid'
25041 d_setenv='$d_setenv'
25042 d_seteuid='$d_seteuid'
25043 d_setgrent='$d_setgrent'
25044 d_setgrent_r='$d_setgrent_r'
25045 d_setgrps='$d_setgrps'
25046 d_sethent='$d_sethent'
25047 d_sethostent_r='$d_sethostent_r'
25048 d_setitimer='$d_setitimer'
25049 d_setlinebuf='$d_setlinebuf'
25050 d_setlocale='$d_setlocale'
25051 d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
25052 d_setlocale_r='$d_setlocale_r'
25053 d_setnent='$d_setnent'
25054 d_setnetent_r='$d_setnetent_r'
25055 d_setpent='$d_setpent'
25056 d_setpgid='$d_setpgid'
25057 d_setpgrp2='$d_setpgrp2'
25058 d_setpgrp='$d_setpgrp'
25059 d_setprior='$d_setprior'
25060 d_setproctitle='$d_setproctitle'
25061 d_setprotoent_r='$d_setprotoent_r'
25062 d_setpwent='$d_setpwent'
25063 d_setpwent_r='$d_setpwent_r'
25064 d_setregid='$d_setregid'
25065 d_setresgid='$d_setresgid'
25066 d_setresuid='$d_setresuid'
25067 d_setreuid='$d_setreuid'
25068 d_setrgid='$d_setrgid'
25069 d_setruid='$d_setruid'
25070 d_setsent='$d_setsent'
25071 d_setservent_r='$d_setservent_r'
25072 d_setsid='$d_setsid'
25073 d_setvbuf='$d_setvbuf'
25074 d_shm='$d_shm'
25075 d_shmat='$d_shmat'
25076 d_shmatprototype='$d_shmatprototype'
25077 d_shmctl='$d_shmctl'
25078 d_shmdt='$d_shmdt'
25079 d_shmget='$d_shmget'
25080 d_sigaction='$d_sigaction'
25081 d_siginfo_si_addr='$d_siginfo_si_addr'
25082 d_siginfo_si_band='$d_siginfo_si_band'
25083 d_siginfo_si_errno='$d_siginfo_si_errno'
25084 d_siginfo_si_fd='$d_siginfo_si_fd'
25085 d_siginfo_si_pid='$d_siginfo_si_pid'
25086 d_siginfo_si_status='$d_siginfo_si_status'
25087 d_siginfo_si_uid='$d_siginfo_si_uid'
25088 d_siginfo_si_value='$d_siginfo_si_value'
25089 d_signbit='$d_signbit'
25090 d_sigprocmask='$d_sigprocmask'
25091 d_sigsetjmp='$d_sigsetjmp'
25092 d_sin6_scope_id='$d_sin6_scope_id'
25093 d_sitearch='$d_sitearch'
25094 d_snprintf='$d_snprintf'
25095 d_sockaddr_in6='$d_sockaddr_in6'
25096 d_sockaddr_sa_len='$d_sockaddr_sa_len'
25097 d_sockaddr_storage='$d_sockaddr_storage'
25098 d_sockatmark='$d_sockatmark'
25099 d_sockatmarkproto='$d_sockatmarkproto'
25100 d_socket='$d_socket'
25101 d_socklen_t='$d_socklen_t'
25102 d_sockpair='$d_sockpair'
25103 d_socks5_init='$d_socks5_init'
25104 d_sqrtl='$d_sqrtl'
25105 d_srand48_r='$d_srand48_r'
25106 d_srandom_r='$d_srandom_r'
25107 d_sresgproto='$d_sresgproto'
25108 d_sresuproto='$d_sresuproto'
25109 d_stat='$d_stat'
25110 d_statblks='$d_statblks'
25111 d_statfs_f_flags='$d_statfs_f_flags'
25112 d_statfs_s='$d_statfs_s'
25113 d_static_inline='$d_static_inline'
25114 d_statvfs='$d_statvfs'
25115 d_stdio_cnt_lval='$d_stdio_cnt_lval'
25116 d_stdio_ptr_lval='$d_stdio_ptr_lval'
25117 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
25118 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
25119 d_stdio_stream_array='$d_stdio_stream_array'
25120 d_stdiobase='$d_stdiobase'
25121 d_stdstdio='$d_stdstdio'
25122 d_strcoll='$d_strcoll'
25123 d_strerror_l='$d_strerror_l'
25124 d_strerror_r='$d_strerror_r'
25125 d_strftime='$d_strftime'
25126 d_strlcat='$d_strlcat'
25127 d_strlcpy='$d_strlcpy'
25128 d_strnlen='$d_strnlen'
25129 d_strtod='$d_strtod'
25130 d_strtod_l='$d_strtod_l'
25131 d_strtol='$d_strtol'
25132 d_strtold='$d_strtold'
25133 d_strtold_l='$d_strtold_l'
25134 d_strtoll='$d_strtoll'
25135 d_strtoq='$d_strtoq'
25136 d_strtoul='$d_strtoul'
25137 d_strtoull='$d_strtoull'
25138 d_strtouq='$d_strtouq'
25139 d_strxfrm='$d_strxfrm'
25140 d_strxfrm_l='$d_strxfrm_l'
25141 d_suidsafe='$d_suidsafe'
25142 d_symlink='$d_symlink'
25143 d_syscall='$d_syscall'
25144 d_syscallproto='$d_syscallproto'
25145 d_sysconf='$d_sysconf'
25146 d_sysernlst='$d_sysernlst'
25147 d_syserrlst='$d_syserrlst'
25148 d_system='$d_system'
25149 d_tcgetpgrp='$d_tcgetpgrp'
25150 d_tcsetpgrp='$d_tcsetpgrp'
25151 d_telldir='$d_telldir'
25152 d_telldirproto='$d_telldirproto'
25153 d_tgamma='$d_tgamma'
25154 d_thread_local='$d_thread_local'
25155 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
25156 d_time='$d_time'
25157 d_timegm='$d_timegm'
25158 d_times='$d_times'
25159 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
25160 d_tm_tm_zone='$d_tm_tm_zone'
25161 d_tmpnam_r='$d_tmpnam_r'
25162 d_towlower='$d_towlower'
25163 d_towupper='$d_towupper'
25164 d_trunc='$d_trunc'
25165 d_truncate='$d_truncate'
25166 d_truncl='$d_truncl'
25167 d_ttyname_r='$d_ttyname_r'
25168 d_tzname='$d_tzname'
25169 d_u32align='$d_u32align'
25170 d_ualarm='$d_ualarm'
25171 d_umask='$d_umask'
25172 d_uname='$d_uname'
25173 d_union_semun='$d_union_semun'
25174 d_unlinkat='$d_unlinkat'
25175 d_unordered='$d_unordered'
25176 d_unsetenv='$d_unsetenv'
25177 d_uselocale='$d_uselocale'
25178 d_usleep='$d_usleep'
25179 d_usleepproto='$d_usleepproto'
25180 d_ustat='$d_ustat'
25181 d_vendorarch='$d_vendorarch'
25182 d_vendorbin='$d_vendorbin'
25183 d_vendorlib='$d_vendorlib'
25184 d_vendorscript='$d_vendorscript'
25185 d_vfork='$d_vfork'
25186 d_void_closedir='$d_void_closedir'
25187 d_voidsig='$d_voidsig'
25188 d_voidtty='$d_voidtty'
25189 d_vsnprintf='$d_vsnprintf'
25190 d_wait4='$d_wait4'
25191 d_waitpid='$d_waitpid'
25192 d_wcrtomb='$d_wcrtomb'
25193 d_wcscmp='$d_wcscmp'
25194 d_wcstombs='$d_wcstombs'
25195 d_wcsxfrm='$d_wcsxfrm'
25196 d_wctomb='$d_wctomb'
25197 d_writev='$d_writev'
25198 d_xenix='$d_xenix'
25199 date='$date'
25200 db_hashtype='$db_hashtype'
25201 db_prefixtype='$db_prefixtype'
25202 db_version_major='$db_version_major'
25203 db_version_minor='$db_version_minor'
25204 db_version_patch='$db_version_patch'
25205 default_inc_excludes_dot='$default_inc_excludes_dot'
25206 direntrytype='$direntrytype'
25207 dlext='$dlext'
25208 dlsrc='$dlsrc'
25209 doubleinfbytes='$doubleinfbytes'
25210 doublekind='$doublekind'
25211 doublemantbits='$doublemantbits'
25212 doublenanbytes='$doublenanbytes'
25213 doublesize='$doublesize'
25214 drand01='$drand01'
25215 drand48_r_proto='$drand48_r_proto'
25216 dtrace='$dtrace'
25217 dtraceobject='$dtraceobject'
25218 dtracexnolibs='$dtracexnolibs'
25219 dynamic_ext='$dynamic_ext'
25220 eagain='$eagain'
25221 ebcdic='$ebcdic'
25222 echo='$echo'
25223 egrep='$egrep'
25224 emacs='$emacs'
25225 endgrent_r_proto='$endgrent_r_proto'
25226 endhostent_r_proto='$endhostent_r_proto'
25227 endnetent_r_proto='$endnetent_r_proto'
25228 endprotoent_r_proto='$endprotoent_r_proto'
25229 endpwent_r_proto='$endpwent_r_proto'
25230 endservent_r_proto='$endservent_r_proto'
25231 eunicefix='$eunicefix'
25232 exe_ext='$exe_ext'
25233 expr='$expr'
25234 extensions='$extensions'
25235 extern_C='$extern_C'
25236 extras='$extras'
25237 fflushNULL='$fflushNULL'
25238 fflushall='$fflushall'
25239 find='$find'
25240 firstmakefile='$firstmakefile'
25241 flex='$flex'
25242 fpossize='$fpossize'
25243 fpostype='$fpostype'
25244 freetype='$freetype'
25245 from='$from'
25246 full_ar='$full_ar'
25247 full_csh='$full_csh'
25248 full_sed='$full_sed'
25249 gccansipedantic='$gccansipedantic'
25250 gccosandvers='$gccosandvers'
25251 gccversion='$gccversion'
25252 getgrent_r_proto='$getgrent_r_proto'
25253 getgrgid_r_proto='$getgrgid_r_proto'
25254 getgrnam_r_proto='$getgrnam_r_proto'
25255 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
25256 gethostbyname_r_proto='$gethostbyname_r_proto'
25257 gethostent_r_proto='$gethostent_r_proto'
25258 getlogin_r_proto='$getlogin_r_proto'
25259 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
25260 getnetbyname_r_proto='$getnetbyname_r_proto'
25261 getnetent_r_proto='$getnetent_r_proto'
25262 getprotobyname_r_proto='$getprotobyname_r_proto'
25263 getprotobynumber_r_proto='$getprotobynumber_r_proto'
25264 getprotoent_r_proto='$getprotoent_r_proto'
25265 getpwent_r_proto='$getpwent_r_proto'
25266 getpwnam_r_proto='$getpwnam_r_proto'
25267 getpwuid_r_proto='$getpwuid_r_proto'
25268 getservbyname_r_proto='$getservbyname_r_proto'
25269 getservbyport_r_proto='$getservbyport_r_proto'
25270 getservent_r_proto='$getservent_r_proto'
25271 getspnam_r_proto='$getspnam_r_proto'
25272 gidformat='$gidformat'
25273 gidsign='$gidsign'
25274 gidsize='$gidsize'
25275 gidtype='$gidtype'
25276 glibpth='$glibpth'
25277 gmake='$gmake'
25278 gmtime_r_proto='$gmtime_r_proto'
25279 gnulibc_version='$gnulibc_version'
25280 grep='$grep'
25281 groupcat='$groupcat'
25282 groupstype='$groupstype'
25283 gzip='$gzip'
25284 h_fcntl='$h_fcntl'
25285 h_sysfile='$h_sysfile'
25286 hint='$hint'
25287 hostcat='$hostcat'
25288 hostgenerate='$hostgenerate'
25289 hostosname='$hostosname'
25290 hostperl='$hostperl'
25291 html1dir='$html1dir'
25292 html1direxp='$html1direxp'
25293 html3dir='$html3dir'
25294 html3direxp='$html3direxp'
25295 i16size='$i16size'
25296 i16type='$i16type'
25297 i32dformat='$i32dformat'
25298 i32size='$i32size'
25299 i32type='$i32type'
25300 i64size='$i64size'
25301 i64type='$i64type'
25302 i8size='$i8size'
25303 i8type='$i8type'
25304 i_arpainet='$i_arpainet'
25305 i_bfd='$i_bfd'
25306 i_bsdioctl='$i_bsdioctl'
25307 i_crypt='$i_crypt'
25308 i_db='$i_db'
25309 i_dbm='$i_dbm'
25310 i_dirent='$i_dirent'
25311 i_dlfcn='$i_dlfcn'
25312 i_execinfo='$i_execinfo'
25313 i_fcntl='$i_fcntl'
25314 i_fenv='$i_fenv'
25315 i_fp='$i_fp'
25316 i_fp_class='$i_fp_class'
25317 i_gdbm='$i_gdbm'
25318 i_gdbm_ndbm='$i_gdbm_ndbm'
25319 i_gdbmndbm='$i_gdbmndbm'
25320 i_grp='$i_grp'
25321 i_ieeefp='$i_ieeefp'
25322 i_inttypes='$i_inttypes'
25323 i_langinfo='$i_langinfo'
25324 i_libutil='$i_libutil'
25325 i_locale='$i_locale'
25326 i_machcthr='$i_machcthr'
25327 i_malloc='$i_malloc'
25328 i_mallocmalloc='$i_mallocmalloc'
25329 i_mntent='$i_mntent'
25330 i_ndbm='$i_ndbm'
25331 i_netdb='$i_netdb'
25332 i_neterrno='$i_neterrno'
25333 i_netinettcp='$i_netinettcp'
25334 i_niin='$i_niin'
25335 i_poll='$i_poll'
25336 i_prot='$i_prot'
25337 i_pthread='$i_pthread'
25338 i_pwd='$i_pwd'
25339 i_quadmath='$i_quadmath'
25340 i_rpcsvcdbm='$i_rpcsvcdbm'
25341 i_sgtty='$i_sgtty'
25342 i_shadow='$i_shadow'
25343 i_socks='$i_socks'
25344 i_stdbool='$i_stdbool'
25345 i_stdint='$i_stdint'
25346 i_stdlib='$i_stdlib'
25347 i_sunmath='$i_sunmath'
25348 i_sysaccess='$i_sysaccess'
25349 i_sysdir='$i_sysdir'
25350 i_sysfile='$i_sysfile'
25351 i_sysfilio='$i_sysfilio'
25352 i_sysin='$i_sysin'
25353 i_sysioctl='$i_sysioctl'
25354 i_syslog='$i_syslog'
25355 i_sysmman='$i_sysmman'
25356 i_sysmode='$i_sysmode'
25357 i_sysmount='$i_sysmount'
25358 i_sysndir='$i_sysndir'
25359 i_sysparam='$i_sysparam'
25360 i_syspoll='$i_syspoll'
25361 i_sysresrc='$i_sysresrc'
25362 i_syssecrt='$i_syssecrt'
25363 i_sysselct='$i_sysselct'
25364 i_syssockio='$i_syssockio'
25365 i_sysstat='$i_sysstat'
25366 i_sysstatfs='$i_sysstatfs'
25367 i_sysstatvfs='$i_sysstatvfs'
25368 i_systime='$i_systime'
25369 i_systimek='$i_systimek'
25370 i_systimes='$i_systimes'
25371 i_systypes='$i_systypes'
25372 i_sysuio='$i_sysuio'
25373 i_sysun='$i_sysun'
25374 i_sysutsname='$i_sysutsname'
25375 i_sysvfs='$i_sysvfs'
25376 i_syswait='$i_syswait'
25377 i_termio='$i_termio'
25378 i_termios='$i_termios'
25379 i_time='$i_time'
25380 i_unistd='$i_unistd'
25381 i_ustat='$i_ustat'
25382 i_utime='$i_utime'
25383 i_vfork='$i_vfork'
25384 i_wchar='$i_wchar'
25385 i_wctype='$i_wctype'
25386 i_xlocale='$i_xlocale'
25387 ignore_versioned_solibs='$ignore_versioned_solibs'
25388 inc_version_list='$inc_version_list'
25389 inc_version_list_init='$inc_version_list_init'
25390 incpath='$incpath'
25391 incpth='$incpth'
25392 inews='$inews'
25393 initialinstalllocation='$initialinstalllocation'
25394 installarchlib='$installarchlib'
25395 installbin='$installbin'
25396 installhtml1dir='$installhtml1dir'
25397 installhtml3dir='$installhtml3dir'
25398 installman1dir='$installman1dir'
25399 installman3dir='$installman3dir'
25400 installprefix='$installprefix'
25401 installprefixexp='$installprefixexp'
25402 installprivlib='$installprivlib'
25403 installscript='$installscript'
25404 installsitearch='$installsitearch'
25405 installsitebin='$installsitebin'
25406 installsitehtml1dir='$installsitehtml1dir'
25407 installsitehtml3dir='$installsitehtml3dir'
25408 installsitelib='$installsitelib'
25409 installsiteman1dir='$installsiteman1dir'
25410 installsiteman3dir='$installsiteman3dir'
25411 installsitescript='$installsitescript'
25412 installstyle='$installstyle'
25413 installusrbinperl='$installusrbinperl'
25414 installvendorarch='$installvendorarch'
25415 installvendorbin='$installvendorbin'
25416 installvendorhtml1dir='$installvendorhtml1dir'
25417 installvendorhtml3dir='$installvendorhtml3dir'
25418 installvendorlib='$installvendorlib'
25419 installvendorman1dir='$installvendorman1dir'
25420 installvendorman3dir='$installvendorman3dir'
25421 installvendorscript='$installvendorscript'
25422 intsize='$intsize'
25423 issymlink='$issymlink'
25424 ivdformat='$ivdformat'
25425 ivsize='$ivsize'
25426 ivtype='$ivtype'
25427 known_extensions='$known_extensions'
25428 ksh='$ksh'
25429 ld='$ld'
25430 ld_can_script='$ld_can_script'
25431 lddlflags='$lddlflags'
25432 ldflags='$ldflags'
25433 ldflags_uselargefiles='$ldflags_uselargefiles'
25434 ldlibpthname='$ldlibpthname'
25435 less='$less'
25436 lib_ext='$lib_ext'
25437 libc='$libc'
25438 libperl='$libperl'
25439 libpth='$libpth'
25440 libs='$libs'
25441 libsdirs='$libsdirs'
25442 libsfiles='$libsfiles'
25443 libsfound='$libsfound'
25444 libspath='$libspath'
25445 libswanted='$libswanted'
25446 libswanted_uselargefiles='$libswanted_uselargefiles'
25447 line='$line'
25448 lint='$lint'
25449 lkflags='$lkflags'
25450 ln='$ln'
25451 lns='$lns'
25452 localtime_r_proto='$localtime_r_proto'
25453 locincpth='$locincpth'
25454 loclibpth='$loclibpth'
25455 longdblinfbytes='$longdblinfbytes'
25456 longdblkind='$longdblkind'
25457 longdblmantbits='$longdblmantbits'
25458 longdblnanbytes='$longdblnanbytes'
25459 longdblsize='$longdblsize'
25460 longlongsize='$longlongsize'
25461 longsize='$longsize'
25462 lp='$lp'
25463 lpr='$lpr'
25464 ls='$ls'
25465 lseeksize='$lseeksize'
25466 lseektype='$lseektype'
25467 mail='$mail'
25468 mailx='$mailx'
25469 make='$make'
25470 make_set_make='$make_set_make'
25471 mallocobj='$mallocobj'
25472 mallocsrc='$mallocsrc'
25473 malloctype='$malloctype'
25474 man1dir='$man1dir'
25475 man1direxp='$man1direxp'
25476 man1ext='$man1ext'
25477 man3dir='$man3dir'
25478 man3direxp='$man3direxp'
25479 man3ext='$man3ext'
25480 mips_type='$mips_type'
25481 mistrustnm='$mistrustnm'
25482 mkdir='$mkdir'
25483 mmaptype='$mmaptype'
25484 modetype='$modetype'
25485 more='$more'
25486 multiarch='$multiarch'
25487 mv='$mv'
25488 myarchname='$myarchname'
25489 mydomain='$mydomain'
25490 myhostname='$myhostname'
25491 myuname='$myuname'
25492 n='$n'
25493 need_va_copy='$need_va_copy'
25494 netdb_hlen_type='$netdb_hlen_type'
25495 netdb_host_type='$netdb_host_type'
25496 netdb_name_type='$netdb_name_type'
25497 netdb_net_type='$netdb_net_type'
25498 nm='$nm'
25499 nm_opt='$nm_opt'
25500 nm_so_opt='$nm_so_opt'
25501 nonxs_ext='$nonxs_ext'
25502 nroff='$nroff'
25503 nvEUformat='$nvEUformat'
25504 nvFUformat='$nvFUformat'
25505 nvGUformat='$nvGUformat'
25506 nv_overflows_integers_at='$nv_overflows_integers_at'
25507 nv_preserves_uv_bits='$nv_preserves_uv_bits'
25508 nveformat='$nveformat'
25509 nvfformat='$nvfformat'
25510 nvgformat='$nvgformat'
25511 nvmantbits='$nvmantbits'
25512 nvsize='$nvsize'
25513 nvtype='$nvtype'
25514 o_nonblock='$o_nonblock'
25515 obj_ext='$obj_ext'
25516 old_pthread_create_joinable='$old_pthread_create_joinable'
25517 optimize='$optimize'
25518 orderlib='$orderlib'
25519 osname='$osname'
25520 osvers='$osvers'
25521 otherlibdirs='$otherlibdirs'
25522 package='$package'
25523 pager='$pager'
25524 passcat='$passcat'
25525 patchlevel='$patchlevel'
25526 path_sep='$path_sep'
25527 perl5='$perl5'
25528 perl='$perl'
25529 perl_patchlevel='$perl_patchlevel'
25530 perl_static_inline='$perl_static_inline'
25531 perl_thread_local='$perl_thread_local'
25532 perladmin='$perladmin'
25533 perllibs='$perllibs'
25534 perlpath='$perlpath'
25535 pg='$pg'
25536 phostname='$phostname'
25537 pidtype='$pidtype'
25538 plibpth='$plibpth'
25539 pmake='$pmake'
25540 pr='$pr'
25541 prefix='$prefix'
25542 prefixexp='$prefixexp'
25543 privlib='$privlib'
25544 privlibexp='$privlibexp'
25545 procselfexe='$procselfexe'
25546 ptrsize='$ptrsize'
25547 quadkind='$quadkind'
25548 quadtype='$quadtype'
25549 randbits='$randbits'
25550 randfunc='$randfunc'
25551 random_r_proto='$random_r_proto'
25552 randseedtype='$randseedtype'
25553 ranlib='$ranlib'
25554 rd_nodata='$rd_nodata'
25555 readdir64_r_proto='$readdir64_r_proto'
25556 readdir_r_proto='$readdir_r_proto'
25557 revision='$revision'
25558 rm='$rm'
25559 rm_try='$rm_try'
25560 rmail='$rmail'
25561 run='$run'
25562 runnm='$runnm'
25563 sGMTIME_max='$sGMTIME_max'
25564 sGMTIME_min='$sGMTIME_min'
25565 sLOCALTIME_max='$sLOCALTIME_max'
25566 sLOCALTIME_min='$sLOCALTIME_min'
25567 sPRIEUldbl='$sPRIEUldbl'
25568 sPRIFUldbl='$sPRIFUldbl'
25569 sPRIGUldbl='$sPRIGUldbl'
25570 sPRIXU64='$sPRIXU64'
25571 sPRId64='$sPRId64'
25572 sPRIeldbl='$sPRIeldbl'
25573 sPRIfldbl='$sPRIfldbl'
25574 sPRIgldbl='$sPRIgldbl'
25575 sPRIi64='$sPRIi64'
25576 sPRIo64='$sPRIo64'
25577 sPRIu64='$sPRIu64'
25578 sPRIx64='$sPRIx64'
25579 sSCNfldbl='$sSCNfldbl'
25580 sched_yield='$sched_yield'
25581 scriptdir='$scriptdir'
25582 scriptdirexp='$scriptdirexp'
25583 sed='$sed'
25584 seedfunc='$seedfunc'
25585 selectminbits='$selectminbits'
25586 selecttype='$selecttype'
25587 sendmail='$sendmail'
25588 setgrent_r_proto='$setgrent_r_proto'
25589 sethostent_r_proto='$sethostent_r_proto'
25590 setlocale_r_proto='$setlocale_r_proto'
25591 setnetent_r_proto='$setnetent_r_proto'
25592 setprotoent_r_proto='$setprotoent_r_proto'
25593 setpwent_r_proto='$setpwent_r_proto'
25594 setservent_r_proto='$setservent_r_proto'
25595 sh='$sh'
25596 shar='$shar'
25597 sharpbang='$sharpbang'
25598 shmattype='$shmattype'
25599 shortsize='$shortsize'
25600 shrpenv='$shrpenv'
25601 shsharp='$shsharp'
25602 sig_count='$sig_count'
25603 sig_name='$sig_name'
25604 sig_name_init='$sig_name_init'
25605 sig_num='$sig_num'
25606 sig_num_init='$sig_num_init'
25607 sig_size='$sig_size'
25608 signal_t='$signal_t'
25609 sitearch='$sitearch'
25610 sitearchexp='$sitearchexp'
25611 sitebin='$sitebin'
25612 sitebinexp='$sitebinexp'
25613 sitehtml1dir='$sitehtml1dir'
25614 sitehtml1direxp='$sitehtml1direxp'
25615 sitehtml3dir='$sitehtml3dir'
25616 sitehtml3direxp='$sitehtml3direxp'
25617 sitelib='$sitelib'
25618 sitelib_stem='$sitelib_stem'
25619 sitelibexp='$sitelibexp'
25620 siteman1dir='$siteman1dir'
25621 siteman1direxp='$siteman1direxp'
25622 siteman3dir='$siteman3dir'
25623 siteman3direxp='$siteman3direxp'
25624 siteprefix='$siteprefix'
25625 siteprefixexp='$siteprefixexp'
25626 sitescript='$sitescript'
25627 sitescriptexp='$sitescriptexp'
25628 sizesize='$sizesize'
25629 sizetype='$sizetype'
25630 sleep='$sleep'
25631 smail='$smail'
25632 so='$so'
25633 sockethdr='$sockethdr'
25634 socketlib='$socketlib'
25635 socksizetype='$socksizetype'
25636 sort='$sort'
25637 spackage='$spackage'
25638 spitshell='$spitshell'
25639 srand48_r_proto='$srand48_r_proto'
25640 srandom_r_proto='$srandom_r_proto'
25641 src='$src'
25642 ssizetype='$ssizetype'
25643 st_dev_sign='$st_dev_sign'
25644 st_dev_size='$st_dev_size'
25645 st_ino_sign='$st_ino_sign'
25646 st_ino_size='$st_ino_size'
25647 startperl='$startperl'
25648 startsh='$startsh'
25649 static_ext='$static_ext'
25650 stdchar='$stdchar'
25651 stdio_base='$stdio_base'
25652 stdio_bufsiz='$stdio_bufsiz'
25653 stdio_cnt='$stdio_cnt'
25654 stdio_filbuf='$stdio_filbuf'
25655 stdio_ptr='$stdio_ptr'
25656 stdio_stream_array='$stdio_stream_array'
25657 strerror_r_proto='$strerror_r_proto'
25658 submit='$submit'
25659 subversion='$subversion'
25660 sysman='$sysman'
25661 sysroot='$sysroot'
25662 tail='$tail'
25663 tar='$tar'
25664 targetarch='$targetarch'
25665 targetdir='$targetdir'
25666 targetenv='$targetenv'
25667 targethost='$targethost'
25668 targetmkdir='$targetmkdir'
25669 targetport='$targetport'
25670 targetsh='$targetsh'
25671 tbl='$tbl'
25672 tee='$tee'
25673 test='$test'
25674 timeincl='$timeincl'
25675 timetype='$timetype'
25676 tmpnam_r_proto='$tmpnam_r_proto'
25677 to='$to'
25678 touch='$touch'
25679 tr='$tr'
25680 trnl='$trnl'
25681 troff='$troff'
25682 ttyname_r_proto='$ttyname_r_proto'
25683 u16size='$u16size'
25684 u16type='$u16type'
25685 u32XUformat='$u32XUformat'
25686 u32oformat='$u32oformat'
25687 u32size='$u32size'
25688 u32type='$u32type'
25689 u32uformat='$u32uformat'
25690 u32xformat='$u32xformat'
25691 u64size='$u64size'
25692 u64type='$u64type'
25693 u8size='$u8size'
25694 u8type='$u8type'
25695 uidformat='$uidformat'
25696 uidsign='$uidsign'
25697 uidsize='$uidsize'
25698 uidtype='$uidtype'
25699 uname='$uname'
25700 uniq='$uniq'
25701 uquadtype='$uquadtype'
25702 use64bitall='$use64bitall'
25703 use64bitint='$use64bitint'
25704 usecbacktrace='$usecbacktrace'
25705 usecrosscompile='$usecrosscompile'
25706 usedefaultstrict='$usedefaultstrict'
25707 usedevel='$usedevel'
25708 usedl='$usedl'
25709 usedtrace='$usedtrace'
25710 usefaststdio='$usefaststdio'
25711 useithreads='$useithreads'
25712 usekernprocpathname='$usekernprocpathname'
25713 uselanginfo='$uselanginfo'
25714 uselargefiles='$uselargefiles'
25715 uselongdouble='$uselongdouble'
25716 usemallocwrap='$usemallocwrap'
25717 usemorebits='$usemorebits'
25718 usemultiplicity='$usemultiplicity'
25719 usemymalloc='$usemymalloc'
25720 usenm='$usenm'
25721 usensgetexecutablepath='$usensgetexecutablepath'
25722 useopcode='$useopcode'
25723 useperlio='$useperlio'
25724 useposix='$useposix'
25725 usequadmath='$usequadmath'
25726 usereentrant='$usereentrant'
25727 userelocatableinc='$userelocatableinc'
25728 useshrplib='$useshrplib'
25729 usesitecustomize='$usesitecustomize'
25730 usesocks='$usesocks'
25731 usethreads='$usethreads'
25732 usevendorprefix='$usevendorprefix'
25733 useversionedarchname='$useversionedarchname'
25734 usevfork='$usevfork'
25735 usrinc='$usrinc'
25736 uuname='$uuname'
25737 uvXUformat='$uvXUformat'
25738 uvoformat='$uvoformat'
25739 uvsize='$uvsize'
25740 uvtype='$uvtype'
25741 uvuformat='$uvuformat'
25742 uvxformat='$uvxformat'
25743 vendorarch='$vendorarch'
25744 vendorarchexp='$vendorarchexp'
25745 vendorbin='$vendorbin'
25746 vendorbinexp='$vendorbinexp'
25747 vendorhtml1dir='$vendorhtml1dir'
25748 vendorhtml1direxp='$vendorhtml1direxp'
25749 vendorhtml3dir='$vendorhtml3dir'
25750 vendorhtml3direxp='$vendorhtml3direxp'
25751 vendorlib='$vendorlib'
25752 vendorlib_stem='$vendorlib_stem'
25753 vendorlibexp='$vendorlibexp'
25754 vendorman1dir='$vendorman1dir'
25755 vendorman1direxp='$vendorman1direxp'
25756 vendorman3dir='$vendorman3dir'
25757 vendorman3direxp='$vendorman3direxp'
25758 vendorprefix='$vendorprefix'
25759 vendorprefixexp='$vendorprefixexp'
25760 vendorscript='$vendorscript'
25761 vendorscriptexp='$vendorscriptexp'
25762 version='$version'
25763 version_patchlevel_string='$version_patchlevel_string'
25764 versiononly='$versiononly'
25765 vi='$vi'
25766 xlibpth='$xlibpth'
25767 xlocale_needed='$xlocale_needed'
25768 yacc='$yacc'
25769 yaccflags='$yaccflags'
25770 zcat='$zcat'
25771 zip='$zip'
25772 EOT
25773
25774 : add special variables
25775 $test -f $src/patchlevel.h && \
25776 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25777 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25778 echo "PERL_CONFIG_SH=true" >>config.sh
25779
25780 : propagate old symbols
25781 if $test -f UU/config.sh; then
25782         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25783         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25784                 config.sh config.sh UU/oldconfig.sh |\
25785                 $sort | $uniq -u >UU/oldsyms
25786         set X `$cat UU/oldsyms`
25787         shift
25788         case $# in
25789         0) ;;
25790         *)
25791                 $cat <<EOM
25792 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25793 EOM
25794                 echo ": Variables propagated from previous config.sh file." >>config.sh
25795                 for sym in `$cat UU/oldsyms`; do
25796                         echo "    Propagating $hint variable "'$'"$sym..."
25797                         eval 'tmp="$'"${sym}"'"'
25798                         echo "$tmp" | \
25799                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25800                 done
25801                 ;;
25802         esac
25803 fi
25804
25805 : preserve RCS keywords in files with variable substitution, grrr
25806 Id='$Id'
25807
25808 : Finish up by extracting the .SH files
25809 case "$alldone" in
25810 exit)
25811         echo "Stopping at your request, leaving temporary files around."
25812         exit 0
25813         ;;
25814 cont)
25815         ;;
25816 '')
25817         dflt=''
25818         nostick=true
25819         $cat <<EOM
25820
25821 If you'd like to make any changes to the config.sh file before I begin
25822 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25823
25824 EOM
25825         rp="Press return or use a shell escape to edit config.sh:"
25826         . UU/myread
25827         nostick=''
25828         case "$ans" in
25829         '') ;;
25830         *) : in case they cannot read
25831                 sh 1>&4 -c "$ans";;
25832         esac
25833         ;;
25834 esac
25835
25836 : if this fails, just run all the .SH files by hand
25837 . ./config.sh
25838
25839 echo " "
25840 exec 1>&4
25841 pwd=`pwd`
25842 . ./UU/extract
25843 cd "$pwd"
25844
25845 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25846         dflt=y
25847         case "$silent" in
25848         true) ;;
25849         *)
25850                 $cat <<EOM
25851
25852 Now you need to generate make dependencies by running "$make depend".
25853 You might prefer to run it in background: "$make depend > makedepend.out &"
25854 It can take a while, so you might not want to run it right now.
25855
25856 EOM
25857                 ;;
25858         esac
25859         rp="Run $make depend now?"
25860         . UU/myread
25861         case "$ans" in
25862         y*)
25863                 $make depend && echo "Now you must run '$make'."
25864                 ;;
25865         *)
25866                 echo "You must run '$make depend' then '$make'."
25867                 ;;
25868         esac
25869 elif test -f [Mm]akefile; then
25870         echo " "
25871         echo "Now you must run a $make."
25872 else
25873         echo "Configure done."
25874 fi
25875
25876 if $test -f Policy.sh; then
25877     $cat <<EOM
25878
25879 If you compile $package on a different machine or from a different object
25880 directory, copy the Policy.sh file from this object directory to the
25881 new one before you run Configure -- this will help you with most of
25882 the policy defaults.
25883
25884 EOM
25885 fi
25886 if $test -f UU/config.msg; then
25887     echo "Hmm.  I also noted the following information while running:"
25888     echo " "
25889     $cat UU/config.msg >&4
25890 fi
25891 $rm -f kit*isdone ark*isdone
25892 $rm -rf UU
25893
25894 : End of Configure
25895