This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl - update usage data to match perlrun
[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_warn_unused_result=''
395 d_printf_format_null=''
396 d_backtrace=''
397 d_builtin_choose_expr=''
398 d_builtin_expect=''
399 d_builtin_add_overflow=''
400 d_builtin_mul_overflow=''
401 d_builtin_sub_overflow=''
402 d_c99_variadic_macros=''
403 d_casti32=''
404 castflags=''
405 d_castneg=''
406 d_cbrt=''
407 d_chown=''
408 d_chroot=''
409 d_chsize=''
410 d_class=''
411 d_clearenv=''
412 d_closedir=''
413 d_void_closedir=''
414 d_cmsghdr_s=''
415 d_copysign=''
416 d_copysignl=''
417 d_cplusplus=''
418 cryptlib=''
419 d_crypt=''
420 crypt_r_proto=''
421 d_crypt_r=''
422 d_csh=''
423 full_csh=''
424 d_ctermid=''
425 ctermid_r_proto=''
426 d_ctermid_r=''
427 ctime_r_proto=''
428 d_ctime_r=''
429 d_cuserid=''
430 d_dbminitproto=''
431 d_difftime=''
432 d_dir_dd_fd=''
433 d_dirfd=''
434 d_dladdr=''
435 d_dlerror=''
436 d_dlopen=''
437 d_dlsymun=''
438 d_dosuid=''
439 d_suidsafe=''
440 d_drand48_r=''
441 drand48_r_proto=''
442 d_drand48proto=''
443 d_dup2=''
444 d_dup3=''
445 d_eaccess=''
446 d_endgrent=''
447 d_endgrent_r=''
448 endgrent_r_proto=''
449 d_endhent=''
450 d_endhostent_r=''
451 endhostent_r_proto=''
452 d_endnent=''
453 d_endnetent_r=''
454 endnetent_r_proto=''
455 d_endpent=''
456 d_endprotoent_r=''
457 endprotoent_r_proto=''
458 d_endpwent=''
459 d_endpwent_r=''
460 endpwent_r_proto=''
461 d_endsent=''
462 d_endservent_r=''
463 endservent_r_proto=''
464 d_erf=''
465 d_erfc=''
466 d_exp2=''
467 d_expm1=''
468 d_faststdio=''
469 d_fchdir=''
470 d_fchmod=''
471 d_fchown=''
472 d_fcntl=''
473 d_fcntl_can_lock=''
474 d_fd_macros=''
475 d_fd_set=''
476 d_fds_bits=''
477 d_fdclose=''
478 d_fdim=''
479 d_fegetround=''
480 d_fgetpos=''
481 d_finite=''
482 d_finitel=''
483 d_flexfnam=''
484 d_flock=''
485 d_flockproto=''
486 d_fma=''
487 d_fmax=''
488 d_fmin=''
489 d_fork=''
490 d_fp_class=''
491 d_fp_classl=''
492 d_fpclass=''
493 d_fp_classify=''
494 d_fpclassify=''
495 d_fpclassl=''
496 d_fpgetround=''
497 d_fpos64_t=''
498 d_frexpl=''
499 d_fs_data_s=''
500 d_fchmodat=''
501 d_linkat=''
502 d_openat=''
503 d_renameat=''
504 d_unlinkat=''
505 d_fseeko=''
506 d_fsetpos=''
507 d_fstatfs=''
508 d_fsync=''
509 d_ftello=''
510 d_ftime=''
511 d_gettimeod=''
512 d_futimes=''
513 d_gai_strerror=''
514 d_Gconvert=''
515 d_getaddrinfo=''
516 d_getcwd=''
517 d_getespwnam=''
518 d_getfsstat=''
519 d_getgrent=''
520 d_getgrent_r=''
521 getgrent_r_proto=''
522 d_getgrgid_r=''
523 getgrgid_r_proto=''
524 d_getgrnam_r=''
525 getgrnam_r_proto=''
526 d_getgrps=''
527 d_gethbyaddr=''
528 d_gethbyname=''
529 d_gethent=''
530 aphostname=''
531 d_gethname=''
532 d_phostname=''
533 d_uname=''
534 d_gethostbyaddr_r=''
535 gethostbyaddr_r_proto=''
536 d_gethostbyname_r=''
537 gethostbyname_r_proto=''
538 d_gethostent_r=''
539 gethostent_r_proto=''
540 d_gethostprotos=''
541 d_getitimer=''
542 d_getlogin=''
543 d_getlogin_r=''
544 getlogin_r_proto=''
545 d_getmnt=''
546 d_getmntent=''
547 d_getnameinfo=''
548 d_getnbyaddr=''
549 d_getnbyname=''
550 d_getnent=''
551 d_getnetbyaddr_r=''
552 getnetbyaddr_r_proto=''
553 d_getnetbyname_r=''
554 getnetbyname_r_proto=''
555 d_getnetent_r=''
556 getnetent_r_proto=''
557 d_getnetprotos=''
558 d_getpagsz=''
559 d_getpent=''
560 d_getpgid=''
561 d_getpgrp2=''
562 d_bsdgetpgrp=''
563 d_getpgrp=''
564 d_getppid=''
565 d_getprior=''
566 d_getpbyname=''
567 d_getpbynumber=''
568 d_getprotobyname_r=''
569 getprotobyname_r_proto=''
570 d_getprotobynumber_r=''
571 getprotobynumber_r_proto=''
572 d_getprotoent_r=''
573 getprotoent_r_proto=''
574 d_getprotoprotos=''
575 d_getprpwnam=''
576 d_getpwent=''
577 d_getpwent_r=''
578 getpwent_r_proto=''
579 d_getpwnam_r=''
580 getpwnam_r_proto=''
581 d_getpwuid_r=''
582 getpwuid_r_proto=''
583 d_getsent=''
584 d_getservbyname_r=''
585 getservbyname_r_proto=''
586 d_getservbyport_r=''
587 getservbyport_r_proto=''
588 d_getservent_r=''
589 getservent_r_proto=''
590 d_getservprotos=''
591 d_getspnam=''
592 d_getspnam_r=''
593 getspnam_r_proto=''
594 d_getsbyname=''
595 d_getsbyport=''
596 d_gmtime_r=''
597 gmtime_r_proto=''
598 d_gnulibc=''
599 gnulibc_version=''
600 d_hasmntopt=''
601 d_htonl=''
602 d_hypot=''
603 d_ilogb=''
604 d_ilogbl=''
605 d_inetaton=''
606 d_inetntop=''
607 d_inetpton=''
608 d_int64_t=''
609 d_isascii=''
610 d_isblank=''
611 d_isfinite=''
612 d_isfinitel=''
613 d_isinf=''
614 d_isinfl=''
615 d_isless=''
616 d_isnan=''
617 d_isnanl=''
618 d_isnormal=''
619 d_j0=''
620 d_j0l=''
621 d_killpg=''
622 d_lc_monetary_2008=''
623 d_lchown=''
624 d_ldbl_dig=''
625 d_lgamma=''
626 d_lgamma_r=''
627 d_libm_lib_version=''
628 d_link=''
629 d_llrint=''
630 d_llrintl=''
631 d_llround=''
632 d_llroundl=''
633 d_localeconv_l=''
634 d_localtime_r=''
635 d_localtime_r_needs_tzset=''
636 localtime_r_proto=''
637 d_locconv=''
638 d_lockf=''
639 d_log1p=''
640 d_log2=''
641 d_logb=''
642 d_ldexpl=''
643 d_long_double_style_ieee=''
644 d_long_double_style_ieee_doubledouble=''
645 d_long_double_style_ieee_extended=''
646 d_long_double_style_ieee_std=''
647 d_long_double_style_vax=''
648 d_longdbl=''
649 longdblkind=''
650 longdblsize=''
651 d_longlong=''
652 longlongsize=''
653 d_lrint=''
654 d_lrintl=''
655 d_lround=''
656 d_lroundl=''
657 d_lseekproto=''
658 d_lstat=''
659 d_madvise=''
660 d_malloc_good_size=''
661 d_malloc_size=''
662 d_malloc_usable_size=''
663 d_mblen=''
664 d_mbrlen=''
665 d_mbrtowc=''
666 d_mbstowcs=''
667 d_mbtowc=''
668 d_memmem=''
669 d_memrchr=''
670 d_mkdir=''
671 d_mkdtemp=''
672 d_mkfifo=''
673 d_mkostemp=''
674 d_mkstemp=''
675 d_mkstemps=''
676 d_mktime=''
677 d_mmap=''
678 mmaptype=''
679 d_modfl=''
680 d_modflproto=''
681 d_mprotect=''
682 d_msg=''
683 d_msgctl=''
684 d_msgget=''
685 d_msghdr_s=''
686 d_msgrcv=''
687 d_msgsnd=''
688 d_msync=''
689 d_munmap=''
690 d_nan=''
691 d_nanosleep=''
692 d_nearbyint=''
693 d_duplocale=''
694 d_freelocale=''
695 d_newlocale=''
696 d_querylocale=''
697 d_uselocale=''
698 i_xlocale=''
699 d_nextafter=''
700 d_nexttoward=''
701 d_nice=''
702 d_nl_langinfo=''
703 d_thread_safe_nl_langinfo_l=''
704 d_off64_t=''
705 d_open3=''
706 d_fpathconf=''
707 d_pathconf=''
708 d_pause=''
709 d_pipe2=''
710 d_pipe=''
711 d_poll=''
712 d_portable=''
713 d_prctl=''
714 d_prctl_set_name=''
715 d_procselfexe=''
716 procselfexe=''
717 d_old_pthread_create_joinable=''
718 old_pthread_create_joinable=''
719 d_pthread_atfork=''
720 d_pthread_attr_setscope=''
721 d_pthread_yield=''
722 d_sched_yield=''
723 sched_yield=''
724 d_ptrdiff_t=''
725 d_qgcvt=''
726 d_random_r=''
727 random_r_proto=''
728 d_readdir64_r=''
729 readdir64_r_proto=''
730 d_readdir=''
731 d_rewinddir=''
732 d_seekdir=''
733 d_telldir=''
734 d_readdir_r=''
735 readdir_r_proto=''
736 d_readlink=''
737 d_readv=''
738 d_recvmsg=''
739 d_re_comp=''
740 d_regcmp=''
741 d_regcomp=''
742 d_remainder=''
743 d_remquo=''
744 d_rename=''
745 d_rint=''
746 d_rmdir=''
747 d_round=''
748 d_sbrkproto=''
749 d_scalbn=''
750 d_scalbnl=''
751 d_select=''
752 d_sem=''
753 d_semctl=''
754 d_semget=''
755 d_semop=''
756 d_sendmsg=''
757 d_setegid=''
758 d_seteuid=''
759 d_setgrent=''
760 d_setgrent_r=''
761 setgrent_r_proto=''
762 d_setgrps=''
763 d_sethent=''
764 d_sethostent_r=''
765 sethostent_r_proto=''
766 d_setitimer=''
767 d_setlinebuf=''
768 d_has_C_UTF8=''
769 d_setlocale=''
770 d_setlocale_accepts_any_locale_name=''
771 d_setlocale_r=''
772 setlocale_r_proto=''
773 d_setnent=''
774 d_setnetent_r=''
775 setnetent_r_proto=''
776 d_setpent=''
777 d_setpgid=''
778 d_setpgrp2=''
779 d_bsdsetpgrp=''
780 d_setpgrp=''
781 d_setprior=''
782 d_setproctitle=''
783 d_setprotoent_r=''
784 setprotoent_r_proto=''
785 d_setpwent=''
786 d_setpwent_r=''
787 setpwent_r_proto=''
788 d_setregid=''
789 d_setresgid=''
790 d_setresuid=''
791 d_setreuid=''
792 d_setrgid=''
793 d_setruid=''
794 d_setsent=''
795 d_setservent_r=''
796 setservent_r_proto=''
797 d_setsid=''
798 d_setvbuf=''
799 d_shm=''
800 d_shmat=''
801 d_shmatprototype=''
802 shmattype=''
803 d_shmctl=''
804 d_shmdt=''
805 d_shmget=''
806 d_sigaction=''
807 d_siginfo_si_addr=''
808 d_siginfo_si_band=''
809 d_siginfo_si_errno=''
810 d_siginfo_si_fd=''
811 d_siginfo_si_pid=''
812 d_siginfo_si_status=''
813 d_siginfo_si_uid=''
814 d_siginfo_si_value=''
815 d_signbit=''
816 d_sigprocmask=''
817 d_sigsetjmp=''
818 usesitecustomize=''
819 d_snprintf=''
820 d_vsnprintf=''
821 d_sockatmark=''
822 d_sockatmarkproto=''
823 d_ip_mreq=''
824 d_ip_mreq_source=''
825 d_ipv6_mreq=''
826 d_ipv6_mreq_source=''
827 d_msg_ctrunc=''
828 d_msg_dontroute=''
829 d_msg_oob=''
830 d_msg_peek=''
831 d_msg_proxy=''
832 d_oldsock=''
833 d_scm_rights=''
834 d_sin6_scope_id=''
835 d_sockaddr_in6=''
836 d_sockaddr_sa_len=''
837 d_sockaddr_storage=''
838 d_socket=''
839 d_sockpair=''
840 sockethdr=''
841 socketlib=''
842 d_socklen_t=''
843 d_socks5_init=''
844 d_sqrtl=''
845 d_srand48_r=''
846 srand48_r_proto=''
847 d_srandom_r=''
848 srandom_r_proto=''
849 d_sresgproto=''
850 d_sresuproto=''
851 d_stat=''
852 d_statblks=''
853 d_statfs_f_flags=''
854 d_statfs_s=''
855 d_static_inline=''
856 perl_static_inline=''
857 d_fstatvfs=''
858 d_statvfs=''
859 d_stdio_cnt_lval=''
860 d_stdio_ptr_lval=''
861 d_stdio_ptr_lval_nochange_cnt=''
862 d_stdio_ptr_lval_sets_cnt=''
863 d_stdiobase=''
864 d_stdstdio=''
865 stdio_base=''
866 stdio_bufsiz=''
867 stdio_cnt=''
868 stdio_filbuf=''
869 stdio_ptr=''
870 d_strcoll=''
871 d_sysernlst=''
872 d_syserrlst=''
873 d_strerror_l=''
874 d_strerror_r=''
875 strerror_r_proto=''
876 d_strftime=''
877 d_strlcat=''
878 d_strlcpy=''
879 d_strnlen=''
880 d_strtod=''
881 d_strtod_l=''
882 d_strtol=''
883 d_strtold=''
884 d_strtold_l=''
885 d_strtoll=''
886 d_strtoq=''
887 d_strtoul=''
888 d_strtoull=''
889 d_strtouq=''
890 d_strxfrm=''
891 d_symlink=''
892 d_syscall=''
893 d_syscallproto=''
894 d_sysconf=''
895 d_system=''
896 d_tcgetpgrp=''
897 d_tcsetpgrp=''
898 d_telldirproto=''
899 d_tgamma=''
900 d_time=''
901 timetype=''
902 d_asctime64=''
903 d_ctime64=''
904 d_difftime64=''
905 d_gmtime64=''
906 d_localtime64=''
907 d_mktime64=''
908 d_timegm=''
909 clocktype=''
910 d_times=''
911 d_tmpnam_r=''
912 tmpnam_r_proto=''
913 d_towlower=''
914 d_towupper=''
915 d_trunc=''
916 d_truncate=''
917 d_truncl=''
918 d_ttyname_r=''
919 ttyname_r_proto=''
920 d_tzname=''
921 d_u32align=''
922 d_ualarm=''
923 d_umask=''
924 d_semctl_semid_ds=''
925 d_semctl_semun=''
926 d_union_semun=''
927 d_unordered=''
928 d_unsetenv=''
929 d_usleep=''
930 d_usleepproto=''
931 d_ustat=''
932 d_pseudofork=''
933 d_vfork=''
934 usevfork=''
935 d_voidsig=''
936 signal_t=''
937 d_wait4=''
938 d_waitpid=''
939 d_wcrtomb=''
940 d_wcscmp=''
941 d_wcstombs=''
942 d_wcsxfrm=''
943 d_wctomb=''
944 d_writev=''
945 default_inc_excludes_dot=''
946 dlext=''
947 bin_ELF=''
948 cccdlflags=''
949 ccdlflags=''
950 dlsrc=''
951 ld=''
952 ld_can_script=''
953 lddlflags=''
954 usedl=''
955 doublesize=''
956 dtraceobject=''
957 dtracexnolibs=''
958 ebcdic=''
959 fflushNULL=''
960 fflushall=''
961 fpossize=''
962 fpostype=''
963 gccansipedantic=''
964 gccosandvers=''
965 gccversion=''
966 gidformat=''
967 gidsign=''
968 gidsize=''
969 gidtype=''
970 groupstype=''
971 h_fcntl=''
972 h_sysfile=''
973 html1dir=''
974 html1direxp=''
975 installhtml1dir=''
976 html3dir=''
977 html3direxp=''
978 installhtml3dir=''
979 i_arpainet=''
980 i_bfd=''
981 i_crypt=''
982 db_hashtype=''
983 db_prefixtype=''
984 db_version_major=''
985 db_version_minor=''
986 db_version_patch=''
987 i_db=''
988 i_dbm=''
989 i_rpcsvcdbm=''
990 d_dirnamlen=''
991 direntrytype=''
992 i_dirent=''
993 i_dlfcn=''
994 i_execinfo=''
995 i_fcntl=''
996 i_fenv=''
997 i_fp=''
998 i_fp_class=''
999 i_gdbm=''
1000 d_grpasswd=''
1001 i_grp=''
1002 i_ieeefp=''
1003 i_inttypes=''
1004 i_langinfo=''
1005 i_libutil=''
1006 i_locale=''
1007 i_machcthr=''
1008 i_malloc=''
1009 i_mallocmalloc=''
1010 i_mntent=''
1011 d_gdbm_ndbm_h_uses_prototypes=''
1012 d_gdbmndbm_h_uses_prototypes=''
1013 d_ndbm=''
1014 d_ndbm_h_uses_prototypes=''
1015 i_gdbm_ndbm=''
1016 i_gdbmndbm=''
1017 i_ndbm=''
1018 i_netdb=''
1019 i_neterrno=''
1020 i_netinettcp=''
1021 i_niin=''
1022 i_sysin=''
1023 i_poll=''
1024 i_prot=''
1025 i_pthread=''
1026 d_pwage=''
1027 d_pwchange=''
1028 d_pwclass=''
1029 d_pwcomment=''
1030 d_pwexpire=''
1031 d_pwgecos=''
1032 d_pwpasswd=''
1033 d_pwquota=''
1034 i_pwd=''
1035 i_quadmath=''
1036 i_shadow=''
1037 i_socks=''
1038 i_stdbool=''
1039 i_stdint=''
1040 i_stdlib=''
1041 i_sunmath=''
1042 i_sysaccess=''
1043 i_sysdir=''
1044 i_sysfile=''
1045 d_voidtty=''
1046 i_bsdioctl=''
1047 i_sysfilio=''
1048 i_sysioctl=''
1049 i_syssockio=''
1050 i_syslog=''
1051 i_sysmman=''
1052 i_sysmode=''
1053 i_sysmount=''
1054 i_sysndir=''
1055 i_sysparam=''
1056 i_syspoll=''
1057 i_sysresrc=''
1058 i_syssecrt=''
1059 i_sysselct=''
1060 i_sysstat=''
1061 i_sysstatfs=''
1062 i_sysstatvfs=''
1063 i_systimes=''
1064 i_systypes=''
1065 i_sysuio=''
1066 i_sysun=''
1067 i_sysutsname=''
1068 i_sysvfs=''
1069 i_syswait=''
1070 i_sgtty=''
1071 i_termio=''
1072 i_termios=''
1073 d_tm_tm_gmtoff=''
1074 d_tm_tm_zone=''
1075 i_systime=''
1076 i_systimek=''
1077 i_time=''
1078 timeincl=''
1079 i_unistd=''
1080 i_ustat=''
1081 i_utime=''
1082 i_vfork=''
1083 i_wchar=''
1084 i_wctype=''
1085 d_inc_version_list=''
1086 inc_version_list=''
1087 inc_version_list_init=''
1088 doubleinfbytes=''
1089 doublenanbytes=''
1090 longdblinfbytes=''
1091 longdblnanbytes=''
1092 installprefix=''
1093 installprefixexp=''
1094 installstyle=''
1095 installusrbinperl=''
1096 intsize=''
1097 longsize=''
1098 shortsize=''
1099 issymlink=''
1100 libc=''
1101 ldlibpthname=''
1102 libperl=''
1103 shrpenv=''
1104 useshrplib=''
1105 glibpth=''
1106 incpth=''
1107 libpth=''
1108 loclibpth=''
1109 plibpth=''
1110 xlibpth=''
1111 ignore_versioned_solibs=''
1112 libs=''
1113 libsdirs=''
1114 libsfiles=''
1115 libsfound=''
1116 libspath=''
1117 lns=''
1118 d_PRIEUldbl=''
1119 d_PRIFUldbl=''
1120 d_PRIGUldbl=''
1121 d_PRIeldbl=''
1122 d_PRIfldbl=''
1123 d_PRIgldbl=''
1124 d_SCNfldbl=''
1125 d_double_has_inf=''
1126 d_double_has_nan=''
1127 d_double_has_negative_zero=''
1128 d_double_has_subnormals=''
1129 d_double_style_cray=''
1130 d_double_style_ibm=''
1131 d_double_style_ieee=''
1132 d_double_style_vax=''
1133 doublekind=''
1134 sPRIEUldbl=''
1135 sPRIFUldbl=''
1136 sPRIGUldbl=''
1137 sPRIeldbl=''
1138 sPRIfldbl=''
1139 sPRIgldbl=''
1140 sSCNfldbl=''
1141 lseeksize=''
1142 lseektype=''
1143 make_set_make=''
1144 d_mymalloc=''
1145 freetype=''
1146 mallocobj=''
1147 mallocsrc=''
1148 malloctype=''
1149 usemallocwrap=''
1150 usemymalloc=''
1151 installman1dir=''
1152 man1dir=''
1153 man1direxp=''
1154 man1ext=''
1155 installman3dir=''
1156 man3dir=''
1157 man3direxp=''
1158 man3ext=''
1159 doublemantbits=''
1160 longdblmantbits=''
1161 nvmantbits=''
1162 modetype=''
1163 multiarch=''
1164 mydomain=''
1165 myhostname=''
1166 phostname=''
1167 c=''
1168 n=''
1169 d_eofnblk=''
1170 eagain=''
1171 o_nonblock=''
1172 rd_nodata=''
1173 need_va_copy=''
1174 netdb_hlen_type=''
1175 netdb_host_type=''
1176 netdb_name_type=''
1177 netdb_net_type=''
1178 groupcat=''
1179 hostcat=''
1180 passcat=''
1181 orderlib=''
1182 ranlib=''
1183 d_perl_otherlibdirs=''
1184 otherlibdirs=''
1185 package=''
1186 spackage=''
1187 pager=''
1188 api_revision=''
1189 api_subversion=''
1190 api_version=''
1191 api_versionstring=''
1192 patchlevel=''
1193 perl_patchlevel=''
1194 revision=''
1195 subversion=''
1196 version=''
1197 version_patchlevel_string=''
1198 perl5=''
1199 perladmin=''
1200 perlpath=''
1201 d_nv_preserves_uv=''
1202 d_nv_zero_is_allbits_zero=''
1203 i16size=''
1204 i16type=''
1205 i32size=''
1206 i32type=''
1207 i64size=''
1208 i64type=''
1209 i8size=''
1210 i8type=''
1211 ivsize=''
1212 ivtype=''
1213 nv_overflows_integers_at=''
1214 nv_preserves_uv_bits=''
1215 nvsize=''
1216 nvtype=''
1217 u16size=''
1218 u16type=''
1219 u32size=''
1220 u32type=''
1221 u64size=''
1222 u64type=''
1223 u8size=''
1224 u8type=''
1225 uvsize=''
1226 uvtype=''
1227 ivdformat=''
1228 nvEUformat=''
1229 nvFUformat=''
1230 nvGUformat=''
1231 nveformat=''
1232 nvfformat=''
1233 nvgformat=''
1234 uvXUformat=''
1235 uvoformat=''
1236 uvuformat=''
1237 uvxformat=''
1238 pidtype=''
1239 prefix=''
1240 prefixexp=''
1241 installprivlib=''
1242 privlib=''
1243 privlibexp=''
1244 ptrsize=''
1245 d_PRIXU64=''
1246 d_PRId64=''
1247 d_PRIi64=''
1248 d_PRIo64=''
1249 d_PRIu64=''
1250 d_PRIx64=''
1251 sPRIXU64=''
1252 sPRId64=''
1253 sPRIi64=''
1254 sPRIo64=''
1255 sPRIu64=''
1256 sPRIx64=''
1257 d_quad=''
1258 quadkind=''
1259 quadtype=''
1260 uquadtype=''
1261 drand01=''
1262 randbits=''
1263 randfunc=''
1264 randseedtype=''
1265 seedfunc=''
1266 installscript=''
1267 scriptdir=''
1268 scriptdirexp=''
1269 selectminbits=''
1270 selecttype=''
1271 sh=''
1272 targetsh=''
1273 sig_count=''
1274 sig_name=''
1275 sig_name_init=''
1276 sig_num=''
1277 sig_num_init=''
1278 sig_size=''
1279 d_sitearch=''
1280 installsitearch=''
1281 sitearch=''
1282 sitearchexp=''
1283 installsitebin=''
1284 sitebin=''
1285 sitebinexp=''
1286 installsitehtml1dir=''
1287 sitehtml1dir=''
1288 sitehtml1direxp=''
1289 installsitehtml3dir=''
1290 sitehtml3dir=''
1291 sitehtml3direxp=''
1292 installsitelib=''
1293 sitelib=''
1294 sitelib_stem=''
1295 sitelibexp=''
1296 installsiteman1dir=''
1297 siteman1dir=''
1298 siteman1direxp=''
1299 installsiteman3dir=''
1300 siteman3dir=''
1301 siteman3direxp=''
1302 siteprefix=''
1303 siteprefixexp=''
1304 installsitescript=''
1305 sitescript=''
1306 sitescriptexp=''
1307 sizesize=''
1308 sizetype=''
1309 d_libname_unique=''
1310 so=''
1311 socksizetype=''
1312 sharpbang=''
1313 shsharp=''
1314 spitshell=''
1315 src=''
1316 ssizetype=''
1317 st_ino_sign=''
1318 st_ino_size=''
1319 startperl=''
1320 startsh=''
1321 stdchar=''
1322 d_stdio_stream_array=''
1323 stdio_stream_array=''
1324 sysman=''
1325 sGMTIME_max=''
1326 sGMTIME_min=''
1327 sLOCALTIME_max=''
1328 sLOCALTIME_min=''
1329 trnl=''
1330 uidformat=''
1331 uidsign=''
1332 uidsize=''
1333 uidtype=''
1334 archname64=''
1335 use64bitall=''
1336 use64bitint=''
1337 usecbacktrace=''
1338 usedefaultstrict=''
1339 dtrace=''
1340 usedtrace=''
1341 usefaststdio=''
1342 usekernprocpathname=''
1343 ccflags_uselargefiles=''
1344 ldflags_uselargefiles=''
1345 libswanted_uselargefiles=''
1346 uselargefiles=''
1347 uselongdouble=''
1348 usemorebits=''
1349 usemultiplicity=''
1350 nm_opt=''
1351 nm_so_opt=''
1352 runnm=''
1353 usenm=''
1354 usensgetexecutablepath=''
1355 useperlio=''
1356 usequadmath=''
1357 usesocks=''
1358 d_oldpthreads=''
1359 useithreads=''
1360 usereentrant=''
1361 usethreads=''
1362 incpath=''
1363 mips_type=''
1364 usrinc=''
1365 d_vendorarch=''
1366 installvendorarch=''
1367 vendorarch=''
1368 vendorarchexp=''
1369 d_vendorbin=''
1370 installvendorbin=''
1371 vendorbin=''
1372 vendorbinexp=''
1373 installvendorhtml1dir=''
1374 vendorhtml1dir=''
1375 vendorhtml1direxp=''
1376 installvendorhtml3dir=''
1377 vendorhtml3dir=''
1378 vendorhtml3direxp=''
1379 d_vendorlib=''
1380 installvendorlib=''
1381 vendorlib=''
1382 vendorlib_stem=''
1383 vendorlibexp=''
1384 installvendorman1dir=''
1385 vendorman1dir=''
1386 vendorman1direxp=''
1387 installvendorman3dir=''
1388 vendorman3dir=''
1389 vendorman3direxp=''
1390 usevendorprefix=''
1391 vendorprefix=''
1392 vendorprefixexp=''
1393 d_vendorscript=''
1394 installvendorscript=''
1395 vendorscript=''
1396 vendorscriptexp=''
1397 versiononly=''
1398 yacc=''
1399 yaccflags=''
1400 CONFIG=''
1401
1402 : Detect odd OSs
1403 define='define'
1404 undef='undef'
1405 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1406 rmlist=''
1407
1408 : We must find out about Eunice early
1409 eunicefix=':'
1410 if test -f /etc/unixtovms; then
1411         eunicefix=/etc/unixtovms
1412 fi
1413 if test -f /etc/unixtovms.exe; then
1414         eunicefix=/etc/unixtovms.exe
1415 fi
1416
1417 : Set executable suffix now -- needed before hints available
1418 if test -f "/libs/version.library"; then
1419 : Amiga OS
1420     _exe=""
1421 elif test -f "/system/gnu_library/bin/ar.pm"; then
1422 : Stratus VOS
1423     _exe=".pm"
1424 elif test -n "$DJGPP"; then
1425 : DOS DJGPP
1426     _exe=".exe"
1427 elif test -f /kern/cookiejar; then
1428 : MiNT
1429     _exe=""
1430 elif test -d c:/. -o -n "$is_os2" ; then
1431 : OS/2 or cygwin
1432     _exe=".exe"
1433 fi
1434
1435 groupstype=''
1436 i_whoami=''
1437 : Possible local include directories to search.
1438 : Set locincpth to "" in a hint file to defeat local include searches.
1439 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1440 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1441 :
1442 : no include file wanted by default
1443 inclwanted=''
1444
1445 : Enable -DEBUGGING and -DDEBUGGING from the command line
1446 EBUGGING=''
1447 DEBUGGING=''
1448
1449 : Trailing extension.  Override this in a hint file, if needed.
1450 : Extra object files, if any, needed on this platform.
1451 archobjs=''
1452 libnames=''
1453 : change the next line if compiling for Xenix/286 on Xenix/386
1454 xlibpth='/usr/lib/386 /lib/386'
1455 : Possible local library directories to search.
1456 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1457 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1458
1459 : general looking path for locating libraries
1460 glibpth="/lib /usr/lib $xlibpth"
1461 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1462 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1463 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1464 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1465
1466 : Private path used by Configure to find libraries.  Its value
1467 : is prepended to libpth. This variable takes care of special
1468 : machines, like the mips.  Usually, it should be empty.
1469 plibpth=''
1470
1471 : default library list
1472 libswanted=''
1473 : some systems want to use only the non-versioned libso:s
1474 ignore_versioned_solibs=''
1475 ccname=''
1476 ccversion=''
1477 perllibs=''
1478 : set useposix=false in your hint file to disable the POSIX extension.
1479 useposix=true
1480 : set useopcode=false in your hint file to disable the Opcode extension.
1481 useopcode=true
1482 : set uselanginfo=false in your hint file to disable the I18N::Langinfo extension.
1483 uselanginfo=true
1484 archname64=''
1485 ccflags_uselargefiles=''
1486 ldflags_uselargefiles=''
1487 libswanted_uselargefiles=''
1488 : set usemultiplicity on the Configure command line to enable multiplicity.
1489 : set usesocks on the Configure command line to enable socks.
1490 archname=''
1491 : set usethreads on the Configure command line to enable threads.
1492 usereentrant='undef'
1493 : List of libraries we want.
1494 : If anyone needs extra -lxxx, put those in a hint file.
1495 libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
1496 libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
1497 : We probably want to search /usr/shlib before most other libraries.
1498 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1499 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1500 glibpth="/usr/shlib $glibpth"
1501 : Do not use vfork unless overridden by a hint file.
1502 usevfork=false
1503
1504 : Find the basic shell for Bourne shell scripts
1505 case "$sh" in
1506 '')
1507         case "$SYSTYPE" in
1508         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1509         *) xxx='/bin/sh';;
1510         esac
1511         if test -f "$xxx"; then
1512                 sh="$xxx"
1513         else
1514                 : Build up a list and do a single loop so we can 'break' out.
1515                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1516                 for xxx in sh bash ksh pdksh ash; do
1517                         for p in $pth; do
1518                                 try="$try ${p}/${xxx}"
1519                         done
1520                 done
1521                 for xxx in $try; do
1522                         if test -f "$xxx"; then
1523                                 sh="$xxx";
1524                                 break
1525                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1526                                 sh="$xxx";
1527                                 break
1528                         elif test -f "$xxx.exe"; then
1529                                 sh="$xxx";
1530                                 break
1531                         fi
1532                 done
1533         fi
1534         ;;
1535 esac
1536
1537 case "$sh" in
1538 '')     cat >&2 <<EOM
1539 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1540
1541 Usually it's in /bin/sh.  How did you even get this far?
1542 Please report this issue at https://github.com/Perl/perl5/issues
1543 and we'll try to straighten this all out.
1544 EOM
1545         exit 1
1546         ;;
1547 esac
1548
1549 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1550 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1551 targetsh=$sh
1552
1553 : see if sh knows # comments
1554 if `$sh -c '#' >/dev/null 2>&1`; then
1555         shsharp=true
1556         spitshell=cat
1557         xcat=/bin/cat
1558         test -f $xcat$_exe || xcat=/usr/bin/cat
1559         if test ! -f $xcat$_exe; then
1560                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1561                         if test -f $p/cat$_exe; then
1562                                 xcat=$p/cat
1563                                 break
1564                         fi
1565                 done
1566                 if test ! -f $xcat$_exe; then
1567                         echo "Can't find cat anywhere!"
1568                         exit 1
1569                 fi
1570         fi
1571         echo "#!$xcat" >sharp
1572         $eunicefix sharp
1573         chmod +x sharp
1574         ./sharp > today 2>/dev/null
1575         if test -s today; then
1576                 sharpbang='#!'
1577         else
1578                 echo "#! $xcat" > sharp
1579                 $eunicefix sharp
1580                 chmod +x sharp
1581                 ./sharp > today 2>/dev/null
1582                 if test -s today; then
1583                         sharpbang='#! '
1584                 else
1585                         sharpbang=': use '
1586                 fi
1587         fi
1588 else
1589         echo " "
1590         echo "Your $sh doesn't grok # comments--I will strip them later on."
1591         shsharp=false
1592         cd ..
1593         echo "exec grep -v '^[  ]*#'" >spitshell
1594         chmod +x spitshell
1595         $eunicefix spitshell
1596         spitshell=`pwd`/spitshell
1597         cd UU
1598         echo "I presume that if # doesn't work, #! won't work either!"
1599         sharpbang=': use '
1600 fi
1601 rm -f sharp today
1602
1603 : figure out how to guarantee sh startup
1604 case "$startsh" in
1605 '') startsh=${sharpbang}${sh} ;;
1606 *)
1607 esac
1608 cat >sharp <<EOSS
1609 $startsh
1610 set abc
1611 test "$?abc" != 1
1612 EOSS
1613
1614 chmod +x sharp
1615 $eunicefix sharp
1616 if ./sharp; then
1617         : echo "Yup, it does."
1618 else
1619         echo "Hmm... '$startsh' does not guarantee sh startup..."
1620         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1621 fi
1622 rm -f sharp
1623
1624 : Save command line options in file UU/cmdline.opt for later use in
1625 : generating config.sh.
1626 cat > cmdline.opt <<EOSH
1627 : Configure command line arguments.
1628 config_arg0='$0'
1629 config_args='$*'
1630 config_argc=$#
1631 EOSH
1632 argn=1
1633 args_exp=''
1634 args_sep=''
1635 for arg in "$@"; do
1636         cat >>cmdline.opt <<EOSH
1637 config_arg$argn='$arg'
1638 EOSH
1639         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1640 $arg
1641 EOC
1642         arg_exp=`cat cmdl.opt`
1643         args_exp="$args_exp$args_sep'$arg_exp'"
1644         argn=`expr $argn + 1`
1645         args_sep=' '
1646 done
1647 rm -f cmdl.opt
1648
1649 : produce awk script to parse command line options
1650 cat >options.awk <<'EOF'
1651 BEGIN {
1652         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1653
1654         len = length(optstr);
1655         for (i = 1; i <= len; i++) {
1656                 c = substr(optstr, i, 1);
1657                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1658                 if (a == ":") {
1659                         arg[c] = 1;
1660                         i++;
1661                 }
1662                 opt[c] = 1;
1663         }
1664 }
1665 {
1666         expect = 0;
1667         str = $0;
1668         if (substr(str, 1, 1) != "-") {
1669                 printf("'%s'\n", str);
1670                 next;
1671         }
1672         len = length($0);
1673         for (i = 2; i <= len; i++) {
1674                 c = substr(str, i, 1);
1675                 if (!opt[c]) {
1676                         printf("-%s\n", substr(str, i));
1677                         next;
1678                 }
1679                 printf("-%s\n", c);
1680                 if (arg[c]) {
1681                         if (i < len)
1682                                 printf("'%s'\n", substr(str, i + 1));
1683                         else
1684                                 expect = 1;
1685                         next;
1686                 }
1687         }
1688 }
1689 END {
1690         if (expect)
1691                 print "?";
1692 }
1693 EOF
1694
1695 : process the command line options
1696 set X `for arg in "$@"; do echo "X$arg"; done |
1697         sed -e s/X// | awk -f options.awk`
1698 eval "set $*"
1699 shift
1700 rm -f options.awk
1701
1702 : set up default values
1703 fastread=''
1704 reuseval=false
1705 config_sh=''
1706 alldone=''
1707 error=''
1708 silent=''
1709 extractsh=''
1710 knowitall=''
1711 rm -f optdef.sh posthint.sh
1712 cat >optdef.sh <<EOS
1713 $startsh
1714 EOS
1715
1716
1717 : option parsing
1718 while test $# -gt 0; do
1719         case "$1" in
1720         -d) shift; fastread=yes;;
1721         -e) shift; alldone=cont;;
1722         -f)
1723                 shift
1724                 cd ..
1725                 if test -r "$1"; then
1726                         config_sh="$1"
1727                 else
1728                         echo "$me: cannot read config file $1." >&2
1729                         error=true
1730                 fi
1731                 cd UU
1732                 shift;;
1733         --help|\
1734         -h) shift; error=true;;
1735         -r) shift; reuseval=true;;
1736         -s) shift; silent=true; realsilent=true;;
1737         -E) shift; alldone=exit;;
1738         -K) shift; knowitall=true;;
1739         -O) shift;;
1740         -S) shift; silent=true; extractsh=true;;
1741         -D)
1742                 shift
1743                 case "$1" in
1744                 *=)
1745                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1746                         echo "$me: ignoring -D $1" >&2
1747                         ;;
1748                 *=*) echo "$1" | \
1749                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1750                 *) echo "$1='define'" >> optdef.sh;;
1751                 esac
1752                 shift
1753                 ;;
1754         -U)
1755                 shift
1756                 case "$1" in
1757                 *=) echo "$1" >> optdef.sh;;
1758                 *=*)
1759                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1760                         echo "$me: ignoring -U $1" >&2
1761                         ;;
1762                 *) echo "$1='undef'" >> optdef.sh;;
1763                 esac
1764                 shift
1765                 ;;
1766         -A)
1767             shift
1768             xxx=''
1769             yyy="$1"
1770             zzz=''
1771             uuu=undef
1772             case "$yyy" in
1773             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1774                  case "$zzz" in
1775                  *:*) zzz='' ;;
1776                  *)   xxx=append
1777                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1778                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1779                  esac
1780                  ;;
1781             esac
1782             case "$xxx" in
1783             '')  case "$yyy" in
1784                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1785                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1786                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1787                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1788                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1789                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1790                  esac
1791                  ;;
1792             esac
1793             case "$xxx" in
1794             append)
1795                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1796             clear)
1797                 echo "$yyy=''"                  >> posthint.sh ;;
1798             define)
1799                 case "$zzz" in
1800                 '') zzz=define ;;
1801                 esac
1802                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1803             eval)
1804                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1805             prepend)
1806                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1807             undef)
1808                 case "$zzz" in
1809                 '') zzz="$uuu" ;;
1810                 esac
1811                 echo "$yyy=$zzz"                >> posthint.sh ;;
1812             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1813             esac
1814             shift
1815             ;;
1816         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1817             exit 0;;
1818         --) break;;
1819         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1820         *) break;;
1821         esac
1822 done
1823
1824 case "$error" in
1825 true)
1826         cat >&2 <<EOM
1827 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1828                  [-U symbol] [-U symbol=] [-A command:symbol...]
1829   -d : use defaults for all answers.
1830   -e : go on without questioning past the production of config.sh.
1831   -f : specify an alternate default configuration file.
1832   -h : print this help message and exit (with an error status).
1833   -r : reuse C symbols value if possible (skips costly nm extraction).
1834   -s : silent mode, only echoes questions and essential information.
1835   -D : define symbol to have some value:
1836          -D symbol         symbol gets the value 'define'
1837          -D symbol=value   symbol gets the value 'value'
1838        common used examples (see INSTALL for more info):
1839          -Duse64bitint            use 64bit integers
1840          -Duse64bitall            use 64bit integers and pointers
1841          -Dusethreads             use thread support
1842          -Dinc_version_list=none  do not include older perl trees in @INC
1843          -DEBUGGING=none          DEBUGGING options
1844          -Dcc=gcc                 choose your compiler
1845          -Dprefix=/opt/perl5      choose your destination
1846   -E : stop at the end of questions, after having produced config.sh.
1847   -K : do not use unless you know what you are doing.
1848   -O : ignored for backward compatibility
1849   -S : perform variable substitutions on all .SH files (can mix with -f)
1850   -U : undefine symbol:
1851          -U symbol    symbol gets the value 'undef'
1852          -U symbol=   symbol gets completely empty
1853        e.g.:  -Uversiononly
1854   -A : manipulate symbol after the platform specific hints have been applied:
1855          -A append:symbol=value   append value to symbol
1856          -A symbol=value          like append:, but with a separating space
1857          -A define:symbol=value   define symbol to have value
1858          -A clear:symbol          define symbol to be ''
1859          -A define:symbol         define symbol to be 'define'
1860          -A eval:symbol=value     define symbol to be eval of value
1861          -A prepend:symbol=value  prepend value to symbol
1862          -A undef:symbol          define symbol to be 'undef'
1863          -A undef:symbol=         define symbol to be ''
1864        e.g.:  -A prepend:libswanted='cl pthread '
1865               -A ccflags=-DSOME_MACRO
1866   -V : print version number and exit (with a zero status).
1867 EOM
1868         exit 1
1869         ;;
1870 esac
1871
1872 : Sanity checks
1873 case "$fastread$alldone" in
1874 yescont|yesexit) ;;
1875 *)
1876         case "$extractsh" in
1877         true) ;;
1878         *)
1879                 if test ! -t 0; then
1880                         echo "Say 'sh Configure', not 'sh <Configure'"
1881                         exit 1
1882                 fi
1883                 ;;
1884         esac
1885         ;;
1886 esac
1887
1888 exec 4>&1
1889 case "$silent" in
1890 true) exec 1>/dev/null;;
1891 esac
1892
1893 : run the defines and the undefines, if any, but leave the file out there...
1894 touch optdef.sh
1895 grep '\\' optdef.sh >/dev/null 2>&1
1896 if test $? = 0; then
1897     echo "Configure does not support \\ in -D arguments"
1898     exit 1
1899 fi
1900 . ./optdef.sh
1901 : create the posthint manipulation script and leave the file out there...
1902 touch posthint.sh
1903
1904 : set package name
1905 package='perl5'
1906 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1907 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1908 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
1909 ABYZ-abyz) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1910 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1911 esac
1912
1913 : Some greps do not return status, grrr.
1914 echo "grimblepritz" >grimble
1915 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1916         contains=contains
1917 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1918         contains=grep
1919 else
1920         contains=contains
1921 fi
1922 rm -f grimble
1923 : the following should work in any shell
1924 case "$contains" in
1925 contains*)
1926         echo " " >&4
1927         echo "AGH!  Grep doesn't return a status.  Attempting remedial action." >&4
1928         cat >contains <<'EOSS'
1929 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1930 EOSS
1931 contains=./contains
1932 chmod +x $contains
1933 esac
1934
1935 : Find the path to the source tree
1936 case "$src" in
1937 '') case "$0" in
1938     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1939          case "$src" in
1940          /*)    ;;
1941          .)     ;;
1942          *)     src=`cd ../$src && pwd` ;;
1943          esac
1944          ;;
1945     *)   src='.';;
1946     esac;;
1947 esac
1948 case "$src" in
1949 '')     src=/
1950         rsrc=/
1951         ;;
1952 /*)     rsrc="$src";;
1953 *)      rsrc="../$src";;
1954 esac
1955 if test -f $rsrc/Configure && \
1956         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1957 then
1958    : found it, so we are ok.
1959 else
1960         rsrc=''
1961         for src in . .. ../.. ../../.. ../../../..; do
1962                 if test -f ../$src/Configure && \
1963                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1964                 then
1965                         rsrc=../$src
1966                         break
1967                 fi
1968         done
1969 fi
1970 case "$rsrc" in
1971 '')
1972         cat <<EOM >&4
1973
1974 Sorry, I can't seem to locate the source dir for $package.  Please start
1975 Configure with an explicit path -- i.e. /some/path/Configure.
1976
1977 EOM
1978         exit 1
1979         ;;
1980 ../.)   rsrc='..';;
1981 *)
1982         echo " "
1983         echo "Sources for $package found in \"$src\"." >&4
1984         ;;
1985 esac
1986
1987 : script used to extract .SH files with variable substitutions
1988 cat >extract <<'EOS'
1989 PERL_CONFIG_SH=true
1990 echo "Doing variable substitutions on .SH files..."
1991 if test -f MANIFEST; then
1992         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1993 else
1994         echo "(Looking for .SH files under the source directory.)"
1995         set x `(cd "$src"; find . -name "*.SH" -print)`
1996 fi
1997 shift
1998 case $# in
1999 0) set x `(cd "$src"; echo *.SH)`; shift;;
2000 esac
2001 if test ! -f "$src/$1"; then
2002         shift
2003 fi
2004 mkdir_p='
2005 name=$1;
2006 create="";
2007 while test $name; do
2008         if test ! -d "$name"; then
2009                 create="$name $create";
2010                 name=`echo $name | sed -e "s|^[^/]*$||"`;
2011                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
2012         else
2013                 name="";
2014         fi;
2015 done;
2016 for file in $create; do
2017         mkdir $file;
2018 done
2019 '
2020 for file in $*; do
2021         case "$src" in
2022         ".")
2023                 case "$file" in
2024                 */*)
2025                         dir=`expr X$file : 'X\(.*\)/'`
2026                         file=`expr X$file : 'X.*/\(.*\)'`
2027                         (cd "$dir" && . ./$file)
2028                         ;;
2029                 *)
2030                         . ./$file
2031                         ;;
2032                 esac
2033                 ;;
2034         *)
2035                 case "$file" in
2036                 */*)
2037                         dir=`expr X$file : 'X\(.*\)/'`
2038                         file=`expr X$file : 'X.*/\(.*\)'`
2039                         (set x $dir; shift; eval $mkdir_p)
2040                         sh <"$src/$dir/$file"
2041                         ;;
2042                 *)
2043                         sh <"$src/$file"
2044                         ;;
2045                 esac
2046                 ;;
2047         esac
2048 done
2049 if test -f "$src/config_h.SH"; then
2050         if test ! -f config.h; then
2051         : oops, they left it out of MANIFEST, probably, so do it anyway.
2052         . "$src/config_h.SH"
2053         fi
2054 fi
2055 EOS
2056
2057 : extract files and exit if asked to do so
2058 case "$extractsh" in
2059 true)
2060         case "$realsilent" in
2061         true) ;;
2062         *) exec 1>&4;;
2063         esac
2064         case "$config_sh" in
2065         '') config_sh='config.sh';;
2066         esac
2067         echo " "
2068         echo "Fetching answers from $config_sh..."
2069         cd ..
2070         . $config_sh
2071         . UU/optdef.sh
2072         echo " "
2073         . UU/extract
2074         rm -rf UU
2075         echo "Extraction done."
2076         exit 0
2077         ;;
2078 esac
2079
2080 : Eunice requires " " instead of "", can you believe it
2081 echo " "
2082 : Here we go...
2083 echo "Beginning of configuration questions for $package."
2084
2085 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2086
2087 : first determine how to suppress newline on echo command
2088 echo " "
2089 echo "Checking echo to see how to suppress newlines..."
2090 (echo "hi there\c" ; echo " ") >.echotmp
2091 if $contains c .echotmp >/dev/null 2>&1 ; then
2092         echo "...using -n."
2093         n='-n'
2094         c=''
2095 else
2096         cat <<'EOM'
2097 ...using \c
2098 EOM
2099         n=''
2100         c='\c'
2101 fi
2102 echo $n "The star should be here-->$c"
2103 echo '*'
2104 rm -f .echotmp
2105
2106 : Now test for existence of everything in MANIFEST
2107 echo " "
2108 if test -f "$rsrc/MANIFEST"; then
2109         echo "First let's make sure your kit is complete.  Checking..." >&4
2110         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2111                 (split -l 50 2>/dev/null || split -50)
2112         rm -f missing
2113         tmppwd=`pwd`
2114         for filelist in x??; do
2115                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2116                         >/dev/null 2>>"$tmppwd/missing")
2117         done
2118         if test -s missing; then
2119                 cat missing >&4
2120                 cat >&4 <<'EOM'
2121
2122 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2123
2124 You have the option of continuing the configuration process, despite the
2125 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2126 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2127 and contact the author (https://github.com/Perl/perl5/issues).
2128
2129 EOM
2130                 echo $n "Continue? [n] $c" >&4
2131                 read ans
2132                 case "$ans" in
2133                 y*)
2134                         echo "Continuing..." >&4
2135                         rm -f missing
2136                         ;;
2137                 *)
2138                         echo "ABORTING..." >&4
2139                         kill $$
2140                         ;;
2141                 esac
2142         else
2143                 echo "Looks good..."
2144         fi
2145 else
2146         echo "There is no MANIFEST file.  I hope your kit is complete !"
2147 fi
2148 rm -f missing x??
2149
2150 : Find the appropriate value for a newline for tr
2151 if test -n "$DJGPP"; then
2152        trnl='\012'
2153 fi
2154 if test X"$trnl" = X; then
2155         case "`echo foo | tr '\n' x 2>/dev/null`" in
2156         foox) trnl='\n' ;;
2157         esac
2158 fi
2159 if test X"$trnl" = X; then
2160         case "`echo foo | tr '\012' x 2>/dev/null`" in
2161         foox) trnl='\012' ;;
2162         esac
2163 fi
2164 if test X"$trnl" = X; then
2165        case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
2166        fooxy) trnl='\n\r' ;;
2167        esac
2168 fi
2169 if test X"$trnl" = X; then
2170         cat <<EOM >&2
2171
2172 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2173
2174 EOM
2175         exit 1
2176 fi
2177
2178 : compute the number of columns on the terminal for proper question formatting
2179 case "$COLUMNS" in
2180 '') COLUMNS='80';;
2181 esac
2182
2183 : set up the echo used in my read
2184 myecho="case \"\$xxxm\" in
2185 '') echo $n \"\$rp $c\" >&4;;
2186 *) case \"\$rp\" in
2187         '') echo $n \"[\$xxxm] $c\";;
2188         *)
2189                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2190                         echo \"\$rp\" >&4
2191                         echo $n \"[\$xxxm] $c\" >&4
2192                 else
2193                         echo $n \"\$rp [\$xxxm] $c\" >&4
2194                 fi
2195                 ;;
2196         esac;;
2197 esac"
2198
2199 : now set up to do reads with possible shell escape and default assignment
2200 cat <<EOSC >myread
2201 $startsh
2202 xxxm=\$dflt
2203 $myecho
2204 ans='!'
2205 case "\$fastread" in
2206 yes) case "\$dflt" in
2207         '') ;;
2208         *) ans='';
2209                 case "\$silent-\$rp" in
2210                 true-) ;;
2211                 *) echo " " >&4;;
2212                 esac;;
2213         esac;;
2214 *) case "\$silent" in
2215         true) case "\$rp" in
2216                 '') ans='';;
2217                 esac;;
2218         esac;;
2219 esac
2220 while expr "X\$ans" : "X!" >/dev/null; do
2221         read answ
2222         set x \$xxxm
2223         shift
2224         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2225         case  "\$answ" in
2226         "!")
2227                 sh 1>&4
2228                 echo " "
2229                 $myecho
2230                 ;;
2231         !*)
2232                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2233                 shift
2234                 sh 1>&4 -c "\$*"
2235                 echo " "
2236                 $myecho
2237                 ;;
2238         "\$ans")
2239                 case "\$ans" in
2240                 \\&*)
2241                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2242                         shift
2243                         case "\$1" in
2244                         -d)
2245                                 fastread=yes
2246                                 echo "(OK, I'll run with -d after this question.)" >&4
2247                                 ;;
2248                         -*)
2249                                 echo "*** Sorry, \$1 not supported yet." >&4
2250                                 ;;
2251                         esac
2252                         $myecho
2253                         ans=!
2254                         ;;
2255                 esac;;
2256         *)
2257                 case "\$aok" in
2258                 y)
2259                         echo "*** Substitution done -- please confirm."
2260                         xxxm="\$ans"
2261                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2262                         xxxm="\$ans"
2263                         ans=!
2264                         ;;
2265                 *)
2266                         echo "*** Error -- try again."
2267                         ans=!
2268                         ;;
2269                 esac
2270                 $myecho
2271                 ;;
2272         esac
2273         case "\$ans\$xxxm\$nostick" in
2274         '')
2275                 ans=!
2276                 $myecho
2277                 ;;
2278         esac
2279 done
2280 case "\$ans" in
2281 '') ans="\$xxxm";;
2282 esac
2283 EOSC
2284
2285 : create .config dir to save info across Configure sessions
2286 test -d ../.config || mkdir ../.config
2287 cat >../.config/README <<EOF
2288 This directory created by Configure to save information that should
2289 persist across sessions for $package.
2290
2291 You may safely delete it if you wish.
2292 EOF
2293
2294 : See if we are using a devel version and want that
2295 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2296 case "$usedevel" in
2297 $define|true|[yY]*)
2298     usedevel="$define" ;;
2299 *) case "$xversion" in
2300    *[13579])
2301         cat >&4 <<EOH
2302 *** WHOA THERE!!! ***
2303
2304     This is an UNSTABLE DEVELOPMENT release.
2305     The version of this $package distribution is $xversion, that is, odd,
2306     (as opposed to even) and that signifies a development release.
2307     If you want a maintenance release, you want an even-numbered version.
2308
2309     Do ***NOT*** install this into production use.
2310     Data corruption and crashes are possible.
2311
2312     It is most seriously suggested that you do not continue any further
2313     unless you want to help in developing and debugging Perl.
2314
2315     If you *still* want to build perl, you can answer 'y' now,
2316     or pass -Dusedevel to Configure.
2317
2318 EOH
2319         rp='Do you really want to continue?'
2320         dflt='n'
2321         . ./myread
2322         case "$ans" in
2323         [yY]) echo >&4 "Okay, continuing."
2324               usedevel="$define" ;;
2325         *) echo >&4 "Okay, bye."
2326            exit 1
2327            ;;
2328         esac
2329         ;;
2330     esac
2331     usedevel="$undef"
2332     ;;
2333 esac
2334 case "$usedevel" in
2335 $define|true|[yY]*)
2336         case "$versiononly" in
2337         '') versiononly="$define" ;;
2338         esac
2339         case "$installusrbinperl" in
2340         '') installusrbinperl="$undef" ;;
2341         esac
2342         ;;
2343 esac
2344
2345 : general instructions
2346 needman=true
2347 firsttime=true
2348 user=`(logname) 2>/dev/null`
2349 case "$user" in
2350 '') user=`whoami 2>&1`;;
2351 esac
2352 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2353         firsttime=false
2354         echo " "
2355         rp='Would you like to see the instructions?'
2356         dflt=n
2357         . ./myread
2358         case "$ans" in
2359         [yY]*) ;;
2360         *) needman=false;;
2361         esac
2362 fi
2363 if $needman; then
2364         cat <<EOH
2365
2366 This installation shell script will examine your system and ask you questions
2367 to determine how the perl5 package should be installed. If you get
2368 stuck on a question, you may use a ! shell escape to start a subshell or
2369 execute a command.  Many of the questions will have default answers in square
2370 brackets; typing carriage return will give you the default.
2371
2372 On some of the questions which ask for file or directory names you are allowed
2373 to use the ~name construct to specify the login directory belonging to "name",
2374 even if you don't have a shell which knows about that.  Questions where this is
2375 allowed will be marked "(~name ok)".
2376
2377 EOH
2378         rp=''
2379         dflt='Type carriage return to continue'
2380         . ./myread
2381         cat <<'EOH'
2382
2383 The prompter used in this script allows you to use shell variables and
2384 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2385 in the default answer, as if the default line was a set of arguments given to a
2386 script shell.  This means you may also use $* to repeat the whole default line,
2387 so you do not have to re-type everything to add something to the default.
2388
2389 Every time there is a substitution, you will have to confirm.  If there is an
2390 error (e.g. an unmatched backtick), the default answer will remain unchanged
2391 and you will be prompted again.
2392
2393 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2394 the questions and use the computed defaults (or the previous answers if there
2395 was already a config.sh file). Type 'Configure -h' for a list of options.
2396 You may also start interactively and then answer '& -d' at any prompt to turn
2397 on the non-interactive behaviour for the remainder of the execution.
2398
2399 EOH
2400         . ./myread
2401         cat <<EOH
2402
2403 Much effort has been expended to ensure that this shell script will run on any
2404 Unix system.  If despite that it blows up on yours, your best bet is to edit
2405 Configure and run it again.  If you can't run Configure for some reason,
2406 you'll have to generate a config.sh file by hand.  Whatever problems you
2407 have, let me (https://github.com/Perl/perl5/issues) know how I blew it.
2408
2409 This installation script affects things in two ways:
2410
2411 1) it may do direct variable substitutions on some of the files included
2412    in this kit.
2413 2) it builds a config.h file for inclusion in C programs.  You may edit
2414    any of these files as the need arises after running this script.
2415
2416 If you make a mistake on a question, there is no easy way to back up to it
2417 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2418 files.  Configure will offer to let you do this before it runs the SH files.
2419
2420 EOH
2421         dflt='Type carriage return to continue'
2422         . ./myread
2423         case "$firsttime" in
2424         true) echo $user >>../.config/instruct;;
2425         esac
2426 fi
2427
2428 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2429 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2430 if test "X$sysroot" = X; then
2431     sysroot=""
2432 else
2433     case "$cc" in
2434         *gcc*|*g++*)
2435             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2436             # _sysroot is used in places where we need --sysroot=foo
2437             # but using the rest of the flags could cause issues.
2438             _sysroot="--sysroot=$sysroot";
2439             case "$ccflags" in
2440                 *sysroot*) ;;
2441                 'undef'|*)
2442                 ccflags="$ccflags $_sysroot"
2443             esac
2444             case "$ldflags" in
2445                 *sysroot*) ;;
2446                 'undef'|*)
2447                 ldflags="$ldflags $_sysroot"
2448             esac
2449             case "$cppflags" in
2450                 *sysroot*) ;;
2451                 'undef'|*)
2452                 cppflags="$cppflags $_sysroot"
2453             esac
2454             # lddlflags updated below in lddlflags section;
2455             # same with cccdlflags
2456             ;;
2457     esac
2458
2459     # Adjust some defaults to also use $sysroot
2460     for var in xlibpth loclibpth locincpth glibpth; do
2461         eval xxx=\$$var
2462         eval $var=''
2463         for path in $xxx; do
2464             eval $var=\"\$$var $sysroot$path\"
2465         done
2466     done
2467
2468 fi
2469
2470 : find out where common programs are
2471 echo " "
2472 echo "Locating common programs..." >&4
2473 cat <<EOSC >loc
2474 $startsh
2475 case \$# in
2476 0) exit 1;;
2477 esac
2478 thing=\$1
2479 shift
2480 dflt=\$1
2481 shift
2482 for dir in \$*; do
2483         case "\$thing" in
2484         .)
2485         if test -d \$dir/\$thing; then
2486                 echo \$dir
2487                 exit 0
2488         fi
2489         ;;
2490         *)
2491         for thisthing in \$dir/\$thing; do
2492                 : just loop through to pick last item
2493         done
2494         if test -f \$thisthing; then
2495                 echo \$thisthing
2496                 exit 0
2497         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2498                 echo \$thisthing
2499                 exit 0
2500         elif test -f \$dir/\$thing.exe; then
2501                 if test -n "$DJGPP"; then
2502                         echo \$dir/\$thing.exe
2503                 elif test "$eunicefix" != ":"; then
2504                         : on Eunice apparently
2505                         echo \$dir/\$thing
2506                 fi
2507                 exit 0
2508         fi
2509         ;;
2510         esac
2511 done
2512 echo \$dflt
2513 exit 1
2514 EOSC
2515 chmod +x loc
2516 $eunicefix loc
2517 loclist="
2518 awk
2519 cat
2520 chmod
2521 comm
2522 cp
2523 echo
2524 expr
2525 grep
2526 ls
2527 mkdir
2528 rm
2529 sed
2530 sort
2531 touch
2532 tr
2533 uniq
2534 "
2535 trylist="
2536 ar
2537 bison
2538 byacc
2539 cpp
2540 csh
2541 date
2542 egrep
2543 gmake
2544 gzip
2545 less
2546 ln
2547 make
2548 more
2549 nm
2550 nroff
2551 perl
2552 pg
2553 test
2554 uname
2555 zip
2556 "
2557 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2558 pth="$pth $sysroot/lib $sysroot/usr/lib"
2559 for file in $loclist; do
2560         eval xxx=\$$file
2561         case "$xxx" in
2562         /*|?:[\\/]*)
2563                 if test -f "$xxx"; then
2564                         : ok
2565                 else
2566                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2567                         xxx=`./loc $file $file $pth`
2568                 fi
2569                 ;;
2570         '') xxx=`./loc $file $file $pth`;;
2571         *) xxx=`./loc $xxx $xxx $pth`;;
2572         esac
2573         eval $file=$xxx$_exe
2574         eval _$file=$xxx
2575         case "$xxx" in
2576         /*)
2577                 echo $file is in $xxx.
2578                 ;;
2579         ?:[\\/]*)
2580                 echo $file is in $xxx.
2581                 ;;
2582         *)
2583                 echo "I don't know where '$file' is, and my life depends on it." >&4
2584                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2585                 exit 1
2586                 ;;
2587         esac
2588 done
2589 echo " "
2590 echo "Don't worry if any of the following aren't found..."
2591 say=offhand
2592 for file in $trylist; do
2593         eval xxx=\$$file
2594         case "$xxx" in
2595         /*|?:[\\/]*)
2596                 if test -f "$xxx"; then
2597                         : ok
2598                 else
2599                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2600                         xxx=`./loc $file $file $pth`
2601                 fi
2602                 ;;
2603         '') xxx=`./loc $file $file $pth`;;
2604         *) xxx=`./loc $xxx $xxx $pth`;;
2605         esac
2606         eval $file=$xxx$_exe
2607         eval _$file=$xxx
2608         case "$xxx" in
2609         /*)
2610                 echo $file is in $xxx.
2611                 ;;
2612         ?:[\\/]*)
2613                 echo $file is in $xxx.
2614                 ;;
2615         *)
2616                 echo "I don't see $file out there, $say."
2617                 say=either
2618                 ;;
2619         esac
2620 done
2621 case "$egrep" in
2622 egrep)
2623         echo "Substituting grep for egrep."
2624         egrep=$grep
2625         _egrep=$grep
2626         ;;
2627 esac
2628 case "$less" in
2629 '')     ;;
2630 *)      if $less -R </dev/null >/dev/null 2>&1; then
2631                echo "Substituting less -R for less."
2632                less="$less -R"
2633                _less=$less
2634         fi
2635         ;;
2636 esac
2637 case "$ln" in
2638 ln)
2639         echo "Substituting cp for ln."
2640         ln=$cp
2641         _ln=$cp
2642         ;;
2643 esac
2644 case "$make" in
2645 make)
2646         case "$gmake" in
2647         gmake)
2648         echo "I can't find make or gmake, and my life depends on it." >&4
2649         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2650         exit 1
2651         ;;
2652         esac
2653         ;;
2654 esac
2655 case "$gmake" in
2656 gmake)  ;;
2657 *)      # We can't have osname yet.
2658         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2659                 # Assume that gmake, if found, is definitely GNU make
2660                 # and prefer it over the system make.
2661                 echo "Substituting gmake for make."
2662                 make=$gmake
2663                 _make=$gmake
2664         fi
2665         ;;
2666 esac
2667 case "$test" in
2668 test)
2669         echo "Hopefully test is built into your sh."
2670         ;;
2671 *)
2672         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2673                 echo "Using the test built into your sh."
2674                 test=test
2675                 _test=test
2676         fi
2677         ;;
2678 esac
2679 case "$echo" in
2680 echo)
2681         echo "Hopefully echo is built into your sh."
2682         ;;
2683 '') ;;
2684 *)
2685         echo " "
2686 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2687         $echo $n "hi there$c" >foo1
2688         echo $n "hi there$c" >foo2
2689         if cmp foo1 foo2 >/dev/null 2>&1; then
2690                 echo "They are compatible.  In fact, they may be identical."
2691         else
2692                 case "$n" in
2693                 '-n') n='' c='\c';;
2694                 *) n='-n' c='';;
2695                 esac
2696                 cat <<FOO
2697 They are not compatible!  You are probably running ksh on a non-USG system.
2698 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2699 have echo built in and we may have to run some Bourne shell scripts.  That
2700 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2701
2702 FOO
2703                 $echo $n "The star should be here-->$c"
2704                 $echo "*"
2705         fi
2706         $rm -f foo1 foo2
2707         ;;
2708 esac
2709
2710 # This question was auctioned at YAPC::Europe-2007 in Vienna
2711 # I never promised you could answer it. I only auctioned the question.
2712 cat <<FOO
2713 The following message is sponsored by
2714
2715   Dresden.pm<--The stars should be here.
2716
2717 Dear Perl user, system administrator or package
2718 maintainer, the Perl community sends greetings to
2719 you. Do you (emblematical) greet back [Y/n]? n
2720
2721 FOO
2722
2723 : Check what type of C compiler we use
2724 cat <<EOS >trygcc
2725 $startsh
2726 EOS
2727 cat <<'EOSC' >>trygcc
2728 case "$cc" in
2729 '') ;;
2730 *)  $rm -f try try.*
2731     $cat >try.c <<EOM
2732 int main(int argc, char *argv[]) {
2733   return 0;
2734 }
2735 EOM
2736     if $cc -o try $ccflags $ldflags try.c; then
2737        :
2738     else
2739         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2740         despair=yes
2741         trygcc=yes
2742         case "$cc" in
2743         *gcc*) trygcc=no ;;
2744         esac
2745         # Skip this test because it gives a false match on output like:
2746         #    ./trygcc: line 23: cc: command not found
2747         # case "`$cc -v -c try.c 2>&1`" in
2748         # *gcc*) trygcc=no ;;
2749         # esac
2750         if $test X"$trygcc" = Xyes; then
2751             if gcc -o try -c try.c; then
2752                 echo " "
2753                 echo "You seem to have a working gcc, though." >&4
2754                 # Switching compilers may undo the work of hints files.
2755                 # The most common problem is -D_REENTRANT for threads.
2756                 # This heuristic catches that case, but gets false positives
2757                 # if -Dusethreads was not actually specified.  Better to
2758                 # bail out here with a useful message than fail
2759                 # mysteriously later. Should we perhaps just try to
2760                 # re-invoke Configure -Dcc=gcc config_args ?
2761                 if $test -f usethreads.cbu; then
2762                         $cat >&4 <<EOM
2763
2764 *** However, any setting of the C compiler flags (e.g. for thread support)
2765 *** will be lost.  It may be necessary for you to restart Configure and
2766 *** add -Dcc=gcc to your Configure command line.
2767
2768 EOM
2769                         rp="Would you like to go ahead and try gcc anyway?"
2770                         dflt=n
2771                 else
2772                         rp="Would you like to use it?"
2773                         dflt=y
2774                 fi
2775                 if $test -f myread; then
2776                     . ./myread
2777                 else
2778                     if $test -f UU/myread; then
2779                         . ./UU/myread
2780                     else
2781                         echo "Cannot find myread, sorry.  Aborting." >&2
2782                         exit 1
2783                     fi
2784                 fi
2785                 case "$ans" in
2786                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2787                 esac
2788             fi
2789         fi
2790     fi
2791     $rm -f try try.*
2792     ;;
2793 esac
2794 EOSC
2795
2796 cat <<EOS >checkcc
2797 $startsh
2798 EOS
2799 cat <<'EOSC' >>checkcc
2800 case "$cc" in
2801 '') ;;
2802 *)  $rm -f try try.*
2803     $cat >try.c <<EOM
2804 int main(int argc, char *argv[]) {
2805   return 0;
2806 }
2807 EOM
2808     if $cc -o try $ccflags $ldflags try.c; then
2809        :
2810     else
2811         if $test X"$despair" = Xyes; then
2812            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2813         fi
2814         $cat >&4 <<EOM
2815 You need to find a working C compiler.
2816 Either (purchase and) install the C compiler supplied by your OS vendor,
2817 or for a free C compiler try http://gcc.gnu.org/
2818 I cannot continue any further, aborting.
2819 EOM
2820         exit 1
2821     fi
2822     $rm -f try try.*
2823     ;;
2824 esac
2825 EOSC
2826
2827 : determine whether symbolic links are supported
2828 echo " "
2829 $touch blurfl
2830 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2831         echo "Symbolic links are supported." >&4
2832         lns="$ln -s"
2833 else
2834         echo "Symbolic links are NOT supported." >&4
2835         lns="$ln"
2836 fi
2837 $rm -f blurfl sym
2838
2839 : determine whether symbolic links are supported
2840 echo " "
2841 case "$lns" in
2842 *"ln"*" -s")
2843         echo "Checking how to test for symbolic links..." >&4
2844         $lns blurfl sym
2845         if $test "X$issymlink" = X; then
2846                 case "$newsh" in
2847                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2848                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2849                 esac
2850                 if test $? = 0; then
2851                         issymlink="test -h"
2852                 else
2853                         echo "Your builtin 'test -h' may be broken." >&4
2854                         case "$test" in
2855                         /*)     ;;
2856                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2857                                 for p in $pth
2858                                 do
2859                                         if test -f "$p/$test"; then
2860                                                 test="$p/$test"
2861                                                 break
2862                                         fi
2863                                 done
2864                                 ;;
2865                         esac
2866                         case "$test" in
2867                         /*)
2868                                 echo "Trying external '$test -h'." >&4
2869                                 issymlink="$test -h"
2870                                 if $test ! -h sym >/dev/null 2>&1; then
2871                                         echo "External '$test -h' is broken, too." >&4
2872                                         issymlink=''
2873                                 fi
2874                                 ;;
2875                         *)      issymlink='' ;;
2876                         esac
2877                 fi
2878         fi
2879         if $test "X$issymlink" = X; then
2880                 if $test -L sym 2>/dev/null; then
2881                         issymlink="$test -L"
2882                         echo "The builtin '$test -L' worked." >&4
2883                 fi
2884         fi
2885         if $test "X$issymlink" != X; then
2886                 echo "You can test for symbolic links with '$issymlink'." >&4
2887         else
2888                 echo "I do not know how you can test for symbolic links." >&4
2889         fi
2890         $rm -f blurfl sym
2891         ;;
2892 *)      echo "No symbolic links, so not testing for their testing..." >&4
2893         ;;
2894 esac
2895
2896 : Make symlinks util
2897 case "$mksymlinks" in
2898 $define|true|[yY]*)
2899         case "$src" in
2900         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2901                 exit 1
2902                 ;;
2903         *)      case "$lns:$issymlink" in
2904                 *"ln"*" -s:"*"test -"?)
2905                         echo "Creating the symbolic links..." >&4
2906                         cd ..
2907                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2908                         awk 'NF == 1 {
2909                                 dir=".";
2910                                 file=$1 "";
2911                              }
2912                              NF == 2 {
2913                                 dir=$1 "";
2914                                 file=$2 "";
2915                              }
2916                              {
2917                                  print "# dir = ", dir, "file = ", file
2918                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2919                              } END {
2920                                  for (d in mf) {
2921                                      if (d != ".") { print("mkdir -p "d) }
2922                                      print("ln -sf "mf[d]" "d);
2923                                  }
2924                              }' source="$src" > UU/mksymlinks.$$
2925                         sh UU/mksymlinks.$$
2926                         rm UU/mksymlinks.$$
2927                         # Sanity check 1.
2928                         if test ! -d t/base; then
2929                                 echo "Failed to create the subdirectories.  Aborting." >&4
2930                                 exit 1
2931                         fi
2932                         # Sanity check 2.
2933                         if test ! -f t/base/lex.t; then
2934                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2935                                 exit 1
2936                         fi
2937                         if test ! -f win32/win32.c; then
2938                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2939                                 exit 1
2940                         fi
2941                         cd UU
2942                         ;;
2943                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2944                         ;;
2945                 esac
2946                 ;;
2947         esac
2948         ;;
2949 esac
2950
2951 : Check for Cross-Compilation
2952 if $test "X$targethost" = "X"; then
2953     targethost=""
2954 fi
2955 if $test "X$targetenv" = "X"; then
2956     targetenv=""
2957 fi
2958 case "$usecrosscompile" in
2959 $define|true|[yY]*)
2960         $echo "Cross-compiling..."
2961         croak=''
2962         case "$cc" in
2963         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2964             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2965             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2966             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2967             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2968             # leave out ld, choosing it is more complex
2969             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2970             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2971             # We are in a weird spot. Just before us, some values
2972             # were 'saved', to be restored after the hints are
2973             # run.  This means that the changes we made to ar,
2974             # nm and ranlib will get reverted.
2975             # To avoid that, we hijack the saving mechanism and
2976             # have it save our new values.
2977             for file in ar nm ranlib; do
2978                 eval xxx=\$$file
2979                 eval $file=$xxx$_exe
2980                 eval _$file=$xxx
2981             done
2982         ;;
2983         esac
2984         case "$targetarch" in
2985         '') echo "Targetarch not defined." >&4; croak=y ;;
2986         *)  echo "Using targetarch $targetarch." >&4 ;;
2987         esac
2988         case "$targethost" in
2989         '') echo "Targethost not defined." >&4; croak=n ;;
2990         *)  echo "Using targethost $targethost." >&4
2991         esac
2992         locincpth=' '
2993         loclibpth=' '
2994         case "$croak" in
2995         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2996         esac
2997     : compile a host miniperl and generate_uudmap, unless we got passed them
2998     if $test "X$hostperl" = X; then
2999       echo "Building host miniperl and generate_uudmap binaries" >&4
3000       before_host=`pwd`
3001       cd ..
3002       cd $src
3003       src=`pwd`
3004       rm -rf $src/host
3005       mkdir $src/host
3006       cd $src/host
3007       $src/Configure -des -Dusedevel -Dmksymlinks
3008       $make miniperl
3009       case "$hostgenerate" in
3010       '') $make generate_uudmap
3011           hostgenerate=$src/host/generate_uudmap
3012           ;;
3013        "$undef") hostgenerate=''
3014           ;;
3015       esac
3016       hostperl=$src/host/miniperl
3017       cd $before_host
3018     fi
3019     hostosname=`$hostperl -le 'print $^O'`
3020     ;;
3021 *)
3022     usecrosscompile="$undef"
3023     ;;
3024 esac
3025
3026 : Define -Dtargethost=somecomputer to run compiled tests on another machine
3027 case "$targethost" in
3028     '') echo "Checking for cross-compile" >&4
3029     case "$usecrosscompile$multiarch" in
3030        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
3031          if [ -f Makefile ]; then
3032            echo " "
3033            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
3034          else
3035            echo "Configure done."
3036          fi
3037        exit 0
3038        ;;
3039      *) echo "No targethost for running compiler tests against defined, running locally" >&4
3040         run=''
3041         to=:
3042         from=:
3043         ;;
3044     esac
3045     ;;
3046     *) echo "Using targethost $targethost." >&4
3047         case "$src" in
3048         /*) run=$src/Cross/run
3049             targetmkdir=$src/Cross/mkdir
3050             to=$src/Cross/to
3051             from=$src/Cross/from
3052             ;;
3053         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3054             run=$pwd/Cross/run
3055             targetmkdir=$pwd/Cross/mkdir
3056             to=$pwd/Cross/to
3057             from=$pwd/Cross/from
3058             ;;
3059         esac
3060         case "$targetrun" in
3061         '') targetrun=ssh ;;
3062         esac
3063         case "$targetto" in
3064         '') targetto=scp ;;
3065         esac
3066         case "$targetfrom" in
3067         '') targetfrom=scp ;;
3068         esac
3069         run=$run-$targetrun
3070         to=$to-$targetto
3071         from=$from-$targetfrom
3072         case "$targetdir" in
3073         '')  targetdir=/tmp
3074              echo "Guessing targetdir $targetdir." >&4
3075              ;;
3076         esac
3077         case "$targetuser" in
3078         '')  targetuser=root
3079              echo "Guessing targetuser $targetuser." >&4
3080              ;;
3081         esac
3082         case "$targetport" in
3083         '')  targetport=22
3084              echo "Guessing targetport $targetport." >&4
3085              ;;
3086         esac
3087         case "$targetfrom" in
3088         scp)    q=-q ;;
3089         *)      q='' ;;
3090         esac
3091         case "$targetrun" in
3092         ssh|rsh)
3093             cat >$run <<EOF
3094 #!/bin/sh
3095 env=''
3096 case "\$1" in
3097 -cwd)
3098   shift
3099   cwd=\$1
3100   shift
3101   ;;
3102 esac
3103 case "\$1" in
3104 -env)
3105   shift
3106   env=\$1
3107   shift
3108   ;;
3109 esac
3110 case "\$cwd" in
3111 '') cwd=$targetdir ;;
3112 esac
3113 exe=\$1
3114 shift
3115 $to \$exe
3116 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3117 EOF
3118             ;;
3119         adb)
3120             $touch $run
3121             ;;
3122         *)  echo "Unknown targetrun '$targetrun'" >&4
3123             exit 1
3124             ;;
3125         esac
3126         case "$targetmkdir" in
3127         */Cross/mkdir)
3128             cat >$targetmkdir <<EOF
3129 #!/bin/sh
3130 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3131 EOF
3132             $chmod a+rx $targetmkdir
3133             ;;
3134         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3135             exit 1
3136             ;;
3137         esac
3138         case "$targetto" in
3139         scp|rcp)
3140             cat >$to <<EOF
3141 #!/bin/sh
3142 for f in \$@
3143 do
3144   case "\$f" in
3145   /*)
3146     $targetmkdir \`dirname \$f\`
3147     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3148     ;;
3149   *)
3150     $targetmkdir $targetdir/\`dirname \$f\`
3151     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3152     ;;
3153   esac
3154 done
3155 exit 0
3156 EOF
3157             ;;
3158         cp) cat >$to <<EOF
3159 #!/bin/sh
3160 for f in \$@
3161 do
3162   case "\$f" in
3163   /*)
3164     $mkdir -p $targetdir/\`dirname \$f\`
3165     $cp \$f $targetdir/\$f || exit 1
3166     ;;
3167   *)
3168     $targetmkdir $targetdir/\`dirname \$f\`
3169     $cp \$f $targetdir/\$f || exit 1
3170     ;;
3171   esac
3172 done
3173 exit 0
3174 EOF
3175             ;;
3176         *)  echo "Unknown targetto '$targetto'" >&4
3177             exit 1
3178             ;;
3179         esac
3180         case "$targetfrom" in
3181         scp|rcp)
3182           cat >$from <<EOF
3183 #!/bin/sh
3184 for f in \$@
3185 do
3186   $rm -f \$f
3187   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3188 done
3189 exit 0
3190 EOF
3191             ;;
3192         cp) cat >$from <<EOF
3193 #!/bin/sh
3194 for f in \$@
3195 do
3196   $rm -f \$f
3197   cp $targetdir/\$f . || exit 1
3198 done
3199 exit 0
3200 EOF
3201             ;;
3202         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3203             exit 1
3204             ;;
3205         esac
3206         if $test ! -f $run; then
3207             echo "Target 'run' script '$run' not found." >&4
3208         else
3209             $chmod a+rx $run
3210         fi
3211         if $test ! -f $to; then
3212             echo "Target 'to' script '$to' not found." >&4
3213         else
3214             $chmod a+rx $to
3215         fi
3216         if $test ! -f $from; then
3217             echo "Target 'from' script '$from' not found." >&4
3218         else
3219             $chmod a+rx $from
3220         fi
3221         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3222             exit 1
3223         fi
3224         cat >&4 <<EOF
3225 Using '$run' for remote execution,
3226 and '$from' and '$to'
3227 for remote file transfer.
3228 EOF
3229         ;;
3230 *)      run=''
3231         to=:
3232         from=:
3233         usecrosscompile="$undef"
3234         targetarch=''
3235         ;;
3236 esac
3237
3238 : see whether [:lower:] and [:upper:] are supported character classes
3239 echo " "
3240 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`"-"`echo AbyZ | $tr '[:upper:]' '[:lower:]' 2>/dev/null`" in
3241 ABYZ-abyz)
3242         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3243         up='[:upper:]'
3244         low='[:lower:]'
3245         ;;
3246 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3247         # (0xd9 and 0xe2), therefore that is a nice testing point.
3248         if test "X$up" = X -o "X$low" = X; then
3249             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3250             rs) up='[A-Z]'
3251                 low='[a-z]'
3252                 ;;
3253             esac
3254         fi
3255         if test "X$up" = X -o "X$low" = X; then
3256             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3257             rs) up='A-Z'
3258                 low='a-z'
3259                 ;;
3260             esac
3261         fi
3262         if test "X$up" = X -o "X$low" = X; then
3263             case "`echo RS | od -x 2>/dev/null`" in
3264             *D9E2*|*d9e2*)
3265                 echo "Hey, this might be EBCDIC." >&4
3266                 if test "X$up" = X -o "X$low" = X; then
3267                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3268                     rs) up='[A-IJ-RS-Z]'
3269                         low='[a-ij-rs-z]'
3270                         ;;
3271                     esac
3272                 fi
3273                 if test "X$up" = X -o "X$low" = X; then
3274                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3275                     rs) up='A-IJ-RS-Z'
3276                         low='a-ij-rs-z'
3277                         ;;
3278                     esac
3279                 fi
3280                 ;;
3281             esac
3282         fi
3283 esac
3284 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3285 rs)
3286     echo "Using $up and $low to convert case." >&4
3287     ;;
3288 *)
3289     echo "I don't know how to translate letters from upper to lower case." >&4
3290     echo "Your tr is not acting any way I know of." >&4
3291     exit 1
3292     ;;
3293 esac
3294 : set up the translation script tr, must be called with ./tr of course
3295 cat >tr <<EOSC
3296 $startsh
3297 case "\$1\$2" in
3298 '[A-Z][a-z]') exec $tr '$up' '$low';;
3299 '[a-z][A-Z]') exec $tr '$low' '$up';;
3300 esac
3301 exec $tr "\$@"
3302 EOSC
3303 chmod +x tr
3304 $eunicefix tr
3305
3306 : Try to determine whether config.sh was made on this system
3307 case "$config_sh" in
3308 '')
3309 myuname=`$uname -a 2>/dev/null`
3310 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3311 # Downcase everything to avoid ambiguity.
3312 # Remove slashes and single quotes so we can use parts of this in
3313 # directory and file names.
3314 # Remove newlines so myuname is sane to use elsewhere.
3315 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3316 # because the A-Z/a-z are not consecutive.
3317 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3318         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3319 newmyuname="$myuname"
3320 dflt=n
3321 case "$knowitall" in
3322 '')
3323         if test -f ../config.sh; then
3324                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3325                         eval "`grep myuname= ../config.sh`"
3326                 fi
3327                 if test "X$myuname" = "X$newmyuname"; then
3328                         dflt=y
3329                 fi
3330         fi
3331         ;;
3332 *) dflt=y;;
3333 esac
3334
3335 : Get old answers from old config file if Configure was run on the
3336 : same system, otherwise use the hints.
3337 hint=default
3338 cd ..
3339 if test -f config.sh; then
3340         echo " "
3341         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3342         . UU/myread
3343         case "$ans" in
3344         n*|N*) echo "OK, I'll ignore it."
3345                 mv config.sh config.sh.old
3346                 myuname="$newmyuname"
3347                 ;;
3348         *)  echo "Fetching default answers from your old config.sh file..." >&4
3349                 tmp_n="$n"
3350                 tmp_c="$c"
3351                 tmp_sh="$sh"
3352                 . ./config.sh
3353                 cp config.sh UU
3354                 n="$tmp_n"
3355                 c="$tmp_c"
3356                 : Older versions did not always set $sh.  Catch re-use of such
3357                 : an old config.sh.
3358                 case "$sh" in
3359                 '') sh="$tmp_sh" ;;
3360                 esac
3361                 hint=previous
3362                 ;;
3363         esac
3364 fi
3365 . ./UU/checkcc
3366 if test ! -f config.sh; then
3367         $cat <<EOM
3368
3369 First time through, eh?  I have some defaults handy for some systems
3370 that need some extra help getting the Configure answers right:
3371
3372 EOM
3373         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3374         dflt=''
3375         : Half the following guesses are probably wrong... If you have better
3376         : tests or hints, please send them to https://github.com/Perl/perl5/issues
3377         : The metaconfig authors would also appreciate a copy...
3378         $test -f /irix && osname=irix
3379         $test -f /xenix && osname=sco_xenix
3380         $test -f /dynix && osname=dynix
3381         $test -f /dnix && osname=dnix
3382         $test -f /lynx.os && osname=lynxos
3383         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3384         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3385         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3386         $test -f /bin/mips && /bin/mips && osname=mips
3387         $test -d /usr/apollo/bin && osname=apollo
3388         $test -f /etc/saf/_sactab && osname=svr4
3389         $test -d /usr/include/minix && osname=minix && osvers=`$uname -r`
3390         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3391         $test -f /sys/utilities/MultiView && osname=amigaos
3392         if $test -d /MachTen -o -d /MachTen_Folder; then
3393                 osname=machten
3394                 if $test -x /sbin/version; then
3395                         osvers=`/sbin/version | $awk '{print $2}' |
3396                         $sed -e 's/[A-Za-z]$//'`
3397                 elif $test -x /usr/etc/version; then
3398                         osvers=`/usr/etc/version | $awk '{print $2}' |
3399                         $sed -e 's/[A-Za-z]$//'`
3400                 else
3401                         osvers="$2.$3"
3402                 fi
3403         fi
3404
3405         $test -f /sys/posix.dll &&
3406                 $test -f /usr/bin/what &&
3407                 set X `/usr/bin/what /sys/posix.dll` &&
3408                 $test "$3" = UWIN &&
3409                 osname=uwin &&
3410                 osvers="$5"
3411
3412         if $test -f $uname; then
3413                 set X $myuname
3414                 shift
3415
3416                 case "$5" in
3417                 fps*) osname=fps ;;
3418                 mips*)
3419                         case "$4" in
3420                         umips) osname=umips ;;
3421                         *) osname=mips ;;
3422                         esac;;
3423                 [23]100) osname=mips ;;
3424                 i386*)
3425                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3426                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3427                                 osname='sco'
3428                                 osvers=$tmp
3429                         elif $test -f /etc/kconfig; then
3430                                 osname=isc
3431                                 if test "$lns" = "$ln -s"; then
3432                                         osvers=4
3433                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3434                                         osvers=3
3435                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3436                                         osvers=2
3437                                 fi
3438                         fi
3439                         tmp=''
3440                         ;;
3441                 pc*)
3442                         if test -n "$DJGPP"; then
3443                                 osname=dos
3444                                 osvers=djgpp
3445                         fi
3446                         ;;
3447                 esac
3448
3449                 case "$1" in
3450                 aix) osname=aix
3451                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3452                         case "$tmp" in
3453                         # oslevel can fail with:
3454                         # oslevel: Unable to acquire lock.
3455                         *not\ found) osvers="$4"."$3" ;;
3456                         '<3240'|'<>3240') osvers=3.2.0 ;;
3457                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3458                         '=3250'|'>3250') osvers=3.2.5 ;;
3459                         *) osvers=$tmp;;
3460                         esac
3461                         ;;
3462                 bitrig) osname=bitrig
3463                         osvers="$3"
3464                         ;;
3465                 bsd386) osname=bsd386
3466                         osvers=`$uname -r`
3467                         ;;
3468                 cygwin*) osname=cygwin
3469                         osvers="$3"
3470                         ;;
3471                 *dc.osx) osname=dcosx
3472                         osvers="$3"
3473                         ;;
3474                 dnix) osname=dnix
3475                         osvers="$3"
3476                         ;;
3477                 domainos) osname=apollo
3478                         osvers="$3"
3479                         ;;
3480                 dgux)   osname=dgux
3481                         osvers="$3"
3482                         ;;
3483                 dragonfly) osname=dragonfly
3484                         osvers="$3"
3485                         ;;
3486                 dynixptx*) osname=dynixptx
3487                         osvers=`echo "$4"|sed 's/^v//'`
3488                         ;;
3489                 freebsd) osname=freebsd
3490                         osvers="$3" ;;
3491                 genix)  osname=genix ;;
3492                 gnu)    osname=gnu
3493                         osvers="$3" ;;
3494                 hp*)    osname=hpux
3495                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3496                         ;;
3497                 irix*)  osname=irix
3498                         case "$3" in
3499                         4*) osvers=4 ;;
3500                         5*) osvers=5 ;;
3501                         *)      osvers="$3" ;;
3502                         esac
3503                         ;;
3504                 linux)  osname=linux
3505                         case "$3" in
3506                         *)      osvers="$3" ;;
3507                         esac
3508                         $test -f /system/lib/libandroid.so && osname=linux-android
3509                         ;;
3510                 MiNT)   osname=mint
3511                         ;;
3512                 minix)  osname=minix
3513                         osvers=`$uname -r`
3514                         ;;
3515                 netbsd*) osname=netbsd
3516                         osvers="$3"
3517                         ;;
3518                 news-os) osvers="$3"
3519                         case "$3" in
3520                         4*) osname=newsos4 ;;
3521                         *) osname=newsos ;;
3522                         esac
3523                         ;;
3524                 nonstop-ux) osname=nonstopux ;;
3525                 openbsd) osname=openbsd
3526                         osvers="$3"
3527                         ;;
3528                 os2)    osname=os2
3529                         osvers="$4"
3530                         ;;
3531                 POSIX-BC | posix-bc ) osname=posix-bc
3532                         osvers="$3"
3533                         ;;
3534                 powerux | power_ux | powermax_os | powermaxos | \
3535                 powerunix | power_unix) osname=powerux
3536                         osvers="$3"
3537                         ;;
3538                 qnx) osname=qnx
3539                         osvers="$4"
3540                         ;;
3541                 solaris) osname=solaris
3542                         case "$3" in
3543                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3544                         *)      osvers="$3" ;;
3545                         esac
3546                         ;;
3547                 sunos) osname=sunos
3548                         case "$3" in
3549                         5*) osname=solaris
3550                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3551                         *)      osvers="$3" ;;
3552                         esac
3553                         ;;
3554                 titanos) osname=titanos
3555                         case "$3" in
3556                         1*) osvers=1 ;;
3557                         2*) osvers=2 ;;
3558                         3*) osvers=3 ;;
3559                         4*) osvers=4 ;;
3560                         *)      osvers="$3" ;;
3561                         esac
3562                         ;;
3563                 ultrix) osname=ultrix
3564                         osvers="$3"
3565                         ;;
3566                 osf1|mls+)      case "$5" in
3567                                 alpha)
3568                                         osname=dec_osf
3569                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3570                                         case "$osvers" in
3571                                         [1-9].[0-9]*) ;;
3572                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3573                                         esac
3574                                         ;;
3575                         hp*)    osname=hp_osf1  ;;
3576                         mips)   osname=mips_osf1 ;;
3577                         esac
3578                         ;;
3579                 # UnixWare 7.1.2 is known as Open UNIX 8
3580                 openunix|unixware) osname=svr5
3581                         osvers="$4"
3582                         ;;
3583                 uts)    osname=uts
3584                         osvers="$3"
3585                         ;;
3586                 vos) osvers="$3"
3587                         ;;
3588                 $2) case "$osname" in
3589                         *isc*) ;;
3590                         *freebsd*) ;;
3591                         svr*)
3592                                 : svr4.x or possibly later
3593                                 case "svr$3" in
3594                                 ${osname}*)
3595                                         osname=svr$3
3596                                         osvers=$4
3597                                         ;;
3598                                 esac
3599                                 case "$osname" in
3600                                 svr4.0)
3601                                         : Check for ESIX
3602                                         if test -f /stand/boot ; then
3603                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3604                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3605                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3606                                                         if test -n "$isesix"; then
3607                                                                 osname=esix4
3608                                                         fi
3609                                                 fi
3610                                         fi
3611                                         ;;
3612                                 esac
3613                                 ;;
3614                         *)      if test -f /etc/systemid; then
3615                                         osname=sco
3616                                         set `echo $3 | $sed 's/\./ /g'` $4
3617                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3618                                                 osvers=$1.$2.$3
3619                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3620                                                 osvers=$1.$2
3621                                         elif $test -f $src/hints/sco_$1.sh; then
3622                                                 osvers=$1
3623                                         fi
3624                                 else
3625                                         case "$osname" in
3626                                         '') : Still unknown.  Probably a generic Sys V.
3627                                                 osname="sysv"
3628                                                 osvers="$3"
3629                                                 ;;
3630                                         esac
3631                                 fi
3632                                 ;;
3633                         esac
3634                         ;;
3635                 *)      case "$osname" in
3636                         '') : Still unknown.  Probably a generic BSD.
3637                                 osname="$1"
3638                                 osvers="$3"
3639                                 ;;
3640                         esac
3641                         ;;
3642                 esac
3643         else
3644                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3645                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3646                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3647                                 osname=news_os
3648                         fi
3649                         $rm -f UU/kernel.what
3650                 elif test -d c:/. -o -n "$is_os2" ; then
3651                         set X $myuname
3652                         osname=os2
3653                         osvers="$5"
3654                 fi
3655         fi
3656
3657         case "$targetarch" in
3658         '') ;;
3659         *)  hostarch=$osname
3660             case "$targetarch" in
3661                 nto*|*-nto-*)
3662                     # Will load qnx.sh, which should change osname to nto
3663                     osname=qnx
3664                     osvers=''
3665                     ;;
3666                 *linux-android*)
3667                     # Catch arm-linux-androideabi, mipsel-linux-android,
3668                     # and i686-linux-android
3669                     osname=linux-android
3670                     osvers=''
3671                     ;;
3672                 *linux*)
3673                     # Something like arm-linux-gnueabihf is really just
3674                     # plain linux.
3675                     osname=linux
3676                     osvers=''
3677                     ;;
3678                 *solaris*|*sunos*)
3679                     osname=solaris
3680                     # XXX perhaps we should just assume
3681                     # osvers to be 2, or maybe take the value
3682                     # from targetarch. Using $run before the
3683                     # hints are run is somewhat icky.
3684                     set X `$run $uname -a 2>/dev/null`
3685                     shift
3686                     case "$3" in
3687                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3688                         *)  osvers="$3" ;;
3689                     esac
3690                     ;;
3691                 *)
3692                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3693                     osvers=''
3694                 ;;
3695             esac
3696             ;;
3697         esac
3698
3699         : Now look for a hint file osname_osvers, unless one has been
3700         : specified already.
3701         case "$hintfile" in
3702         ''|' ')
3703                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3704                 : Also try without trailing minor version numbers.
3705                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3706                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3707                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3708                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3709                 case "$file" in
3710                 '') dflt=none ;;
3711                 *)  case "$osvers" in
3712                         '') dflt=$file
3713                                 ;;
3714                         *)  if $test -f $src/hints/$file.sh ; then
3715                                         dflt=$file
3716                                 elif $test -f $src/hints/$xfile.sh ; then
3717                                         dflt=$xfile
3718                                 elif $test -f $src/hints/$xxfile.sh ; then
3719                                         dflt=$xxfile
3720                                 elif $test -f $src/hints/$xxxfile.sh ; then
3721                                         dflt=$xxxfile
3722                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3723                                         dflt=$xxxxfile
3724                                 elif $test -f "$src/hints/${osname}.sh" ; then
3725                                         dflt="${osname}"
3726                                 else
3727                                         dflt=none
3728                                 fi
3729                                 ;;
3730                         esac
3731                         ;;
3732                 esac
3733                 if $test -f Policy.sh ; then
3734                         case "$dflt" in
3735                         *Policy*) ;;
3736                         none) dflt="Policy" ;;
3737                         *) dflt="Policy $dflt" ;;
3738                         esac
3739                 fi
3740                 ;;
3741         *)
3742                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3743                 ;;
3744         esac
3745
3746         if $test -f Policy.sh ; then
3747                 $cat <<EOM
3748
3749 There's also a Policy hint file available, which should make the
3750 site-specific (policy) questions easier to answer.
3751 EOM
3752
3753         fi
3754
3755         $cat <<EOM
3756
3757 You may give one or more space-separated answers, or "none" if appropriate.
3758 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3759 previous run of Configure, you may specify it as well as or instead of
3760 OS-specific hints.  If hints are provided for your OS, you should use them:
3761 although Perl can probably be built without hints on many platforms, using
3762 hints often improve performance and may enable features that Configure can't
3763 set up on its own. If there are no hints that match your OS, specify "none";
3764 DO NOT give a wrong version or a wrong OS.
3765
3766 EOM
3767
3768         rp="Which of these apply, if any?"
3769         . UU/myread
3770         tans=$ans
3771         for file in $tans; do
3772                 if $test X$file = XPolicy -a -f Policy.sh; then
3773                         . Policy.sh
3774                         $cat Policy.sh >> UU/config.sh
3775                 elif $test -f $src/hints/$file.sh; then
3776                         . $src/hints/$file.sh
3777                         $cat $src/hints/$file.sh >> UU/config.sh
3778                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3779                         : nothing
3780                 else
3781                         : Give one chance to correct a possible typo.
3782                         echo "$file.sh does not exist"
3783                         dflt=$file
3784                         rp="hint to use instead?"
3785                         . UU/myread
3786                         for file in $ans; do
3787                                 if $test -f "$src/hints/$file.sh"; then
3788                                         . $src/hints/$file.sh
3789                                         $cat $src/hints/$file.sh >> UU/config.sh
3790                                 elif $test X$ans = X -o X$ans = Xnone ; then
3791                                         : nothing
3792                                 else
3793                                         echo "$file.sh does not exist -- ignored."
3794                                 fi
3795                         done
3796                 fi
3797         done
3798
3799         hint=recommended
3800         : Remember our hint file for later.
3801         if $test -f "$src/hints/$file.sh" ; then
3802                 hintfile="$file"
3803         else
3804                 hintfile=''
3805         fi
3806 fi
3807 cd UU
3808 ;;
3809 *)
3810         echo " "
3811         echo "Fetching default answers from $config_sh..." >&4
3812         tmp_n="$n"
3813         tmp_c="$c"
3814         cd ..
3815         cp $config_sh config.sh 2>/dev/null
3816         chmod +w config.sh
3817         . ./config.sh
3818         cd UU
3819         cp ../config.sh .
3820         n="$tmp_n"
3821         c="$tmp_c"
3822         hint=previous
3823         ;;
3824 esac
3825 . ./optdef.sh
3826
3827 : Restore computed paths
3828 for file in $loclist $trylist; do
3829         eval $file="\$_$file"
3830 done
3831
3832 cat << EOM
3833
3834 Configure uses the operating system name and version to set some defaults.
3835 The default value is probably right if the name rings a bell. Otherwise,
3836 since spelling matters for me, either accept the default or answer "none"
3837 to leave it blank.
3838
3839 EOM
3840 case "$osname" in
3841         ''|' ')
3842                 case "$hintfile" in
3843                 ''|' '|none) dflt=none ;;
3844                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3845                 esac
3846                 ;;
3847         *) dflt="$osname" ;;
3848 esac
3849 rp="Operating system name?"
3850 . ./myread
3851 case "$ans" in
3852 none)  osname='' ;;
3853 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3854 esac
3855 echo " "
3856 case "$osvers" in
3857         ''|' ')
3858                 case "$hintfile" in
3859                 ''|' '|none) dflt=none ;;
3860                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3861                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3862                         case "$dflt" in
3863                         ''|' ') dflt=none ;;
3864                         esac
3865                         ;;
3866                 esac
3867                 ;;
3868         *) dflt="$osvers" ;;
3869 esac
3870 rp="Operating system version?"
3871 . ./myread
3872 case "$ans" in
3873 none)  osvers='' ;;
3874 *) osvers="$ans" ;;
3875 esac
3876
3877
3878 . ./posthint.sh
3879
3880 : who configured the system
3881 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3882 case "$cf_by" in
3883 "")
3884         cf_by=`(logname) 2>/dev/null`
3885         case "$cf_by" in
3886         "")
3887                 cf_by=`(whoami) 2>/dev/null`
3888                 case "$cf_by" in
3889                 "") cf_by=unknown ;;
3890                 esac ;;
3891         esac ;;
3892 esac
3893
3894 : decide how portable to be.  Allow command line overrides.
3895 case "$d_portable" in
3896 "$undef") ;;
3897 *)      d_portable="$define" ;;
3898 esac
3899
3900 : set up shell script to do ~ expansion
3901 cat >filexp <<EOSS
3902 $startsh
3903 : expand filename
3904 case "\$1" in
3905  \~/*|\~)
3906         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3907         ;;
3908  \~*)
3909         if $test -f /bin/csh; then
3910                 /bin/csh -f -c "glob \$1"
3911                 failed=\$?
3912                 echo ""
3913                 exit \$failed
3914         else
3915                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3916                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3917                 if $test ! -d "\$dir"; then
3918                         me=\`basename \$0\`
3919                         echo "\$me: can't locate home directory for: \$name" >&2
3920                         exit 1
3921                 fi
3922                 case "\$1" in
3923                 */*)
3924                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3925                         ;;
3926                 *)
3927                         echo \$dir
3928                         ;;
3929                 esac
3930         fi
3931         ;;
3932 *)
3933         echo \$1
3934         ;;
3935 esac
3936 EOSS
3937 chmod +x filexp
3938 $eunicefix filexp
3939
3940 : now set up to get a file name
3941 cat <<EOS >getfile
3942 $startsh
3943 EOS
3944 cat <<'EOSC' >>getfile
3945 tilde=''
3946 fullpath=''
3947 already=''
3948 skip=''
3949 none_ok=''
3950 exp_file=''
3951 nopath_ok=''
3952 orig_rp="$rp"
3953 orig_dflt="$dflt"
3954 case "$gfpth" in
3955 '') gfpth='.' ;;
3956 esac
3957
3958 case "$fn" in
3959 *\(*)
3960         : getfile will accept an answer from the comma-separated list
3961         : enclosed in parentheses even if it does not meet other criteria.
3962         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3963         fn=`echo $fn | sed 's/(.*)//'`
3964         ;;
3965 esac
3966
3967 case "$fn" in
3968 *:*)
3969         loc_file=`expr $fn : '.*:\(.*\)'`
3970         fn=`expr $fn : '\(.*\):.*'`
3971         ;;
3972 esac
3973
3974 case "$fn" in
3975 *~*) tilde=true;;
3976 esac
3977 case "$fn" in
3978 */*) fullpath=true;;
3979 esac
3980 case "$fn" in
3981 *+*) skip=true;;
3982 esac
3983 case "$fn" in
3984 *n*) none_ok=true;;
3985 esac
3986 case "$fn" in
3987 *e*) exp_file=true;;
3988 esac
3989 case "$fn" in
3990 *p*) nopath_ok=true;;
3991 esac
3992
3993 case "$fn" in
3994 *f*) type='File';;
3995 *d*) type='Directory';;
3996 *l*) type='Locate';;
3997 esac
3998
3999 what="$type"
4000 case "$what" in
4001 Locate) what='File';;
4002 esac
4003
4004 case "$exp_file" in
4005 '')
4006         case "$d_portable" in
4007         "$define") ;;
4008         *) exp_file=true;;
4009         esac
4010         ;;
4011 esac
4012
4013 cd ..
4014 while test "$type"; do
4015         redo=''
4016         rp="$orig_rp"
4017         dflt="$orig_dflt"
4018         case "$tilde" in
4019         true) rp="$rp (~name ok)";;
4020         esac
4021         . UU/myread
4022         if test -f UU/getfile.ok && \
4023                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4024         then
4025                 value="$ans"
4026                 ansexp="$ans"
4027                 break
4028         fi
4029         case "$ans" in
4030         none)
4031                 value=''
4032                 ansexp=''
4033                 case "$none_ok" in
4034                 true) type='';;
4035                 esac
4036                 ;;
4037         *)
4038                 case "$tilde" in
4039                 '') value="$ans"
4040                         ansexp="$ans";;
4041                 *)
4042                         value=`UU/filexp $ans`
4043                         case $? in
4044                         0)
4045                                 if test "$ans" != "$value"; then
4046                                         echo "(That expands to $value on this system.)"
4047                                 fi
4048                                 ;;
4049                         *) value="$ans";;
4050                         esac
4051                         ansexp="$value"
4052                         case "$exp_file" in
4053                         '') value="$ans";;
4054                         esac
4055                         ;;
4056                 esac
4057                 case "$fullpath" in
4058                 true)
4059                         case "$ansexp" in
4060                         /*) value="$ansexp" ;;
4061                         [a-zA-Z]:/*) value="$ansexp" ;;
4062                         *)
4063                                 redo=true
4064                                 case "$already" in
4065                                 true)
4066                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4067                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4068                                         ;;
4069                                 *)
4070                                 echo "Please give a full path name, starting with slash." >&4
4071                                         case "$tilde" in
4072                                         true)
4073                                 echo "Note that using ~name is ok provided it expands well." >&4
4074                                                 already=true
4075                                                 ;;
4076                                         esac
4077                                 esac
4078                                 ;;
4079                         esac
4080                         ;;
4081                 esac
4082                 case "$redo" in
4083                 '')
4084                         case "$type" in
4085                         File)
4086                                 for fp in $gfpth; do
4087                                         if test "X$fp" = X.; then
4088                                             pf="$ansexp"
4089                                         else    
4090                                             pf="$fp/$ansexp"
4091                                         fi
4092                                         if test -f "$pf"; then
4093                                                 type=''
4094                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4095                                         then
4096                                                 echo "($value is not a plain file, but that's ok.)"
4097                                                 type=''
4098                                         fi
4099                                         if test X"$type" = X; then
4100                                             value="$pf"
4101                                             break
4102                                         fi
4103                                 done
4104                                 ;;
4105                         Directory)
4106                                 for fp in $gfpth; do
4107                                         if test "X$fp" = X.; then
4108                                             dir="$ans"
4109                                             direxp="$ansexp"
4110                                         else    
4111                                             dir="$fp/$ansexp"
4112                                             direxp="$fp/$ansexp"
4113                                         fi
4114                                         if test -d "$direxp"; then
4115                                                 type=''
4116                                                 value="$dir"
4117                                                 break
4118                                         fi
4119                                 done
4120                                 ;;
4121                         Locate)
4122                                 if test -d "$ansexp"; then
4123                                         echo "(Looking for $loc_file in directory $value.)"
4124                                         value="$value/$loc_file"
4125                                         ansexp="$ansexp/$loc_file"
4126                                 fi
4127                                 if test -f "$ansexp"; then
4128                                         type=''
4129                                 fi
4130                                 case "$nopath_ok" in
4131                                 true)   case "$value" in
4132                                         */*) ;;
4133                                         *)      echo "Assuming $value will be in people's path."
4134                                                 type=''
4135                                                 ;;
4136                                         esac
4137                                         ;;
4138                                 esac
4139                                 ;;
4140                         esac
4141
4142                         case "$skip" in
4143                         true) type='';
4144                         esac
4145
4146                         case "$type" in
4147                         '') ;;
4148                         *)
4149                                 if test "$fastread" = yes; then
4150                                         dflt=y
4151                                 else
4152                                         dflt=n
4153                                 fi
4154                                 rp="$what $value doesn't exist.  Use that name anyway?"
4155                                 . UU/myread
4156                                 dflt=''
4157                                 case "$ans" in
4158                                 y*) type='';;
4159                                 *) echo " ";;
4160                                 esac
4161                                 ;;
4162                         esac
4163                         ;;
4164                 esac
4165                 ;;
4166         esac
4167 done
4168 cd UU
4169 ans="$value"
4170 rp="$orig_rp"
4171 dflt="$orig_dflt"
4172 rm -f getfile.ok
4173 test "X$gfpthkeep" != Xy && gfpth=""
4174 EOSC
4175
4176 : determine root of directory hierarchy where package will be installed.
4177 case "$prefix" in
4178 '')     dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4179         ;;
4180 *)      dflt="$prefix"
4181         ;;
4182 esac
4183 $cat <<EOM
4184
4185 By default, $package will be installed in $dflt/bin, manual pages
4186 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4187 installation directories. Typically this is something like /usr/local.
4188 If you wish to have binaries under /usr/bin but other parts of the
4189 installation under /usr/local, that's ok: you will be prompted
4190 separately for each of the installation directories, the prefix being
4191 only used to set the defaults.
4192
4193 EOM
4194 fn=d~
4195 rp='Installation prefix to use?'
4196 . ./getfile
4197 oldprefix=''
4198 case "$prefix" in
4199 '')     ;;
4200 *)      case "$ans" in
4201         "$prefix") ;;
4202         *) oldprefix="$prefix";;
4203         esac
4204         ;;
4205 esac
4206
4207 case "$ans" in
4208 *?/)    prefix=`echo "$ans" | sed 's/.$//'`
4209         ;;
4210 *)      prefix="$ans"
4211 esac
4212
4213 case "$ansexp" in
4214 *?/)    prefixexp=`echo "$ansexp" | sed 's/.$//'`
4215         ;;
4216 *)      prefixexp="$ansexp"
4217 esac
4218
4219 : allow them to override the AFS root
4220 case "$afsroot" in
4221 '')     afsroot=/afs ;;
4222 *)      afsroot=$afsroot ;;
4223 esac
4224
4225 : is AFS running?
4226 echo " "
4227 case "$afs" in
4228 $define|true)   afs=true ;;
4229 $undef|false)   afs=false ;;
4230 *)      if $test -d $afsroot; then
4231                 afs=true
4232         else
4233                 afs=false
4234         fi
4235         ;;
4236 esac
4237 if $afs; then
4238         echo "AFS may be running... I'll be extra cautious then..." >&4
4239 else
4240         echo "AFS does not seem to be running..." >&4
4241 fi
4242
4243 : determine installation prefix for where package is to be installed.
4244 if $afs; then
4245 $cat <<EOM
4246
4247 Since you are running AFS, I need to distinguish the directory in which
4248 files will reside from the directory in which they are installed (and from
4249 which they are presumably copied to the former directory by occult means).
4250
4251 EOM
4252         case "$installprefix" in
4253         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4254         *) dflt="$installprefix";;
4255         esac
4256 else
4257 $cat <<EOM
4258
4259 In some special cases, particularly when building $package for distribution,
4260 it is convenient to distinguish the directory in which files should be
4261 installed from the directory ($prefix) in which they will
4262 eventually reside.  For most users, these two directories are the same.
4263
4264 EOM
4265         case "$installprefix" in
4266         '') dflt=$prefix ;;
4267         *) dflt=$installprefix;;
4268         esac
4269 fi
4270 fn=d~
4271 rp='What installation prefix should I use for installing files?'
4272 . ./getfile
4273 installprefix="$ans"
4274 installprefixexp="$ansexp"
4275
4276 : Perform the prefixexp/installprefixexp correction if necessary
4277 cat <<EOS >installprefix
4278 $startsh
4279 EOS
4280 cat <<'EOSC' >>installprefix
4281 : Change installation prefix, if necessary.
4282 if $test X"$prefix" != X"$installprefix"; then
4283     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4284 else
4285     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4286 fi
4287 EOSC
4288 chmod +x installprefix
4289 $eunicefix installprefix
4290
4291 : Set variables such as privlib and privlibexp from the output of ./getfile
4292 : performing the prefixexp/installprefixexp correction if necessary.
4293 cat <<EOS >setprefixvar
4294 $startsh
4295 EOS
4296 cat <<'EOSC' >>setprefixvar
4297 eval "${prefixvar}=\"\$ans\""
4298 eval "${prefixvar}exp=\"\$ansexp\""
4299 . ./installprefix
4300 EOSC
4301 chmod +x setprefixvar
4302 $eunicefix setprefixvar
4303
4304 : set up the script used to warn in case of inconsistency
4305 cat <<EOS >whoa
4306 $startsh
4307 EOS
4308 cat <<'EOSC' >>whoa
4309 dflt=y
4310 case "$hint" in
4311     recommended)
4312         case "$hintfile" in
4313         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4314                 ;;
4315         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4316                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4317                 ;;
4318         esac
4319         ;;
4320     *)  echo " "
4321         echo "*** WHOA THERE!!! ***" >&4
4322         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4323         ;;
4324 esac
4325 rp="    Keep the $hint value?"
4326 . ./myread
4327 case "$ans" in
4328 y) td=$was; tu=$was;;
4329 esac
4330 EOSC
4331
4332 : function used to set '$1' to '$val'
4333 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4334 case "$val$was" in
4335 $define$undef) . ./whoa; eval "$var=\$td";;
4336 $undef$define) . ./whoa; eval "$var=\$tu";;
4337 *) eval "$var=$val";;
4338 esac'
4339
4340 : Do we want threads support and if so, what type
4341 case "$usethreads" in
4342 $define|true|[yY]*)     dflt='y';;
4343 *)     # Catch case where user specified ithreads but
4344        # forgot -Dusethreads (A.D. 4/2002)
4345        case "$useithreads" in
4346        *$define*)       dflt='y';;
4347        *)               dflt='n';;
4348        esac
4349        ;;
4350 esac
4351 cat <<EOM
4352
4353 Perl can be built to offer a form of threading support on some systems
4354 To do so, Configure can be run with -Dusethreads.
4355
4356 Note that Perl built with threading support runs slightly slower
4357 and uses slightly more memory than plain Perl.
4358
4359 If this doesn't make any sense to you, just accept the default '$dflt'.
4360 EOM
4361 rp='Build a threading Perl?'
4362 . ./myread
4363 case "$ans" in
4364 y|Y)    val="$define" ;;
4365 *)      val="$undef" ;;
4366 esac
4367 set usethreads
4368 eval $setvar
4369
4370 useithreads="$usethreads"
4371
4372 case "$d_oldpthreads" in
4373 '')     : Configure tests would be welcome here.  For now, assume undef.
4374         val="$undef" ;;
4375 *)      val="$d_oldpthreads" ;;
4376 esac
4377 set d_oldpthreads
4378 eval $setvar
4379
4380
4381 : Look for a hint-file generated 'call-back-unit'.  If the
4382 : user has specified that a threading perl is to be built,
4383 : we may need to set or change some other defaults.
4384 if $test -f usethreads.cbu; then
4385     echo "Your platform has some specific hints regarding threaded builds, using them..."
4386     . ./usethreads.cbu
4387 else
4388     case "$usethreads" in
4389         "$define"|true|[yY]*)
4390                 $cat <<EOM
4391 (Your platform does not have any specific hints for threaded builds.
4392  Assuming POSIX threads, then.)
4393 EOM
4394         ;;
4395     esac
4396 fi
4397
4398 : Check if multiplicity is required
4399 cat <<EOM
4400
4401 Perl can be built so that multiple Perl interpreters can coexist
4402 within the same Perl executable.
4403 EOM
4404
4405 case "$useithreads" in
4406 $define)
4407         cat <<EOM
4408 This multiple interpreter support is required for interpreter-based threads.
4409 EOM
4410         val="$define"
4411         ;;
4412 *)      case "$usemultiplicity" in
4413         $define|true|[yY]*)     dflt='y';;
4414         *) dflt='n';;
4415         esac
4416         echo " "
4417         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4418         rp='Build Perl for multiplicity?'
4419         . ./myread
4420         case "$ans" in
4421         y|Y)    val="$define" ;;
4422         *)      val="$undef" ;;
4423         esac
4424         ;;
4425 esac
4426 set usemultiplicity
4427 eval $setvar
4428
4429 : Check if morebits is requested
4430 case "$usemorebits" in
4431 "$define"|true|[yY]*)
4432         use64bitint="$define"
4433         uselongdouble="$define"
4434         usemorebits="$define"
4435         ;;
4436 *)      usemorebits="$undef"
4437         ;;
4438 esac
4439
4440 : Determine the C compiler to be used
4441 echo " "
4442 case "$cc" in
4443 '') dflt=cc;;
4444 *) dflt="$cc";;
4445 esac
4446 rp="Use which C compiler?"
4447 . ./myread
4448 cc="$ans"
4449
4450 : See whether they have no cc but they do have gcc
4451 . ./trygcc
4452 if $test -f cc.cbu; then
4453     . ./cc.cbu
4454 fi
4455 . ./checkcc
4456
4457 : make some quick guesses about what we are up against
4458 echo " "
4459 $echo $n "Hmm...  $c"
4460 echo exit 1 >bsd
4461 echo exit 1 >usg
4462 echo exit 1 >v7
4463 echo exit 1 >osf1
4464 echo exit 1 >eunice
4465 echo exit 1 >xenix
4466 echo exit 1 >venix
4467 echo exit 1 >os2
4468 d_bsd="$undef"
4469 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4470 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4471 then
4472         echo "Looks kind of like an OSF/1 system, but we'll see..."
4473         echo exit 0 >osf1
4474 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4475         xxx=`./loc addbib blurfl $pth`
4476         if $test -f $xxx; then
4477         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4478                 echo exit 0 >bsd
4479                 echo exit 0 >usg
4480         else
4481                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4482                         echo "Looks kind of like an extended USG system, but we'll see..."
4483                 else
4484                         echo "Looks kind of like a USG system, but we'll see..."
4485                 fi
4486                 echo exit 0 >usg
4487         fi
4488 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4489         echo "Looks kind of like a BSD system, but we'll see..."
4490         d_bsd="$define"
4491         echo exit 0 >bsd
4492 else
4493         echo "Looks kind of like a Version 7 system, but we'll see..."
4494         echo exit 0 >v7
4495 fi
4496 case "$eunicefix" in
4497 *unixtovms*)
4498         $cat <<'EOI'
4499 There is, however, a strange, musty smell in the air that reminds me of
4500 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4501 EOI
4502         echo exit 0 >eunice
4503         d_eunice="$define"
4504 : it so happens the Eunice I know will not run shell scripts in Unix format
4505         ;;
4506 *)
4507         echo " "
4508         echo "Congratulations.  You aren't running Eunice."
4509         d_eunice="$undef"
4510         ;;
4511 esac
4512 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4513 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4514 : semicolon as a patch separator
4515 case "$p_" in
4516 :) ;;
4517 *)
4518         $cat <<'EOI'
4519 I have the feeling something is not exactly right, however...don't tell me...
4520 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4521 (Or you may be running DOS with DJGPP.)
4522 EOI
4523         echo exit 0 >os2
4524         ;;
4525 esac
4526 if test -f /xenix; then
4527         echo "Actually, this looks more like a XENIX system..."
4528         echo exit 0 >xenix
4529         d_xenix="$define"
4530 else
4531         echo " "
4532         echo "It's not Xenix..."
4533         d_xenix="$undef"
4534 fi
4535 chmod +x xenix
4536 $eunicefix xenix
4537 if test -f /venix; then
4538         echo "Actually, this looks more like a VENIX system..."
4539         echo exit 0 >venix
4540 else
4541         echo " "
4542         if ./xenix; then
4543                 : null
4544         else
4545                 echo "Nor is it Venix..."
4546         fi
4547 fi
4548 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4549 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4550 $rm -f foo
4551
4552 : Check if we are using GNU gcc and what its version is
4553 echo " "
4554 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4555 $cat >try.c <<EOM
4556 #include <stdio.h>
4557 int main() {
4558 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4559 #ifdef __VERSION__
4560         printf("%s\n", __VERSION__);
4561 #else
4562         printf("%s\n", "1");
4563 #endif
4564 #endif
4565         return(0);
4566 }
4567 EOM
4568 if $cc -o try $ccflags $ldflags try.c; then
4569         gccversion=`$run ./try`
4570         case "$gccversion" in
4571         '') echo "You are not using GNU cc." ;;
4572         *)  echo "You are using GNU cc $gccversion."
4573             ccname=gcc
4574             ;;
4575         esac
4576 else
4577         echo " "
4578         echo "*** WHOA THERE!!! ***" >&4
4579         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4580         case "$knowitall" in
4581         '')
4582         echo "    You'd better start hunting for one and let me know about it." >&4
4583                 exit 1
4584                 ;;
4585         esac
4586 fi
4587 $rm -f try try.*
4588 case "$gccversion" in
4589 1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4590 esac
4591 case "$gccversion" in
4592 '') gccosandvers='' ;;
4593 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4594    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4595    gccshortvers=''
4596    case "$gccosandvers" in
4597    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4598    $osname$osvers) ;; # looking good
4599    $osname*) cat <<EOM >&4
4600
4601 *** WHOA THERE!!! ***
4602
4603     Your gcc has not been compiled for the exact release of
4604     your operating system ($gccosandvers versus $osname$osvers).
4605
4606     In general it is a good idea to keep gcc synchronized with
4607     the operating system because otherwise serious problems
4608     may ensue when trying to compile software, like Perl.
4609
4610     I'm trying to be optimistic here, though, and will continue.
4611     If later during the configuration and build icky compilation
4612     problems appear (headerfile conflicts being the most common
4613     manifestation), I suggest reinstalling the gcc to match
4614     your operating system release.
4615
4616 EOM
4617       ;;
4618    *) gccosandvers='' ;; # failed to parse, better be silent
4619    esac
4620    ;;
4621 esac
4622 case "$ccname" in
4623 '') ccname="$cc" ;;
4624 esac
4625
4626 # gcc 3.* complain about adding -Idirectories that they already know about,
4627 # so we will take those off from locincpth.
4628 case "$gccversion" in
4629 3.*)
4630     echo "main(){}">try.c
4631     for incdir in $locincpth; do
4632        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4633              grep '^c[cp]p*[01]: warning: changing search order '`
4634        if test "X$warn" != X; then
4635            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4636        fi
4637     done
4638     $rm -f try try.*
4639 esac
4640
4641 # gcc 4.9 by default does some optimizations that break perl.
4642 # see ticket 121505.
4643 #
4644 # The -fwrapv disables those optimizations (and probably others,) so
4645 # for gcc 4.9 (and later, since the optimizations probably won't go
4646 # away), add -fwrapv unless the user requests -fno-wrapv, which
4647 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4648 # which turns the overflows -fwrapv ignores into runtime errors.
4649 case "$gccversion" in
4650 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4651     case "$ccflags" in
4652     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4653     *) ccflags="$ccflags -fwrapv" ;;
4654     esac
4655 esac
4656
4657 : What should the include directory be ?
4658 : Use sysroot if set, so findhdr looks in the right place.
4659 echo " "
4660 $echo $n "Hmm...  $c"
4661 dflt="$sysroot/usr/include"
4662 incpath=''
4663 mips_type=''
4664 if $test -f /bin/mips && /bin/mips; then
4665         echo "Looks like a MIPS system..."
4666         $cat >usr.c <<'EOCP'
4667 #ifdef SYSTYPE_BSD43
4668 /bsd43
4669 #endif
4670 EOCP
4671         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4672                 dflt='/bsd43/usr/include'
4673                 incpath='/bsd43'
4674                 mips_type='BSD 4.3'
4675         else
4676                 mips_type='System V'
4677         fi
4678         $rm -f usr.c usr.out
4679         echo "and you're compiling with the $mips_type compiler and libraries."
4680         xxx_prompt=y
4681         echo "exit 0" >mips
4682 else
4683         echo "Doesn't look like a MIPS system."
4684         xxx_prompt=n
4685         echo "exit 1" >mips
4686 fi
4687 chmod +x mips
4688 $eunicefix mips
4689 case "$usrinc" in
4690 '') ;;
4691 *) dflt="$usrinc";;
4692 esac
4693 case "$xxx_prompt" in
4694 y)      fn=d/
4695         echo " "
4696         rp='Where are the include files you want to use?'
4697         . ./getfile
4698         usrinc="$ans"
4699         ;;
4700 *)      usrinc="$dflt"
4701         ;;
4702 esac
4703
4704 : see how we invoke the C preprocessor
4705 echo " "
4706 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4707 cat <<'EOT' >testcpp.c
4708 #define ABC abc
4709 #define XYZ xyz
4710 ABC.XYZ
4711 EOT
4712 cd ..
4713 if test ! -f cppstdin; then
4714         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4715                 # AIX cc -E doesn't show the absolute headerfile
4716                 # locations but we'll cheat by using the -M flag.
4717                 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
4718         else
4719                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4720         fi
4721 else
4722         echo "Keeping your $hint cppstdin wrapper."
4723 fi
4724 chmod 755 cppstdin
4725 wrapper=`pwd`/cppstdin
4726 ok='false'
4727 cd UU
4728
4729 if $test "X$cppstdin" != "X" && \
4730         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4731         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4732 then
4733         echo "You used to use $cppstdin $cppminus so we'll use that again."
4734         case "$cpprun" in
4735         '') echo "But let's see if we can live without a wrapper..." ;;
4736         *)
4737                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4738                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4739                 then
4740                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4741                         ok='true'
4742                 else
4743                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4744                 fi
4745                 ;;
4746         esac
4747 else
4748         case "$cppstdin" in
4749         '') ;;
4750         *)
4751                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4752                 ;;
4753         esac
4754 fi
4755
4756 if $ok; then
4757         : nothing
4758 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4759         $cc -E <testcpp.c >testcpp.out 2>&1; \
4760         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4761         echo "Yup, it does."
4762         x_cpp="$cc $cppflags -E"
4763         x_minus='';
4764 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4765         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4766         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4767         echo "Yup, it does."
4768         x_cpp="$cc $cppflags -E"
4769         x_minus='-';
4770 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4771         $cc -P <testcpp.c >testcpp.out 2>&1; \
4772         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4773         echo "Yipee, that works!"
4774         x_cpp="$cc $cppflags -P"
4775         x_minus='';
4776 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4777         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4778         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4779         echo "At long last!"
4780         x_cpp="$cc $cppflags -P"
4781         x_minus='-';
4782 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4783         $cpp <testcpp.c >testcpp.out 2>&1; \
4784         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4785         echo "It works!"
4786         x_cpp="$cpp $cppflags"
4787         x_minus='';
4788 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4789         $cpp - <testcpp.c >testcpp.out 2>&1; \
4790         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4791         echo "Hooray, it works!  I was beginning to wonder."
4792         x_cpp="$cpp $cppflags"
4793         x_minus='-';
4794 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4795         $wrapper <testcpp.c >testcpp.out 2>&1; \
4796         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4797         x_cpp="$wrapper"
4798         x_minus=''
4799         echo "Eureka!"
4800 else
4801         dflt=''
4802         rp="No dice.  I can't find a C preprocessor.  Name one:"
4803         . ./myread
4804         x_cpp="$ans"
4805         x_minus=''
4806         $x_cpp <testcpp.c >testcpp.out 2>&1
4807         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4808                 echo "OK, that will do." >&4
4809         else
4810 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4811                 exit 1
4812         fi
4813 fi
4814
4815 case "$ok" in
4816 false)
4817         cppstdin="$x_cpp"
4818         cppminus="$x_minus"
4819         cpprun="$x_cpp"
4820         cpplast="$x_minus"
4821         set X $x_cpp
4822         shift
4823         case "$1" in
4824         "$cpp")
4825                 echo "Perhaps can we force $cc -E using a wrapper..."
4826                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4827                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4828                 then
4829                         echo "Yup, we can."
4830                         cppstdin="$wrapper"
4831                         cppminus='';
4832                 else
4833                         echo "Nope, we'll have to live without it..."
4834                 fi
4835                 ;;
4836         esac
4837         case "$cpprun" in
4838         "$wrapper")
4839                 cpprun=''
4840                 cpplast=''
4841                 ;;
4842         esac
4843         ;;
4844 esac
4845
4846 case "$cppstdin" in
4847 "$wrapper"|'cppstdin') ;;
4848 *) $rm -f $wrapper;;
4849 esac
4850 $rm -f testcpp.c testcpp.out
4851
4852 : Adjust cppfilter for path component separator
4853 case "$osname" in
4854 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4855 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4856 *)   cppfilter='' ;;
4857 esac
4858
4859 : Use gcc to determine libpth and incpth
4860 # If using gcc or clang, we can get better values for libpth, incpth
4861 # and usrinc directly from the compiler.
4862 # Note that ccname for clang is also gcc.
4863 case "$ccname" in
4864     gcc)
4865         $echo 'extern int foo;' > try.c
4866         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4867         shift
4868         if $test $# -gt 0; then
4869             incpth="$incpth $*"
4870             incpth="`$echo $incpth|$sed 's/^ //'`"
4871             for i in $*; do
4872                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4873                 if $test -d $j; then
4874                     libpth="$libpth $j"
4875                 fi
4876             done
4877             libpth="`$echo $libpth|$sed 's/^ //'`"
4878             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4879                 if $test -d $xxx; then
4880                     case " $libpth " in
4881                     *" $xxx "*) ;;
4882                     *) libpth="$libpth $xxx";;
4883                     esac
4884                 fi
4885             done
4886         fi
4887         $rm -f try.c
4888         case "$usrinc" in
4889         '') for i in $incpth; do
4890                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4891                     usrinc="$i"
4892                     break
4893                 fi
4894             done
4895             ;;
4896         esac
4897
4898         case "$usecrosscompile" in
4899         $define|true|[yY]*)
4900             case "$incpth" in
4901                 '') echo "Incpth not defined." >&4; croak=y ;;
4902                 *)  echo "Using incpth '$incpth'." >&4 ;;
4903             esac
4904             case "$libpth" in
4905                 '') echo "Libpth not defined." >&4; croak=y ;;
4906                 *)  echo "Using libpth '$libpth'." >&4 ;;
4907             esac
4908             case "$usrinc" in
4909                 '') echo "Usrinc not defined." >&4; croak=y ;;
4910                 *)  echo "Using usrinc $usrinc." >&4 ;;
4911             esac
4912             case "$croak" in
4913                 y)
4914                 if test "X$sysroot" = X; then
4915                     echo "Cannot continue, aborting." >&4; exit 1
4916                 else
4917                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4918                 fi
4919                 ;;
4920             esac
4921             ;;
4922         esac
4923     ;;
4924 esac
4925
4926 : Default value for incpth is just usrinc
4927 case "$incpth" in
4928 '') incpth="$usrinc";;
4929 esac
4930
4931 : Set private lib path
4932 case "$plibpth" in
4933 '') if ./mips; then
4934         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
4935     fi;;
4936 esac
4937 case "$libpth" in
4938 ' ') dlist='';;
4939 '') dlist="$loclibpth $plibpth $glibpth";;
4940 *) dlist="$libpth";;
4941 esac
4942
4943 : Now check and see which directories actually exist, avoiding duplicates
4944 for xxx in $dlist
4945 do
4946     if $test -d $xxx; then
4947                 case " $libpth " in
4948                 *" $xxx "*) ;;
4949                 *) libpth="$libpth $xxx";;
4950                 esac
4951     fi
4952 done
4953 $cat <<'EOM'
4954
4955 Some systems have incompatible or broken versions of libraries.  Among
4956 the directories listed in the question below, please remove any you
4957 know not to be holding relevant libraries, and add any that are needed.
4958 Say "none" for none.
4959
4960 EOM
4961
4962 if test "X$sysroot" != X; then
4963     $cat <<EOM
4964 You have set sysroot to $sysroot, please supply the directories excluding sysroot
4965
4966 EOM
4967 fi
4968
4969 case "$libpth" in
4970 '') dflt='none';;
4971 *)
4972         set X $libpth
4973         shift
4974         dflt=${1+"$@"}
4975         ;;
4976 esac
4977 rp="Directories to use for library searches?"
4978 . ./myread
4979 case "$ans" in
4980 none) libpth=' ';;
4981 *) libpth="$ans";;
4982 esac
4983
4984 : compute shared library extension
4985 case "$so" in
4986 '')
4987         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4988                 dflt='sl'
4989         else
4990                 dflt='so'
4991         fi
4992         ;;
4993 *) dflt="$so";;
4994 esac
4995 $cat <<EOM
4996
4997 On some systems, shared libraries may be available.  Answer 'none' if
4998 you want to suppress searching of shared libraries for the remainder
4999 of this configuration.
5000
5001 EOM
5002 rp='What is the file extension used for shared libraries?'
5003 . ./myread
5004 so="$ans"
5005
5006 : Does target system insist that shared library basenames are unique
5007 $cat << EOM
5008
5009 Some dynamic loaders assume that the *basename* of shared library filenames
5010 are globally unique.  We'll default this to undef as we assume your system
5011 is not this weird. Set to defined if you're on one of them.
5012
5013 EOM
5014
5015 dflt='n'
5016 rp='Make shared library basenames unique?'
5017 . ./myread
5018 case "$ans" in
5019 y|Y) val="$define" ;;
5020 *)   val="$undef"  ;;
5021 esac
5022 set d_libname_unique
5023 eval $setvar
5024
5025 : Define several unixisms.
5026 : Hints files or command line option can be used to override them.
5027 : The convoluted testing is in case hints files set either the old
5028 : or the new name.
5029 case "$_exe" in
5030 '')     case "$exe_ext" in
5031         '')     ;;
5032         *)      _exe="$exe_ext" ;;
5033         esac
5034         ;;
5035 esac
5036 case "$_a" in
5037 '')     case "$lib_ext" in
5038     '') _a='.a';;
5039         *)      _a="$lib_ext" ;;
5040         esac
5041         ;;
5042 esac
5043 case "$_o" in
5044 '') case "$obj_ext" in
5045         '')     _o='.o';;
5046         *)      _o="$obj_ext";;
5047         esac
5048         ;;
5049 esac
5050 case "$p_" in
5051 '') case "$path_sep" in
5052         '')     p_=':';;
5053         *)      p_="$path_sep";;
5054         esac
5055         ;;
5056 esac
5057 exe_ext=$_exe
5058 lib_ext=$_a
5059 obj_ext=$_o
5060 path_sep=$p_
5061
5062 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5063
5064 : Which makefile gets called first.  This is used by make depend.
5065 case "$firstmakefile" in
5066 '') firstmakefile='makefile';;
5067 esac
5068
5069 : Check is we will use socks
5070 case "$usesocks" in
5071 $define|true|[yY]*)     dflt='y';;
5072 *) dflt='n';;
5073 esac
5074 cat <<EOM
5075
5076 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5077 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5078 to use the PerlIO abstraction layer, this will be implicitly selected.
5079
5080 If this doesn't make any sense to you, just accept the default '$dflt'.
5081 EOM
5082 rp='Build Perl for SOCKS?'
5083 . ./myread
5084 case "$ans" in
5085 y|Y)    val="$define" ;;
5086 *)      val="$undef" ;;
5087 esac
5088 set usesocks
5089 eval $setvar
5090
5091 : Check for uselongdouble support
5092 case "$ccflags" in
5093 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5094 esac
5095
5096 case "$uselongdouble" in
5097 $define|true|[yY]*)     dflt='y';;
5098 *) dflt='n';;
5099 esac
5100 cat <<EOM
5101
5102 Perl can be built to take advantage of long doubles which
5103 (if available) may give more accuracy and range for floating point numbers.
5104
5105 If this doesn't make any sense to you, just accept the default '$dflt'.
5106 EOM
5107 rp='Try to use long doubles if available?'
5108 . ./myread
5109 case "$ans" in
5110 y|Y)    val="$define"   ;;
5111 *)      val="$undef"    ;;
5112 esac
5113 set uselongdouble
5114 eval $setvar
5115
5116 case "$uselongdouble" in
5117 true|[yY]*) uselongdouble="$define" ;;
5118 esac
5119
5120 : Look for a hint-file generated 'call-back-unit'.  If the
5121 : user has specified that long doubles should be used,
5122 : we may need to set or change some other defaults.
5123 if $test -f uselongdouble.cbu; then
5124     echo "Your platform has some specific hints regarding long doubles, using them..."
5125     . ./uselongdouble.cbu
5126 else
5127     case "$uselongdouble" in
5128         $define)
5129                 $cat <<EOM
5130 (Your platform does not have any specific hints for long doubles.)
5131 EOM
5132         ;;
5133     esac
5134 fi
5135
5136 : Check if quadmath is requested
5137 case "$usequadmath" in
5138 "$define"|true|[yY]*) usequadmath="$define" ;;
5139 *)                    usequadmath="$undef"  ;;
5140 esac
5141
5142 : Fail if both uselongdouble and usequadmath are requested
5143 case "$usequadmath:$uselongdouble" in
5144 define:define)
5145         $cat <<EOM >&4
5146
5147 *** You requested the use of the quadmath library and use
5148 *** of long doubles.
5149 ***
5150 *** Please select one or the other.
5151 EOM
5152         exit 1
5153         ;;
5154 esac
5155
5156 : Looking for optional libraries
5157 echo " "
5158 echo "Checking for optional libraries..." >&4
5159 case "$libs" in
5160 ' '|'') dflt='';;
5161 *) dflt="$libs";;
5162 esac
5163 case "$libswanted" in
5164 '') libswanted='c_s';;
5165 esac
5166 case "$usesocks" in
5167 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5168 esac
5169 case "$usecbacktrace" in
5170 "$define") libswanted="$libswanted bfd" ;;
5171 esac
5172 case "$usequadmath" in
5173 "$define") libswanted="$libswanted quadmath" ;;
5174 esac
5175 libsfound=''
5176 libsfiles=''
5177 libsdirs=''
5178 libspath=''
5179 for thisdir in $libpth $xlibpth; do
5180   test -d $thisdir && libspath="$libspath $thisdir"
5181 done
5182 for thislib in $libswanted; do
5183         for thisdir in $libspath; do
5184             xxx=''
5185             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5186                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5187                 $test -f "$xxx" && eval $libscheck
5188                 $test -f "$xxx" && libstyle=shared
5189                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5190                 $test -f "$xxx" && eval $libscheck
5191                 $test -f "$xxx" && libstyle=shared
5192             fi
5193             if test ! -f "$xxx"; then
5194                 xxx=$thisdir/lib$thislib.$so
5195                 $test -f "$xxx" && eval $libscheck
5196                 $test -f "$xxx" && libstyle=shared
5197             fi
5198             if test ! -f "$xxx"; then
5199                 xxx=$thisdir/lib$thislib$_a
5200                 $test -f "$xxx" && eval $libscheck
5201                 $test -f "$xxx" && libstyle=static
5202             fi
5203             if test ! -f "$xxx"; then
5204                 xxx=$thisdir/$thislib$_a
5205                 $test -f "$xxx" && eval $libscheck
5206                 $test -f "$xxx" && libstyle=static
5207             fi
5208             if test ! -f "$xxx"; then
5209                 xxx=$thisdir/lib${thislib}_s$_a
5210                 $test -f "$xxx" && eval $libscheck
5211                 $test -f "$xxx" && libstyle=static
5212                 $test -f "$xxx" && thislib=${thislib}_s
5213             fi
5214             if test ! -f "$xxx"; then
5215                 xxx=$thisdir/Slib$thislib$_a
5216                 $test -f "$xxx" && eval $libscheck
5217                 $test -f "$xxx" && libstyle=static
5218             fi
5219             if $test -f "$xxx"; then
5220                 case "$libstyle" in
5221                 shared) echo "Found -l$thislib (shared)." ;;
5222                 static) echo "Found -l$thislib." ;;
5223                 *)      echo "Found -l$thislib ($libstyle)." ;;
5224                 esac
5225                 case " $dflt " in
5226                 *"-l$thislib "*);;
5227                 *) dflt="$dflt -l$thislib"
5228                    libsfound="$libsfound $xxx"
5229                    yyy=`basename $xxx`
5230                    libsfiles="$libsfiles $yyy"
5231                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5232                    case " $libsdirs " in
5233                    *" $yyy "*) ;;
5234                    *) libsdirs="$libsdirs $yyy" ;;
5235                    esac
5236                    ;;
5237                 esac
5238                 break
5239             fi
5240         done
5241         if $test ! -f "$xxx"; then
5242             echo "No -l$thislib."
5243         fi
5244 done
5245 set X $dflt
5246 shift
5247 dflt="$*"
5248 case "$libs" in
5249 '') dflt="$dflt";;
5250 *) dflt="$libs";;
5251 esac
5252 case "$dflt" in
5253 ' '|'') dflt='none';;
5254 esac
5255
5256 $cat <<EOM
5257
5258 In order to compile $package on your machine, a number of libraries
5259 are usually needed.  Include any other special libraries here as well.
5260 Say "none" for none.  The default list is almost always right.
5261 EOM
5262
5263 echo " "
5264 rp="What libraries to use?"
5265 . ./myread
5266 case "$ans" in
5267 none) libs=' ';;
5268 *) libs="$ans";;
5269 esac
5270
5271 : determine optimization, if desired, or use for debug flag also
5272 case "$optimize" in
5273 ' '|$undef) dflt='none';;
5274 '') dflt='-O';;
5275 *) dflt="$optimize";;
5276 esac
5277 $cat <<EOH
5278
5279 By default, $package compiles with the -O flag to use the optimizer.
5280 Alternately, you might want to use the symbolic debugger, which uses
5281 the -g flag (on traditional Unix systems).  Either flag can be
5282 specified here.  To use neither flag, specify the word "none".
5283
5284 EOH
5285 rp="What optimizer/debugger flag should be used?"
5286 . ./myread
5287 optimize="$ans"
5288 case "$optimize" in
5289 'none') optimize=" ";;
5290 esac
5291
5292 : Check what DEBUGGING is required from the command line
5293 : -DEBUGGING      or -DDEBUGGING or
5294 : -DEBUGGING=both                       = -g + -DDEBUGGING
5295 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5296 : -DEBUGGING=none or -UDEBUGGING        =
5297 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5298 case "$EBUGGING" in
5299 '')     ;;
5300 *)      DEBUGGING=$EBUGGING ;;
5301 esac
5302
5303 case "$DEBUGGING" in
5304 -g|both|$define)
5305     case "$optimize" in
5306         *-g*) ;;
5307         *)    optimize="$optimize -g" ;;
5308     esac ;;
5309 none|$undef)
5310     case "$optimize" in
5311         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5312                 shift
5313                 optimize="$*"
5314                 ;;
5315     esac ;;
5316 esac
5317
5318 dflt=''
5319 case "$DEBUGGING" in
5320 both|$define) dflt='-DDEBUGGING'
5321 esac
5322
5323 : argument order is deliberate, as the flag will start with - which set could
5324 : think is an option
5325 checkccflag='check=$1; flag=$2; callback=$3;
5326 echo " ";
5327 echo "Checking if your compiler accepts $flag" 2>&1;
5328 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5329 echo "int main(void) { return 0; }" > gcctest.c;
5330 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5331     echo "Yes, it does." 2>&1;
5332     if $test -s gcctest.out ; then
5333         echo "But your platform does not like it:";
5334         cat gcctest.out;
5335     else
5336         case "$ccflags" in
5337         *$check*)
5338             echo "Leaving current flags $ccflags alone." 2>&1
5339             ;;
5340         *) dflt="$dflt $flag";
5341             eval $callback
5342             ;;
5343         esac
5344     fi
5345 else
5346     echo "Nope, it does not, but that is ok." 2>&1;
5347 fi
5348 '
5349
5350 : We will not override a previous value, but we might want to
5351 : augment a hint file
5352 case "$hint" in
5353 default|recommended)
5354         case "$gccversion" in
5355         1.*) dflt="$dflt -fpcc-struct-return" ;;
5356         esac
5357         case "$optimize:$DEBUGGING" in
5358         *-g*:old) dflt="$dflt -DDEBUGGING";;
5359         esac
5360         case "$gccversion" in
5361         2.*) if $test -d /etc/conf/kconfig.d &&
5362                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5363                 then
5364                         # Interactive Systems (ISC) POSIX mode.
5365                         dflt="$dflt -posix"
5366                 fi
5367                 ;;
5368         esac
5369         case "$gccversion" in
5370         1.*) ;;
5371         2.[0-8]*) ;;
5372         ?*)     set strict-aliasing -fno-strict-aliasing
5373                 eval $checkccflag
5374                 ;;
5375         esac
5376         # For gcc, adding -pipe speeds up compilations for some, but apparently
5377         # some assemblers can't read from stdin.  (It also slows down compilations
5378         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5379         case "$gccversion" in
5380         ?*)     set pipe -pipe
5381                 eval $checkccflag
5382                 ;;
5383         esac
5384
5385         # on x86_64 (at least) we require an extra library (libssp) in the
5386         # link command line. This library is not named, so I infer that it is
5387         # an implementation detail that may change. Hence the safest approach
5388         # is to add the flag to the flags passed to the compiler at link time,
5389         # as that way the compiler can do the right implementation dependant
5390         # thing. (NWC)
5391         case "$ccflags" in
5392         *-fno-stack-protector*)
5393             echo "Do not add -fstack-protector nor -fstack-protector-strong" 2>&1
5394             ;;
5395         *) case "$gccversion" in
5396            ?*)  set stack-protector-strong -fstack-protector-strong
5397                 eval $checkccflag
5398                 case "$dflt" in
5399                 *-fstack-protector-strong*) ;; # It got added.
5400                 *) # Try the plain/older -fstack-protector.
5401                    set stack-protector -fstack-protector
5402                    eval $checkccflag
5403                    ;;
5404                 esac
5405                 ;;
5406             esac
5407             ;;
5408         esac
5409 esac
5410
5411 case "$mips_type" in
5412 *BSD*|'') inclwanted="$locincpth $usrinc";;
5413 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5414 esac
5415 for thisincl in $inclwanted; do
5416         if $test -d $thisincl; then
5417                 if $test x$thisincl != x$usrinc; then
5418                         case "$dflt" in
5419                         *" -I$thisincl "*);;
5420                         *) dflt="$dflt -I$thisincl ";;
5421                         esac
5422                 fi
5423         fi
5424 done
5425
5426 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5427         xxx=true;
5428 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5429         xxx=true;
5430 else
5431         xxx=false;
5432 fi;
5433 if $xxx; then
5434         case "$dflt" in
5435         *$2*);;
5436         *) dflt="$dflt -D$2";;
5437         esac;
5438 fi'
5439
5440 set signal.h LANGUAGE_C; eval $inctest
5441
5442 case "$usesocks" in
5443 $define)
5444         ccflags="$ccflags -DSOCKS"
5445         ;;
5446 esac
5447
5448 case "$hint" in
5449 default|recommended) dflt="$ccflags $dflt" ;;
5450 *) dflt="$ccflags";;
5451 esac
5452
5453 case "$dflt" in
5454 ''|' ') dflt=none;;
5455 esac
5456
5457 $cat <<EOH
5458
5459 Your C compiler may want other flags.  For this question you should include
5460 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5461 but you should NOT include libraries or ld flags like -lwhatever.  If you
5462 want $package to honor its debug switch, you should include -DDEBUGGING here.
5463 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5464
5465 To use no flags, specify the word "none".
5466
5467 EOH
5468 set X $dflt
5469 shift
5470 dflt=${1+"$@"}
5471 rp="Any additional cc flags?"
5472 . ./myread
5473 case "$ans" in
5474 none) ccflags='';;
5475 *) ccflags="$ans";;
5476 esac
5477
5478 : the following weeds options from ccflags that are of no interest to cpp
5479 case "$cppflags" in
5480 '') cppflags="$ccflags" ;;
5481 *)  set X $ccflags; shift
5482     case " $cppflags " in
5483     *" $1 "*) ;;  # Try to avoid doubling the cppflags.
5484     *) cppflags="$cppflags $ccflags" ;;
5485     esac
5486     ;;
5487 esac
5488 case "$gccversion" in
5489 1.*) cppflags="$cppflags -D__GNUC__"
5490 esac
5491 case "$mips_type" in
5492 '');;
5493 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5494 esac
5495 case "$cppflags" in
5496 '');;
5497 *)
5498         echo " "
5499         echo "Let me guess what the preprocessor flags are..." >&4
5500         set X $cppflags
5501         shift
5502         cppflags=''
5503         $cat >cpp.c <<'EOM'
5504 #define BLURFL foo
5505
5506 BLURFL xx LFRULB
5507 EOM
5508         previous=''
5509         for flag in $*
5510         do
5511                 case "$flag" in
5512                 -*) ftry="$flag";;
5513                 *) ftry="$previous $flag";;
5514                 esac
5515                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5516                         >cpp1.out 2>/dev/null && \
5517                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5518                         >cpp2.out 2>/dev/null && \
5519                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5520                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5521                 then
5522                         cppflags="$cppflags $ftry"
5523                         previous=''
5524                 else
5525                         previous="$flag"
5526                 fi
5527         done
5528         set X $cppflags
5529         shift
5530         cppflags=${1+"$@"}
5531         case "$cppflags" in
5532         *-*)  echo "They appear to be: $cppflags";;
5533         esac
5534         $rm -f cpp.c cpp?.out
5535         ;;
5536 esac
5537
5538 : flags used in final linking phase
5539 case "$ldflags" in
5540 '') if ./venix; then
5541                 dflt='-i -z'
5542         else
5543                 dflt=''
5544         fi
5545         case "$ccflags" in
5546         *-posix*) dflt="$dflt -posix" ;;
5547         esac
5548         ;;
5549 *) dflt="$ldflags";;
5550 esac
5551 # See note above about -fstack-protector
5552 case "$ccflags" in
5553 *-fstack-protector-strong*)
5554         case "$dflt" in
5555         *-fstack-protector-strong*) ;; # Don't add it again
5556         *) dflt="$dflt -fstack-protector-strong" ;;
5557         esac
5558         ;;
5559 *-fstack-protector*)
5560         case "$dflt" in
5561         *-fstack-protector*) ;; # Don't add it again
5562         *) dflt="$dflt -fstack-protector" ;;
5563         esac
5564         ;;
5565 esac
5566
5567 : Try to guess additional flags to pick up local libraries.
5568 for thislibdir in $libpth; do
5569         case " $loclibpth " in
5570         *" $thislibdir "*)
5571                 case "$dflt " in
5572                 *"-L$thislibdir "*) ;;
5573                 *)  dflt="$dflt -L$thislibdir" ;;
5574                 esac
5575                 ;;
5576         esac
5577 done
5578
5579 case "$dflt" in
5580 '') dflt='none' ;;
5581 esac
5582
5583 $cat <<EOH
5584
5585 Your C linker may need flags.  For this question you should
5586 include -L/whatever and any other flags used by the C linker, but you
5587 should NOT include libraries like -lwhatever.
5588
5589 Make sure you include the appropriate -L/path flags if your C linker
5590 does not normally search all of the directories you specified above,
5591 namely
5592         $libpth
5593 To use no flags, specify the word "none".
5594
5595 EOH
5596
5597 rp="Any additional ld flags (NOT including libraries)?"
5598 . ./myread
5599 case "$ans" in
5600 none) ldflags='';;
5601 *) ldflags="$ans";;
5602 esac
5603 rmlist="$rmlist pdp11"
5604
5605 : coherency check
5606 echo " "
5607 echo "Checking your choice of C compiler and flags for coherency..." >&4
5608 $cat > try.c <<'EOF'
5609 #include <stdio.h>
5610 int main() { printf("Ok\n"); return(0); }
5611 EOF
5612 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5613 shift
5614 $cat >try.msg <<'EOM'
5615 I've tried to compile and run the following simple program:
5616
5617 EOM
5618 $cat try.c >> try.msg
5619
5620 $cat >> try.msg <<EOM
5621
5622 I used the command:
5623
5624         $*
5625         $run ./try
5626
5627 and I got the following output:
5628
5629 EOM
5630 dflt=y
5631 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5632         if $sh -c "$run ./try " >>try.msg 2>&1; then
5633                 xxx=`$run ./try`
5634                 case "$xxx" in
5635                 "Ok") dflt=n ;;
5636                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5637                 esac
5638         else
5639                 echo "The program compiled OK, but exited with status $?." >>try.msg
5640                 rp="You have a problem.  Shall I abort Configure"
5641                 dflt=y
5642         fi
5643 else
5644         echo "I can't compile the test program." >>try.msg
5645         rp="You have a BIG problem.  Shall I abort Configure"
5646         dflt=y
5647 fi
5648 case "$dflt" in
5649 y)
5650         $cat try.msg >&4
5651         case "$knowitall" in
5652         '')
5653                 echo "(The supplied flags or libraries might be incorrect.)"
5654                 ;;
5655         *) dflt=n;;
5656         esac
5657         echo " "
5658         . ./myread
5659         case "$ans" in
5660         n*|N*) ;;
5661         *)      echo "Ok.  Stopping Configure." >&4
5662                 exit 1
5663                 ;;
5664         esac
5665         ;;
5666 n) echo "OK, that should do.";;
5667 esac
5668 $rm_try gcctest gcctest.out
5669
5670 : define a shorthand compile call
5671 compile='
5672 mc_file=$1;
5673 shift;
5674 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5675 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to https://github.com/Perl/perl5/issues" >&4;
5676 exit 1;
5677 fi;
5678 esac;
5679 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5680 : define a shorthand compile call for compilations that should be ok.
5681 compile_ok='
5682 mc_file=$1;
5683 shift;
5684 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5685
5686 : stub, used only to satisfy other units
5687 i_stdlib='define'
5688
5689 : check for lengths of integral types
5690 echo " "
5691 case "$intsize" in
5692 '')
5693         echo "Checking to see how big your integers are..." >&4
5694         $cat >try.c <<EOCP
5695 #include <stdio.h>
5696 #$i_stdlib I_STDLIB
5697 #ifdef I_STDLIB
5698 #include <stdlib.h>
5699 #endif
5700 int main()
5701 {
5702         printf("intsize=%d;\n", (int)sizeof(int));
5703         printf("longsize=%d;\n", (int)sizeof(long));
5704         printf("shortsize=%d;\n", (int)sizeof(short));
5705         exit(0);
5706 }
5707 EOCP
5708         set try
5709         if eval $compile_ok && $run ./try > /dev/null; then
5710                 eval `$run ./try`
5711                 echo "Your integers are $intsize bytes long."
5712                 echo "Your long integers are $longsize bytes long."
5713                 echo "Your short integers are $shortsize bytes long."
5714         else
5715                 $cat >&4 <<EOM
5716 !
5717 Help! I can't compile and run the intsize test program: please enlighten me!
5718 (This is probably a misconfiguration in your system or libraries, and
5719 you really ought to fix it.  Still, I'll try anyway.)
5720 !
5721 EOM
5722                 dflt=4
5723                 rp="What is the size of an integer (in bytes)?"
5724                 . ./myread
5725                 intsize="$ans"
5726                 dflt=$intsize
5727                 rp="What is the size of a long integer (in bytes)?"
5728                 . ./myread
5729                 longsize="$ans"
5730                 dflt=2
5731                 rp="What is the size of a short integer (in bytes)?"
5732                 . ./myread
5733                 shortsize="$ans"
5734         fi
5735         ;;
5736 esac
5737 $rm_try
5738
5739 : check for long long
5740 echo " "
5741 echo "Checking to see if you have long long..." >&4
5742 echo 'int main() { long long x = 7; return 0; }' > try.c
5743 set try
5744 if eval $compile; then
5745         val="$define"
5746         echo "You have long long."
5747 else
5748         val="$undef"
5749         echo "You do not have long long."
5750 fi
5751 $rm_try
5752 set d_longlong
5753 eval $setvar
5754
5755 : check for length of long long
5756 case "${d_longlong}${longlongsize}" in
5757 $define)
5758         echo " "
5759         echo "Checking to see how big your long longs are..." >&4
5760         $cat >try.c <<'EOCP'
5761 #include <stdio.h>
5762 int main()
5763 {
5764     printf("%d\n", (int)sizeof(long long));
5765     return(0);
5766 }
5767 EOCP
5768         set try
5769         if eval $compile_ok; then
5770                 longlongsize=`$run ./try`
5771                 echo "Your long longs are $longlongsize bytes long."
5772         else
5773                 dflt='8'
5774                 echo " "
5775                 echo "(I can't seem to compile the test program.  Guessing...)"
5776                 rp="What is the size of a long long (in bytes)?"
5777                 . ./myread
5778                 longlongsize="$ans"
5779         fi
5780         if $test "X$longsize" = "X$longlongsize"; then
5781                 echo "(That isn't any different from an ordinary long.)"
5782         fi
5783         ;;
5784 esac
5785 $rm_try
5786
5787 : determine filename position in cpp output
5788 echo " "
5789 echo "Computing filename position in cpp output for #include directives..." >&4
5790 case "$osname" in
5791 amigaos) fieldn=3 ;;  # Workaround for a bug in abc (pdksh).
5792 esac
5793 case "$fieldn" in
5794 '')
5795 case "$osname" in
5796 vos) testaccess=-e ;;
5797 *)   testaccess=-r ;;
5798 esac
5799 echo '#include <stdio.h>' > foo.c
5800 $cat >fieldn <<EOF
5801 $startsh
5802 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5803 $grep '^[       ]*#.*stdio\.h' | \
5804 while read cline; do
5805         pos=1
5806         set \$cline
5807         while $test \$# -gt 0; do
5808                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5809                         echo "\$pos"
5810                         exit 0
5811                 fi
5812                 shift
5813                 pos=\`expr \$pos + 1\`
5814         done
5815 done
5816 EOF
5817 chmod +x fieldn
5818 fieldn=`./fieldn`
5819 $rm -f foo.c fieldn
5820 ;;
5821 esac
5822 case $fieldn in
5823 '') pos='???';;
5824 1) pos=first;;
5825 2) pos=second;;
5826 3) pos=third;;
5827 *) pos="${fieldn}th";;
5828 esac
5829 echo "Your cpp writes the filename in the $pos field of the line."
5830
5831 : locate header file
5832 $cat >findhdr <<EOF
5833 $startsh
5834 wanted=\$1
5835 name=''
5836 for usrincdir in $incpth
5837 do
5838         if test -f \$usrincdir/\$wanted; then
5839                 echo "\$usrincdir/\$wanted"
5840                 exit 0
5841         fi
5842 done
5843 awkprg='{ print \$$fieldn }'
5844 echo "#include <\$wanted>" > foo\$\$.c
5845 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5846 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5847 while read cline; do
5848         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5849         case "\$name" in
5850         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5851         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5852         *) exit 2;;
5853         esac;
5854 done;
5855 #
5856 # status = 0: grep returned 0 lines, case statement not executed
5857 # status = 1: headerfile found
5858 # status = 2: while loop executed, no headerfile found
5859 #
5860 status=\$?
5861 $rm -f foo\$\$.c;
5862 if test \$status -eq 1; then
5863         exit 0;
5864 fi
5865 exit 1
5866 EOF
5867 chmod +x findhdr
5868
5869 : define an alternate in-header-list? function
5870 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5871 cont=true; xxf="echo \"<\$1> found.\" >&4";
5872 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5873 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5874 esac;
5875 case $# in 4) instead=instead;; *) instead="at last";; esac;
5876 while $test "$cont"; do
5877         xxx=`./findhdr $1`
5878         var=$2; eval "was=\$$2";
5879         if $test "$xxx" && $test -r "$xxx";
5880         then eval $xxf;
5881         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5882                 cont="";
5883         else eval $xxnf;
5884         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5885         set $yyy; shift; shift; yyy=$@;
5886         case $# in 0) cont="";;
5887         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5888                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5889         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5890                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5891         esac;
5892 done;
5893 while $test "$yyy";
5894 do set $yyy; var=$2; eval "was=\$$2";
5895         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5896         set $yyy; shift; shift; yyy=$@;
5897 done'
5898
5899 : see if inttypes.h is available
5900 : we want a real compile instead of Inhdr because some systems
5901 : have an inttypes.h which includes non-existent headers
5902 echo " "
5903 $cat >try.c <<EOCP
5904 #include <inttypes.h>
5905 int main() {
5906         static int32_t foo32 = 0x12345678;
5907 }
5908 EOCP
5909 set try
5910 if eval $compile; then
5911         echo "<inttypes.h> found." >&4
5912         val="$define"
5913 else
5914         echo "<inttypes.h> NOT found." >&4
5915         val="$undef"
5916 fi
5917 $rm_try
5918 set i_inttypes
5919 eval $setvar
5920
5921 : check for int64_t
5922 echo " "
5923 echo "Checking to see if you have int64_t..." >&4
5924 $cat >try.c <<EOCP
5925 #include <sys/types.h>
5926 #$i_inttypes I_INTTYPES
5927 #ifdef I_INTTYPES
5928 #include <inttypes.h>
5929 #endif
5930 int main() { int64_t x = 7; }
5931 EOCP
5932 set try
5933 if eval $compile; then
5934         val="$define"
5935         echo "You have int64_t."
5936 else
5937         val="$undef"
5938         echo "You do not have int64_t."
5939 fi
5940 $rm_try
5941 set d_int64_t
5942 eval $setvar
5943
5944 : Check if 64bit ints have a quad type
5945 echo " "
5946 echo "Checking which 64-bit integer type we could use..." >&4
5947
5948 case "$intsize" in
5949 8) val=int
5950    set quadtype
5951    eval $setvar
5952    val='"unsigned int"'
5953    set uquadtype
5954    eval $setvar
5955    quadkind=1
5956    ;;
5957 *) case "$longsize" in
5958    8) val=long
5959       set quadtype
5960       eval $setvar
5961       val='"unsigned long"'
5962       set uquadtype
5963       eval $setvar
5964       quadkind=2
5965       ;;
5966    *) case "$d_longlong:$longlongsize" in
5967       define:8)
5968         val='"long long"'
5969         set quadtype
5970         eval $setvar
5971         val='"unsigned long long"'
5972         set uquadtype
5973         eval $setvar
5974         quadkind=3
5975         ;;
5976       *) case "$d_int64_t" in
5977          define)
5978            val=int64_t
5979            set quadtype
5980            eval $setvar
5981            val=uint64_t
5982            set uquadtype
5983            eval $setvar
5984            quadkind=4
5985            ;;
5986          esac
5987          ;;
5988       esac
5989       ;;
5990    esac
5991    ;;
5992 esac
5993
5994 case "$quadtype" in
5995 '')     echo "Alas, no 64-bit integer types in sight." >&4
5996         d_quad="$undef"
5997         ;;
5998 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5999         d_quad="$define"
6000         ;;
6001 esac
6002
6003 : Do we want 64bit support
6004 case "$uselonglong" in
6005 "$define"|true|[yY]*)
6006         cat <<EOM >&4
6007
6008 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6009 EOM
6010         use64bitint="$define"
6011         ;;
6012 esac
6013 case "$use64bits" in
6014 "$define"|true|[yY]*)
6015         cat <<EOM >&4
6016
6017 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6018 EOM
6019         use64bitint="$define"
6020         ;;
6021 esac
6022 case "$use64bitints" in
6023 "$define"|true|[yY]*)
6024         cat <<EOM >&4
6025
6026 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6027 EOM
6028         use64bitint="$define"
6029         ;;
6030 esac
6031 case "$use64bitsint" in
6032 "$define"|true|[yY]*)
6033         cat <<EOM >&4
6034
6035 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6036 EOM
6037         use64bitint="$define"
6038         ;;
6039 esac
6040 case "$uselonglongs" in
6041 "$define"|true|[yY]*)
6042         cat <<EOM >&4
6043
6044 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6045 EOM
6046         use64bitint="$define"
6047         ;;
6048 esac
6049 case "$use64bitsall" in
6050 "$define"|true|[yY]*)
6051         cat <<EOM >&4
6052
6053 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6054 EOM
6055         use64bitall="$define"
6056         ;;
6057 esac
6058
6059 case "$ccflags" in
6060 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6061 esac
6062 case "$use64bitall" in
6063 "$define"|true|[yY]*) use64bitint="$define" ;;
6064 esac
6065
6066 case "$longsize" in
6067 8) cat <<EOM
6068
6069 You have natively 64-bit long integers.
6070 EOM
6071    val="$define"
6072    ;;
6073 *) case "$use64bitint" in
6074    "$define"|true|[yY]*) dflt='y';;
6075    *) dflt='n';;
6076    esac
6077    case "$d_quad" in
6078    "$define") ;;
6079    *) dflt='n' ;;
6080    esac
6081    cat <<EOM
6082
6083 Perl can be built to take advantage of 64-bit integer types
6084 on some systems.  To do so, Configure can be run with -Duse64bitint.
6085 Choosing this option will most probably introduce binary incompatibilities.
6086
6087 If this doesn't make any sense to you, just accept the default '$dflt'.
6088 (The default has been chosen based on your configuration.)
6089 EOM
6090    rp='Try to use 64-bit integers, if available?'
6091    . ./myread
6092    case "$ans" in
6093    [yY]*) val="$define" ;;
6094    *)     val="$undef"  ;;
6095    esac
6096    ;;
6097 esac
6098 set use64bitint
6099 eval $setvar
6100
6101 case "$use64bitall" in
6102 "$define"|true|[yY]*) dflt='y' ;;
6103 *) case "$longsize" in
6104    8) dflt='y' ;;
6105    *) dflt='n' ;;
6106    esac
6107    ;;
6108 esac
6109 cat <<EOM
6110
6111 You may also choose to try maximal 64-bitness.  It means using as much
6112 64-bitness as possible on the platform.  This in turn means even more
6113 binary incompatibilities.  On the other hand, your platform may not
6114 have any more 64-bitness available than what you already have chosen.
6115
6116 If this doesn't make any sense to you, just accept the default '$dflt'.
6117 (The default has been chosen based on your configuration.)
6118 EOM
6119 rp='Try to use maximal 64-bit support, if available?'
6120 . ./myread
6121 case "$ans" in
6122 [yY]*) val="$define" ;;
6123 *)     val="$undef"  ;;
6124 esac
6125 set use64bitall
6126 eval $setvar
6127 case "$use64bitall" in
6128 "$define")
6129         case "$use64bitint" in
6130         "$undef")
6131                 cat <<EOM
6132
6133 Since you have chosen a maximally 64-bit build, I'm also turning on
6134 the use of 64-bit integers.
6135 EOM
6136                 use64bitint="$define" ;;
6137         esac
6138         ;;
6139 esac
6140
6141 : Look for a hint-file generated 'call-back-unit'.  If the
6142 : user has specified that a 64-bit perl is to be built,
6143 : we may need to set or change some other defaults.
6144 if $test -f use64bitint.cbu; then
6145         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6146         . ./use64bitint.cbu
6147 fi
6148 case "$use64bitint" in
6149 "$define"|true|[yY]*)
6150         : This test was common to all the OpenBSD forks, and seems harmless for
6151         : other platforms:
6152         echo " "
6153         echo "Checking if your C library has broken 64-bit functions..." >&4
6154         cat >try.c <<EOCP
6155 #include <stdio.h>
6156 typedef $uquadtype myULL;
6157 int main (void)
6158 {
6159     struct {
6160         double d;
6161         myULL  u;
6162     } *p, test[] = {
6163         {4294967303.15, 4294967303ULL},
6164         {4294967294.2,  4294967294ULL},
6165         {4294967295.7,  4294967295ULL},
6166         {0.0, 0ULL}
6167     };
6168     for (p = test; p->u; p++) {
6169         myULL x = (myULL)p->d;
6170         if (x != p->u) {
6171             printf("buggy\n");
6172             return 0;
6173         }
6174     }
6175     printf("ok\n");
6176     return 0;
6177 }
6178 EOCP
6179         set try
6180         if eval $compile_ok; then
6181             libcquad=`$run ./try`
6182             echo "Your C library's 64-bit functions are $libcquad."
6183         else
6184             echo "(I can't seem to compile the test program.)"
6185             echo "Assuming that your C library's 64-bit functions are ok."
6186             libcquad="ok"
6187         fi
6188         $rm_try
6189
6190         case "$libcquad" in
6191             buggy*)
6192                 cat >&4 <<EOM
6193
6194 *** You have a C library with broken 64-bit functions.
6195 *** 64-bit support does not work reliably in this configuration.
6196 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6197 *** Cannot continue, aborting.
6198
6199 EOM
6200                 exit 1
6201                 ;;
6202         esac
6203         case "$longsize" in
6204         4) case "$archname64" in
6205            '') archname64=64int ;;
6206            esac
6207            ;;
6208         esac
6209         ;;
6210 esac
6211
6212 : Look for a hint-file generated 'call-back-unit'.  If the
6213 : user has specified that a maximally 64-bit perl is to be built,
6214 : we may need to set or change some other defaults.
6215 if $test -f use64bitall.cbu; then
6216         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6217         . ./use64bitall.cbu
6218 fi
6219 case "$use64bitall" in
6220 "$define"|true|[yY]*)
6221         case "$longsize" in
6222         4) case "$archname64" in
6223            ''|64int) archname64=64all ;;
6224            esac
6225            ;;
6226         esac
6227         ;;
6228 esac
6229
6230 case "$d_quad:$use64bitint" in
6231 $undef:$define)
6232         cat >&4 <<EOF
6233
6234 *** You have chosen to use 64-bit integers,
6235 *** but none can be found.
6236 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6237 *** Cannot continue, aborting.
6238
6239 EOF
6240         exit 1
6241         ;;
6242 esac
6243
6244 : Check if we are using the GNU C library
6245 echo " "
6246 echo "Checking for GNU C Library..." >&4
6247 cat >try.c <<'EOCP'
6248 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6249    alone are insufficient to distinguish different versions, such as
6250    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6251    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6252 */
6253 #include <stdio.h>
6254 int main(void)
6255 {
6256 #ifdef __GLIBC__
6257 #   ifdef __GLIBC_MINOR__
6258 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6259 #           include <gnu/libc-version.h>
6260             printf("%s\n",  gnu_get_libc_version());
6261 #       else
6262             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6263 #       endif
6264 #   else
6265         printf("%d\n",  __GLIBC__);
6266 #   endif
6267     return 0;
6268 #else
6269     return 1;
6270 #endif
6271 }
6272 EOCP
6273 set try
6274 if eval $compile_ok && $run ./try > glibc.ver; then
6275         val="$define"
6276         gnulibc_version=`$cat glibc.ver`
6277         echo "You are using the GNU C Library version $gnulibc_version"
6278 else
6279         val="$undef"
6280         gnulibc_version=''
6281         echo "You are not using the GNU C Library"
6282 fi
6283 $rm_try glibc.ver
6284 set d_gnulibc
6285 eval $setvar
6286
6287 : see if nm is to be used to determine whether a symbol is defined or not
6288 case "$usenm" in
6289 '')
6290         dflt=''
6291         case "$d_gnulibc" in
6292         "$define")
6293                 echo " "
6294                 echo "nm probably won't work on the GNU C Library." >&4
6295                 dflt=n
6296                 ;;
6297         esac
6298         case "$dflt" in
6299         '')
6300                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6301                         echo " "
6302                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6303                         echo "'nm' won't be sufficient on this system." >&4
6304                         dflt=n
6305                 fi
6306                 ;;
6307         esac
6308         case "$dflt" in
6309         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6310                 if $test $dflt -gt 20; then
6311                         dflt=y
6312                 else
6313                         dflt=n
6314                 fi
6315                 ;;
6316         esac
6317         ;;
6318 *)
6319         case "$usenm" in
6320         true|$define) dflt=y;;
6321         *) dflt=n;;
6322         esac
6323         ;;
6324 esac
6325 $cat <<EOM
6326
6327 I can use $nm to extract the symbols from your C libraries. This
6328 is a time consuming task which may generate huge output on the disk (up
6329 to 3 megabytes) but that should make the symbols extraction faster. The
6330 alternative is to skip the 'nm' extraction part and to compile a small
6331 test program instead to determine whether each symbol is present. If
6332 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6333 this may be the best solution.
6334
6335 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6336
6337 EOM
6338 rp="Shall I use $nm to extract C symbols from the libraries?"
6339 . ./myread
6340 case "$ans" in
6341 [Nn]*) usenm=false;;
6342 *) usenm=true;;
6343 esac
6344
6345 runnm=$usenm
6346 case "$reuseval" in
6347 true) runnm=false;;
6348 esac
6349
6350 : nm options which may be necessary
6351 case "$nm_opt" in
6352 '') if $test -f /mach_boot; then
6353                 nm_opt=''       # Mach
6354         elif $test -d /usr/ccs/lib; then
6355                 nm_opt='-p'     # Solaris (and SunOS?)
6356         elif $test -f /dgux; then
6357                 nm_opt='-p'     # DG-UX
6358         elif $test -f /lib64/rld; then
6359                 nm_opt='-p'     # 64-bit Irix
6360         else
6361                 nm_opt=''
6362         fi;;
6363 esac
6364
6365 : nm options which may be necessary for shared libraries but illegal
6366 : for archive libraries.  Thank you, Linux.
6367 case "$nm_so_opt" in
6368 '')     case "$myuname" in
6369         *linux*|gnu*)
6370                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6371                         nm_so_opt='--dynamic'
6372                 fi
6373                 ;;
6374         esac
6375         ;;
6376 esac
6377
6378 : Figure out where the libc is located
6379 case "$runnm" in
6380 true)
6381 : get list of predefined functions in a handy place
6382 echo " "
6383 case "$libc" in
6384 '') libc=unknown
6385         case "$libs" in
6386         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6387         esac
6388         ;;
6389 esac
6390 case "$libs" in
6391 '') ;;
6392 *)  for thislib in $libs; do
6393         case "$thislib" in
6394         -lc|-lc_s)
6395                 : Handle C library specially below.
6396                 ;;
6397         -l*)
6398                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6399                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6400                         :
6401                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6402                         :
6403                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6404                         :
6405                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6406                         :
6407                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6408                         :
6409                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6410                         :
6411                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6412                         :
6413                 else
6414                         try=''
6415                 fi
6416                 libnames="$libnames $try"
6417                 ;;
6418         *) libnames="$libnames $thislib" ;;
6419         esac
6420         done
6421         ;;
6422 esac
6423 xxx=normal
6424 case "$libc" in
6425 unknown)
6426         set /lib/libc.$so
6427         for xxx in $libpth; do
6428                 $test -r $1 || set $xxx/libc.$so
6429                 : The messy sed command sorts on library version numbers.
6430                 $test -r $1 || \
6431                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6432                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6433                                 h
6434                                 s/[0-9][0-9]*/0000&/g
6435                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6436                                 G
6437                                 s/\n/ /' | \
6438                          $sort | $sed -e 's/^.* //'`
6439                 eval set \$$#
6440         done
6441         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6442         $test -r $1 || set $sysroot/lib/libsys_s$_a
6443         ;;
6444 *)
6445         set blurfl
6446         ;;
6447 esac
6448 if $test -r "$1"; then
6449         echo "Your (shared) C library seems to be in $1."
6450         libc="$1"
6451 elif $test -r /lib/libc && $test -r /lib/clib; then
6452         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6453         xxx=apollo
6454         libc='/lib/clib /lib/libc'
6455         if $test -r /lib/syslib; then
6456                 echo "(Your math library is in /lib/syslib.)"
6457                 libc="$libc /lib/syslib"
6458         fi
6459 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6460         echo "Your C library seems to be in $libc, as you said before."
6461 elif $test -r $incpath/usr/lib/libc$_a; then
6462         libc=$incpath/usr/lib/libc$_a;
6463         echo "Your C library seems to be in $libc.  That's fine."
6464 elif $test -r /lib/libc$_a; then
6465         libc=/lib/libc$_a;
6466         echo "Your C library seems to be in $libc.  You're normal."
6467 else
6468         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6469                 :
6470         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6471                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6472         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6473                 :
6474         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6475                 :
6476         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6477                 :
6478         else
6479                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6480         fi
6481         if $test -r "$tans"; then
6482                 echo "Your C library seems to be in $tans, of all places."
6483                 libc=$tans
6484         else
6485                 libc='blurfl'
6486         fi
6487 fi
6488 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6489         dflt="$libc"
6490         cat <<EOM
6491
6492 If the guess above is wrong (which it might be if you're using a strange
6493 compiler, or your machine supports multiple models), you can override it here.
6494
6495 EOM
6496 else
6497         dflt=''
6498         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6499         cat >&4 <<EOM
6500 I can't seem to find your C library.  I've looked in the following places:
6501
6502 EOM
6503         $sed 's/^/      /' libpath
6504         cat <<EOM
6505
6506 None of these seems to contain your C library. I need to get its name...
6507
6508 EOM
6509 fi
6510 fn=f
6511 rp='Where is your C library?'
6512 . ./getfile
6513 libc="$ans"
6514
6515 echo " "
6516 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6517 set X `cat libnames`
6518 shift
6519 xxx=files
6520 case $# in 1) xxx=file; esac
6521 echo "Extracting names from the following $xxx for later perusal:" >&4
6522 echo " "
6523 $sed 's/^/      /' libnames >&4
6524 echo " "
6525 $echo $n "This may take a while...$c" >&4
6526
6527 for file in $*; do
6528         case $file in
6529         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6530         *) $nm $nm_opt $file 2>/dev/null;;
6531         esac
6532 done >libc.tmp
6533
6534 $echo $n ".$c"
6535 $grep fprintf libc.tmp > libc.ptf
6536 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6537 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6538 xxx='[ADTSIWi]'
6539 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6540         eval $xscan;\
6541         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6542                 eval $xrun
6543 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6544         eval $xscan;\
6545         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6546                 eval $xrun
6547 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6548         eval $xscan;\
6549         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6550                 eval $xrun
6551 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6552         eval $xscan;\
6553         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6554                 eval $xrun
6555 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6556         eval $xscan;\
6557         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6558                 eval $xrun
6559 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6560         eval $xscan;\
6561         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6562                 eval $xrun
6563 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6564                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6565         eval $xscan;\
6566         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6567                 eval $xrun
6568 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6569         eval $xscan;\
6570         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6571                 eval $xrun
6572 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6573         eval $xscan;\
6574         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6575                 eval $xrun
6576 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6577         eval $xscan;\
6578         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6579                 eval $xrun
6580 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6581         eval $xscan;\
6582         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6583                 eval $xrun
6584 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6585         eval $xscan;\
6586         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6587                 eval $xrun
6588 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6589         eval $xscan;\
6590         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6591                 eval $xrun
6592 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6593         eval $xscan;\
6594         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6595                 eval $xrun
6596 else
6597         $nm -p $* 2>/dev/null >libc.tmp
6598         $grep fprintf libc.tmp > libc.ptf
6599         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6600                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6601         then
6602                 nm_opt='-p'
6603                 eval $xrun
6604         else
6605                 echo " "
6606                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6607                 com=''
6608                 if $ar t $libc > libc.tmp && \
6609                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6610                 then
6611                         for thisname in $libnames $libc; do
6612                                 $ar t $thisname >>libc.tmp
6613                         done
6614                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6615                         echo "Ok." >&4
6616                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6617                         for thisname in $libnames $libc; do
6618                                 $ar tv $thisname >>libc.tmp
6619                                 emximp -o tmp.imp $thisname \
6620                                     2>/dev/null && \
6621                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6622                                     < tmp.imp >>libc.tmp
6623                                 $rm -f tmp.imp
6624                         done
6625                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6626                         echo "Ok." >&4
6627                 else
6628                         echo "$ar didn't seem to work right." >&4
6629                         echo "Maybe this is a Cray...trying bld instead..." >&4
6630                         if  bld t $libc | \
6631                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6632                                 $test -s libc.list
6633                         then
6634                                 for thisname in $libnames; do
6635                                         bld t $libnames | \
6636                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6637                                         $ar t $thisname >>libc.tmp
6638                                 done
6639                                 echo "Ok." >&4
6640                         else
6641                                 echo "That didn't work either.  Giving up." >&4
6642                                 exit 1
6643                         fi
6644                 fi
6645         fi
6646 fi
6647 nm_extract="$com"
6648 case "$PASE" in
6649 define)
6650     echo " "
6651     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6652     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6653     ;;
6654 *)  if $test -f /lib/syscalls.exp; then
6655         echo " "
6656         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6657         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6658                 /lib/syscalls.exp >>libc.list
6659     fi
6660     ;;
6661 esac
6662 ;;
6663 esac
6664 $rm -f libnames libpath
6665
6666 : Check if we are using C++
6667 echo " "
6668 echo "Checking for C++..." >&4
6669 $cat >try.c <<'EOCP'
6670 #include <stdio.h>
6671 int main(void)
6672 {
6673 #ifdef __cplusplus
6674     return 0;
6675 #else
6676     return 1;
6677 #endif
6678 }
6679 EOCP
6680 set try
6681 if eval $compile_ok && $run ./try; then
6682         val="$define"
6683         echo "You are using a C++ compiler."
6684 else
6685         val="$undef"
6686         echo "You are not using a C++ compiler."
6687 fi
6688 $rm_try cplusplus$$
6689 set d_cplusplus
6690 eval $setvar
6691
6692 : is a C symbol defined?
6693 csym='tlook=$1;
6694 case "$3" in
6695 -v) tf=libc.tmp; tdc="";;
6696 -a) tf=libc.tmp; tdc="[]";;
6697 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6698 esac;
6699 case "$d_cplusplus" in
6700     $define)    extern_C="extern \"C\"" ;;
6701     *)          extern_C="extern"       ;;
6702 esac;
6703 tx=yes;
6704 case "$reuseval-$4" in
6705 true-) ;;
6706 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6707 esac;
6708 case "$tx" in
6709 yes)
6710         tval=false;
6711         if $test "$runnm" = true; then
6712                 if $contains $tlook $tf >/dev/null 2>&1; then
6713                         tval=true;
6714                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6715                         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;
6716                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6717                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6718                         $rm_try;
6719                 fi;
6720         else
6721                 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;
6722                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6723                 $rm_try;
6724         fi;
6725         ;;
6726 *)
6727         case "$tval" in
6728         $define) tval=true;;
6729         *) tval=false;;
6730         esac;
6731         ;;
6732 esac;
6733 eval "$2=$tval"'
6734
6735 : define an is-in-libc? function
6736 inlibc='echo " "; td=$define; tu=$undef;
6737 sym=$1; var=$2; eval "was=\$$2";
6738 tx=yes;
6739 case "$reuseval$was" in
6740 true) ;;
6741 true*) tx=no;;
6742 esac;
6743 case "$tx" in
6744 yes)
6745         set $sym tres -f;
6746         eval $csym;
6747         case "$tres" in
6748         true)
6749                 echo "$sym() found." >&4;
6750                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6751         *)
6752                 echo "$sym() NOT found." >&4;
6753                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6754         esac;;
6755 *)
6756         case "$was" in
6757         $define) echo "$sym() found." >&4;;
6758         *) echo "$sym() NOT found." >&4;;
6759         esac;;
6760 esac'
6761
6762 : check for length of double
6763 echo " "
6764 case "$doublesize" in
6765 '')
6766         echo "Checking to see how big your double precision numbers are..." >&4
6767         $cat >try.c <<EOCP
6768 #include <stdio.h>
6769 #$i_stdlib I_STDLIB
6770 #ifdef I_STDLIB
6771 #include <stdlib.h>
6772 #endif
6773 int main()
6774 {
6775     printf("%d\n", (int)sizeof(double));
6776     exit(0);
6777 }
6778 EOCP
6779         set try
6780         if eval $compile_ok; then
6781                 doublesize=`$run ./try`
6782                 echo "Your double is $doublesize bytes long."
6783         else
6784                 dflt='8'
6785                 echo "(I can't seem to compile the test program.  Guessing...)"
6786                 rp="What is the size of a double precision number (in bytes)?"
6787                 . ./myread
6788                 doublesize="$ans"
6789         fi
6790         ;;
6791 esac
6792 $rm_try
6793
6794 : check for long doubles
6795 echo " " >&4
6796 echo "Checking to see if you have long double..." >&4
6797 echo 'int main() { long double x = 7.0; }' > try.c
6798 set try
6799 if eval $compile; then
6800         val="$define"
6801         echo "You have long double." >&4
6802 else
6803         val="$undef"
6804         echo "You do not have long double." >&4
6805 fi
6806 $rm_try
6807 set d_longdbl
6808 eval $setvar
6809
6810 : see if ldexpl exists
6811 set ldexpl d_ldexpl
6812 eval $inlibc
6813
6814 : check for length of long double
6815 case "${d_longdbl}${longdblsize}" in
6816 $define)
6817         echo " " >&4
6818         echo "Checking to see how big your long doubles are..." >&4
6819         $cat >try.c <<'EOCP'
6820 #include <stdio.h>
6821 int main()
6822 {
6823         printf("%d\n", sizeof(long double));
6824 }
6825 EOCP
6826         set try
6827         set try
6828         if eval $compile; then
6829                 longdblsize=`$run ./try`
6830                 echo "Your long doubles are $longdblsize bytes long." >&4
6831         else
6832                 dflt='8'
6833                 echo " " >&4
6834                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6835                 rp="What is the size of a long double (in bytes)?"
6836                 . ./myread
6837                 longdblsize="$ans"
6838         fi
6839         if $test "X$doublesize" = "X$longdblsize"; then
6840                 echo "That isn't any different from an ordinary double." >&4
6841                 echo "I'll keep your setting anyway, but you may see some" >&4
6842                 echo "harmless compilation warnings." >&4
6843         fi
6844         ;;
6845 esac
6846 $rm_try
6847
6848 $echo "Checking the kind of long doubles you have..." >&4
6849 case "$d_longdbl" in
6850 define)
6851 $cat <<EOP >try.c
6852 #$i_stdlib I_STDLIB
6853 #define LONGDBLSIZE $longdblsize
6854 #define DOUBLESIZE $doublesize
6855 #include <float.h>
6856 #ifdef I_STDLIB
6857 #include <stdlib.h>
6858 #endif
6859 #include <stdio.h>
6860 static const long double d = -0.1L;
6861 int main() {
6862   unsigned const char* b = (unsigned const char*)(&d);
6863 #if DOUBLESIZE == LONGDBLSIZE
6864   printf("0\n"); /* if it floats like double */
6865   exit(0);
6866 #endif
6867 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6868   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6869     /* IEEE 754 128-bit little-endian */
6870     printf("1\n");
6871     exit(0);
6872   }
6873   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6874     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6875     printf("2\n");
6876     exit(0);
6877   }
6878 #endif
6879 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6880  * while 64-bits platforms have it in 16 bytes.  The trailing bytes
6881  * cannot be trusted. */
6882 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6883   if (b[0] == 0xCD && b[9] == 0xBF) {
6884     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6885      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6886      * Also known as "extended precision". */
6887     printf("3\n");
6888     exit(0);
6889   }
6890   if (b[0] == 0xBF && b[9] == 0xCD) {
6891     /* Is there ever big-endian 80-bit, really?
6892      *
6893      * The Motorola 68881 had another "extended precision" format:
6894      * sign:1 exp:15 zero:16 integer:1 mantissa:63
6895      * for total of 96 bits of bytes.  The zero bits were unused.
6896      * See "M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL" for more details.
6897      * If it ever becomes relevant, this format should be allocated
6898      * a new doublekind code since it's quite different from the Intel x87.
6899      */
6900     printf("4\n");
6901     exit(0);
6902   }
6903 #endif
6904 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6905   /* software "double double", the 106 is 53+53.
6906    * but irix thinks it is 107. */
6907   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6908     /* double double 128-bit fully little-endian,
6909      * little-endian doubles in little-endian order,
6910      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6911     printf("5\n");
6912     exit(0);
6913   }
6914   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
6915     /* double double 128-bit fully big-endian,
6916      * big-endian doubles in big-endian order,
6917      * e.g. PPC/Power and MIPS:
6918      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
6919     printf("6\n");
6920     exit(0);
6921   }
6922   if (b[0] == 0x9A && b[7] == 0xBF && b[8] == 0x9A && b[15] == 0x3C) {
6923     /* double double 128-bit mixed endian.
6924      * little-endian doubles in big-endian order,
6925      * e.g. ppc64el,
6926      * 9a 99 99 99 99 99 b9 bf 9a 99 99 99 99 99 59 3c */
6927     printf("7\n");
6928     exit(0);
6929   }
6930   if (b[0] == 0x3C && b[7] == 0x9A && b[8] == 0xBF && b[15] == 0x9A) {
6931     /* double double 128-bit mixed endian,
6932      * big-endian doubles in little-endian order,
6933      * 3c 59 99 99 99 99 99 9a bf b9 99 99 99 99 99 9a */
6934     printf("8\n");
6935     exit(0);
6936   }
6937 #endif
6938 /* We are largely making this up because it may well be
6939  * that the VAX format H was never made available to C,
6940  * only to Fortran. */
6941 #if LONGDBLSIZE == 16 && defined(__vax__)
6942   if (b[0] == 0xFD && b[15] == 0x99) {
6943     /* VAX format H, PDP-11 mixed endian. */
6944     printf("9\n");
6945     exit(0);
6946   }
6947 #endif
6948   printf("-1\n"); /* unknown */
6949   exit(0);
6950 }
6951 EOP
6952 set try
6953 if eval $compile; then
6954     longdblkind=`$run ./try`
6955 else
6956     longdblkind=-1
6957 fi
6958 ;;
6959 *) longdblkind=0 ;;
6960 esac
6961 case "$longdblkind" in
6962 0) echo "Your long doubles are doubles." >&4 ;;
6963 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
6964 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
6965 3) echo "You have x86 80-bit little endian long doubles." >&4 ;;
6966 4) echo "You have x86 80-bit big endian long doubles." >&4 ;;
6967 5) echo "You have 128-bit fully little-endian double-double long doubles (64-bit LEs in LE)." >&4 ;;
6968 6) echo "You have 128-bit fully big-endian double-double long doubles (64-bit BEs in BE)." >&4 ;;
6969 7) echo "You have 128-bit mixed-endian double-double long doubles (64-bit LEs in BE)." >&4 ;;
6970 8) echo "You have 128-bit mixed-endian double-double long doubles (64-bit BEs in LE)." >&4 ;;
6971 9) echo "You have 128-bit PDP-style mixed-endian long doubles (VAX format H)." >&4 ;;
6972 *) echo "Cannot figure out your long double." >&4 ;;
6973 esac
6974 d_long_double_style_ieee=$undef
6975 d_long_double_style_ieee_std=$undef
6976 d_long_double_style_ieee_extended=$undef
6977 d_long_double_style_ieee_doubledouble=$undef
6978 d_long_double_style_vax=$undef
6979 case "$longdblkind" in
6980 1|2|3|4|5|6|7|8) d_long_double_style_ieee=$define ;;
6981 esac
6982 case "$longdblkind" in
6983 1|2) d_long_double_style_ieee_std=$define ;;
6984 esac
6985 case "$longdblkind" in
6986 3|4) d_long_double_style_ieee_extended=$define ;;
6987 esac
6988 case "$longdblkind" in
6989 5|6|7|8) d_long_double_style_ieee_doubledouble=$define ;;
6990 esac
6991 case "$longdblkind" in
6992 9) d_long_double_style_vax=$define ;;
6993 esac
6994 $rm_try
6995
6996 : get the patchlevel
6997 echo " "
6998 echo "Getting the current patchlevel..." >&4
6999 if $test -r $rsrc/patchlevel.h;then
7000         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
7001         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
7002         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
7003         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
7004         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
7005         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
7006         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
7007 else
7008         revision=0
7009         patchlevel=0
7010         subversion=0
7011         api_revision=0
7012         api_version=0
7013         api_subversion=0
7014         perl_patchlevel=0
7015         $echo "(You do not have patchlevel.h.  Eek.)"
7016 fi
7017 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
7018 version_patchlevel_string="version $patchlevel subversion $subversion"
7019 case "$perl_patchlevel" in
7020 0|'') ;;
7021 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
7022     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
7023     ;;
7024 esac
7025
7026 $echo "(You have $package $version_patchlevel_string.)"
7027
7028 case "$osname" in
7029 dos|vms)
7030         : XXX Should be a Configure test for double-dots in filenames.
7031         version=`echo $revision $patchlevel $subversion | \
7032                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
7033         api_versionstring=`echo $api_revision $api_version $api_subversion | \
7034                  $awk '{ printf "%d_%d_%d", $1, $2, $3 }'`
7035         ;;
7036 *)
7037         version=`echo $revision $patchlevel $subversion | \
7038                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
7039         api_versionstring=`echo $api_revision $api_version $api_subversion | \
7040                  $awk '{ printf "%d.%d.%d", $1, $2, $3 }'`
7041         ;;
7042 esac
7043 : Special case the 5.005_xx maintenance series, which used 5.005
7044 : without any subversion label as a subdirectory in $sitelib
7045 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
7046         api_versionstring='5.005'
7047 fi
7048
7049 : determine the architecture name
7050 echo " "
7051 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7052         tarch=`arch`"-$osname"
7053 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7054         if uname -m > tmparch 2>&1 ; then
7055                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7056                         -e 's/$/'"-$osname/" tmparch`
7057         else
7058                 tarch="$osname"
7059         fi
7060         $rm -f tmparch
7061 else
7062         tarch="$osname"
7063 fi
7064 case "$myarchname" in
7065 ''|"$tarch") ;;
7066 *)
7067         echo "(Your architecture name used to be $myarchname.)"
7068         archname=''
7069         ;;
7070 esac
7071 case "$targetarch" in
7072 '') ;;
7073 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7074 esac
7075 myarchname="$tarch"
7076 case "$archname" in
7077 '') dflt="$tarch";;
7078 *) dflt="$archname";;
7079 esac
7080 rp='What is your architecture name'
7081 . ./myread
7082 archname="$ans"
7083
7084 : optionally add API version to the architecture for versioned archlibs
7085 case "$useversionedarchname" in
7086 $define|true|[yY]*) dflt='y';;
7087 *)                  dflt='n';;
7088 esac
7089 rp='Add the Perl API version to your archname?'
7090 . ./myread
7091 case "$ans" in
7092 y|Y)    useversionedarchname="$define" ;;
7093 *)      useversionedarchname="$undef" ;;
7094 esac
7095 case "$useversionedarchname" in
7096 $define)
7097         case "$archname" in
7098         *-$api_versionstring)
7099                 echo "...and architecture name already has -$api_versionstring" >&4
7100                 ;;
7101         *)
7102                 archname="$archname-$api_versionstring"
7103                 echo "...setting architecture name to $archname." >&4
7104                 ;;
7105         esac
7106         ;;
7107 esac
7108
7109 case "$usethreads" in
7110 $define)
7111         echo "Threads selected." >&4
7112         case "$archname" in
7113         *-thread*) echo "...and architecture name already has -thread." >&4
7114                 ;;
7115         *)      archname="$archname-thread"
7116                 echo "...setting architecture name to $archname." >&4
7117                 ;;
7118         esac
7119         ;;
7120 esac
7121 case "$usemultiplicity" in
7122 $define)
7123         echo "Multiplicity selected." >&4
7124         case "$archname" in
7125         *-multi*) echo "...and architecture name already has -multi." >&4
7126                 ;;
7127         *)      archname="$archname-multi"
7128                 echo "...setting architecture name to $archname." >&4
7129                 ;;
7130         esac
7131         ;;
7132 esac
7133 case "$use64bitint$use64bitall" in
7134 *"$define"*)
7135         case "$archname64" in
7136         '')
7137                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7138                 ;;
7139         *)
7140                 case "$use64bitint" in
7141                 "$define") echo "64 bit integers selected." >&4 ;;
7142                 esac
7143                 case "$use64bitall" in
7144                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7145                 esac
7146                 case "$archname" in
7147                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7148                         ;;
7149                 *)      archname="$archname-$archname64"
7150                         echo "...setting architecture name to $archname." >&4
7151                         ;;
7152                 esac
7153                 ;;
7154         esac
7155 esac
7156 case "$uselongdouble" in
7157 $define)
7158         echo "Long doubles selected." >&4
7159         case "$longdblsize" in
7160         $doublesize)
7161                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7162                 ;;
7163         *)
7164                 case "$archname" in
7165                 *-ld*) echo "...and architecture name already has -ld." >&4
7166                         ;;
7167                 *)      archname="$archname-ld"
7168                         echo "...setting architecture name to $archname." >&4
7169                         ;;
7170                 esac
7171                 ;;
7172         esac
7173         ;;
7174 esac
7175 case "$usequadmath" in
7176 $define)
7177         echo "quadmath selected." >&4
7178         case "$archname" in
7179         *-quadmath*) echo "...and architecture name already has -quadmath." >&4
7180                 ;;
7181         *)      archname="$archname-quadmath"
7182                 echo "...setting architecture name to $archname." >&4
7183                 ;;
7184         esac
7185         ;;
7186 esac
7187 if $test -f archname.cbu; then
7188         echo "Your platform has some specific hints for architecture name, using them..."
7189         . ./archname.cbu
7190 fi
7191
7192 : set the prefixit variable, to compute a suitable default value
7193 prefixit='case "$3" in
7194 ""|none)
7195         case "$oldprefix" in
7196         "") eval "$1=\"\$$2\"";;
7197         *)
7198                 case "$3" in
7199                 "") eval "$1=";;
7200                 none)
7201                         eval "tp=\"\$$2\"";
7202                         case "$tp" in
7203                         ""|" "|none) eval "$1=\"\$$2\"";;
7204                         *) eval "$1=";;
7205                         esac;;
7206                 esac;;
7207         esac;;
7208 *)
7209         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7210         case "$tp" in
7211         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7212         /*-$oldprefix/*|\~*-$oldprefix/*)
7213                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7214         *) eval "$1=\"\$$2\"";;
7215         esac;;
7216 esac'
7217
7218 : determine installation style
7219 : For now, try to deduce it from prefix unless it is already set.
7220 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7221 case "$installstyle" in
7222 '')     case "$prefix" in
7223                 *perl*) dflt='lib';;
7224                 *) dflt='lib/perl5' ;;
7225         esac
7226         ;;
7227 *)      dflt="$installstyle" ;;
7228 esac
7229 : Probably not worth prompting for this since we prompt for all
7230 : the directories individually, and the prompt would be too long and
7231 : confusing anyway.
7232 installstyle=$dflt
7233
7234 : determine where public executables go
7235 echo " "
7236 set dflt bin bin
7237 eval $prefixit
7238 fn=d~
7239 rp='Pathname where the public executables will reside?'
7240 . ./getfile
7241 if $test "X$ansexp" != "X$binexp"; then
7242         installbin=''
7243 fi
7244 prefixvar=bin
7245 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7246 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7247 :     this via initialinstalllocation
7248 . ./setprefixvar
7249
7250 case "$userelocatableinc" in
7251 $define|true|[yY]*)     dflt='y' ;;
7252 *)                      dflt='n' ;;
7253 esac
7254 cat <<EOM
7255
7256 Would you like to build Perl so that the installation is relocatable, so that
7257 library paths in @INC are determined relative to the path of the perl binary?
7258 This is not advised for system Perl installs, or if you need to run setid
7259 scripts or scripts under taint mode.
7260
7261 If this doesn't make any sense to you, just accept the default '$dflt'.
7262 EOM
7263 rp='Use relocatable @INC?'
7264 . ./myread
7265 case "$ans" in
7266 y|Y)    val="$define" ;;
7267 *)      val="$undef"  ;;
7268 esac
7269 set userelocatableinc
7270 eval $setvar
7271
7272 initialinstalllocation="$binexp"
7273 : Default prefix is now "up one level from where the binaries are"
7274 case "$userelocatableinc" in
7275 $define|true|[yY]*)
7276     bin=".../"
7277     binexp=".../"
7278     prefix=".../.."
7279     prefixexp=".../.."
7280     installprefixexp=".../.."
7281     ;;
7282 esac
7283
7284 : determine where private library files go
7285 : Usual default is /usr/local/lib/perl5/$version.
7286 : Also allow things like /opt/perl/lib/$version, since
7287 : /opt/perl/lib/perl5... would be redundant.
7288 : The default "style" setting is made in installstyle.U
7289 case "$installstyle" in
7290 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7291 *)       set dflt privlib lib/$version ;;
7292 esac
7293 eval $prefixit
7294 $cat <<EOM
7295
7296 There are some auxiliary files for $package that need to be put into a
7297 private library directory that is accessible by everyone.
7298
7299 EOM
7300 fn=$binexp
7301 fn=d~+
7302 rp='Pathname where the private library files will reside?'
7303 . ./getfile
7304 prefixvar=privlib
7305 . ./setprefixvar
7306
7307 : set the prefixup variable, to restore leading tilda escape
7308 prefixup='case "$prefixexp" in
7309 "$prefix") ;;
7310 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7311 esac'
7312
7313 : determine where public architecture dependent libraries go
7314 set archlib archlib
7315 eval $prefixit
7316 : privlib default is /usr/local/lib/$package/$version
7317 : archlib default is /usr/local/lib/$package/$version/$archname
7318 : privlib may have an optional trailing /share.
7319 tdflt=`echo $privlib | $sed 's,/share$,,'`
7320 tdflt=$tdflt/$archname
7321 case "$archlib" in
7322 '')     dflt=$tdflt
7323         ;;
7324 *)      dflt="$archlib"
7325     ;;
7326 esac
7327 $cat <<EOM
7328
7329 $spackage contains architecture-dependent library files.  If you are
7330 sharing libraries in a heterogeneous environment, you might store
7331 these files in a separate location.  Otherwise, you can just include
7332 them with the rest of the public library files.
7333
7334 EOM
7335 fn=$binexp
7336 fn=d+~
7337 rp='Where do you want to put the public architecture-dependent libraries?'
7338 . ./getfile
7339 prefixvar=archlib
7340 . ./setprefixvar
7341 if $test X"$archlib" = X"$privlib"; then
7342         d_archlib="$undef"
7343 else
7344         d_archlib="$define"
7345 fi
7346
7347 : see if setuid scripts can be secure
7348 $cat <<EOM
7349
7350 Some kernels have a bug that prevents setuid #! scripts from being
7351 secure.  Some sites have disabled setuid #! scripts because of this.
7352
7353 First let's decide if your kernel supports secure setuid #! scripts.
7354 (If setuid #! scripts would be secure but have been disabled anyway,
7355 don't say that they are secure if asked.)
7356
7357 EOM
7358
7359 val="$undef"
7360 if $test -d /dev/fd; then
7361         echo "#!$ls" >reflect
7362         chmod +x,u+s reflect
7363         ./reflect >flect 2>&1
7364         if $contains "/dev/fd" flect >/dev/null; then
7365                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7366                 val="$define"
7367         else
7368                 $cat <<EOM
7369 If you are not sure if they are secure, I can check but I'll need a
7370 username and password different from the one you are using right now.
7371 If you don't have such a username or don't want me to test, simply
7372 enter 'none'.
7373
7374 EOM
7375                 rp='Other username to test security of setuid scripts with?'
7376                 dflt='none'
7377                 . ./myread
7378                 case "$ans" in
7379                 n|none)
7380                         case "$d_suidsafe" in
7381                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7382                                 dflt=n;;
7383                         "$undef")
7384                                 echo "Well, the $hint value is *not* secure." >&4
7385                                 dflt=n;;
7386                         *)      echo "Well, the $hint value *is* secure." >&4
7387                                 dflt=y;;
7388                         esac
7389                         ;;
7390                 *)
7391                         $rm -f reflect flect
7392                         echo "#!$ls" >reflect
7393                         chmod +x,u+s reflect
7394                         echo >flect
7395                         chmod a+w flect
7396                         echo '"su" will (probably) prompt you for '"$ans's password."
7397                         su $ans -c './reflect >flect'
7398                         if $contains "/dev/fd" flect >/dev/null; then
7399                                 echo "Okay, it looks like setuid scripts are secure." >&4
7400                                 dflt=y
7401                         else
7402                                 echo "I don't think setuid scripts are secure." >&4
7403                                 dflt=n
7404                         fi
7405                         ;;
7406                 esac
7407                 rp='Does your kernel have *secure* setuid scripts?'
7408                 . ./myread
7409                 case "$ans" in
7410                 [yY]*)  val="$define";;
7411                 *)      val="$undef";;
7412                 esac
7413         fi
7414 else
7415         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7416         echo "(That's for file descriptors, not floppy disks.)"
7417         val="$undef"
7418 fi
7419 set d_suidsafe
7420 eval $setvar
7421
7422 $rm -f reflect flect
7423
7424 : now see if they want to do setuid emulation
7425 if $test $patchlevel -lt 11; then
7426 echo " "
7427 val="$undef"
7428 case "$d_suidsafe" in
7429 "$define")
7430         val="$undef"
7431         echo "No need to emulate SUID scripts since they are secure here." >&4
7432         ;;
7433 *)
7434         $cat <<EOM
7435 Some systems have disabled setuid scripts, especially systems where
7436 setuid scripts cannot be secure.  On systems where setuid scripts have
7437 been disabled, the setuid/setgid bits on scripts are currently
7438 useless.  It is possible for $package to detect those bits and emulate
7439 setuid/setgid in a secure fashion.  This emulation will only work if
7440 setuid scripts have been disabled in your kernel.
7441
7442 EOM
7443         case "$d_dosuid" in
7444         "$define") dflt=y ;;
7445         *) dflt=n ;;
7446         esac
7447         rp="Do you want to do setuid/setgid emulation?"
7448         . ./myread
7449         case "$ans" in
7450         [yY]*)  val="$define";;
7451         *)      val="$undef";;
7452         esac
7453         ;;
7454 esac
7455 set d_dosuid
7456 eval $setvar
7457 else
7458     case "$d_dosuid" in
7459         "$define")
7460         cat >&4 <<EOH
7461
7462 SUID emulation has been removed for 5.12
7463 Please re-run Configure without -Dd_dosuid
7464
7465 EOH
7466         exit 1;
7467         ;;
7468     esac
7469     d_dosuid=undef
7470 fi
7471
7472 : Find perl5.005 or later.
7473 echo "Looking for a previously installed perl5.005 or later... "
7474 case "$perl5" in
7475 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7476                 : Check if this perl is recent and can load a simple module
7477                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7478                         perl5=$tdir/perl
7479                         break;
7480                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7481                         perl5=$tdir/perl5
7482                         break;
7483                 fi
7484         done
7485         ;;
7486 *)      perl5="$perl5"
7487         ;;
7488 esac
7489 case "$perl5" in
7490 '')     echo "None found.  That's ok.";;
7491 *)      echo "Using $perl5." ;;
7492 esac
7493
7494 : Set the siteprefix variables
7495 $cat <<EOM
7496
7497 After $package is installed, you may wish to install various
7498 add-on modules and utilities.  Typically, these add-ons will
7499 be installed under $prefix with the rest
7500 of this package.  However, you may wish to install such add-ons
7501 elsewhere under a different prefix.
7502
7503 If you do not wish to put everything under a single prefix, that's
7504 ok.  You will be prompted for the individual locations; this siteprefix
7505 is only used to suggest the defaults.
7506
7507 The default should be fine for most people.
7508
7509 EOM
7510 fn=d~+
7511 rp='Installation prefix to use for add-on modules and utilities?'
7512 : XXX Here might be another good place for an installstyle setting.
7513 case "$siteprefix" in
7514 '') dflt=$prefix ;;
7515 *)  dflt=$siteprefix ;;
7516 esac
7517 . ./getfile
7518 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7519 oldsiteprefix=''
7520 case "$siteprefix" in
7521 '') ;;
7522 *)      case "$ans" in
7523         "$prefix") ;;
7524         *) oldsiteprefix="$prefix";;
7525         esac
7526         ;;
7527 esac
7528 siteprefix="$ans"
7529 siteprefixexp="$ansexp"
7530
7531 : determine where site specific libraries go.
7532 : Usual default is /usr/local/lib/perl5/site_perl/$version
7533 : The default "style" setting is made in installstyle.U
7534 : XXX No longer works with Prefixit stuff.
7535 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7536 case "$sitelib" in
7537 '') case "$installstyle" in
7538         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7539         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7540         esac
7541         ;;
7542 *)      dflt="$sitelib"
7543         ;;
7544 esac
7545 $cat <<EOM
7546
7547 The installation process will create a directory for
7548 site-specific extensions and modules.  Most users find it convenient
7549 to place all site-specific files in this directory rather than in the
7550 main distribution directory.
7551
7552 EOM
7553 fn=d~+
7554 rp='Pathname for the site-specific library files?'
7555 . ./getfile
7556 prefixvar=sitelib
7557 . ./setprefixvar
7558 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7559
7560 : Determine list of previous versions to include in @INC
7561 $cat > getverlist <<EOPL
7562 #!$perl5
7563 use strict;
7564 use warnings;
7565 use File::Basename;
7566 my \$api_versionstring = "$api_versionstring";
7567 my \$version = "$version";
7568 my \$stem = "$sitelib_stem";
7569 my \$archname = "$archname";
7570 EOPL
7571         $cat >> getverlist <<'EOPL'
7572 # The list found is stored twice for each entry: the original name, and
7573 # the binary broken down version into pack "s>s>s>", so sorting is easy
7574 # and unambiguous.  This will work for all versions that have a maximum
7575 # of three digit per group separate by '.'s or '_'s. Names are extended
7576 # with ".0.0" to ensure at least three elements for the pack.
7577 #                                   -- H.Merijn Brand (m)'06 23-10-2006
7578
7579 my @inc_version_list;
7580 my @candidates;
7581 # XXX Redo to do opendir/readdir?
7582 if (-d $stem) {
7583     chdir($stem);
7584     ;@candidates = map {
7585         [ $_, pack "s>s>s>", split m/[._]/, "$_.0.0" ] } glob("5.*");
7586     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7587 }
7588 else {
7589     ;@candidates = ();
7590 }
7591
7592 my ($pversion, $aversion, $vsn5005) = map {
7593     pack "s>s>s>", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7594 foreach my $d (@candidates) {
7595     if ($d->[1] lt $pversion) {
7596         if ($d->[1] ge $aversion) {
7597             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7598         }
7599         elsif ($d->[1] ge $vsn5005) {
7600             unshift(@inc_version_list, grep { -d } $d->[0]);
7601         }
7602     }
7603     else {
7604         # Skip newer version.  I.e. don't look in
7605         # 5.7.0 if we're installing 5.6.1.
7606     }
7607 }
7608
7609 if (@inc_version_list) {
7610     print join(' ', @inc_version_list);
7611 }
7612 else {
7613     # Blank space to preserve value for next Configure run.
7614     print " ";
7615 }
7616 EOPL
7617 chmod +x getverlist
7618 case "$inc_version_list" in
7619 '')     if test -x "$perl5$exe_ext"; then
7620                 dflt=`$perl5 getverlist`
7621         else
7622                 dflt='none'
7623         fi
7624         ;;
7625 $undef) dflt='none' ;;
7626 *)  eval dflt=\"$inc_version_list\" ;;
7627 esac
7628 case "$dflt" in
7629 ''|' ') dflt=none ;;
7630 esac
7631 case "$dflt" in
7632 5.005) dflt=none ;;
7633 esac
7634 $cat <<EOM
7635
7636 In order to ease the process of upgrading, this version of perl
7637 can be configured to use modules built and installed with earlier
7638 versions of perl that were installed under $prefix.  Specify here
7639 the list of earlier versions that this version of perl should check.
7640 If Configure detected no earlier versions of perl installed under
7641 $prefix, then the list will be empty.  Answer 'none' to tell perl
7642 to not search earlier versions.
7643
7644 The default should almost always be sensible, so if you're not sure,
7645 just accept the default.
7646 EOM
7647
7648 rp='List of earlier versions to include in @INC?'
7649 . ./myread
7650 case "$ans" in
7651 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7652 *) inc_version_list="$ans" ;;
7653 esac
7654 case "$inc_version_list" in
7655 ''|' ')
7656         inc_version_list_init='0'
7657         d_inc_version_list="$undef"
7658         ;;
7659 *)      inc_version_list_init=`echo $inc_version_list |
7660                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7661         d_inc_version_list="$define"
7662         ;;
7663 esac
7664 $rm -f getverlist
7665
7666 : see if malloc/malloc.h has to be included
7667 set malloc/malloc.h i_mallocmalloc
7668 eval $inhdr
7669
7670 : see if this is a malloc.h system
7671 : we want a real compile instead of Inhdr because some systems have a
7672 : malloc.h that just gives a compile error saying to use stdlib.h instead
7673 echo " "
7674 $cat >try.c <<EOCP
7675 #include <stdlib.h>
7676 #include <malloc.h>
7677 #$i_mallocmalloc I_MALLOCMALLOC
7678 #ifdef I_MALLOCMALLOC
7679 # include <malloc/malloc.h>
7680 #endif
7681
7682 int main () { return 0; }
7683 EOCP
7684 set try
7685 if eval $compile; then
7686     echo "<malloc.h> found." >&4
7687     val="$define"
7688 else
7689     echo "<malloc.h> NOT found." >&4
7690     val="$undef"
7691 fi
7692 $rm_try
7693 set i_malloc
7694 eval $setvar
7695
7696 : check for length of pointer
7697 echo " "
7698 case "$ptrsize" in
7699 '')
7700         echo "Checking to see how big your pointers are..." >&4
7701         $cat >try.c <<EOCP
7702 #include <stdio.h>
7703 #$i_stdlib I_STDLIB
7704 #ifdef I_STDLIB
7705 #include <stdlib.h>
7706 #endif
7707 int main()
7708 {
7709     printf("%d\n", (int)sizeof(void *));
7710     exit(0);
7711 }
7712 EOCP
7713         set try
7714         if eval $compile_ok; then
7715                 ptrsize=`$run ./try`
7716                 echo "Your pointers are $ptrsize bytes long."
7717         else
7718                 dflt='4'
7719                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7720                 rp="What is the size of a pointer (in bytes)?"
7721                 . ./myread
7722                 ptrsize="$ans"
7723         fi
7724         ;;
7725 esac
7726 $rm_try
7727 case "$use64bitall" in
7728 "$define"|true|[yY]*)
7729         case "$ptrsize" in
7730         4)      cat <<EOM >&4
7731
7732 *** You have chosen a maximally 64-bit build,
7733 *** but your pointers are only 4 bytes wide.
7734 *** Please rerun Configure without -Duse64bitall.
7735 EOM
7736                 case "$d_quad" in
7737                 define)
7738                         cat <<EOM >&4
7739 *** Since you have quads, you could possibly try with -Duse64bitint.
7740 EOM
7741                         ;;
7742                 esac
7743                 cat <<EOM >&4
7744 *** Cannot continue, aborting.
7745
7746 EOM
7747
7748                 exit 1
7749                 ;;
7750         esac
7751         ;;
7752 esac
7753
7754 : determine whether to use malloc wrapping
7755 echo " "
7756 case "$usemallocwrap" in
7757 [yY]*|true|$define)     dflt='y' ;;
7758 [nN]*|false|$undef)     dflt='n' ;;
7759 *)      case "$usedevel" in
7760         [yY]*|true|$define)     dflt='y' ;;
7761         *) dflt='n' ;;
7762         esac
7763         ;;
7764 esac
7765 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7766 . ./myread
7767 usemallocwrap="$ans"
7768 case "$ans" in
7769 y*|true)
7770         usemallocwrap="$define" ;;
7771 *)
7772         usemallocwrap="$undef" ;;
7773 esac
7774
7775 : determine which malloc to compile in
7776 echo " "
7777 case "$usemymalloc" in
7778 [yY]*|true|$define)     dflt='y' ;;
7779 [nN]*|false|$undef)     dflt='n' ;;
7780 *)      case "$ptrsize" in
7781         4) dflt='y' ;;
7782         *) dflt='n' ;;
7783         esac
7784         if test "$useithreads" = "$define"; then dflt='n'; fi
7785         ;;
7786 esac
7787 rp="Do you wish to attempt to use the malloc that comes with $package?"
7788 . ./myread
7789 usemymalloc="$ans"
7790 case "$ans" in
7791 y*|true)
7792         usemymalloc='y'
7793         mallocsrc='malloc.c'
7794         mallocobj="malloc$_o"
7795         d_mymalloc="$define"
7796         case "$libs" in
7797         *-lmalloc*)
7798                 : Remove malloc from list of libraries to use
7799                 echo "Removing unneeded -lmalloc from library list" >&4
7800                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7801                 shift
7802                 libs="$*"
7803                 echo "libs = $libs" >&4
7804                 ;;
7805         esac
7806         ;;
7807 *)
7808         usemymalloc='n'
7809         mallocsrc=''
7810         mallocobj=''
7811         d_mymalloc="$undef"
7812         ;;
7813 esac
7814
7815 : compute the return types of malloc and free
7816 echo " "
7817 $cat >malloc.c <<END
7818 #$i_malloc I_MALLOC
7819 #$i_stdlib I_STDLIB
7820 #include <stdio.h>
7821 #include <sys/types.h>
7822 #ifdef I_MALLOC
7823 #include <malloc.h>
7824 #endif
7825 #ifdef I_STDLIB
7826 #include <stdlib.h>
7827 #endif
7828 #ifdef TRY_MALLOC
7829 void *malloc();
7830 #endif
7831 #ifdef TRY_FREE
7832 void free();
7833 #endif
7834 END
7835 case "$malloctype" in
7836 '')
7837         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7838                 malloctype='void *'
7839         else
7840                 malloctype='char *'
7841         fi
7842         ;;
7843 esac
7844 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7845
7846 case "$freetype" in
7847 '')
7848         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7849                 freetype='void'
7850         else
7851                 freetype='int'
7852         fi
7853         ;;
7854 esac
7855 echo "Your system uses $freetype free(), it would seem." >&4
7856 $rm -f malloc.[co]
7857 : determine where site specific architecture-dependent libraries go.
7858 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7859 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7860 : sitelib may have an optional trailing /share.
7861 case "$sitearch" in
7862 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7863         dflt="$dflt/$archname"
7864         ;;
7865 *)      dflt="$sitearch"
7866         ;;
7867 esac
7868 set sitearch sitearch none
7869 eval $prefixit
7870 $cat <<EOM
7871
7872 The installation process will also create a directory for
7873 architecture-dependent site-specific extensions and modules.
7874
7875 EOM
7876 fn=d~+
7877 rp='Pathname for the site-specific architecture-dependent library files?'
7878 . ./getfile
7879 prefixvar=sitearch
7880 . ./setprefixvar
7881 if $test X"$sitearch" = X"$sitelib"; then
7882         d_sitearch="$undef"
7883 else
7884         d_sitearch="$define"
7885 fi
7886
7887 : Set the vendorprefix variables
7888 $cat <<EOM
7889
7890 The installation process will also create a directory for
7891 vendor-supplied add-ons.  Vendors who supply perl with their system
7892 may find it convenient to place all vendor-supplied files in this
7893 directory rather than in the main distribution directory.  This will
7894 ease upgrades between binary-compatible maintenance versions of perl.
7895
7896 Of course you may also use these directories in whatever way you see
7897 fit.  For example, you might use them to access modules shared over a
7898 company-wide network.
7899
7900 The default answer should be fine for most people.
7901 This causes further questions about vendor add-ons to be skipped
7902 and no vendor-specific directories will be configured for perl.
7903
7904 EOM
7905 rp='Do you want to configure vendor-specific add-on directories?'
7906 case "$usevendorprefix" in
7907 define|true|[yY]*) dflt=y ;;
7908 *)      : User may have set vendorprefix directly on Configure command line.
7909         case "$vendorprefix" in
7910         ''|' ') dflt=n ;;
7911         *)      dflt=y ;;
7912         esac
7913         ;;
7914 esac
7915 . ./myread
7916 case "$ans" in
7917 [yY]*)  fn=d~+
7918         rp='Installation prefix to use for vendor-supplied add-ons?'
7919         case "$vendorprefix" in
7920         '') dflt="$prefix" ;;
7921         *)  dflt=$vendorprefix ;;
7922         esac
7923         . ./getfile
7924         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7925         oldvendorprefix=''
7926         case "$vendorprefix" in
7927         '') ;;
7928         *)      case "$ans" in
7929                 "$prefix") ;;
7930                 *) oldvendorprefix="$prefix";;
7931                 esac
7932                 ;;
7933         esac
7934         usevendorprefix="$define"
7935         vendorprefix="$ans"
7936         vendorprefixexp="$ansexp"
7937         ;;
7938 *)      usevendorprefix="$undef"
7939         vendorprefix=''
7940         vendorprefixexp=''
7941         ;;
7942 esac
7943
7944 : Set the vendorlib variables
7945 case "$vendorprefix" in
7946 '')     d_vendorlib="$undef"
7947         vendorlib=''
7948         vendorlibexp=''
7949         ;;
7950 *)      d_vendorlib="$define"
7951         : determine where vendor-supplied modules go.
7952         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7953         case "$vendorlib" in
7954         '')
7955                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7956                 case "$installstyle" in
7957                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7958                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7959                 esac
7960                 ;;
7961         *)      dflt="$vendorlib"
7962                 ;;
7963         esac
7964         fn=d~+
7965         rp='Pathname for the vendor-supplied library files?'
7966         . ./getfile
7967         vendorlib="$ans"
7968         vendorlibexp="$ansexp"
7969         ;;
7970 esac
7971 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7972 prefixvar=vendorlib
7973 . ./installprefix
7974
7975 : Set the vendorarch variables
7976 case "$vendorprefix" in
7977 '')     d_vendorarch="$undef"
7978         vendorarch=''
7979         vendorarchexp=''
7980         ;;
7981 *)      d_vendorarch="$define"
7982         : determine where vendor-supplied architecture-dependent libraries go.
7983         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7984         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7985         : vendorlib may have an optional trailing /share.
7986         case "$vendorarch" in
7987         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7988                 dflt="$dflt/$archname"
7989                 ;;
7990         *)      dflt="$vendorarch" ;;
7991         esac
7992         fn=d~+
7993         rp='Pathname for vendor-supplied architecture-dependent files?'
7994         . ./getfile
7995         vendorarch="$ans"
7996         vendorarchexp="$ansexp"
7997         ;;
7998 esac
7999 prefixvar=vendorarch
8000 . ./installprefix
8001 if $test X"$vendorarch" = X"$vendorlib"; then
8002         d_vendorarch="$undef"
8003 else
8004         d_vendorarch="$define"
8005 fi
8006
8007 : Final catch-all directories to search
8008 $cat <<EOM
8009
8010 Lastly, you can have perl look in other directories for extensions and
8011 modules in addition to those already specified.
8012 These directories will be searched after
8013         $sitearch
8014         $sitelib
8015 EOM
8016 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8017 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8018 echo ' '
8019 case "$otherlibdirs" in
8020 ''|' ') dflt='none' ;;
8021 *)      dflt="$otherlibdirs" ;;
8022 esac
8023 $cat <<EOM
8024 Enter a colon-separated set of extra paths to include in perl's @INC
8025 search path, or enter 'none' for no extra paths.
8026
8027 EOM
8028
8029 rp='Colon-separated list of additional directories for perl to search?'
8030 . ./myread
8031 case "$ans" in
8032 ' '|''|none)    otherlibdirs=' ' ;;
8033 *)      otherlibdirs="$ans" ;;
8034 esac
8035 case "$otherlibdirs" in
8036 ' ') val=$undef ;;
8037 *)      val=$define ;;
8038 esac
8039 set d_perl_otherlibdirs
8040 eval $setvar
8041
8042 : DTrace support
8043 dflt_dtrace='/usr/sbin/dtrace'
8044 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8045
8046 cat <<EOM
8047
8048 Perl can be built to support DTrace on platforms that support it.
8049 DTrace is a diagnosis and performance analysis tool from Sun.
8050
8051 If this doesn't make any sense to you, just accept the default.
8052 EOM
8053
8054 while $test 1 ; do
8055         case "$usedtrace" in
8056         $define|true|[yY]*)
8057                 dflt='y'
8058                 ;;
8059         $undef|false|[nN]*)
8060                 dflt='n'
8061                 dflt_dtrace=""
8062                 ;;
8063         ?*)
8064                 dflt='y'
8065                 dflt_dtrace=$usedtrace
8066                 ;;
8067         *)
8068                 dflt='n'
8069                 ;;
8070         esac
8071
8072         rp='Support DTrace if available?'
8073         . ./myread
8074         case "$ans" in
8075         y|Y)    val="$define" ;;
8076         *)      val="$undef" ;;
8077         esac
8078         set usedtrace
8079         eval $setvar
8080
8081         test "X$usedtrace" != "X$define" && break
8082
8083         echo " "
8084         rp='Where is the dtrace executable?'
8085         dflt=$dflt_dtrace
8086         . ./getfile
8087         val="$ans"
8088         set dtrace
8089         eval $setvar
8090
8091         if $test -f $dtrace
8092         then
8093                 if $dtrace -h -s ../perldtrace.d \
8094                         -o perldtrace.tmp >/dev/null 2>&1 \
8095                         && rm -f perldtrace.tmp
8096                 then
8097                         echo " "
8098                         echo "Good: your $dtrace knows about the -h flag."
8099                 else
8100                         cat >&2 <<EOM
8101
8102 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8103 ***
8104 *** Your installed dtrace doesn't support the -h switch to compile a D
8105 *** program into a C header. Can't continue.
8106
8107 EOM
8108                         exit 1
8109                 fi
8110                 break;
8111         fi
8112
8113         case "$fastread" in
8114         yes)
8115                 cat >&2 <<EOM
8116
8117 *** $me:  Fatal Error:  $dtrace not found.
8118 *** Can't continue.
8119
8120 EOM
8121                 exit 1
8122                 ;;
8123         *)
8124                 echo "*** $dtrace was not found."
8125                 echo " "
8126                 ;;
8127         esac
8128 done
8129
8130 : See if we want extra modules installed
8131 echo " "
8132 case "$extras" in
8133 '') dflt='n';;
8134 *) dflt='y';;
8135 esac
8136 cat <<EOM
8137 Perl can be built with extra modules or bundles of modules which
8138 will be fetched from the CPAN and installed alongside Perl.
8139
8140 Notice that you will need access to the CPAN; either via the Internet,
8141 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8142 be asked later to configure the CPAN.pm module which will in turn do
8143 the installation of the rest of the extra modules or bundles.)
8144
8145 Notice also that if the modules require any external software such as
8146 libraries and headers (the libz library and the zlib.h header for the
8147 Compress::Zlib module, for example) you MUST have any such software
8148 already installed, this configuration process will NOT install such
8149 things for you.
8150
8151 If this doesn't make any sense to you, just accept the default '$dflt'.
8152 EOM
8153 rp='Install any extra modules (y or n)?'
8154 . ./myread
8155 case "$ans" in
8156 y|Y)
8157         cat <<EOM
8158
8159 Please list any extra modules or bundles to be installed from CPAN,
8160 with spaces between the names.  The names can be in any format the
8161 'install' command of CPAN.pm will understand.  (Answer 'none',
8162 without the quotes, to install no extra modules or bundles.)
8163 EOM
8164         rp='Extras?'
8165         dflt="$extras"
8166         . ./myread
8167         extras="$ans"
8168 esac
8169 case "$extras" in
8170 ''|'none')
8171         val=''
8172         $rm -f ../extras.lst
8173         ;;
8174 *)      echo "(Saving the list of extras for later...)"
8175         echo "$extras" > ../extras.lst
8176         val="'$extras'"
8177         ;;
8178 esac
8179 set extras
8180 eval $setvar
8181 echo " "
8182
8183 : determine where html pages for programs go
8184 set html1dir html1dir none
8185 eval $prefixit
8186 $cat <<EOM
8187
8188 If you wish to install html files for programs in $spackage, indicate
8189 the appropriate directory here.  To skip installing html files,
8190 answer "none".
8191 EOM
8192 case "$html1dir" in
8193 ''|none|$undef|' ') dflt=none ;;
8194 *) dflt=$html1dir ;;
8195 esac
8196 fn=dn+~
8197 rp="Directory for the main $spackage html pages?"
8198 . ./getfile
8199 prefixvar=html1dir
8200 . ./setprefixvar
8201 : Use ' ' for none so value is preserved next time through Configure
8202 $test X"$html1dir" = "X" && html1dir=' '
8203
8204 : determine where html pages for libraries and modules go
8205 set html3dir html3dir none
8206 eval $prefixit
8207 $cat <<EOM
8208
8209 If you wish to install html files for modules associated with $spackage,
8210 indicate the appropriate directory here.  To skip installing html files,
8211 answer "none".
8212 EOM
8213 : There is no obvious default.  If they have specified html1dir, then
8214 : try to key off that, possibly changing .../html1 into .../html3.
8215 case "$html3dir" in
8216 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8217 *) dflt=$html3dir ;;
8218 esac
8219 fn=dn+~
8220 rp="Directory for the $spackage module html pages?"
8221 . ./getfile
8222 prefixvar=html3dir
8223 . ./setprefixvar
8224 : Use ' ' for none so value is preserved next time through Configure
8225 $test X"$html3dir" = "X" && html3dir=' '
8226
8227 : determine whether to install perl also as /usr/bin/perl
8228
8229 echo " "
8230 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8231         $cat <<EOM
8232 Many scripts expect perl to be installed as /usr/bin/perl.
8233
8234 If you want to, I can install the perl you are about to compile
8235 as /usr/bin/perl (in addition to $bin/perl).
8236 EOM
8237         if test -f /usr/bin/perl; then
8238             $cat <<EOM
8239
8240 However, please note that because you already have a /usr/bin/perl,
8241 overwriting that with a new Perl would very probably cause problems.
8242 Therefore I'm assuming you don't want to do that (unless you insist).
8243
8244 EOM
8245             case "$installusrbinperl" in
8246             "$define"|[yY]*)    dflt='y';;
8247             *)                  dflt='n';;
8248             esac
8249         else
8250             $cat <<EOM
8251
8252 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8253
8254 EOM
8255             case "$installusrbinperl" in
8256             "$undef"|[nN]*)     dflt='n';;
8257             *)                  dflt='y';;
8258             esac
8259         fi
8260         rp="Do you want to install perl as /usr/bin/perl?"
8261         . ./myread
8262         case "$ans" in
8263         [yY]*)  val="$define";;
8264         *)      val="$undef" ;;
8265         esac
8266 else
8267         val="$undef"
8268 fi
8269 set installusrbinperl
8270 eval $setvar
8271
8272 : see if dlopen exists
8273 xxx_runnm="$runnm"
8274 xxx_ccflags="$ccflags"
8275 runnm=false
8276 : with g++ one needs -shared to get is-in-libc to work for dlopen
8277 case "$gccversion" in
8278 '')     ;;
8279 *Clang*)        ;;
8280 *)      case "$d_cplusplus" in
8281         "$define") ccflags="$ccflags -shared" ;;
8282         esac
8283         ;;
8284 esac
8285 set dlopen d_dlopen
8286 eval $inlibc
8287 runnm="$xxx_runnm"
8288 ccflags="$xxx_ccflags"
8289
8290 : see if this is a unistd.h system
8291 set unistd.h i_unistd
8292 eval $inhdr
8293
8294 : determine which dynamic loading, if any, to compile in
8295 echo " "
8296 dldir="ext/DynaLoader"
8297 case "$usedl" in
8298     $define|y|true)
8299         dflt='y'
8300         usedl="$define"
8301         ;;
8302     $undef|n|false)
8303         dflt='n'
8304         usedl="$undef"
8305         ;;
8306     *)
8307         dflt='n'
8308         case "$d_dlopen" in
8309             $define) dflt='y' ;;
8310         esac
8311         : Does a dl_xxx.xs file exist for this operating system
8312         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8313         ;;
8314 esac
8315 rp="Do you wish to use dynamic loading?"
8316 . ./myread
8317 usedl="$ans"
8318 bin_ELF="$undef"
8319 case "$ans" in
8320     y*) usedl="$define"
8321         case "$dlsrc" in
8322             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8323                     dflt="$dldir/dl_${osname}.xs"
8324                 elif $test "$d_dlopen" = "$define" ; then
8325                     dflt="$dldir/dl_dlopen.xs"
8326                 else
8327                     dflt=''
8328                 fi
8329                 ;;
8330             *)  dflt="$dldir/$dlsrc"
8331                 ;;
8332         esac
8333         echo "The following dynamic loading files are available:"
8334         : Can not go over to $dldir because getfile has path hard-coded in.
8335         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8336         rp="Source file to use for dynamic loading"
8337         fn="fne"
8338         gfpth="$src"
8339         . ./getfile
8340         usedl="$define"
8341         : emulate basename
8342         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8343
8344         $cat << EOM
8345
8346 Some systems may require passing special flags to $cc -c to
8347 compile modules that will be used to create a shared library.
8348 To use no flags, say "none".
8349
8350 EOM
8351         case "$cccdlflags" in
8352             '') case "$gccversion" in
8353                 '') case "$osname" in
8354                         hpux)   dflt='+z' ;;
8355                         irix*)  dflt='-KPIC' ;;
8356                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8357                         sunos)  dflt='-pic' ;;
8358                         *)      dflt='none' ;;
8359                     esac
8360                     ;;
8361                 *)  case "$osname" in
8362                         darwin) dflt='none' ;;
8363                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8364                         *)      dflt='-fpic' ;;
8365                     esac ;;
8366                 esac ;;
8367             ' ') dflt='none' ;;
8368             *)   dflt="$cccdlflags" ;;
8369         esac
8370
8371         case "$dflt" in
8372             none) dflt='' ;;
8373         esac
8374
8375         # If -Dsysroot was specified, now's the time to add it
8376         # to cccdlflags
8377         if test "X$sysroot" != X; then
8378             case "$gccversion" in
8379                 '') ;;
8380                 *)  case "$dflt" in
8381                         *sysroot*) ;;
8382                         'undef'|*)
8383                             dflt="$dflt --sysroot=$sysroot" ;;
8384                     esac
8385                     ;;
8386             esac
8387         fi
8388
8389         case "$dflt" in
8390             '') dflt='none';;
8391         esac
8392
8393         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8394         . ./myread
8395         case "$ans" in
8396             none) cccdlflags=' ' ;;
8397             *)    cccdlflags="$ans" ;;
8398         esac
8399
8400         cat << EOM
8401
8402 Some systems use ld to create libraries that can be dynamically loaded,
8403 while other systems (such as those using ELF) use $cc.
8404
8405 EOM
8406
8407 : Determine if this is ELF
8408         $cat >try.c <<EOM
8409 /* Test for whether ELF binaries are produced */
8410 #include <fcntl.h>
8411 #$i_stdlib I_STDLIB
8412 #ifdef I_STDLIB
8413 #include <stdlib.h>
8414 #endif
8415 #$i_unistd I_UNISTD
8416 #ifdef I_UNISTD
8417 #include <unistd.h>
8418 #endif
8419 int main() {
8420     char b[4];
8421     int i = open("a.out",O_RDONLY);
8422     if(i == -1)
8423         exit(1); /* fail */
8424     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8425         exit(0); /* succeed (yes, it is ELF) */
8426     exit(1); /* fail */
8427 }
8428 EOM
8429         if $cc $ccflags $ldflags -o a.out try.c >/dev/null 2>&1 && $run ./a.out; then
8430             bin_ELF="$define"
8431         fi
8432         $rm_try
8433
8434         case "$ld" in
8435             '') if $test $bin_ELF = "$define"; then
8436                     cat <<EOM
8437 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8438 EOM
8439                     dflt="$cc"
8440                 else
8441                     echo "I'll use ld to build dynamic libraries."
8442                     dflt='ld'
8443                 fi
8444                 ;;
8445             *)  dflt="$ld"
8446                 ;;
8447         esac
8448
8449         rp="What command should be used to create dynamic libraries?"
8450         . ./myread
8451         ld="$ans"
8452
8453         cat << EOM
8454
8455 Some systems may require passing special flags to $ld to create a
8456 library that can be dynamically loaded.  If your ld flags include
8457 -L/other/path options to locate libraries outside your loader's normal
8458 search path, you may need to specify those -L options here as well.  To
8459 use no flags, say "none".
8460
8461 EOM
8462         case "$lddlflags" in
8463             '') case "$osname" in
8464                     haiku) dflt='-shared' ;;
8465                     hpux) dflt='-b';
8466                           case "$gccversion" in
8467                               '') dflt="$dflt +vnocompatwarnings" ;;
8468                           esac
8469                           ;;
8470                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8471                     solaris) # See [perl #66604].
8472                             # On Solaris 11, gcc -m64 on amd64
8473                             # appears not to understand -G.  gcc versions at
8474                             # least as old as 3.4.3 support -shared, so just
8475                             # use that with Solaris 11 and later, but keep
8476                             # the old behavior for older Solaris versions.
8477                             case "$gccversion" in
8478                                 '') dflt='-G' ;;
8479                                 *)  case "$osvers" in
8480                                         2.?|2.10) dflt='-G' ;;
8481                                         *) dflt='-shared' ;;
8482                                     esac
8483                                     ;;
8484                             esac
8485                             ;;
8486                     sunos) dflt='-assert nodefinitions' ;;
8487                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8488                     *)     dflt='none' ;;
8489                 esac
8490                 ;;
8491             *) dflt="$lddlflags" ;;
8492         esac
8493
8494         : Only do this for gcc, since, for example, qcc has no concept
8495         : of --sysroot.
8496         if $test "X$sysroot" != X; then
8497             case "$gccversion" in
8498                 '') ;;
8499                 *)  dflt="$dflt --sysroot=$sysroot" ;;
8500             esac
8501         fi
8502
8503         : Try to guess additional flags to pick up local libraries.
8504         : Be careful not to append to a plain 'none'
8505         case "$dflt" in
8506             none) dflt='' ;;
8507         esac
8508         for thisflag in $ldflags; do
8509             case "$thisflag" in
8510                 -L*|-R*|-Wl,-R*)
8511                     case " $dflt " in
8512                         *" $thisflag "*) ;;
8513                         *) dflt="$dflt $thisflag" ;;
8514                     esac
8515                     ;;
8516             esac
8517         done
8518
8519         case "$dflt" in
8520             ''|' ') dflt='none' ;;
8521         esac
8522
8523         case "$ldflags" in
8524             *-fstack-protector-strong*)
8525                 case "$dflt" in
8526                     *-fstack-protector-strong*) ;; # Don't add it again
8527                     *) dflt="$dflt -fstack-protector-strong" ;;
8528                 esac
8529                 ;;
8530             *-fstack-protector*)
8531                 case "$dflt" in
8532                     *-fstack-protector*) ;; # Don't add it again
8533                     *) dflt="$dflt -fstack-protector" ;;
8534                 esac
8535                 ;;
8536         esac
8537
8538         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8539         . ./myread
8540         case "$ans" in
8541             none) lddlflags=' ' ;;
8542             *) lddlflags="$ans" ;;
8543         esac
8544
8545         cat <<EOM
8546
8547 Some systems may require passing special flags to $cc to indicate that
8548 the resulting executable will use dynamic linking.  To use no flags,
8549 say "none".
8550
8551 EOM
8552         case "$ccdlflags" in
8553             '') case "$osname" in
8554                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8555                     sunos)             dflt='none'   ;;
8556                     *)                 dflt='none'   ;;
8557                 esac ;;
8558             ' ') dflt='none' ;;
8559             *)   dflt="$ccdlflags" ;;
8560         esac
8561         rp="Any special flags to pass to $cc to use dynamic linking?"
8562         . ./myread
8563         case "$ans" in
8564             none) ccdlflags=' ' ;;
8565             *)    ccdlflags="$ans" ;;
8566         esac
8567         ;;
8568
8569     *)  usedl="$undef"
8570         ld='ld'
8571         dlsrc='dl_none.xs'
8572         lddlflags=''
8573         ccdlflags=''
8574         ;;
8575 esac
8576
8577 ld_can_script="$undef"
8578 case "$bin_ELF$usedl" in
8579     $define$define)
8580         # Abuse try.h and a.out names for neat cleanup
8581         $cat >try.c <<EOM
8582 void foo() {}
8583 void bar() {}
8584 EOM
8585         $cat >try.h <<EOM
8586 LIBTEST_42 {
8587  global:
8588   foo;
8589  local: *;
8590  };
8591 EOM
8592         if $cc $cccdlflags $ccdlflags $ccflags \
8593                $ldflags $lddlflags -o a.out try.c \
8594                -Wl,--version-script=try.h >/dev/null 2>&1 \
8595            &&  $test -s a.out ; then
8596             echo "ld supports scripting" >&4
8597             ld_can_script="$define"
8598         else
8599             echo "ld does not support scripting" >&4
8600         fi
8601         $rm_try
8602         ;;
8603 esac
8604
8605 : Do we want a shared libperl?
8606 also=''
8607 case "$usedl" in
8608 $undef)
8609         # No dynamic loading being used, so don't bother even to prompt.
8610         useshrplib='false'
8611         ;;
8612 *)      case "$useshrplib" in
8613         '')     case "$osname" in
8614                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8615                         dflt=y
8616                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8617                         ;;
8618                 *)      dflt=n
8619                         ;;
8620                 esac
8621                 ;;
8622         $define|true|[Yy]*)
8623                 dflt=y
8624                 ;;
8625         *)      dflt=n
8626                 ;;
8627         esac
8628         $cat << EOM
8629
8630 The perl executable is normally obtained by linking perlmain.c with
8631 libperl${_a}, any static extensions (usually just DynaLoader), and
8632 any other libraries needed on this system (such as -lm, etc.).  Since
8633 your system supports dynamic loading, it is probably possible to build
8634 a shared libperl.$so.  If you will have more than one executable linked
8635 to libperl.$so, this will significantly reduce the size of each
8636 executable, but it may have a noticeable effect on performance.  The
8637 default is probably sensible for your system.
8638 $also
8639
8640 EOM
8641         rp="Build a shared libperl.$so (y/n)"
8642         . ./myread
8643         case "$ans" in
8644         true|$define|[Yy]*)
8645                 useshrplib='true'  ;;
8646         *)      useshrplib='false' ;;
8647         esac
8648         ;;
8649 esac
8650
8651 case "$useshrplib" in
8652 true)
8653         case "$userelocatableinc" in
8654         true|define)
8655                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8656                 echo "See INSTALL for an explanation why that won't work." >&4
8657                 exit 4
8658                 ;;
8659         esac
8660         case "$libperl" in
8661         '')
8662                 # Figure out a good name for libperl.so.  Since it gets stored in
8663                 # a version-specific architecture-dependent library, the version
8664                 # number isn't really that important, except for making cc/ld happy.
8665                 #
8666                 # A name such as libperl.so.10.1
8667                 majmin="libperl.$so.$patchlevel.$subversion"
8668                 # A name such as libperl.so.100
8669                 majonly=`echo $patchlevel $subversion |
8670                         $awk '{printf "%d%02d", $1, $2}'`
8671                 majonly=libperl.$so.$majonly
8672                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8673                 # rely on figuring it out from the naming of libc.
8674                 case "${osname}${osvers}" in
8675                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8676                         dflt=libperl.$so
8677                         ;;
8678                 cygwin*) # ld links now against the dll directly
8679                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8680                         majonly=`echo $patchlevel $subversion |
8681                                 $awk '{printf "%03d%03d", $1, $2}'`
8682                         majonly=cygperl5.$majonly.$so
8683                         dflt=$majmin
8684                         ;;
8685                 *)      # Try to guess based on whether libc has major.minor.
8686                         case "$libc" in
8687                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8688                         *libc.$so.[0-9]*) dflt=$majonly ;;
8689                         *)      dflt=libperl.$so ;;
8690                         esac
8691                         ;;
8692                 esac
8693                 ;;
8694         *)      dflt=$libperl
8695                 ;;
8696         esac
8697         cat << EOM
8698
8699 I need to select a good name for the shared libperl.  If your system uses
8700 library names with major and minor numbers, then you might want something
8701 like $majmin.  Alternatively, if your system uses a single version
8702 number for shared libraries, then you might want to use $majonly.
8703 Or, your system might be quite happy with a simple libperl.$so.
8704
8705 Since the shared libperl will get installed into a version-specific
8706 architecture-dependent directory, the version number of the shared perl
8707 library probably isn't important, so the default should be o.k.
8708
8709 EOM
8710         rp='What name do you want to give to the shared libperl?'
8711         . ./myread
8712         libperl=$ans
8713         echo "Ok, I'll use $libperl"
8714         ;;
8715 *)
8716         libperl="libperl${_a}"
8717         ;;
8718 esac
8719
8720 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8721 case "$shrpdir" in
8722 '') ;;
8723 *)      $cat >&4 <<EOM
8724 WARNING:  Use of the shrpdir variable for the installation location of
8725 the shared $libperl is not supported.  It was never documented and
8726 will not work in this version.  Let me (https://github.com/Perl/perl5/issues)
8727 know of any problems this may cause.
8728
8729 EOM
8730         case "$shrpdir" in
8731         "$archlibexp/CORE")
8732                 $cat >&4 <<EOM
8733 But your current setting of $shrpdir is
8734 the default anyway, so it's harmless.
8735 EOM
8736                 ;;
8737         *)
8738                 $cat >&4 <<EOM
8739 Further, your current attempted setting of $shrpdir
8740 conflicts with the value of $archlibexp/CORE
8741 that installperl will use.
8742 EOM
8743                 ;;
8744         esac
8745         ;;
8746 esac
8747
8748 # How will the perl executable find the installed shared $libperl?
8749 # Add $xxx to ccdlflags.
8750 # If we can't figure out a command-line option, use $shrpenv to
8751 # set env LD_RUN_PATH.  The main perl makefile uses this.
8752 shrpdir=$archlibexp/CORE
8753 xxx=''
8754 tmp_shrpenv=''
8755 if "$useshrplib"; then
8756     case "$osname" in
8757         aix)
8758                 # We'll set it in Makefile.SH...
8759                 ;;
8760         solaris)
8761                 xxx="-R $shrpdir"
8762                 ;;
8763         freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8764                 xxx="-Wl,-R$shrpdir"
8765                 ;;
8766         bsdos|linux|irix*|dec_osf|gnu*|haiku)
8767                 xxx="-Wl,-rpath,$shrpdir"
8768                 ;;
8769         hpux*)
8770                 # hpux doesn't like the default, either.
8771                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8772                 ;;
8773         cygwin)
8774                 # cygwin needs only ldlibpth
8775                 ;;
8776         *)
8777                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8778                 ;;
8779         esac
8780         case "$xxx" in
8781         '') ;;
8782         *)
8783                 # Only add $xxx if it isn't already in ccdlflags.
8784                 case " $ccdlflags " in
8785                 *" $xxx "*)     ;;
8786                 *)      ccdlflags="$ccdlflags $xxx"
8787                         cat <<EOM >&4
8788
8789 Adding $xxx to the flags
8790 passed to $ld so that the perl executable will find the
8791 installed shared $libperl.
8792
8793 EOM
8794                         ;;
8795                 esac
8796                 ;;
8797         esac
8798 fi
8799 # Fix ccdlflags in AIX for building external extensions.
8800 # (For building Perl itself bare -bE:perl.exp is needed,
8801 #  Makefile.SH takes care of this.)
8802 case "$osname" in
8803 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8804 esac
8805 # Respect a hint or command-line value.
8806 case "$shrpenv" in
8807 '') shrpenv="$tmp_shrpenv" ;;
8808 esac
8809 case "$ldlibpthname" in
8810 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8811 none)   ldlibpthname='' ;;
8812 esac
8813
8814 : determine where manual pages are on this system
8815 echo " "
8816 case "$sysman" in
8817 '')
8818         syspath='/usr/share/man/man1 /usr/man/man1'
8819         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8820         syspath="$syspath /usr/man/u_man/man1"
8821         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8822         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8823         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8824         sysman=`./loc . /usr/man/man1 $syspath`
8825         ;;
8826 esac
8827 if $test -d "$sysman"; then
8828         echo "System manual is in $sysman." >&4
8829 else
8830         echo "Could not find manual pages in source form." >&4
8831 fi
8832
8833 : determine where manual pages go
8834 set man1dir man1dir none
8835 eval $prefixit
8836 $cat <<EOM
8837
8838 $spackage has manual pages available in source form.
8839 EOM
8840 case "$nroff" in
8841 nroff)
8842         echo "However, you don't have nroff, so they're probably useless to you."
8843         case "$man1dir" in
8844         '') man1dir="none";;
8845         esac;;
8846 esac
8847 echo "If you don't want the manual sources installed, answer 'none'."
8848 case "$man1dir" in
8849 ' ') dflt=none
8850         ;;
8851 '')
8852         lookpath="$prefixexp/share/man/man1"
8853         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8854         lookpath="$lookpath $prefixexp/man/p_man/man1"
8855         lookpath="$lookpath $prefixexp/man/u_man/man1"
8856         lookpath="$lookpath $prefixexp/man/man.1"
8857         case "$sysman" in
8858         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8859         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8860         esac
8861         set dflt
8862         eval $prefixup
8863         ;;
8864 *)  dflt="$man1dir"
8865         ;;
8866 esac
8867 echo " "
8868 fn=dn+~
8869 rp="Where do the main $spackage manual pages (source) go?"
8870 . ./getfile
8871 if $test "X$man1direxp" != "X$ansexp"; then
8872         installman1dir=''
8873 fi
8874 prefixvar=man1dir
8875 . ./setprefixvar
8876
8877 case "$man1dir" in
8878 '')     man1dir=' '
8879         installman1dir='';;
8880 esac
8881
8882 : What suffix to use on installed man pages
8883
8884 case "$man1dir" in
8885 ' ')
8886         man1ext='0'
8887         ;;
8888 *)
8889         rp="What suffix should be used for the main $spackage man pages?"
8890         case "$man1ext" in
8891         '')     case "$man1dir" in
8892                 *1)  dflt=1 ;;
8893                 *1p) dflt=1p ;;
8894                 *1pm) dflt=1pm ;;
8895                 *l) dflt=l;;
8896                 *n) dflt=n;;
8897                 *o) dflt=o;;
8898                 *p) dflt=p;;
8899                 *C) dflt=C;;
8900                 *L) dflt=L;;
8901                 *L1) dflt=L1;;
8902                 *) dflt=1;;
8903                 esac
8904                 ;;
8905         *)      dflt="$man1ext";;
8906         esac
8907         . ./myread
8908         man1ext="$ans"
8909         ;;
8910 esac
8911
8912 : see if we can have long filenames
8913 echo " "
8914 first=123456789abcdef
8915 $rm -f $first
8916 if (echo hi >$first) 2>/dev/null; then
8917         if $test -f 123456789abcde; then
8918                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8919                 val="$undef"
8920         else
8921                 echo 'You can have filenames longer than 14 characters.'>&4
8922                 val="$define"
8923         fi
8924 else
8925         $cat <<'EOM'
8926 You can't have filenames longer than 14 chars.
8927 You can't even think about them!
8928 EOM
8929         val="$undef"
8930 fi
8931 set d_flexfnam
8932 eval $setvar
8933 $rm -rf 123456789abcde*
8934
8935 : determine where library module manual pages go
8936 set man3dir man3dir none
8937 eval $prefixit
8938 $cat <<EOM
8939
8940 $spackage has manual pages for many of the library modules.
8941 EOM
8942
8943 case "$nroff" in
8944 nroff)
8945         $cat <<'EOM'
8946 However, you don't have nroff, so they're probably useless to you.
8947 EOM
8948         case "$man3dir" in
8949         '') man3dir="none";;
8950         esac;;
8951 esac
8952
8953 case "$d_flexfnam" in
8954 undef)
8955         $cat <<'EOM'
8956 However, your system can't handle the long file names like File::Basename.3.
8957 EOM
8958         case "$man3dir" in
8959         '') man3dir="none";;
8960         esac;;
8961 esac
8962
8963 echo "If you don't want the manual sources installed, answer 'none'."
8964 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8965 case "$man3dir" in
8966 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8967         if $test -d "$privlib/man/man3"; then
8968                 cat <<EOM >&4
8969
8970 WARNING:  Previous versions of perl installed man3 pages into
8971 $privlib/man/man3.  This version will suggest a
8972 new default of $dflt.
8973 EOM
8974                 tdflt=$dflt
8975                 dflt='n'
8976                 rp='Do you wish to preserve the old behavior?(y/n)'
8977                 . ./myread
8978                 case "$ans" in
8979                 y*) dflt="$privlib/man/man3" ;;
8980                 *)  dflt=$tdflt ;;
8981                 esac
8982     fi
8983         ;;
8984 *)      dflt="$man3dir" ;;
8985 esac
8986 case "$dflt" in
8987 ' ') dflt=none ;;
8988 esac
8989 echo " "
8990 fn=dn+~
8991 rp="Where do the $package library man pages (source) go?"
8992 . ./getfile
8993 prefixvar=man3dir
8994 . ./setprefixvar
8995
8996 case "$man3dir" in
8997 '')     man3dir=' '
8998         installman3dir='';;
8999 esac
9000
9001 : What suffix to use on installed man pages
9002 case "$man3dir" in
9003 ' ')
9004         man3ext='0'
9005         ;;
9006 *)
9007         rp="What suffix should be used for the $package library man pages?"
9008         case "$man3ext" in
9009         '')     case "$man3dir" in
9010                 *3)  dflt=3 ;;
9011                 *3p) dflt=3p ;;
9012                 *3pm) dflt=3pm ;;
9013                 *l) dflt=l;;
9014                 *n) dflt=n;;
9015                 *o) dflt=o;;
9016                 *p) dflt=p;;
9017                 *C) dflt=C;;
9018                 *L) dflt=L;;
9019                 *L3) dflt=L3;;
9020                 *) dflt=3;;
9021                 esac
9022                 ;;
9023         *)      dflt="$man3ext";;
9024         esac
9025         . ./myread
9026         man3ext="$ans"
9027         ;;
9028 esac
9029
9030 : see if we have to deal with yellow pages, now NIS.
9031 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9032         case "$hostcat" in
9033         nidump*) ;;
9034         *)
9035                 case "$hostcat" in
9036                 *ypcat*) dflt=y;;
9037                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9038                                 dflt=y
9039                         else
9040                                 dflt=n
9041                         fi;;
9042                 *) dflt=n;;
9043                 esac
9044                 echo " "
9045                 rp='Are you getting the hosts file via yellow pages?'
9046                 . ./myread
9047                 case "$ans" in
9048                 y*) hostcat='ypcat hosts';;
9049                 *) hostcat='cat /etc/hosts';;
9050                 esac
9051                 ;;
9052         esac
9053 fi
9054 case "$hostcat" in
9055 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9056 esac
9057 case "$groupcat" in
9058 '') test -f /etc/group && groupcat='cat /etc/group';;
9059 esac
9060 case "$passcat" in
9061 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9062 esac
9063
9064 : now get the host name
9065 echo " "
9066 echo "Figuring out host name..." >&4
9067 case "$myhostname" in
9068 '') cont=true
9069         echo 'Maybe "hostname" will work...'
9070         if tans=`sh -c hostname 2>&1` ; then
9071                 myhostname=$tans
9072                 phostname=hostname
9073                 cont=''
9074         fi
9075         ;;
9076 *) cont='';;
9077 esac
9078 if $test "$cont"; then
9079         if ./xenix; then
9080                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9081                 if tans=`cat /etc/systemid 2>&1` ; then
9082                         myhostname=$tans
9083                         phostname='cat /etc/systemid'
9084                         echo "Whadyaknow.  Xenix always was a bit strange..."
9085                         cont=''
9086                 fi
9087         elif $test -r /etc/systemid; then
9088                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9089         fi
9090 fi
9091 if $test "$cont"; then
9092         echo 'No, maybe "uuname -l" will work...'
9093         if tans=`sh -c 'uuname -l' 2>&1` ; then
9094                 myhostname=$tans
9095                 phostname='uuname -l'
9096         else
9097                 echo 'Strange.  Maybe "uname -n" will work...'
9098                 if tans=`sh -c 'uname -n' 2>&1` ; then
9099                         myhostname=$tans
9100                         phostname='uname -n'
9101                 else
9102                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9103                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9104                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9105                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9106                         else
9107                                 case "$myhostname" in
9108                                 '') echo "Does this machine have an identity crisis or something?"
9109                                         phostname='';;
9110                                 *)
9111                                         echo "Well, you said $myhostname before..."
9112                                         phostname='echo $myhostname';;
9113                                 esac
9114                         fi
9115                 fi
9116         fi
9117 fi
9118 case "$myhostname" in
9119 '') myhostname=noname ;;
9120 esac
9121 : you do not want to know about this
9122 set $myhostname
9123 myhostname=$1
9124
9125 : verify guess
9126 if $test "$myhostname" ; then
9127         dflt=y
9128         rp='Your host name appears to be "'$myhostname'".'" Right?"
9129         . ./myread
9130         case "$ans" in
9131         y*) ;;
9132         *) myhostname='';;
9133         esac
9134 fi
9135
9136 : bad guess or no guess
9137 while $test "X$myhostname" = X ; do
9138         dflt=''
9139         rp="Please type the (one word) name of your host:"
9140         . ./myread
9141         myhostname="$ans"
9142 done
9143
9144 : translate upper to lower if necessary
9145 case "$myhostname" in
9146 *[A-Z]*)
9147         echo "(Normalizing case in your host name)"
9148         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9149         ;;
9150 esac
9151
9152 case "$myhostname" in
9153 *.*)
9154         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9155         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9156         echo "(Trimming domain name from host name--host name is now $myhostname)"
9157         ;;
9158 *) case "$mydomain" in
9159         '')
9160                 {
9161                         test "X$hostcat" = "Xypcat hosts" &&
9162                         ypmatch "$myhostname" hosts 2>/dev/null |\
9163                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9164                         $test -s hosts
9165                 } || {
9166                         test "X$hostcat" != "X" &&
9167                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9168                                         /[       ]$myhostname[  . ]/p" > hosts
9169                 }
9170                 tmp_re="[       . ]"
9171                 if $test -f hosts; then
9172                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9173                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9174                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9175                                 hosts | $sort | $uniq | \
9176                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9177                         case `$echo X$dflt` in
9178                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9179                                 dflt=.
9180                                 ;;
9181                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9182                                 ;;
9183                         esac
9184                 else
9185                         echo "(I cannot locate a hosts database anywhere)"
9186                         dflt=.
9187                 fi
9188                 case "$dflt" in
9189                 .)
9190                         tans=`./loc resolv.conf X /etc /usr/etc`
9191                         if $test -f "$tans"; then
9192                                 echo "(Attempting domain name extraction from $tans)"
9193                                 dflt=.`$sed -n -e 's/   / /g' \
9194                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9195                                   -e 1q 2>/dev/null`
9196                                 case "$dflt" in
9197                                 .) dflt=.`$sed -n -e 's/        / /g' \
9198                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9199                                      -e 1q 2>/dev/null`
9200                                         ;;
9201                                 esac
9202                         fi
9203                         ;;
9204                 esac
9205                 case "$dflt" in
9206                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9207                         dflt=.`sh -c domainname 2>/dev/null`
9208                         case "$dflt" in
9209                         '') dflt='.';;
9210                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9211                         esac
9212                         ;;
9213                 esac
9214                 case "$dflt$osname" in
9215                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9216                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9217                         ;;
9218                 esac
9219                 case "$dflt" in
9220                 .) echo "(Lost all hope -- silly guess then)"
9221                         dflt='.nonet'
9222                         ;;
9223                 esac
9224                 $rm -f hosts
9225                 ;;
9226         *) dflt="$mydomain";;
9227         esac;;
9228 esac
9229 echo " "
9230 rp="What is your domain name?"
9231 . ./myread
9232 tans="$ans"
9233 case "$ans" in
9234 '') ;;
9235 .*) ;;
9236 *) tans=".$tans";;
9237 esac
9238 mydomain="$tans"
9239
9240 : translate upper to lower if necessary
9241 case "$mydomain" in
9242 *[A-Z]*)
9243         echo "(Normalizing case in your domain name)"
9244         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9245         ;;
9246 esac
9247
9248 : a little sanity check here
9249 case "$phostname" in
9250 '') ;;
9251 *)
9252         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9253         $myhostname$mydomain|$myhostname) ;;
9254         *)
9255                 case "$phostname" in
9256                 sed*)
9257                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9258                         ;;
9259                 *)
9260                         echo "(That doesn't agree with your $phostname command, by the way.)"
9261                         ;;
9262                 esac
9263         ;;
9264         esac
9265         ;;
9266 esac
9267
9268 : determine the e-mail address of the user who is running us
9269 $cat <<EOM
9270
9271 I need to get your e-mail address in Internet format if possible, i.e.
9272 something like user@host.domain. Please answer accurately since I have
9273 no easy means to double check it. The default value provided below
9274 is most probably close to reality but may not be valid from outside
9275 your organization...
9276
9277 EOM
9278 cont=x
9279 while test "$cont"; do
9280         case "$MAILDOMAIN" in
9281         '')
9282                 if $test -s /etc/mailname; then
9283                         maildomain=`$cat /etc/mailname`
9284                 else
9285                         maildomain="$myhostname$mydomain"
9286                 fi
9287                 ;;
9288         *)  maildomain="$MAILDOMAIN";;
9289         esac
9290         case "$cf_email" in
9291         '') dflt="$cf_by@$maildomain";;
9292         *)  dflt="$cf_email";;
9293         esac
9294         rp='What is your e-mail address?'
9295         . ./myread
9296         cf_email="$ans"
9297         case "$cf_email" in
9298         *@*.*) cont='' ;;
9299         *)
9300                 rp='Address does not look like an Internet one.  Use it anyway?'
9301                 case "$fastread" in
9302                 yes) dflt=y ;;
9303                 *) dflt=n ;;
9304                 esac
9305                 . ./myread
9306                 case "$ans" in
9307                 y*) cont='' ;;
9308                 *) echo " " ;;
9309                 esac
9310                 ;;
9311         esac
9312 done
9313
9314 : Ask e-mail of administrator
9315 $cat <<EOM
9316
9317 If you or somebody else will be maintaining perl at your site, please
9318 fill in the correct e-mail address here so that they may be contacted
9319 if necessary. Currently, the "perlbug" program included with perl
9320 will send mail to this address in addition to perlbug@perl.org. You may
9321 enter "none" for no administrator.
9322
9323 EOM
9324 case "$perladmin" in
9325 '') dflt="$cf_email";;
9326 *) dflt="$perladmin";;
9327 esac
9328 rp='Perl administrator e-mail address'
9329 . ./myread
9330 perladmin="$ans"
9331
9332 : determine whether to use a version number suffix for installed binaries
9333 echo " "
9334 $cat <<EOM
9335 Do you want to use a version number suffix for installed binaries? This
9336 will install 'perl$version' instead of 'perl', and likewise for other
9337 binaries like 'perldoc' and 'cpan'. This allows many versions of perl
9338 to be installed side-by-side. Unless you are a developer, you probably
9339 do *not* want to do this.
9340 EOM
9341 case "$versiononly" in
9342 "$define"|[Yy]*|true) dflt='y' ;;
9343 *) dflt='n';
9344 esac
9345 rp="Do you want to use a version number suffix for installed binaries?"
9346 . ./myread
9347 case "$ans" in
9348 [yY]*)  val="$define";;
9349 *)      val="$undef" ;;
9350 esac
9351 set versiononly
9352 eval $setvar
9353
9354 case "$versiononly" in
9355 "$define") inc_version_list=''
9356            inc_version_list_init=0
9357            ;;
9358 esac
9359
9360 : figure out how to guarantee perl startup
9361 : XXX Note that this currently takes advantage of the bug that binexp ignores
9362 :     the Configure -Dinstallprefix setting, which in turn means that under
9363 :     relocatable @INC, initialinstalllocation is what binexp started as.
9364 case "$startperl" in
9365 '')
9366         case "$sharpbang" in
9367         *!)
9368                 $cat <<EOH
9369
9370 I can use the #! construct to start perl on your system. This will
9371 make startup of perl scripts faster, but may cause problems if you
9372 want to share those scripts and perl is not in a standard place
9373 ($initialinstalllocation/perl) on all your platforms. The alternative
9374 is to force a shell by starting the script with a single ':' character.
9375
9376 EOH
9377                 case "$versiononly" in
9378                 "$define")      dflt="$initialinstalllocation/perl$version";;
9379                 *)              dflt="$initialinstalllocation/perl";;
9380                 esac
9381                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9382                 . ./myread
9383                 case "$ans" in
9384                 none)   startperl=": # use perl";;
9385                 *)      startperl="#!$ans"
9386                         if $test 30 -lt `echo "$ans" | wc -c`; then
9387                                 $cat >&4 <<EOM
9388
9389 WARNING:  Some systems limit the #! command to 32 characters.
9390 If you experience difficulty running Perl scripts with #!, try
9391 installing Perl in a directory with a shorter pathname.
9392
9393 EOM
9394                         fi ;;
9395                 esac
9396                 ;;
9397         *) startperl=": # use perl"
9398                 ;;
9399         esac
9400         ;;
9401 esac
9402 echo "I'll use $startperl to start perl scripts."
9403
9404 : figure best path for perl in scripts
9405 case "$perlpath" in
9406 '')
9407         case "$versiononly" in
9408         "$define")      perlpath="$initialinstalllocation/perl$version";;
9409         *)              perlpath="$initialinstalllocation/perl";;
9410         esac
9411         case "$startperl" in
9412         *!*) ;;
9413         *)
9414                 $cat <<EOH
9415
9416 I will use the "eval 'exec'" idiom to start Perl on your system.
9417 I can use the full path of your Perl binary for this purpose, but
9418 doing so may cause problems if you want to share those scripts and
9419 Perl is not always in a standard place ($initialinstalllocation/perl).
9420
9421 EOH
9422                 dflt="$initialinstalllocation/perl"
9423                 rp="What path shall I use in \"eval 'exec'\"?"
9424                 . ./myread
9425                 perlpath="$ans"
9426                 ;;
9427         esac
9428         ;;
9429 esac
9430 case "$startperl" in
9431 *!*)    ;;
9432 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9433 esac
9434
9435 : determine where public executable scripts go
9436 set scriptdir scriptdir
9437 eval $prefixit
9438 case "$scriptdir" in
9439 '')
9440         dflt="$bin"
9441         : guess some guesses
9442         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9443         $test -d /usr/share/bin     && dflt=/usr/share/bin
9444         $test -d /usr/local/script  && dflt=/usr/local/script
9445         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9446         $test -d $prefixexp/script  && dflt=$prefixexp/script
9447         set dflt
9448         eval $prefixup
9449         ;;
9450 *)  dflt="$scriptdir"
9451         ;;
9452 esac
9453 $cat <<EOM
9454
9455 Some installations have a separate directory just for executable scripts so
9456 that they can mount it across multiple architectures but keep the scripts in
9457 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9458 Or you might just lump your scripts in with all your other executables.
9459
9460 EOM
9461 fn=d~
9462 rp='Where do you keep publicly executable scripts?'
9463 . ./getfile
9464 if $test "X$ansexp" != "X$scriptdirexp"; then
9465         installscript=''
9466 fi
9467 installscriptdir=''
9468 prefixvar=scriptdir
9469 . ./setprefixvar
9470 : A little fix up for an irregularly named variable.
9471 installscript="$installscriptdir"
9472
9473 : determine where add-on public executables go
9474 case "$sitebin" in
9475 '')     dflt=$siteprefix/bin ;;
9476 *)      dflt=$sitebin ;;
9477 esac
9478 fn=d~
9479 rp='Pathname where the add-on public executables should be installed?'
9480 . ./getfile
9481 prefixvar=sitebin
9482 . ./setprefixvar
9483
9484 : determine where add-on html pages go
9485 : There is no standard location, so try to copy the previously-selected
9486 : directory structure for the core html pages.
9487 case "$sitehtml1dir" in
9488 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9489 *)     dflt=$sitehtml1dir ;;
9490 esac
9491 case "$dflt" in
9492 ''|' ') dflt=none ;;
9493 esac
9494 fn=dn+~
9495 rp='Pathname where the site-specific html pages should be installed?'
9496 . ./getfile
9497 prefixvar=sitehtml1dir
9498 . ./setprefixvar
9499
9500 : determine where add-on library html pages go
9501 : There is no standard location, so try to copy the previously-selected
9502 : directory structure for the core html pages.
9503 case "$sitehtml3dir" in
9504 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9505 *)     dflt=$sitehtml3dir ;;
9506 esac
9507 case "$dflt" in
9508 ''|' ') dflt=none ;;
9509 esac
9510 fn=dn+~
9511 rp='Pathname where the site-specific library html pages should be installed?'
9512 . ./getfile
9513 prefixvar=sitehtml3dir
9514 . ./setprefixvar
9515
9516 : determine where add-on manual pages go
9517 case "$siteman1dir" in
9518 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9519 *)      dflt=$siteman1dir ;;
9520 esac
9521 case "$dflt" in
9522 ''|' ') dflt=none ;;
9523 esac
9524 fn=dn+~
9525 rp='Pathname where the site-specific manual pages should be installed?'
9526 . ./getfile
9527 prefixvar=siteman1dir
9528 . ./setprefixvar
9529
9530 : determine where add-on library man pages go
9531 case "$siteman3dir" in
9532 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9533 *)      dflt=$siteman3dir ;;
9534 esac
9535 case "$dflt" in
9536 ''|' ') dflt=none ;;
9537 esac
9538 fn=dn+~
9539 rp='Pathname where the site-specific library manual pages should be installed?'
9540 . ./getfile
9541 prefixvar=siteman3dir
9542 . ./setprefixvar
9543
9544 : determine where add-on public executable scripts go
9545 case "$sitescript" in
9546 '')     dflt=$siteprefix/script
9547         $test -d $dflt || dflt=$sitebin ;;
9548 *)  dflt="$sitescript" ;;
9549 esac
9550 fn=d~+
9551 rp='Pathname where add-on public executable scripts should be installed?'
9552 . ./getfile
9553 prefixvar=sitescript
9554 . ./setprefixvar
9555
9556 : see if backtrace exists
9557 set backtrace d_backtrace
9558 eval $inlibc
9559
9560 : Check if C backtrace is actually supported.
9561 case "$usecbacktrace" in
9562   "") usecbacktrace=$undef ;;
9563   [yY]*|true|$define)
9564     case "$d_backtrace" in
9565       [yY]*|true|$define)
9566         ;;
9567       *)
9568         echo "This system does not support backtrace" >&4
9569         usecbacktrace=$undef
9570         ;;
9571       esac
9572     ;;
9573   esac
9574
9575 : Check if faststdio is requested and available
9576 case "$usefaststdio" in
9577 $define|true|[yY]*|'')
9578         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9579         case "$xversion" in
9580         [68])   dflt='y' ;;
9581         *)      dflt='n' ;;
9582         esac
9583         ;;
9584 *) dflt='n';;
9585 esac
9586 cat <<EOM
9587
9588 Perl can be built to use 'fast stdio', which means using the stdio
9589 library but also directly manipulating the stdio buffers to enable
9590 faster I/O.  Using stdio is better for backward compatibility (especially
9591 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9592 interface has been preferred instead of stdio.
9593
9594 If this doesn't make any sense to you, just accept the default '$dflt'.
9595 EOM
9596 rp='Use the "fast stdio" if available?'
9597 . ./myread
9598 case "$ans" in
9599 y|Y)    val="$define" ;;
9600 *)      val="$undef" ;;
9601 esac
9602 set usefaststdio
9603 eval $setvar
9604
9605 : define an is-a-typedef? function
9606 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9607 case "$inclist" in
9608 "") inclist="sys/types.h";;
9609 esac;
9610 eval "varval=\$$var";
9611 case "$varval" in
9612 "")
9613         $rm -f temp.c;
9614         for inc in $inclist; do
9615                 echo "#include <$inc>" >>temp.c;
9616         done;
9617         echo "#ifdef $type" >> temp.c;
9618         echo "printf(\"We have $type\");" >> temp.c;
9619         echo "#endif" >> temp.c;
9620         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9621         if $contains $type temp.E >/dev/null 2>&1; then
9622                 eval "$var=\$type";
9623         else
9624                 eval "$var=\$def";
9625         fi;
9626         $rm -f temp.?;;
9627 *) eval "$var=\$varval";;
9628 esac'
9629
9630 : define an is-a-typedef? function that prompts if the type is not available.
9631 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9632 case "$inclist" in
9633 "") inclist="sys/types.h";;
9634 esac;
9635 eval "varval=\$$var";
9636 case "$varval" in
9637 "")
9638         $rm -f temp.c;
9639         for inc in $inclist; do
9640                 echo "#include <$inc>" >>temp.c;
9641         done;
9642         echo "#ifdef $type" >> temp.c;
9643         echo "printf(\"We have $type\");" >> temp.c;
9644         echo "#endif" >> temp.c;
9645         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9646         echo " " ;
9647         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9648         if $contains $type temp.E >/dev/null 2>&1; then
9649                 echo "$type found." >&4;
9650                 eval "$var=\$type";
9651         else
9652                 echo "$type NOT found." >&4;
9653                 dflt="$def";
9654                 . ./myread ;
9655                 eval "$var=\$ans";
9656         fi;
9657         $rm -f temp.?;;
9658 *) eval "$var=\$varval";;
9659 esac'
9660
9661 : see what type lseek is declared as in the kernel
9662 rp="What is the type used for lseek's offset on this system?"
9663 set off_t lseektype long stdio.h sys/types.h
9664 eval $typedef_ask
9665
9666 echo " "
9667 echo "Checking to see how big your file offsets are..." >&4
9668 $cat >try.c <<EOCP
9669 #include <sys/types.h>
9670 #include <stdio.h>
9671 int main()
9672 {
9673     printf("%d\n", (int)sizeof($lseektype));
9674     return(0);
9675 }
9676 EOCP
9677 set try
9678 if eval $compile_ok; then
9679         lseeksize=`$run ./try`
9680         echo "Your file offsets are $lseeksize bytes long."
9681 else
9682         dflt=$longsize
9683         echo " "
9684         echo "(I can't seem to compile the test program.  Guessing...)"
9685         rp="What is the size of your file offsets (in bytes)?"
9686         . ./myread
9687         lseeksize="$ans"
9688 fi
9689 $rm_try
9690
9691 : see what type file positions are declared as in the library
9692 rp="What is the type for file position used by fsetpos()?"
9693 set fpos_t fpostype long stdio.h sys/types.h
9694 eval $typedef_ask
9695
9696 : Check size for Fpos_t
9697 echo " "
9698 case "$fpostype" in
9699 *_t) zzz="$fpostype"    ;;
9700 *)   zzz="fpos_t"       ;;
9701 esac
9702 echo "Checking the size of $zzz..." >&4
9703 cat > try.c <<EOCP
9704 #include <sys/types.h>
9705 #include <stdio.h>
9706 #$i_stdlib I_STDLIB
9707 #ifdef I_STDLIB
9708 #include <stdlib.h>
9709 #endif
9710 int main() {
9711     printf("%d\n", (int)sizeof($fpostype));
9712     exit(0);
9713 }
9714 EOCP
9715 set try
9716 if eval $compile_ok; then
9717         yyy=`$run ./try`
9718         case "$yyy" in
9719         '')     fpossize=4
9720                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9721                 ;;
9722         *)      fpossize=$yyy
9723                 echo "Your $zzz is $fpossize bytes long."
9724                 ;;
9725         esac
9726 else
9727         dflt="$longsize"
9728         echo " " >&4
9729         echo "(I can't compile the test program.  Guessing...)" >&4
9730         rp="What is the size of your file positions (in bytes)?"
9731         . ./myread
9732         fpossize="$ans"
9733 fi
9734
9735 : Check for large file support
9736 # Backward compatibility (uselfs is deprecated).
9737 case "$uselfs" in
9738 "$define"|true|[yY]*)
9739         cat <<EOM >&4
9740
9741 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9742 EOM
9743         uselargefiles="$define"
9744         ;;
9745 esac
9746
9747 case "$lseeksize:$fpossize" in
9748 8:8) cat <<EOM
9749
9750 You can have files larger than 2 gigabytes.
9751 EOM
9752    val="$define" ;;
9753 *)    case "$uselargefiles" in
9754    "$undef"|false|[nN]*) dflt='n' ;;
9755    *)   dflt='y' ;;
9756    esac
9757    cat <<EOM
9758
9759 Perl can be built to understand large files (files larger than 2 gigabytes)
9760 on some systems.  To do so, Configure can be run with -Duselargefiles.
9761
9762 If this doesn't make any sense to you, just accept the default '$dflt'.
9763 EOM
9764    rp='Try to understand large files, if available?'
9765    . ./myread
9766    case "$ans" in
9767    y|Y) val="$define" ;;
9768    *)   val="$undef"  ;;
9769    esac
9770    ;;
9771 esac
9772 set uselargefiles
9773 eval $setvar
9774 : Look for a hint-file generated 'call-back-unit'.  If the
9775 : user has specified that a large files perl is to be built,
9776 : we may need to set or change some other defaults.
9777 if $test -f uselargefiles.cbu; then
9778         echo "Your platform has some specific hints regarding large file builds, using them..."
9779         . ./uselargefiles.cbu
9780 fi
9781 case "$uselargefiles" in
9782 "$define")
9783         if $test -f uselargefiles.cbu; then
9784                 echo " "
9785                 echo "Rechecking to see how big your file offsets are..." >&4
9786                 $cat >try.c <<EOCP
9787 #include <sys/types.h>
9788 #include <stdio.h>
9789 int main()
9790 {
9791     printf("%d\n", (int)sizeof($lseektype));
9792     return(0);
9793 }
9794 EOCP
9795                 set try
9796                 if eval $compile_ok; then
9797                         lseeksize=`$run ./try`
9798                         $echo "Your file offsets are now $lseeksize bytes long."
9799                 else
9800                         dflt="$lseeksize"
9801                         echo " "
9802                         echo "(I can't seem to compile the test program.  Guessing...)"
9803                         rp="What is the size of your file offsets (in bytes)?"
9804                         . ./myread
9805                         lseeksize="$ans"
9806                 fi
9807                 case "$fpostype" in
9808                 *_t) zzz="$fpostype"    ;;
9809                 *)   zzz="fpos_t"       ;;
9810                 esac
9811                 $echo $n "Rechecking the size of $zzz...$c" >&4
9812                 $cat > try.c <<EOCP
9813 #include <sys/types.h>
9814 #include <stdio.h>
9815 #$i_stdlib I_STDLIB
9816 #ifdef I_STDLIB
9817 #include <stdlib.h>
9818 #endif
9819 int main() {
9820     printf("%d\n", (int)sizeof($fpostype));
9821     return(0);
9822 }
9823 EOCP
9824                 set try
9825                 if eval $compile_ok; then
9826                         yyy=`$run ./try`
9827                         dflt="$lseeksize"
9828                         case "$yyy" in
9829                         '')     echo " "
9830                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9831                                 ;;
9832                         *)      fpossize=$yyy
9833                                 echo " $fpossize bytes." >&4
9834                                 ;;
9835                         esac
9836                 else
9837                         dflt="$fpossize"
9838                         echo " "
9839                         echo "(I can't compile the test program.  Guessing...)" >&4
9840                         rp="What is the size of your file positions (in bytes)?"
9841                         . ./myread
9842                         fpossize="$ans"
9843                 fi
9844                 $rm_try
9845         fi
9846         ;;
9847 esac
9848
9849 : Check if we want perlio
9850 useperlio="$define"
9851
9852 : Set the vendorbin variables
9853 case "$vendorprefix" in
9854 '')     d_vendorbin="$undef"
9855         vendorbin=''
9856         vendorbinexp=''
9857         ;;
9858 *)      d_vendorbin="$define"
9859         : determine where vendor-supplied executables go.
9860         case "$vendorbin" in
9861         '') dflt=$vendorprefix/bin ;;
9862         *)      dflt="$vendorbin" ;;
9863         esac
9864         fn=d~+
9865         rp='Pathname for the vendor-supplied executables directory?'
9866         . ./getfile
9867         vendorbin="$ans"
9868         vendorbinexp="$ansexp"
9869         ;;
9870 esac
9871 prefixvar=vendorbin
9872 . ./installprefix
9873
9874 : Set the vendorhtml1dir variables
9875 case "$vendorprefix" in
9876 '')     vendorhtml1dir=''
9877         vendorhtml1direxp=''
9878         ;;
9879 *)      : determine where vendor-supplied html pages go.
9880         : There is no standard location, so try to copy the previously-selected
9881         : directory structure for the core html pages.
9882         : XXX Better default suggestions would be welcome.
9883         case "$vendorhtml1dir" in
9884         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9885         *)      dflt=$vendorhtml1dir ;;
9886         esac
9887         case "$dflt" in
9888         ''|' ') dflt=none ;;
9889         esac
9890         fn=dn+~
9891         rp='Pathname for the vendor-supplied html pages?'
9892         . ./getfile
9893         vendorhtml1dir="$ans"
9894         vendorhtml1direxp="$ansexp"
9895         ;;
9896 esac
9897 : Use ' ' for none so value is preserved next time through Configure
9898 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9899 prefixvar=vendorhtml1dir
9900 . ./installprefix
9901
9902 : Set the vendorhtml3dir variables
9903 case "$vendorprefix" in
9904 '')     vendorhtml3dir=''
9905         vendorhtml3direxp=''
9906         ;;
9907 *)      : determine where vendor-supplied module html pages go.
9908         : There is no standard location, so try to copy the previously-selected
9909         : directory structure for the core html pages.
9910         : XXX Better default suggestions would be welcome.
9911         case "$vendorhtml3dir" in
9912         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9913         *)      dflt=$vendorhtml3dir ;;
9914         esac
9915         case "$dflt" in
9916         ''|' ') dflt=none ;;
9917         esac
9918         fn=dn+~
9919         rp='Pathname for the vendor-supplied html pages?'
9920         . ./getfile
9921         vendorhtml3dir="$ans"
9922         vendorhtml3direxp="$ansexp"
9923         ;;
9924 esac
9925 : Use ' ' for none so value is preserved next time through Configure
9926 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9927 prefixvar=vendorhtml3dir
9928 . ./installprefix
9929
9930 : Set the vendorman1dir variables
9931 case "$vendorprefix" in
9932 '')     vendorman1dir=''
9933         vendorman1direxp=''
9934         ;;
9935 *)      : determine where vendor-supplied manual pages go.
9936         case "$vendorman1dir" in
9937         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9938         *)      dflt=$vendorman1dir ;;
9939         esac
9940         case "$dflt" in
9941         ''|' ') dflt=none ;;
9942         esac
9943         fn=nd~+
9944         rp='Pathname for the vendor-supplied manual section 1 pages?'
9945         . ./getfile
9946         vendorman1dir="$ans"
9947         vendorman1direxp="$ansexp"
9948         ;;
9949 esac
9950 : Use ' ' for none so value is preserved next time through Configure
9951 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9952 prefixvar=vendorman1dir
9953 . ./installprefix
9954
9955 : Set the vendorman3dir variables
9956 case "$vendorprefix" in
9957 '')     vendorman3dir=''
9958         vendorman3direxp=''
9959         ;;
9960 *)      : determine where vendor-supplied module manual pages go.
9961         case "$vendorman3dir" in
9962         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9963         *)      dflt=$vendorman3dir ;;
9964         esac
9965         case "$dflt" in
9966         ''|' ') dflt=none ;;
9967         esac
9968         fn=nd~+
9969         rp='Pathname for the vendor-supplied manual section 3 pages?'
9970         . ./getfile
9971         vendorman3dir="$ans"
9972         vendorman3direxp="$ansexp"
9973         ;;
9974 esac
9975 : Use ' ' for none so value is preserved next time through Configure
9976 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9977 prefixvar=vendorman3dir
9978 . ./installprefix
9979
9980 : Set the vendorscript variables
9981 case "$vendorprefix" in
9982 '')     d_vendorscript="$undef"
9983         vendorscript=''
9984         vendorscriptexp=''
9985         ;;
9986 *)      d_vendorscript="$define"
9987         : determine where vendor-supplied scripts go.
9988         case "$vendorscript" in
9989         '')     dflt=$vendorprefix/script
9990                 $test -d $dflt || dflt=$vendorbin ;;
9991         *)  dflt="$vendorscript" ;;
9992         esac
9993         $cat <<EOM
9994
9995 The installation process will create a directory for
9996 vendor-supplied scripts.
9997
9998 EOM
9999         fn=d~+
10000         rp='Pathname for the vendor-supplied scripts directory?'
10001         . ./getfile
10002         vendorscript="$ans"
10003         vendorscriptexp="$ansexp"
10004         ;;
10005 esac
10006 prefixvar=vendorscript
10007 . ./installprefix
10008
10009 : see if qgcvt exists
10010 set qgcvt d_qgcvt
10011 eval $inlibc
10012
10013 : Check what kind of doubles your system has
10014 $echo "Checking the kind of doubles you have..." >&4
10015 $cat >try.c <<EOP
10016 #$i_stdlib I_STDLIB
10017 #define DOUBLESIZE $doublesize
10018 #ifdef I_STDLIB
10019 #include <stdlib.h>
10020 #endif
10021 #include <stdio.h>
10022 static const double d = -0.1;
10023 int main() {
10024   unsigned const char* b = (unsigned const char*)(&d);
10025 #if DOUBLESIZE == 4
10026   if (b[0] == 0xCD && b[3] == 0xBD) {
10027     /* IEEE 754 32-bit little-endian */
10028     printf("1\n");
10029     exit(0);
10030   }
10031   if (b[0] == 0xBD && b[3] == 0xCD) {
10032     /* IEEE 754 32-bit big-endian */
10033     printf("2\n");
10034     exit(0);
10035   }
10036   if (b[0] == 0xCC && b[3] == 0xCC) {
10037     /* VAX format F, 32-bit PDP-style mixed endian. */
10038     printf("9\n");
10039     exit(0);
10040   }
10041   if (b[0] == 0xC0 && b[3] == 0x9A) {
10042     /* IBM single 32-bit */
10043     printf("12\n");
10044     exit(0);
10045   }
10046 #endif
10047 #if DOUBLESIZE == 8
10048   if (b[0] == 0x9A && b[7] == 0xBF) {
10049     /* IEEE 754 64-bit little-endian */
10050     printf("3\n");
10051     exit(0);
10052   }
10053   if (b[0] == 0xBF && b[7] == 0x9A) {
10054     /* IEEE 754 64-bit big-endian */
10055     printf("4\n");
10056     exit(0);
10057   }
10058   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10059    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10060     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10061     * 99 99 b9 bf 9a 99 99 99 */
10062     printf("7\n");
10063     exit(0);
10064   }
10065   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10066    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10067     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10068     * 99 99 99 9a bf b9 99 99 */
10069     printf("8\n");
10070     exit(0);
10071   }
10072   if (b[0] == 0xCC && b[7] == 0xCC) {
10073    /* VAX format D, 64-bit PDP-style mixed endian. */
10074     printf("10\n");
10075     exit(0);
10076   }
10077   if (b[0] == 0xD9 && b[7] == 0x99) {
10078    /* VAX format G, 64-bit PDP-style mixed endian. */
10079     printf("11\n");
10080     exit(0);
10081   }
10082   if (b[0] == 0xC0 && b[7] == 0x9A) {
10083     /* IBM double 64-bit */
10084     printf("13\n");
10085     exit(0);
10086   }
10087   if (b[0] == 0xBF && b[7] == 0xCD) {
10088     /* CRAY single 64-bit */
10089     printf("14\n");
10090     exit(0);
10091   }
10092 #endif
10093 #if DOUBLESIZE == 16
10094   if (b[0] == 0x9A && b[15] == 0xBF) {
10095     /* IEEE 754 128-bit little-endian */
10096     printf("5\n");
10097     exit(0);
10098   }
10099   if (b[0] == 0xBF && b[15] == 0x9A) {
10100     /* IEEE 754 128-bit big-endian */
10101     printf("6\n");
10102     exit(0);
10103   }
10104 #endif
10105   /* Then there are old mainframe/miniframe formats like IBM and CRAY.
10106    * Whether those environments can still build Perl is debatable. */
10107   printf("-1\n"); /* unknown */
10108   exit(0);
10109 }
10110 EOP
10111 set try
10112 if eval $compile; then
10113     doublekind=`$run ./try`
10114 else
10115     doublekind=-1
10116 fi
10117 case "$doublekind" in
10118 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10119 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10120 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10121 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10122 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10123 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10124 7) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit LEs in BE)." >&4 ;;
10125 8) echo "You have IEEE 754 64-bit mixed endian doubles (32-bit BEs in LE)." >&4 ;;
10126 9) echo "You have VAX format F 32-bit PDP-style mixed endian doubles." >&4 ;;
10127 10) echo "You have VAX format D 64-bit PDP-style mixed endian doubles." >&4 ;;
10128 11) echo "You have VAX format G 64-bit PDP-style mixed endian doubles." >&4 ;;
10129 12) echo "You have IBM short 32-bit doubles." >&4 ;;
10130 13) echo "You have IBM long 64-bit doubles." >&4 ;;
10131 14) echo "You have Cray single 64-bit doubles." >&4 ;;
10132 *) echo "Cannot figure out your double.  You Cyber, or something?" >&4 ;;
10133 esac
10134 d_double_style_ieee=$undef
10135 d_double_style_vax=$undef
10136 d_double_style_ibm=$undef
10137 d_double_style_cray=$undef
10138 case "$doublekind" in
10139 1|2|3|4|5|6|7|8) d_double_style_ieee=$define ;;
10140 9|10|11) d_double_style_vax=$define ;;
10141 12|13) d_double_style_ibm=$define ;;
10142 14) d_double_style_cray=$define ;;
10143 esac
10144 case "$d_double_style_ieee" in
10145 $define)
10146     d_double_has_inf=$define
10147     d_double_has_nan=$define
10148     d_double_has_negative_zero=$define
10149     d_double_has_subnormals=$define
10150     ;;
10151 *)
10152     d_double_has_inf=$undef
10153     d_double_has_nan=$undef
10154     d_double_has_negative_zero=$undef
10155     d_double_has_subnormals=$undef
10156     ;;
10157 esac
10158 $rm_try
10159
10160 : Check print/scan long double stuff
10161 echo " "
10162
10163 if $test X"$d_longdbl" = X"$define"; then
10164
10165 echo "Checking how to print long doubles..." >&4
10166
10167 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10168         $cat >try.c <<'EOCP'
10169 #include <sys/types.h>
10170 #include <stdio.h>
10171 int main() {
10172   double d = 123.456;
10173   printf("%.3f\n", d);
10174 }
10175 EOCP
10176         set try
10177         if eval $compile; then
10178                 yyy=`$run ./try`
10179                 case "$yyy" in
10180                 123.456)
10181                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10182                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10183                         echo "We will use %f."
10184                         ;;
10185                 esac
10186         fi
10187 fi
10188
10189 if $test X"$sPRIfldbl" = X; then
10190         $cat >try.c <<'EOCP'
10191 #include <sys/types.h>
10192 #include <stdio.h>
10193 int main() {
10194   long double d = 123.456;
10195   printf("%.3Lf\n", d);
10196 }
10197 EOCP
10198         set try
10199         if eval $compile; then
10200                 yyy=`$run ./try`
10201                 case "$yyy" in
10202                 123.456)
10203                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10204                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10205                         echo "We will use %Lf."
10206                         ;;
10207                 esac
10208         fi
10209 fi
10210
10211 if $test X"$sPRIfldbl" = X; then
10212         $cat >try.c <<'EOCP'
10213 #include <sys/types.h>
10214 #include <stdio.h>
10215 int main() {
10216   long double d = 123.456;
10217   printf("%.3llf\n", d);
10218 }
10219 EOCP
10220         set try
10221         if eval $compile; then
10222                 yyy=`$run ./try`
10223                 case "$yyy" in
10224                 123.456)
10225                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10226                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10227                         echo "We will use %llf."
10228                         ;;
10229                 esac
10230         fi
10231 fi
10232
10233 if $test X"$sPRIfldbl" = X; then
10234         $cat >try.c <<'EOCP'
10235 #include <sys/types.h>
10236 #include <stdio.h>
10237 int main() {
10238   long double d = 123.456;
10239   printf("%.3lf\n", d);
10240 }
10241 EOCP
10242         set try
10243         if eval $compile; then
10244                 yyy=`$run ./try`
10245                 case "$yyy" in
10246                 123.456)
10247                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10248                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10249                         echo "We will use %lf."
10250                         ;;
10251                 esac
10252         fi
10253 fi
10254
10255 if $test X"$sPRIfldbl" = X; then
10256         echo "Cannot figure out how to print long doubles." >&4
10257 else
10258         sSCNfldbl=$sPRIfldbl    # expect consistency
10259 fi
10260
10261 $rm_try
10262
10263 fi # d_longdbl
10264
10265 case "$sPRIfldbl" in
10266 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10267         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10268         d_SCNfldbl="$undef";
10269         ;;
10270 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10271         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10272         d_SCNfldbl="$define";
10273         ;;
10274 esac
10275
10276 : Before committing on uselongdouble, see whether that looks sane.
10277 if $test "$uselongdouble" = "$define"; then
10278     message=""
10279     echo " "
10280     echo "Checking if your long double math functions work right..." >&4
10281     $cat > try.c <<EOF
10282 #include <math.h>
10283 #include <stdio.h>
10284 int main() {
10285   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10286 }
10287 EOF
10288     case "$osname:$gccversion" in
10289     aix:)       saveccflags="$ccflags"
10290                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10291     esac
10292     set try
10293     if eval $compile_ok; then
10294       yyy=`$run ./try`
10295     fi
10296     case "$yyy" in
10297     3) echo "Your long double math functions are working correctly." >&4 ;;
10298     *) echo "Your long double math functions are broken, not using long doubles." >&4
10299        uselongdouble=$undef
10300        ;;
10301     esac
10302     $rm_try
10303     case "$osname:$gccversion" in
10304     aix:)       ccflags="$saveccflags" ;; # restore
10305     esac
10306 fi
10307
10308 : Check how to convert floats to strings.
10309
10310 if test "X$d_Gconvert" = X; then
10311
10312 echo " "
10313 echo "Checking for an efficient way to convert floats to strings."
10314 echo " " > try.c
10315 case "$uselongdouble" in
10316 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10317 esac
10318 case "$d_longdbl" in
10319 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10320 esac
10321 case "$d_PRIgldbl" in
10322 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10323 esac
10324 $cat >>try.c <<EOP
10325 #ifdef TRY_gconvert
10326 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10327 const char *myname = "gconvert";
10328 #endif
10329 #ifdef TRY_gcvt
10330 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10331 const char *myname = "gcvt";
10332 #endif
10333 #ifdef TRY_qgcvt
10334 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10335 const char *myname = "qgcvt";
10336 #define DOUBLETYPE long double
10337 #endif
10338 #ifdef TRY_sprintf
10339 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10340 #ifdef HAS_PRIgldbl
10341 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10342 #else
10343 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10344 #endif
10345 #else
10346 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10347 #endif
10348 const char *myname = "sprintf";
10349 #endif
10350
10351 #ifndef DOUBLETYPE
10352 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10353 #define DOUBLETYPE long double
10354 #else
10355 #define DOUBLETYPE double
10356 #endif
10357 #endif
10358
10359 #include <stdio.h>
10360
10361 #$i_stdlib I_STDLIB
10362 #ifdef I_STDLIB
10363 #include <stdlib.h>
10364 #endif
10365 #include <string.h>
10366
10367 void checkit(const char *expect, char *got)
10368 {
10369     if (strcmp(expect, got)) {
10370                 printf("%s oddity:  Expected %s, got %s\n",
10371                         myname, expect, got);
10372                 exit(1);
10373         }
10374 }
10375
10376 int main()
10377 {
10378         char buf[64];
10379         buf[63] = '\0';
10380
10381         /* This must be 1st test on (which?) platform */
10382         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10383         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10384         checkit("0.1", buf);
10385
10386         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10387         checkit("0.01", buf);
10388
10389         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10390         checkit("0.001", buf);
10391
10392         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10393         checkit("0.0001", buf);
10394
10395         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10396         if (strlen(buf) > 5)
10397             checkit("9e-005", buf); /* for Microsoft ?? */
10398         else
10399             checkit("9e-05", buf);
10400
10401         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10402         checkit("1", buf);
10403
10404         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10405         checkit("1.1", buf);
10406
10407         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10408         checkit("1.01", buf);
10409
10410         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10411         checkit("1.001", buf);
10412
10413         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10414         checkit("1.0001", buf);
10415
10416         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10417         checkit("1.00001", buf);
10418
10419         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10420         checkit("1.000001", buf);
10421
10422         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10423         checkit("0", buf);
10424
10425         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10426         checkit("-1", buf);
10427
10428         /* Some Linux gcvt's give 1.e+5 here. */
10429         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10430         checkit("100000", buf);
10431
10432         /* Some Linux gcvt's give -1.e+5 here. */
10433         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10434         checkit("-100000", buf);
10435
10436         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10437         checkit("123.456", buf);
10438
10439         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10440         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10441         /* 34 should be enough to scare even long double
10442          * places into using the e notation. */
10443         if (strlen(buf) > 5)
10444             checkit("1e+034", buf); /* for Microsoft */
10445         else
10446             checkit("1e+34", buf);
10447
10448         /* For Perl, if you add additional tests here, also add them to
10449          * t/base/num.t for benefit of platforms not using Configure or
10450          * overriding d_Gconvert */
10451
10452         exit(0);
10453 }
10454 EOP
10455 : first add preferred functions to our list
10456 xxx_list=""
10457 for xxx_convert in $gconvert_preference; do
10458     case $xxx_convert in
10459     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10460     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10461     esac
10462 done
10463 : then add any others
10464 for xxx_convert in gconvert gcvt sprintf; do
10465     case "$xxx_list" in
10466     *$xxx_convert*) ;;
10467     *) xxx_list="$xxx_list $xxx_convert" ;;
10468     esac
10469 done
10470
10471 case "$d_longdbl$uselongdouble" in
10472 "$define$define")
10473     : again, add preferred functions to our list first
10474     xxx_ld_list=""
10475     for xxx_convert in $gconvert_ld_preference; do
10476         case $xxx_convert in
10477         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10478         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10479         esac
10480     done
10481     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10482     for xxx_convert in qgcvt sprintf $xxx_list; do
10483         case "$xxx_ld_list" in
10484         $xxx_convert*|*" $xxx_convert"*) ;;
10485         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10486         esac
10487     done
10488     : if sprintf cannot do long doubles, move it to the end
10489     if test "$d_PRIgldbl" != "$define"; then
10490         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10491     fi
10492     : if no qgcvt, remove it
10493     if test "$d_qgcvt" != "$define"; then
10494         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10495     fi
10496     : use the ld_list
10497     xxx_list="$xxx_ld_list"
10498     ;;
10499 esac
10500
10501 for xxx_convert in $xxx_list; do
10502         echo "Trying $xxx_convert..."
10503         $rm -f try try$_o core
10504         set try -DTRY_$xxx_convert
10505         if eval $compile; then
10506                 echo "$xxx_convert() found." >&4
10507                 if $run ./try; then
10508                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10509                         break;
10510                 else
10511                         echo "...But $xxx_convert didn't work as I expected."
10512                         xxx_convert=''
10513                 fi
10514         else
10515                 echo "$xxx_convert NOT found." >&4
10516                 xxx_convert=''
10517         fi
10518 done
10519
10520 if test X$xxx_convert = X; then
10521     echo "*** WHOA THERE!!! ***" >&4
10522     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10523     xxx_convert=sprintf
10524 fi
10525
10526 case "$xxx_convert" in
10527 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10528 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10529 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10530 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10531    "$define$define$define")
10532       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10533    "$define$define$undef")
10534       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10535    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10536    esac
10537    ;;
10538 esac
10539
10540 fi
10541 $rm_try
10542
10543 : see if _fwalk exists
10544 set fwalk d__fwalk
10545 eval $inlibc
10546
10547 : see if accept4 exists
10548 set accept4 d_accept4
10549 eval $inlibc
10550
10551 : Initialize h_fcntl
10552 h_fcntl=false
10553
10554 : Initialize h_sysfile
10555 h_sysfile=false
10556
10557 : access call always available on UNIX
10558 set access d_access
10559 eval $inlibc
10560
10561 : locate the flags for 'access()'
10562 case "$d_access" in
10563 "$define")
10564         echo " "
10565         $cat >access.c <<EOCP
10566 #include <sys/types.h>
10567 #ifdef I_FCNTL
10568 #include <fcntl.h>
10569 #endif
10570 #ifdef I_SYS_FILE
10571 #include <sys/file.h>
10572 #endif
10573 #ifdef I_UNISTD
10574 #include <unistd.h>
10575 #endif
10576 #$i_stdlib I_STDLIB
10577 #ifdef I_STDLIB
10578 #include <stdlib.h>
10579 #endif
10580 int main() {
10581         exit(R_OK);
10582 }
10583 EOCP
10584         : check sys/file.h first, no particular reason here
10585         if $test `./findhdr sys/file.h` && \
10586                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10587                 h_sysfile=true;
10588                 echo "<sys/file.h> defines the *_OK access constants." >&4
10589         elif $test `./findhdr fcntl.h` && \
10590                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10591                 h_fcntl=true;
10592                 echo "<fcntl.h> defines the *_OK access constants." >&4
10593         elif $test `./findhdr unistd.h` && \
10594                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10595                 echo "<unistd.h> defines the *_OK access constants." >&4
10596         else
10597                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10598         fi
10599         ;;
10600 esac
10601 $rm -f access*
10602
10603 : see if accessx exists
10604 set accessx d_accessx
10605 eval $inlibc
10606
10607 : see if acosh exists
10608 set acosh d_acosh
10609 eval $inlibc
10610
10611 : see if aintl exists
10612 set aintl d_aintl
10613 eval $inlibc
10614
10615 : see if alarm exists
10616 set alarm d_alarm
10617 eval $inlibc
10618
10619 : see if 64bit time functions exists
10620
10621 set ctime64 d_ctime64
10622 eval $inlibc
10623
10624 set localtime64 d_localtime64
10625 eval $inlibc
10626
10627 set gmtime64 d_gmtime64
10628 eval $inlibc
10629
10630 set mktime64 d_mktime64
10631 eval $inlibc
10632
10633 set difftime64 d_difftime64
10634 eval $inlibc
10635
10636 set asctime64 d_asctime64
10637 eval $inlibc
10638
10639 : see if POSIX threads are available
10640 set pthread.h i_pthread
10641 eval $inhdr
10642
10643 : define a function to check prototypes
10644 $cat > protochk <<EOSH
10645 $startsh
10646 cc="$cc"
10647 optimize="$optimize"
10648 ccflags="$ccflags"
10649 define="$define"
10650 rm_try="$rm_try"
10651 usethreads=$usethreads
10652 i_pthread=$i_pthread
10653 pthread_h_first=$pthread_h_first
10654 EOSH
10655
10656 $cat >> protochk <<'EOSH'
10657
10658 $rm_try
10659 foo="$1"
10660 shift
10661 while test $# -ge 2; do
10662         case "$1" in
10663                 $define) echo "#include <$2>" >> try.c ;;
10664                 literal) echo "$2" >> try.c ;;
10665         esac
10666     # Extra magic for the benefit of systems that need pthread.h
10667     # to be included early to correctly detect threadsafe functions.
10668     # Such functions must guarantee themselves, though, that the usethreads
10669     # and i_pthread have been defined, before calling protochk.
10670     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10671         echo "#include <pthread.h>" >> try.c
10672         pthread_h_done=yes
10673     fi
10674     shift 2
10675 done
10676 cat >> try.c <<'EOCP'
10677 #define _(args) args
10678 EOCP
10679 echo "$foo" >> try.c
10680 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10681 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10682 status=$?
10683 $rm_try
10684 exit $status
10685 EOSH
10686 chmod +x protochk
10687 $eunicefix protochk
10688
10689 : Define hasproto macro for Configure internal use
10690 hasproto='varname=$1; func=$2; shift; shift;
10691 while $test $# -ge 2; do
10692         case "$1" in
10693         $define) echo "#include <$2>";;
10694         literal) echo "$2" ;;
10695         esac ;
10696     shift 2;
10697 done > try.c;
10698 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10699 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10700         echo "$func() prototype found.";
10701         val="$define";
10702 else
10703         echo "$func() prototype NOT found.";
10704         val="$undef";
10705 fi;
10706 set $varname;
10707 eval $setvar;
10708 $rm_try tryout.c'
10709
10710 : see if sys/types.h has to be included
10711 set sys/types.h i_systypes
10712 eval $inhdr
10713
10714 : see if sys/select.h has to be included
10715 set sys/select.h i_sysselct
10716 eval $inhdr
10717
10718 : Define hasfield macro for Configure internal use
10719 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10720 while $test $# -ge 2; do
10721         case "$1" in
10722         $define) echo "#include <$2>";;
10723         esac ;
10724     shift 2;
10725 done > try.c;
10726 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10727 set try;
10728 if eval $compile; then
10729         val="$define";
10730 else
10731         val="$undef";
10732 fi;
10733 set $varname;
10734 eval $setvar;
10735 $rm_try'
10736
10737 : see if we should include sys/time.h
10738 echo " "
10739 i_time='define'
10740 if test "X$timeincl" = X; then
10741         echo "Testing to see if we should include <sys/time.h>." >&4
10742         $echo $n "I'm now running the test program...$c"
10743         $cat >try.c <<EOCP
10744 #include <sys/types.h>
10745 #include <time.h>
10746 #ifdef I_SYSTIME
10747 #ifdef SYSTIMEKERNEL
10748 #define KERNEL
10749 #endif
10750 #include <sys/time.h>
10751 #endif
10752 #ifdef I_SYSSELECT
10753 #include <sys/select.h>
10754 #endif
10755 #$i_stdlib I_STDLIB
10756 #ifdef I_STDLIB
10757 #include <stdlib.h>
10758 #endif
10759 int main()
10760 {
10761         struct tm foo;
10762 #ifdef S_TIMEVAL
10763         struct timeval bar;
10764 #endif
10765 #ifdef S_TIMEZONE
10766         struct timezone tzp;
10767 #endif
10768         if (foo.tm_sec == foo.tm_sec)
10769                 exit(0);
10770 #ifdef S_TIMEVAL
10771         if (bar.tv_sec == bar.tv_sec)
10772                 exit(0);
10773 #endif
10774         exit(1);
10775 }
10776 EOCP
10777         flags=''
10778         for s_timezone in '-DS_TIMEZONE' ''; do
10779         sysselect=''
10780         for s_timeval in '-DS_TIMEVAL' ''; do
10781         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10782         for i_systime in '-DI_SYSTIME' ''; do
10783                 case "$flags" in
10784                 '') $echo $n ".$c"
10785                         set try $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10786                         if eval $compile; then
10787                                 set X $i_systime $i_systimek $sysselect $s_timeval
10788                                 shift
10789                                 flags="$*"
10790                                 echo " "
10791                                 $echo $n "Succeeded with $flags$c"
10792                         fi
10793                         ;;
10794                 esac
10795         done
10796         done
10797         done
10798         done
10799         timeincl=''
10800         echo " "
10801         case "$flags" in
10802         *SYSTIMEKERNEL*) i_systimek="$define"
10803                 timeincl=`./findhdr sys/time.h`
10804                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10805         *) i_systimek="$undef";;
10806         esac
10807         case "$flags" in
10808         *I_SYSTIME*) i_systime="$define"
10809                 timeincl=`./findhdr sys/time.h`" $timeincl"
10810                 echo "We'll include <sys/time.h>." >&4;;
10811         *) i_systime="$undef";;
10812         esac
10813         $rm_try
10814 fi
10815 : see if struct tm knows about tm_zone
10816 case "$i_systime$i_time" in
10817 *$define*)
10818         echo " "
10819         echo "Checking to see if your struct tm has tm_zone field..." >&4
10820         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10821         eval $hasfield
10822         ;;
10823 *)      val="$undef"
10824         set d_tm_tm_zone
10825         eval $setvar
10826         ;;
10827 esac
10828 case "$d_tm_tm_zone" in
10829 "$define")      echo "Yes, it does."   ;;
10830 *)              echo "No, it doesn't." ;;
10831 esac
10832 : see if struct tm knows about tm_gmtoff
10833 case "$i_systime$i_time" in
10834 *$define*)
10835         echo " "
10836         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10837         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10838         eval $hasfield
10839         ;;
10840 *)      val="$undef"
10841         set d_tm_tm_gmtoff
10842         eval $setvar
10843         ;;
10844 esac
10845 case "$d_tm_tm_gmtoff" in
10846 "$define")      echo "Yes, it does."   ;;
10847 *)              echo "No, it doesn't." ;;
10848 esac
10849
10850 : see if asctime_r exists
10851 set asctime_r d_asctime_r
10852 eval $inlibc
10853 case "$d_asctime_r" in
10854 "$define")
10855         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10856         case "$d_asctime_r_proto:$usethreads" in
10857         ":define")      d_asctime_r_proto=define
10858                 set d_asctime_r_proto asctime_r $hdrs
10859                 eval $hasproto ;;
10860         *)      ;;
10861         esac
10862         case "$d_asctime_r_proto" in
10863         define)
10864         case "$asctime_r_proto" in
10865         ''|0) try='char* asctime_r(const struct tm*, char*);'
10866         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10867         esac
10868         case "$asctime_r_proto" in
10869         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10870         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10871         esac
10872         case "$asctime_r_proto" in
10873         ''|0) try='int asctime_r(const struct tm*, char*);'
10874         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10875         esac
10876         case "$asctime_r_proto" in
10877         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10878         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10879         esac
10880         case "$asctime_r_proto" in
10881         ''|0)   d_asctime_r=undef
10882                 asctime_r_proto=0
10883                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10884         * )     case "$asctime_r_proto" in
10885                 REENTRANT_PROTO*) ;;
10886                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10887                 esac
10888                 echo "Prototype: $try" ;;
10889         esac
10890         ;;
10891         *)      case "$usethreads" in
10892                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10893                 esac
10894                 d_asctime_r=undef
10895                 asctime_r_proto=0
10896                 ;;
10897         esac
10898         ;;
10899 *)      asctime_r_proto=0
10900         ;;
10901 esac
10902
10903 : see if asinh exists
10904 set asinh d_asinh
10905 eval $inlibc
10906
10907 : see if atanh exists
10908 set atanh d_atanh
10909 eval $inlibc
10910
10911 : see if atolf exists
10912 set atolf d_atolf
10913 eval $inlibc
10914
10915 : see if atoll exists
10916 set atoll d_atoll
10917 eval $inlibc
10918
10919 : See if a file contains compiler warnings
10920 : See if a file contains compiler warnings
10921 case "$osname" in
10922   'aix')
10923         cat >compiler_warning <<EOSS
10924 # Sample for aix ('.5' indicates the column number in the line):
10925 #    "op.h", line 203.5: 1506-159 (E) Bit field type specified for op_type
10926 # Since the word 'warning' isn't present, use a fairly rigorous match of what
10927 # warning messages look like
10928 #            "    o        p        .  h   ", line    203      .   5        :   1506     -    159      (  E  )
10929 $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"
10930 EOSS
10931         compiler_warning=./compiler_warning
10932         chmod +x $compiler_warning
10933     ;;
10934      # Maybe a colon after the 'warning' would be appropriate
10935   *) compiler_warning="$contains -i warning"
10936     ;;
10937 esac
10938
10939 : Look for GCC-style attribute format
10940 case "$d_attribute_format" in
10941 '')
10942 echo " "
10943 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10944 $cat >attrib.c <<'EOCP'
10945 #include <stdio.h>
10946 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10947 EOCP
10948 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10949         if $compiler_warning attrib.out >/dev/null 2>&1; then
10950                 echo "Your C compiler doesn't support __attribute__((format))."
10951                 val="$undef"
10952         else
10953                 echo "Your C compiler supports __attribute__((format))."
10954                 val="$define"
10955         fi
10956 else
10957         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10958         val="$undef"
10959 fi
10960 ;;
10961 *) val="$d_attribute_format" ;;
10962 esac
10963 set d_attribute_format
10964 eval $setvar
10965 $rm -f attrib*
10966
10967 : Look for GCC-style attribute format with null format allowed
10968 case "$d_printf_format_null" in
10969 '') case "$d_attribute_format" in
10970     $define)
10971         echo " "
10972         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10973 $cat >attrib.c <<EOCP
10974 #include <stdio.h>
10975 #$i_stdlib I_STDLIB
10976 #ifdef I_STDLIB
10977 #include <stdlib.h>
10978 #endif
10979 #$i_inttypes I_INTTYPES
10980 #ifdef I_INTTYPES
10981 #include <inttypes.h>
10982 #endif
10983 #ifndef INTPTR_MAX
10984 #define intptr_t int
10985 #endif
10986 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10987 int null_printf (char* pat,...) { return (int)(intptr_t)pat; }
10988 int main () { exit(null_printf(NULL)); }
10989 EOCP
10990         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10991             : run the executable in case it produces a run-time warning
10992             if $run ./attrib >>attrib.out 2>&1; then
10993                 if $compiler_warning attrib.out >/dev/null 2>&1; then
10994                     echo "Your C compiler doesn't allow __printf__ format to be null."
10995                     val="$undef"
10996                 else
10997                     echo "Your C compiler allows __printf__ format to be null."
10998                     val="$define"
10999                 fi
11000             else
11001             echo "Your C compiler executable failed with __printf__ format null."
11002             val="$undef"
11003         fi
11004     else
11005         echo "Your C compiler fails with __printf__ format null."
11006         val="$undef"
11007     fi
11008     ;;
11009     *)  val="$undef" ;;
11010     esac
11011 ;;
11012 *)  val="$d_printf_format_null" ;;
11013 esac
11014 set d_printf_format_null
11015 eval $setvar
11016 $rm -f attrib*
11017
11018 : Look for GCC-style attribute malloc
11019 case "$d_attribute_malloc" in
11020 '')
11021 echo " "
11022 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
11023 $cat >attrib.c <<'EOCP'
11024 #include <stdio.h>
11025 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
11026 EOCP
11027 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11028         if $compiler_warning attrib.out >/dev/null 2>&1; then
11029                 echo "Your C compiler doesn't support __attribute__((malloc))."
11030                 val="$undef"
11031         else
11032                 echo "Your C compiler supports __attribute__((malloc))."
11033                 val="$define"
11034         fi
11035 else
11036         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11037         val="$undef"
11038 fi
11039 ;;
11040 *) val="$d_attribute_malloc" ;;
11041 esac
11042 set d_attribute_malloc
11043 eval $setvar
11044 $rm -f attrib*
11045
11046 : Look for GCC-style attribute nonnull
11047 case "$d_attribute_nonnull" in
11048 '')
11049 echo " "
11050 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
11051 $cat >attrib.c <<'EOCP'
11052 #include <stdio.h>
11053 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
11054 EOCP
11055 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11056         if $compiler_warning attrib.out >/dev/null 2>&1; then
11057                 echo "Your C compiler doesn't support __attribute__((nonnull))."
11058                 val="$undef"
11059         else
11060                 echo "Your C compiler supports __attribute__((nonnull))."
11061                 val="$define"
11062         fi
11063 else
11064         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11065         val="$undef"
11066 fi
11067 ;;
11068 *) val="$d_attribute_nonnull" ;;
11069 esac
11070 set d_attribute_nonnull
11071 eval $setvar
11072 $rm -f attrib*
11073
11074 : Look for GCC-style attribute noreturn
11075 case "$d_attribute_noreturn" in
11076 '')
11077 echo " "
11078 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11079 $cat >attrib.c <<'EOCP'
11080 #include <stdio.h>
11081 void fall_over_dead( void ) __attribute__((noreturn));
11082 EOCP
11083 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11084         if $compiler_warning attrib.out >/dev/null 2>&1; then
11085                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11086                 val="$undef"
11087         else
11088                 echo "Your C compiler supports __attribute__((noreturn))."
11089                 val="$define"
11090         fi
11091 else
11092         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11093         val="$undef"
11094 fi
11095 ;;
11096 *) val="$d_attribute_noreturn" ;;
11097 esac
11098 set d_attribute_noreturn
11099 eval $setvar
11100 $rm -f attrib*
11101
11102 : Look for GCC-style attribute pure
11103 case "$d_attribute_pure" in
11104 '')
11105 echo " "
11106 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11107 $cat >attrib.c <<'EOCP'
11108 #include <stdio.h>
11109 int square( int n ) __attribute__((pure));
11110 EOCP
11111 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11112         if $compiler_warning attrib.out >/dev/null 2>&1; then
11113                 echo "Your C compiler doesn't support __attribute__((pure))."
11114                 val="$undef"
11115         else
11116                 echo "Your C compiler supports __attribute__((pure))."
11117                 val="$define"
11118         fi
11119 else
11120         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11121         val="$undef"
11122 fi
11123 ;;
11124 *) val="$d_attribute_pure" ;;
11125 esac
11126 set d_attribute_pure
11127 eval $setvar
11128 $rm -f attrib*
11129
11130 : Look for GCC-style attribute unused
11131 case "$d_attribute_unused" in
11132 '')
11133 echo " "
11134 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11135 $cat >attrib.c <<'EOCP'
11136 #include <stdio.h>
11137 int do_something( int dummy __attribute__((unused)), int n );
11138 EOCP
11139 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11140         if $compiler_warning attrib.out >/dev/null 2>&1; then
11141                 echo "Your C compiler doesn't support __attribute__((unused))."
11142                 val="$undef"
11143         else
11144                 echo "Your C compiler supports __attribute__((unused))."
11145                 val="$define"
11146         fi
11147 else
11148         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11149         val="$undef"
11150 fi
11151 ;;
11152 *) val="$d_attribute_unused" ;;
11153 esac
11154 set d_attribute_unused
11155 eval $setvar
11156 $rm -f attrib*
11157
11158 : Look for GCC-style attribute deprecated
11159 case "$d_attribute_deprecated" in
11160 '')
11161 echo " "
11162 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11163 $cat >attrib.c <<'EOCP'
11164 #include <stdio.h>
11165 int I_am_deprecated(void) __attribute__((deprecated));
11166 EOCP
11167 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11168         if $compiler_warning attrib.out >/dev/null 2>&1; then
11169                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11170                 val="$undef"
11171         else
11172                 echo "Your C compiler supports __attribute__((deprecated))."
11173                 val="$define"
11174         fi
11175 else
11176         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11177         val="$undef"
11178 fi
11179 ;;
11180 *) val="$d_attribute_deprecated" ;;
11181 esac
11182 set d_attribute_deprecated
11183 eval $setvar
11184 $rm -f attrib*
11185
11186 : Look for GCC-style attribute warn_unused_result
11187 case "$d_attribute_warn_unused_result" in
11188 '')
11189 echo " "
11190 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11191 $cat >attrib.c <<'EOCP'
11192 #include <stdio.h>
11193 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11194 EOCP
11195 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11196         if $compiler_warning attrib.out >/dev/null 2>&1; then
11197                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11198                 val="$undef"
11199         else
11200                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11201                 val="$define"
11202         fi
11203 else
11204         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11205         val="$undef"
11206 fi
11207 ;;
11208 *) val="$d_attribute_warn_unused_result" ;;
11209 esac
11210 set d_attribute_warn_unused_result
11211 eval $setvar
11212 $rm -f attrib*
11213
11214 : Look for GCC-style attribute always_inline
11215 case "$d_attribute_always_inline" in
11216 '')
11217 echo " "
11218 echo "Checking whether your compiler can handle __attribute__((always_inline)) ..." >&4
11219 $cat >attrib.c <<'EOCP'
11220 #include <stdio.h>
11221 static __inline__ __attribute__((always_inline)) int I_will_always_be_inlined(void);
11222 EOCP
11223 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11224         if $compiler_warning attrib.out >/dev/null 2>&1; then
11225                 echo "Your C compiler doesn't support __attribute__((always_inline))."
11226                 val="$undef"
11227         else
11228                 echo "Your C compiler supports __attribute__((always_inline))."
11229                 val="$define"
11230         fi
11231 else
11232         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11233         val="$undef"
11234 fi
11235 ;;
11236 *) val="$d_attribute_always_inline" ;;
11237 esac
11238 set d_attribute_always_inline
11239 eval $setvar
11240 $rm -f attrib*
11241
11242 : see if getpgrp exists
11243 set getpgrp d_getpgrp
11244 eval $inlibc
11245
11246 case "$d_getpgrp" in
11247 "$define")
11248         echo " "
11249         echo "Checking to see which flavor of getpgrp is in use..."
11250         $cat >try.c <<EOP
11251 #include <stdio.h>
11252 #$i_unistd I_UNISTD
11253 #include <sys/types.h>
11254 #ifdef I_UNISTD
11255 #  include <unistd.h>
11256 #endif
11257 #$i_stdlib I_STDLIB
11258 #ifdef I_STDLIB
11259 #include <stdlib.h>
11260 #endif
11261 int main()
11262 {
11263         if (getuid() == 0) {
11264                 printf("(I see you are running Configure as super-user...)\n");
11265                 setuid(1);
11266         }
11267 #ifdef TRY_BSD_PGRP
11268         if (getpgrp(1) == 0)
11269                 exit(0);
11270 #else
11271         if (getpgrp() > 0)
11272                 exit(0);
11273 #endif
11274         exit(1);
11275 }
11276 EOP
11277         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11278                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11279                 val="$define"
11280         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11281                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11282                 val="$undef"
11283         else
11284                 echo "I can't seem to compile and run the test program."
11285                 if ./usg; then
11286                         xxx="a USG one, i.e. you use getpgrp()."
11287                 else
11288                         # SVR4 systems can appear rather BSD-ish.
11289                         case "$i_unistd" in
11290                         $undef)
11291                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11292                                 val="$define"
11293                                 ;;
11294                         $define)
11295                                 xxx="probably a USG one, i.e. you use getpgrp()."
11296                                 val="$undef"
11297                                 ;;
11298                         esac
11299                 fi
11300                 echo "Assuming your getpgrp is $xxx" >&4
11301         fi
11302         ;;
11303 *) val="$undef";;
11304 esac
11305 set d_bsdgetpgrp
11306 eval $setvar
11307 $rm_try
11308
11309 : see if setpgrp exists
11310 set setpgrp d_setpgrp
11311 eval $inlibc
11312
11313 case "$d_setpgrp" in
11314 "$define")
11315         echo " "
11316         echo "Checking to see which flavor of setpgrp is in use..."
11317         $cat >try.c <<EOP
11318 #include <stdio.h>
11319 #$i_unistd I_UNISTD
11320 #include <sys/types.h>
11321 #ifdef I_UNISTD
11322 #  include <unistd.h>
11323 #endif
11324 #$i_stdlib I_STDLIB
11325 #ifdef I_STDLIB
11326 #include <stdlib.h>
11327 #endif
11328 int main()
11329 {
11330         if (getuid() == 0) {
11331                 printf("(I see you are running Configure as super-user...)\n");
11332                 setuid(1);
11333         }
11334 #ifdef TRY_BSD_PGRP
11335         if (-1 == setpgrp(1, 1))
11336                 exit(0);
11337 #else
11338         if (setpgrp() != -1)
11339                 exit(0);
11340 #endif
11341         exit(1);
11342 }
11343 EOP
11344         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11345                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11346                 val="$define"
11347         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11348                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11349                 val="$undef"
11350         else
11351                 echo "(I can't seem to compile and run the test program.)"
11352                 if ./usg; then
11353                         xxx="a USG one, i.e. you use setpgrp()."
11354                 else
11355                         # SVR4 systems can appear rather BSD-ish.
11356                         case "$i_unistd" in
11357                         $undef)
11358                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11359                                 val="$define"
11360                                 ;;
11361                         $define)
11362                                 xxx="probably a USG one, i.e. you use setpgrp()."
11363                                 val="$undef"
11364                                 ;;
11365                         esac
11366                 fi
11367                 echo "Assuming your setpgrp is $xxx" >&4
11368         fi
11369         ;;
11370 *) val="$undef";;
11371 esac
11372 set d_bsdsetpgrp
11373 eval $setvar
11374 $rm_try
11375
11376 : Look for GCC-style __builtin_add_overflow
11377 case "$d_builtin_add_overflow" in
11378 '')
11379     echo " "
11380     echo "Checking whether your compiler can handle __builtin_add_overflow ..." >&4
11381     $cat >try.c <<'EOCP'
11382 int main(void) {
11383     const unsigned int uint_max = ~0u;
11384     int target_int = 0;
11385     if (__builtin_add_overflow(1, 2, &target_int) || target_int != 3) {
11386         return 1;
11387     }
11388     if (!__builtin_add_overflow((int)(uint_max >> 1), 1, &target_int)) {
11389         return 1;
11390     }
11391     if (!__builtin_add_overflow(uint_max, -1, &target_int)) {
11392         return 1;
11393     }
11394     return 0;
11395 }
11396 EOCP
11397     set try
11398     if eval $compile && $run ./try; then
11399         echo "Your C compiler supports __builtin_add_overflow."
11400         val="$define"
11401     else
11402         echo "Your C compiler doesn't seem to understand __builtin_add_overflow."
11403         val="$undef"
11404     fi
11405     ;;
11406 *) val="$d_builtin_add_overflow" ;;
11407 esac
11408
11409 set d_builtin_add_overflow
11410 eval $setvar
11411 $rm_try
11412
11413 : Look for GCC-style __builtin_sub_overflow
11414 case "$d_builtin_sub_overflow" in
11415 '')
11416     echo " "
11417     echo "Checking whether your compiler can handle __builtin_sub_overflow ..." >&4
11418     $cat >try.c <<'EOCP'
11419 int main(void) {
11420     const unsigned int uint_max = ~0u;
11421     int target_int = 0;
11422     if (__builtin_sub_overflow(1, -2, &target_int) || target_int != 3) {
11423         return 1;
11424     }
11425     if (!__builtin_sub_overflow(-(int)(uint_max >> 1), 2, &target_int)) {
11426         return 1;
11427     }
11428     if (!__builtin_sub_overflow(uint_max, 1, &target_int)) {
11429         return 1;
11430     }
11431     return 0;
11432 }
11433 EOCP
11434     set try
11435     if eval $compile && $run ./try; then
11436         echo "Your C compiler supports __builtin_sub_overflow."
11437         val="$define"
11438     else
11439         echo "Your C compiler doesn't seem to understand __builtin_sub_overflow."
11440         val="$undef"
11441     fi
11442     ;;
11443 *) val="$d_builtin_sub_overflow" ;;
11444 esac
11445
11446 set d_builtin_sub_overflow
11447 eval $setvar
11448 $rm_try
11449
11450 : Look for GCC-style __builtin_mul_overflow
11451 case "$d_builtin_mul_overflow" in
11452 '')
11453     echo " "
11454     echo "Checking whether your compiler can handle __builtin_mul_overflow ..." >&4
11455     $cat >try.c <<'EOCP'
11456 int main(void) {
11457     const unsigned int uint_max = ~0u;
11458     int target_int = 0;
11459     if (__builtin_mul_overflow(2, 3, &target_int) || target_int != 6) {
11460         return 1;
11461     }
11462     if (!__builtin_mul_overflow((int)(uint_max >> 1), 2, &target_int)) {
11463         return 1;
11464     }
11465     if (!__builtin_mul_overflow(uint_max, 1, &target_int)) {
11466         return 1;
11467     }
11468     return 0;
11469 }
11470 EOCP
11471     set try
11472     if eval $compile && $run ./try; then
11473         echo "Your C compiler supports __builtin_mul_overflow."
11474         val="$define"
11475     else
11476         echo "Your C compiler doesn't seem to understand __builtin_mul_overflow."
11477         val="$undef"
11478     fi
11479     ;;
11480 *) val="$d_builtin_mul_overflow" ;;
11481 esac
11482
11483 set d_builtin_mul_overflow
11484 eval $setvar
11485 $rm_try
11486
11487 : Look for GCC-style __builtin_choose_expr
11488 case "$d_builtin_choose_expr" in
11489 '')
11490     echo " "
11491     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11492     $cat >try.c <<'EOCP'
11493 #include <assert.h>
11494 #include <stdlib.h>
11495 #include <stdio.h>
11496
11497 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11498
11499 int main(void) {
11500     assert( SYRINX(1) == 2112 );
11501     assert( SYRINX(1) != 5150 );
11502     assert( SYRINX(0) == 5150 );
11503     assert( SYRINX(0) != 2112 );
11504     puts( "All good!" );
11505     exit(0);
11506 }
11507
11508 EOCP
11509     set try
11510     if eval $compile && $run ./try; then
11511         echo "Your C compiler supports __builtin_choose_expr."
11512         val="$define"
11513     else
11514         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11515         val="$undef"
11516     fi
11517 ;;
11518 *) val="$d_builtin_choose_expr" ;;
11519 esac
11520
11521 set d_builtin_choose_expr
11522 eval $setvar
11523 $rm_try
11524
11525 : Look for GCC-style __builtin_expect
11526 case "$d_builtin_expect" in
11527 '')
11528     echo " "
11529     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11530     $cat >try.c <<'EOCP'
11531 int main(void) {
11532     int n = 50;
11533     if ( __builtin_expect(n, 0) ) n = 1;
11534     /* Remember shell exit code truth is 0, C truth is non-zero */
11535     return !(n == 1);
11536 }
11537 EOCP
11538     set try
11539     if eval $compile && $run ./try; then
11540         echo "Your C compiler supports __builtin_expect."
11541         val="$define"
11542     else
11543         echo "Your C compiler doesn't seem to understand __builtin_expect."
11544         val="$undef"
11545     fi
11546     ;;
11547 *) val="$d_builtin_expect" ;;
11548 esac
11549
11550 set d_builtin_expect
11551 eval $setvar
11552 $rm_try
11553
11554 : see if the Compiler supports C99 variadic macros
11555 echo "Checking for C99 variadic macros." >&4
11556 $cat >try.c <<EOCP
11557 #include <stdio.h>
11558 #include <stdarg.h>
11559
11560 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11561
11562 int main() {
11563   char buf[20];
11564   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11565   puts(buf);
11566   return 0;
11567 }
11568 EOCP
11569 set try
11570 if eval $compile && $run ./try 2>&1 >/dev/null; then
11571     case "`$run ./try`" in
11572         "123 456 789")
11573         echo "You have C99 variadic macros." >&4
11574         d_c99_variadic_macros="$define"
11575         ;;
11576         *)
11577         echo "You don't have functional C99 variadic macros." >&4
11578         d_c99_variadic_macros="$undef"
11579         ;;
11580     esac
11581 else
11582     echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11583     d_c99_variadic_macros="$undef"
11584 fi
11585 $rm_try
11586
11587 : see if signal is declared as pointer to function returning int or void
11588 echo " "
11589 xxx=`./findhdr signal.h`
11590 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11591 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11592         echo "You have int (*signal())() instead of void." >&4
11593         val="$undef"
11594 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11595         echo "You have void (*signal())()." >&4
11596         val="$define"
11597 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11598         echo "You have int (*signal())() instead of void." >&4
11599         val="$undef"
11600 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11601         echo "You have void (*signal())()." >&4
11602         val="$define"
11603 else
11604         case "$d_voidsig" in
11605         '')
11606         echo "I can't determine whether signal handler returns void or int..." >&4
11607                 dflt=void
11608                 rp="What type does your signal handler return?"
11609                 . ./myread
11610                 case "$ans" in
11611                 v*) val="$define";;
11612                 *) val="$undef";;
11613                 esac;;
11614         "$define")
11615                 echo "As you already told me, signal handler returns void." >&4
11616                 val="$define"
11617                 ;;
11618         *)      echo "As you already told me, signal handler returns int." >&4
11619                 val="$undef"
11620                 ;;
11621         esac
11622 fi
11623 set d_voidsig
11624 eval $setvar
11625 case "$d_voidsig" in
11626 "$define") signal_t="void";;
11627 *) signal_t="int";;
11628 esac
11629 $rm -f $$.tmp
11630
11631 : check for ability to cast large floats to 32-bit ints.
11632 echo " "
11633 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11634 if $test "$intsize" -ge 4; then
11635         xxx=int
11636 else
11637         xxx=long
11638 fi
11639 $cat >try.c <<EOCP
11640 #include <stdio.h>
11641 #$i_stdlib I_STDLIB
11642 #ifdef I_STDLIB
11643 #include <stdlib.h>
11644 #endif
11645 #include <sys/types.h>
11646 #include <signal.h>
11647 $signal_t blech(int s) { exit(3); }
11648 int main()
11649 {
11650         $xxx i32;
11651         double f, g;
11652         int result = 0;
11653         char str[16];
11654         signal(SIGFPE, blech);
11655
11656         /* Don't let compiler optimize the test away.  Store the number
11657            in a writable string for gcc to pass to sscanf under HP-UX.
11658         */
11659         sprintf(str, "2147483647");
11660         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11661         g = 10 * f;
11662         i32  = ($xxx) g;
11663
11664         /* x86 processors will probably give 0x8000 0000, which is a
11665            sign change.  We don't want that.  We want to mimic SPARC
11666            behavior here, which is to preserve the sign and give
11667            back 0x7fff ffff.
11668         */
11669         if (i32 != ($xxx) f)
11670                 result |= 1;
11671         exit(result);
11672 }
11673 EOCP
11674 set try
11675 if eval $compile_ok; then
11676         $run ./try 2>/dev/null
11677         yyy=$?
11678 else
11679         echo "(I can't seem to compile the test program--assuming it can't)"
11680         yyy=1
11681 fi
11682 case "$yyy" in
11683 0)      val="$define"
11684         echo "Yup, it can."
11685         ;;
11686 *)      val="$undef"
11687         echo "Nope, it can't."
11688         ;;
11689 esac
11690 set d_casti32
11691 eval $setvar
11692 $rm_try
11693
11694 : check for ability to cast negative floats to unsigned
11695 echo " "
11696 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11697 $cat >try.c <<EOCP
11698 #include <stdio.h>
11699 #$i_stdlib I_STDLIB
11700 #ifdef I_STDLIB
11701 #include <stdlib.h>
11702 #endif
11703 #include <sys/types.h>
11704 #include <signal.h>
11705 $signal_t blech(int s) { exit(7); }
11706 $signal_t blech_in_list(int s) { exit(4); }
11707 unsigned long dummy_long(unsigned long p) { return p; }
11708 unsigned int dummy_int(unsigned int p) { return p; }
11709 unsigned short dummy_short(unsigned short p) { return p; }
11710 int main()
11711 {
11712         double f;
11713         unsigned long along;
11714         unsigned int aint;
11715         unsigned short ashort;
11716         int result = 0;
11717         char str[16];
11718
11719         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11720            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11721            optimized the whole file away
11722         */
11723         /* Store the number in a writable string for gcc to pass to
11724            sscanf under HP-UX.
11725         */
11726         sprintf(str, "-123");
11727         sscanf(str, "%lf", &f);  /* f = -123.; */
11728
11729         signal(SIGFPE, blech);
11730         along = (unsigned long)f;
11731         aint = (unsigned int)f;
11732         ashort = (unsigned short)f;
11733         if (along != (unsigned long)-123)
11734                 result |= 1;
11735         if (aint != (unsigned int)-123)
11736                 result |= 1;
11737         if (ashort != (unsigned short)-123)
11738                 result |= 1;
11739         sprintf(str, "1073741824.");
11740         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11741         f = f + f;
11742         along = 0;
11743         along = (unsigned long)f;
11744         if (along != 0x80000000)
11745                 result |= 2;
11746         f -= 1.;
11747         along = 0;
11748         along = (unsigned long)f;
11749         if (along != 0x7fffffff)
11750                 result |= 1;
11751         f += 2.;
11752         along = 0;
11753         along = (unsigned long)f;
11754         if (along != 0x80000001)
11755                 result |= 2;
11756         if (result)
11757                 exit(result);
11758         signal(SIGFPE, blech_in_list);
11759         sprintf(str, "123.");
11760         sscanf(str, "%lf", &f);  /* f = 123.; */
11761         along = dummy_long((unsigned long)f);
11762         aint = dummy_int((unsigned int)f);
11763         ashort = dummy_short((unsigned short)f);
11764         if (along != (unsigned long)123)
11765                 result |= 4;
11766         if (aint != (unsigned int)123)
11767                 result |= 4;
11768         if (ashort != (unsigned short)123)
11769                 result |= 4;
11770         exit(result);
11771
11772 }
11773 EOCP
11774 set try
11775 if eval $compile_ok; then
11776         $run ./try 2>/dev/null
11777         castflags=$?
11778 else
11779         echo "(I can't seem to compile the test program--assuming it can't)"
11780         castflags=7
11781 fi
11782 case "$castflags" in
11783 0)      val="$define"
11784         echo "Yup, it can."
11785         ;;
11786 *)      val="$undef"
11787         echo "Nope, it can't."
11788         ;;
11789 esac
11790 set d_castneg
11791 eval $setvar
11792 $rm_try
11793
11794 : see if cbrt exists
11795 set cbrt d_cbrt
11796 eval $inlibc
11797
11798 : see if chown exists
11799 set chown d_chown
11800 eval $inlibc
11801
11802 : see if chroot exists
11803 set chroot d_chroot
11804 eval $inlibc
11805
11806 : see if chsize exists
11807 set chsize d_chsize
11808 eval $inlibc
11809
11810 : see if class exists
11811 set class d_class
11812 eval $inlibc
11813
11814 : see if clearenv exists
11815 set clearenv d_clearenv
11816 eval $inlibc
11817
11818 : Define hasstruct macro for Configure internal use
11819 hasstruct='varname=$1; struct=$2; shift; shift;
11820 while $test $# -ge 2; do
11821         case "$1" in
11822         $define) echo "#include <$2>";;
11823         esac ;
11824     shift 2;
11825 done > try.c;
11826 echo "int main () { struct $struct foo; }" >> try.c;
11827 set try;
11828 if eval $compile; then
11829         val="$define";
11830 else
11831         val="$undef";
11832 fi;
11833 set $varname;
11834 eval $setvar;
11835 $rm_try'
11836
11837 : see whether socket exists
11838 socketlib=''
11839 sockethdr=''
11840 echo " "
11841 $echo $n "Hmm... $c" >&4
11842 if set socket val -f d_socket; eval $csym; $val; then
11843     echo "Looks like you have Berkeley networking support." >&4
11844     d_socket="$define"
11845     if set setsockopt val -f; eval $csym; $val; then
11846         d_oldsock="$undef"
11847     else
11848         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11849         d_oldsock="$define"
11850     fi
11851 else
11852     if $contains socklib libc.list >/dev/null 2>&1; then
11853         echo "Looks like you have Berkeley networking support." >&4
11854         d_socket="$define"
11855         : we will have to assume that it supports the 4.2 BSD interface
11856         d_oldsock="$undef"
11857     else
11858         echo "You don't have Berkeley networking in libc$_a..." >&4
11859         if test "X$d_socket" = "X$define"; then
11860             echo "...but you seem to believe that you have sockets." >&4
11861         else
11862             for net in net socket
11863             do
11864                 if test -f $sysroot/usr/lib/lib$net$_a; then
11865                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11866                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11867                     if $contains socket libc.list >/dev/null 2>&1; then
11868                         d_socket="$define"
11869                         socketlib="-l$net"
11870                         case "$net" in
11871                         net)
11872                             echo "...but the Wollongong group seems to have hacked it in." >&4
11873                             sockethdr="-I$sysroot/usr/netinclude"
11874                             ;;
11875                         esac
11876                         echo "Found Berkeley sockets interface in lib$net." >&4
11877                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11878                             d_oldsock="$undef"
11879                         else
11880                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11881                             d_oldsock="$define"
11882                         fi
11883                         break
11884                     fi
11885                 fi
11886             done
11887             if test "X$d_socket" != "X$define"; then
11888                echo "or anywhere else I see." >&4
11889                d_socket="$undef"
11890                d_oldsock="$undef"
11891             fi
11892         fi
11893     fi
11894 fi
11895
11896 : see if socketpair exists
11897 set socketpair d_sockpair
11898 eval $inlibc
11899
11900
11901 echo "Checking the availability sa_len in the sock struct ..." >&4
11902 $cat >try.c <<EOF
11903 #include <sys/types.h>
11904 #include <sys/socket.h>
11905 int main() {
11906 struct sockaddr sa;
11907 return (sa.sa_len);
11908 }
11909 EOF
11910 val="$undef"
11911 set try; if eval $compile; then
11912     val="$define"
11913 fi
11914 set d_sockaddr_sa_len; eval $setvar
11915 $rm_try
11916
11917 echo "Checking the availability struct sockaddr_in6 ..." >&4
11918 $cat >try.c <<EOF
11919 #include <sys/types.h>
11920 #include <sys/socket.h>
11921 #include <netinet/in.h>
11922 int main() {
11923 struct sockaddr_in6 sin6;
11924 return (sin6.sin6_family);
11925 }
11926 EOF
11927 val="$undef"
11928 set try; if eval $compile; then
11929     val="$define"
11930 fi
11931 set d_sockaddr_in6; eval $setvar
11932 $rm_try
11933
11934 echo "Checking the availability struct sockaddr_storage ..." >&4
11935 $cat >try.c <<EOF
11936 #include <sys/types.h>
11937 #include <sys/socket.h>
11938 #include <netinet/in.h>
11939 int main() {
11940 struct sockaddr_storage sastor;
11941 return (sastor.ss_family);
11942 }
11943 EOF
11944 val="$undef"
11945 set try; if eval $compile; then
11946     val="$define"
11947 fi
11948 set d_sockaddr_storage; eval $setvar
11949 $rm_try
11950
11951 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11952 $cat >try.c <<EOF
11953 #include <sys/types.h>
11954 #include <sys/socket.h>
11955 #include <netinet/in.h>
11956 int main() {
11957 struct sockaddr_in6 sin6;
11958 return (sin6.sin6_scope_id);
11959 }
11960 EOF
11961 val="$undef"
11962 set try; if eval $compile; then
11963     val="$define"
11964 fi
11965 set d_sin6_scope_id; eval $setvar
11966 $rm_try
11967
11968 echo "Checking the availability struct ip_mreq ..." >&4
11969 $cat >try.c <<EOF
11970 #include <sys/types.h>
11971 #include <sys/socket.h>
11972 #include <netinet/in.h>
11973 int main() {
11974 struct ip_mreq mreq;
11975 return (mreq.imr_multiaddr.s_addr);
11976 }
11977 EOF
11978 val="$undef"
11979 set try; if eval $compile; then
11980        val="$define"
11981 fi
11982 set d_ip_mreq; eval $setvar
11983 $rm_try
11984
11985 echo "Checking the availability struct ip_mreq_source ..." >&4
11986 $cat >try.c <<EOF
11987 #include <sys/types.h>
11988 #include <sys/socket.h>
11989 #include <netinet/in.h>
11990 int main() {
11991 struct ip_mreq_source mreq;
11992 return (mreq.imr_multiaddr.s_addr);
11993 }
11994 EOF
11995 val="$undef"
11996 set try; if eval $compile; then
11997        val="$define"
11998 fi
11999 set d_ip_mreq_source; eval $setvar
12000 $rm_try
12001
12002 echo "Checking the availability struct ipv6_mreq ..." >&4
12003 $cat >try.c <<EOF
12004 #include <sys/types.h>
12005 #include <sys/socket.h>
12006 #include <netinet/in.h>
12007 int main() {
12008 struct ipv6_mreq mreq;
12009 return (mreq.ipv6mr_interface);
12010 }
12011 EOF
12012 val="$undef"
12013 set try; if eval $compile; then
12014     val="$define"
12015 fi
12016 set d_ipv6_mreq; eval $setvar
12017 $rm_try
12018
12019 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12020 $cat >try.c <<EOF
12021 #include <sys/types.h>
12022 #include <sys/socket.h>
12023 #include <netinet/in.h>
12024 int main() {
12025 struct ipv6_mreq_source mreq;
12026 return (mreq.imr_multiaddr.s_addr);
12027 }
12028 EOF
12029 val="$undef"
12030 set try; if eval $compile; then
12031        val="$define"
12032 fi
12033 set d_ipv6_mreq_source; eval $setvar
12034 $rm_try
12035
12036 echo "Checking the availability of certain socket constants..." >&4
12037 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12038     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12039     $cat >try.c <<EOF
12040 #include <sys/types.h>
12041 #include <sys/socket.h>
12042 int main() {
12043     int i = $ENUM;
12044 }
12045 EOF
12046     val="$undef"
12047     set try; if eval $compile; then
12048         val="$define"
12049     fi
12050     set d_${enum}; eval $setvar
12051     $rm_try
12052 done
12053
12054 : see if this is a sys/uio.h system
12055 set sys/uio.h i_sysuio
12056 eval $inhdr
12057
12058 : Check for cmsghdr support
12059 echo " "
12060 echo "Checking to see if your system supports struct cmsghdr..." >&4
12061 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12062 eval $hasstruct
12063 case "$d_cmsghdr_s" in
12064 "$define")      echo "Yes, it does."   ;;
12065 *)              echo "No, it doesn't." ;;
12066 esac
12067
12068 : see if copysign exists
12069 set copysign d_copysign
12070 eval $inlibc
12071
12072 : see if copysignl exists
12073 set copysignl d_copysignl
12074 eval $inlibc
12075
12076 : see if crypt exists
12077 echo " "
12078 set crypt d_crypt
12079 eval $inlibc
12080 case "$d_crypt" in
12081 $define) cryptlib='' ;;
12082 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12083                 echo 'crypt() found.' >&4
12084                 val="$define"
12085                 cryptlib=''
12086         else
12087                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12088                 if $test -z "$cryptlib"; then
12089                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12090                 else
12091                         cryptlib=-lcrypt
12092                 fi
12093                 if $test -z "$cryptlib"; then
12094                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12095                 else
12096                         cryptlib=-lcrypt
12097                 fi
12098                 if $test -z "$cryptlib"; then
12099                         cryptlib=`./loc libcrypt$_a "" $libpth`
12100                 else
12101                         cryptlib=-lcrypt
12102                 fi
12103                 if $test -z "$cryptlib"; then
12104                         echo 'crypt() NOT found.' >&4
12105                         val="$undef"
12106                 else
12107                         val="$define"
12108                 fi
12109         fi
12110         set d_crypt
12111         eval $setvar
12112         ;;
12113 esac
12114
12115 : see if this is a crypt.h system
12116 set crypt.h i_crypt
12117 eval $inhdr
12118
12119 : see if crypt_r exists
12120 set crypt_r d_crypt_r
12121 eval $inlibc
12122 case "$d_crypt_r" in
12123 "$define")
12124         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12125         case "$d_crypt_r_proto:$usethreads" in
12126         ":define")      d_crypt_r_proto=define
12127                 set d_crypt_r_proto crypt_r $hdrs
12128                 eval $hasproto ;;
12129         *)      ;;
12130         esac
12131         case "$d_crypt_r_proto" in
12132         define)
12133         case "$crypt_r_proto" in
12134         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12135         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12136         esac
12137         case "$crypt_r_proto" in
12138         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12139         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12140         esac
12141         case "$crypt_r_proto" in
12142         ''|0)   d_crypt_r=undef
12143                 crypt_r_proto=0
12144                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12145         * )     case "$crypt_r_proto" in
12146                 REENTRANT_PROTO*) ;;
12147                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12148                 esac
12149                 echo "Prototype: $try" ;;
12150         esac
12151         ;;
12152         *)      case "$usethreads" in
12153                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12154                 esac
12155                 d_crypt_r=undef
12156                 crypt_r_proto=0
12157                 ;;
12158         esac
12159         ;;
12160 *)      crypt_r_proto=0
12161         ;;
12162 esac
12163
12164 : get csh whereabouts
12165 case "$csh" in
12166 'csh') val="$undef" ;;
12167 *) val="$define" ;;
12168 esac
12169 set d_csh
12170 eval $setvar
12171 : Respect a hint or command line value for full_csh.
12172 case "$full_csh" in
12173 '') full_csh=$csh ;;
12174 esac
12175
12176 : see if ctermid exists
12177 set ctermid d_ctermid
12178 eval $inlibc
12179
12180 : see if ctermid_r exists
12181 set ctermid_r d_ctermid_r
12182 eval $inlibc
12183 case "$d_ctermid_r" in
12184 "$define")
12185         hdrs="$i_systypes sys/types.h define stdio.h "
12186         case "$d_ctermid_r_proto:$usethreads" in
12187         ":define")      d_ctermid_r_proto=define
12188                 set d_ctermid_r_proto ctermid_r $hdrs
12189                 eval $hasproto ;;
12190         *)      ;;
12191         esac
12192         case "$d_ctermid_r_proto" in
12193         define)
12194         case "$ctermid_r_proto" in
12195         ''|0) try='char* ctermid_r(char*);'
12196         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12197         esac
12198         case "$ctermid_r_proto" in
12199         ''|0)   d_ctermid_r=undef
12200                 ctermid_r_proto=0
12201                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12202         * )     case "$ctermid_r_proto" in
12203                 REENTRANT_PROTO*) ;;
12204                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12205                 esac
12206                 echo "Prototype: $try" ;;
12207         esac
12208         ;;
12209         *)      case "$usethreads" in
12210                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12211                 esac
12212                 d_ctermid_r=undef
12213                 ctermid_r_proto=0
12214                 ;;
12215         esac
12216         ;;
12217 *)      ctermid_r_proto=0
12218         ;;
12219 esac
12220
12221 : see if ctime_r exists
12222 set ctime_r d_ctime_r
12223 eval $inlibc
12224 case "$d_ctime_r" in
12225 "$define")
12226         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12227         case "$d_ctime_r_proto:$usethreads" in
12228         ":define")      d_ctime_r_proto=define
12229                 set d_ctime_r_proto ctime_r $hdrs
12230                 eval $hasproto ;;
12231         *)      ;;
12232         esac
12233         case "$d_ctime_r_proto" in
12234         define)
12235         case "$ctime_r_proto" in
12236         ''|0) try='char* ctime_r(const time_t*, char*);'
12237         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12238         esac
12239         case "$ctime_r_proto" in
12240         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12241         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12242         esac
12243         case "$ctime_r_proto" in
12244         ''|0) try='int ctime_r(const time_t*, char*);'
12245         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12246         esac
12247         case "$ctime_r_proto" in
12248         ''|0) try='int ctime_r(const time_t*, char*, int);'
12249         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12250         esac
12251         case "$ctime_r_proto" in
12252         ''|0)   d_ctime_r=undef
12253                 ctime_r_proto=0
12254                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12255         * )     case "$ctime_r_proto" in
12256                 REENTRANT_PROTO*) ;;
12257                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12258                 esac
12259                 echo "Prototype: $try" ;;
12260         esac
12261         ;;
12262         *)      case "$usethreads" in
12263                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12264                 esac
12265                 d_ctime_r=undef
12266                 ctime_r_proto=0
12267                 ;;
12268         esac
12269         ;;
12270 *)      ctime_r_proto=0
12271         ;;
12272 esac
12273
12274 : see if cuserid exists
12275 set cuserid d_cuserid
12276 eval $inlibc
12277
12278 : see if dbm.h is available
12279 : see if dbmclose exists
12280 set dbmclose d_dbmclose
12281 eval $inlibc
12282
12283 case "$d_dbmclose" in
12284 $define)
12285         set dbm.h i_dbm
12286         eval $inhdr
12287         case "$i_dbm" in
12288         $define)
12289                 val="$undef"
12290                 set i_rpcsvcdbm
12291                 eval $setvar
12292                 ;;
12293         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12294                 eval $inhdr
12295                 ;;
12296         esac
12297         ;;
12298 *)      echo "We won't be including <dbm.h>"
12299         val="$undef"
12300         set i_dbm
12301         eval $setvar
12302         val="$undef"
12303         set i_rpcsvcdbm
12304         eval $setvar
12305         ;;
12306 esac
12307
12308 : see if prototype for dbminit is available
12309 echo " "
12310 set d_dbminitproto dbminit $i_dbm dbm.h
12311 eval $hasproto
12312
12313 : see if difftime exists
12314 set difftime d_difftime
12315 eval $inlibc
12316
12317 : see if this is a dirent system
12318 echo " "
12319 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12320         val="$define"
12321         echo "<dirent.h> found." >&4
12322 else
12323         val="$undef"
12324         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12325                 echo "<sys/dir.h> found." >&4
12326                 echo " "
12327         else
12328                 xinc=`./findhdr sys/ndir.h`
12329         fi
12330         echo "<dirent.h> NOT found." >&4
12331 fi
12332 set i_dirent
12333 eval $setvar
12334
12335 : Look for type of directory structure.
12336 echo " "
12337 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12338
12339 case "$direntrytype" in
12340 ''|' ')
12341         case "$i_dirent" in
12342         $define) guess1='struct dirent' ;;
12343         *) guess1='struct direct'  ;;
12344         esac
12345         ;;
12346 *)      guess1="$direntrytype"
12347         ;;
12348 esac
12349
12350 case "$guess1" in
12351 'struct dirent') guess2='struct direct' ;;
12352 *) guess2='struct dirent' ;;
12353 esac
12354
12355 if $contains "$guess1" try.c >/dev/null 2>&1; then
12356         direntrytype="$guess1"
12357         echo "Your directory entries are $direntrytype." >&4
12358 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12359         direntrytype="$guess2"
12360         echo "Your directory entries seem to be $direntrytype." >&4
12361 else
12362         echo "I don't recognize your system's directory entries." >&4
12363         rp="What type is used for directory entries on this system?"
12364         dflt="$guess1"
12365         . ./myread
12366         direntrytype="$ans"
12367 fi
12368 $rm_try
12369
12370 : see if the directory entry stores field length
12371 echo " "
12372 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12373 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12374         echo "Good, your directory entry keeps length information in d_namlen." >&4
12375         val="$define"
12376 else
12377         echo "Your directory entry does not know about the d_namlen field." >&4
12378         val="$undef"
12379 fi
12380 set d_dirnamlen
12381 eval $setvar
12382 $rm_try
12383
12384 : Look for DIR.dd_fd
12385 case "$i_dirent" in
12386 "$define")
12387     echo "Checking to see if DIR has a dd_fd member variable" >&4
12388     $cat >try.c <<EOCP
12389 #$i_stdlib I_STDLIB
12390 #ifdef I_STDLIB
12391 #include <stdlib.h>
12392 #endif
12393 #include <dirent.h>
12394
12395 int main() {
12396     DIR dir;
12397     dir.dd_fd = 1;
12398     return 0;
12399 }
12400 EOCP
12401     val=$undef
12402     set try
12403     if eval $compile; then
12404         echo "Yes, it does."
12405         val="$define"
12406     else
12407         echo "No, it does not."
12408         val="$undef"
12409     fi
12410     ;;
12411 *)
12412     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12413     val="$undef"
12414     ;;
12415 esac
12416 set d_dir_dd_fd
12417 eval $setvar
12418 $rm_try
12419
12420 : see if this is an sysdir system
12421 set sys/dir.h i_sysdir
12422 eval $inhdr
12423
12424 : see if this is an sysndir system
12425 set sys/ndir.h i_sysndir
12426 eval $inhdr
12427
12428 : Look for dirfd
12429 echo " "
12430 $cat >dirfd.c <<EOM
12431 #include <stdio.h>
12432 #$i_stdlib I_STDLIB
12433 #ifdef I_STDLIB
12434 #include <stdlib.h>
12435 #endif
12436 #$i_dirent I_DIRENT             /**/
12437 #$i_sysdir I_SYS_DIR            /**/
12438 #$i_sysndir I_SYS_NDIR          /**/
12439 #$i_systypes I_SYS_TYPES        /**/
12440 #if defined(I_SYS_TYPES)
12441 #include <sys/types.h>
12442 #endif
12443 #if defined(I_DIRENT)
12444 #include <dirent.h>
12445 #else
12446 #ifdef I_SYS_NDIR
12447 #include <sys/ndir.h>
12448 #else
12449 #ifdef I_SYS_DIR
12450 #include <sys/dir.h>
12451 #endif
12452 #endif
12453 #endif
12454 int main() {
12455         DIR *dirp = opendir(".");
12456         if (dirfd(dirp) >= 0)
12457                 exit(0);
12458         else
12459                 exit(1);
12460 }
12461 EOM
12462 val=$undef
12463 set dirfd
12464 if eval $compile; then
12465         val="$define"
12466 fi
12467 case "$val" in
12468 $define)        echo "dirfd() found." >&4       ;;
12469 *)              echo "dirfd() NOT found." >&4   ;;
12470 esac
12471 set d_dirfd
12472 eval $setvar
12473 $rm -f dirfd*
12474
12475 : see if dladdr exists
12476 set dladdr d_dladdr
12477 eval $inlibc
12478
12479 : see if dlerror exists
12480 xxx_runnm="$runnm"
12481 runnm=false
12482 set dlerror d_dlerror
12483 eval $inlibc
12484 runnm="$xxx_runnm"
12485
12486 : see if dlfcn is available
12487 set dlfcn.h i_dlfcn
12488 eval $inhdr
12489
12490 : Check what extension to use for shared libs
12491 case "$usedl" in
12492 $define|y|true)
12493         $cat << EOM
12494
12495 On a few systems, the dynamically loaded modules that perl generates and uses
12496 will need a different extension than shared libs. The default will probably
12497 be appropriate.
12498
12499 EOM
12500         case "$dlext" in
12501         '')     dflt="$so" ;;
12502         *)      dflt="$dlext" ;;
12503         esac
12504         rp='What is the extension of dynamically loaded modules'
12505         . ./myread
12506         dlext="$ans"
12507         ;;
12508 *)
12509         dlext="none"
12510         ;;
12511 esac
12512
12513 : Check if dlsym need a leading underscore
12514 echo " "
12515 val="$undef"
12516
12517 case "$dlsrc" in
12518 dl_dlopen.xs)
12519         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12520         $cat >dyna.c <<'EOM'
12521 fred () { }
12522 EOM
12523
12524 $cat >fred.c<<EOM
12525
12526 #include <stdio.h>
12527 #$i_stdlib I_STDLIB
12528 #ifdef I_STDLIB
12529 #include <stdlib.h>
12530 #endif
12531 #$i_dlfcn I_DLFCN
12532 #ifdef I_DLFCN
12533 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12534 #else
12535 #include <sys/types.h>
12536 #include <nlist.h>
12537 #include <link.h>
12538 #endif
12539
12540 extern int fred() ;
12541
12542 int main()
12543 {
12544     void * handle ;
12545     void * symbol ;
12546 #ifndef RTLD_LAZY
12547     int mode = 1 ;
12548 #else
12549     int mode = RTLD_LAZY ;
12550 #endif
12551     handle = dlopen("./dyna.$dlext", mode) ;
12552     if (handle == NULL) {
12553         printf ("1\n") ;
12554         fflush (stdout) ;
12555         exit(0);
12556     }
12557     symbol = dlsym(handle, "fred") ;
12558     if (symbol == NULL) {
12559         /* try putting a leading underscore */
12560         symbol = dlsym(handle, "_fred") ;
12561         if (symbol == NULL) {
12562             printf ("2\n") ;
12563             fflush (stdout) ;
12564             exit(0);
12565         }
12566         printf ("3\n") ;
12567     }
12568     else
12569         printf ("4\n") ;
12570     fflush (stdout) ;
12571     exit(0);
12572 }
12573 EOM
12574         : Call the object file tmp-dyna.o in case dlext=o.
12575         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12576                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12577                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12578                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12579                 xxx=`$run ./fred`
12580                 case $xxx in
12581                 1)      echo "Test program failed using dlopen." >&4
12582                         echo "Perhaps you should not use dynamic loading." >&4;;
12583                 2)      echo "Test program failed using dlsym." >&4
12584                         echo "Perhaps you should not use dynamic loading." >&4;;
12585                 3)      echo "dlsym needs a leading underscore" >&4
12586                         val="$define" ;;
12587                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12588                 esac
12589         else
12590                 echo "I can't compile and run the test program." >&4
12591                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12592         fi
12593         ;;
12594 esac
12595
12596 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12597
12598 set d_dlsymun
12599 eval $setvar
12600
12601 : see if drand48_r exists
12602 set drand48_r d_drand48_r
12603 eval $inlibc
12604 case "$d_drand48_r" in
12605 "$define")
12606         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12607         case "$d_drand48_r_proto:$usethreads" in
12608         ":define")      d_drand48_r_proto=define
12609                 set d_drand48_r_proto drand48_r $hdrs
12610                 eval $hasproto ;;
12611         *)      ;;
12612         esac
12613         case "$d_drand48_r_proto" in
12614         define)
12615         case "$drand48_r_proto" in
12616         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12617         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12618         esac
12619         case "$drand48_r_proto" in
12620         ''|0)   d_drand48_r=undef
12621                 drand48_r_proto=0
12622                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12623         * )     case "$drand48_r_proto" in
12624                 REENTRANT_PROTO*) ;;
12625                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12626                 esac
12627                 echo "Prototype: $try" ;;
12628         esac
12629         ;;
12630         *)      case "$usethreads" in
12631                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12632                 esac
12633                 d_drand48_r=undef
12634                 drand48_r_proto=0
12635                 ;;
12636         esac
12637         ;;
12638 *)      drand48_r_proto=0
12639         ;;
12640 esac
12641
12642 : see if prototype for drand48 is available
12643 echo " "
12644 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12645 eval $hasproto
12646
12647 : see if dup2 exists
12648 set dup2 d_dup2
12649 eval $inlibc
12650
12651 : see if dup3 exists
12652 set dup3 d_dup3
12653 eval $inlibc
12654
12655 : see if this is an xlocale.h system
12656 set xlocale.h i_xlocale
12657 eval $inhdr
12658
12659 : see if newlocale exists
12660 set newlocale d_newlocale
12661 eval $inlibc
12662
12663 : see if freelocale exists
12664 set freelocale d_freelocale
12665 eval $inlibc
12666
12667 : see if uselocale exists
12668 set uselocale d_uselocale
12669 eval $inlibc
12670
12671 : see if duplocale exists
12672 set duplocale d_duplocale
12673 eval $inlibc
12674
12675 : see if querylocale exists
12676 set querylocale d_querylocale
12677 eval $inlibc
12678
12679 : see if eaccess exists
12680 set eaccess d_eaccess
12681 eval $inlibc
12682
12683 : see if endgrent exists
12684 set endgrent d_endgrent
12685 eval $inlibc
12686
12687 : see if this is an grp system
12688 set grp.h i_grp
12689 eval $inhdr
12690
12691 case "$i_grp" in
12692 $define)
12693         xxx=`./findhdr grp.h`
12694         $cppstdin $cppflags $cppminus < $xxx >$$.h
12695
12696         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12697                 val="$define"
12698         else
12699                 val="$undef"
12700         fi
12701         set d_grpasswd
12702         eval $setvar
12703
12704         $rm -f $$.h
12705         ;;
12706 *)
12707         val="$undef";
12708         set d_grpasswd; eval $setvar
12709         ;;
12710 esac
12711
12712 : see if endgrent_r exists
12713 set endgrent_r d_endgrent_r
12714 eval $inlibc
12715 case "$d_endgrent_r" in
12716 "$define")
12717         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12718         case "$d_endgrent_r_proto:$usethreads" in
12719         ":define")      d_endgrent_r_proto=define
12720                 set d_endgrent_r_proto endgrent_r $hdrs
12721                 eval $hasproto ;;
12722         *)      ;;
12723         esac
12724         case "$d_endgrent_r_proto" in
12725         define)
12726         case "$endgrent_r_proto" in
12727         ''|0) try='int endgrent_r(FILE**);'
12728         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12729         esac
12730         case "$endgrent_r_proto" in
12731         ''|0) try='void endgrent_r(FILE**);'
12732         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12733         esac
12734         case "$endgrent_r_proto" in
12735         ''|0)   d_endgrent_r=undef
12736                 endgrent_r_proto=0
12737                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12738         * )     case "$endgrent_r_proto" in
12739                 REENTRANT_PROTO*) ;;
12740                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12741                 esac
12742                 echo "Prototype: $try" ;;
12743         esac
12744         ;;
12745         *)      case "$usethreads" in
12746                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12747                 esac
12748                 d_endgrent_r=undef
12749                 endgrent_r_proto=0
12750                 ;;
12751         esac
12752         ;;
12753 *)      endgrent_r_proto=0
12754         ;;
12755 esac
12756
12757 : see if endhostent exists
12758 set endhostent d_endhent
12759 eval $inlibc
12760
12761 : see if this is a netdb.h system
12762 set netdb.h i_netdb
12763 eval $inhdr
12764
12765 : see if endhostent_r exists
12766 set endhostent_r d_endhostent_r
12767 eval $inlibc
12768 case "$d_endhostent_r" in
12769 "$define")
12770         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12771         case "$d_endhostent_r_proto:$usethreads" in
12772         ":define")      d_endhostent_r_proto=define
12773                 set d_endhostent_r_proto endhostent_r $hdrs
12774                 eval $hasproto ;;
12775         *)      ;;
12776         esac
12777         case "$d_endhostent_r_proto" in
12778         define)
12779         case "$endhostent_r_proto" in
12780         ''|0) try='int endhostent_r(struct hostent_data*);'
12781         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12782         esac
12783         case "$endhostent_r_proto" in
12784         ''|0) try='void endhostent_r(struct hostent_data*);'
12785         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12786         esac
12787         case "$endhostent_r_proto" in
12788         ''|0)   d_endhostent_r=undef
12789                 endhostent_r_proto=0
12790                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12791         * )     case "$endhostent_r_proto" in
12792                 REENTRANT_PROTO*) ;;
12793                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12794                 esac
12795                 echo "Prototype: $try" ;;
12796         esac
12797         ;;
12798         *)      case "$usethreads" in
12799                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12800                 esac
12801                 d_endhostent_r=undef
12802                 endhostent_r_proto=0
12803                 ;;
12804         esac
12805         ;;
12806 *)      endhostent_r_proto=0
12807         ;;
12808 esac
12809
12810 : see if endnetent exists
12811 set endnetent d_endnent
12812 eval $inlibc
12813
12814 : see if endnetent_r exists
12815 set endnetent_r d_endnetent_r
12816 eval $inlibc
12817 case "$d_endnetent_r" in
12818 "$define")
12819         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12820         case "$d_endnetent_r_proto:$usethreads" in
12821         ":define")      d_endnetent_r_proto=define
12822                 set d_endnetent_r_proto endnetent_r $hdrs
12823                 eval $hasproto ;;
12824         *)      ;;
12825         esac
12826         case "$d_endnetent_r_proto" in
12827         define)
12828         case "$endnetent_r_proto" in
12829         ''|0) try='int endnetent_r(struct netent_data*);'
12830         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12831         esac
12832         case "$endnetent_r_proto" in
12833         ''|0) try='void endnetent_r(struct netent_data*);'
12834         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12835         esac
12836         case "$endnetent_r_proto" in
12837         ''|0)   d_endnetent_r=undef
12838                 endnetent_r_proto=0
12839                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12840         * )     case "$endnetent_r_proto" in
12841                 REENTRANT_PROTO*) ;;
12842                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12843                 esac
12844                 echo "Prototype: $try" ;;
12845         esac
12846         ;;
12847         *)      case "$usethreads" in
12848                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12849                 esac
12850                 d_endnetent_r=undef
12851                 endnetent_r_proto=0
12852                 ;;
12853         esac
12854         ;;
12855 *)      endnetent_r_proto=0
12856         ;;
12857 esac
12858
12859 : see if endprotoent exists
12860 set endprotoent d_endpent
12861 eval $inlibc
12862
12863 : see if endprotoent_r exists
12864 set endprotoent_r d_endprotoent_r
12865 eval $inlibc
12866 case "$d_endprotoent_r" in
12867 "$define")
12868         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12869         case "$d_endprotoent_r_proto:$usethreads" in
12870         ":define")      d_endprotoent_r_proto=define
12871                 set d_endprotoent_r_proto endprotoent_r $hdrs
12872                 eval $hasproto ;;
12873         *)      ;;
12874         esac
12875         case "$d_endprotoent_r_proto" in
12876         define)
12877         case "$endprotoent_r_proto" in
12878         ''|0) try='int endprotoent_r(struct protoent_data*);'
12879         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12880         esac
12881         case "$endprotoent_r_proto" in
12882         ''|0) try='void endprotoent_r(struct protoent_data*);'
12883         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12884         esac
12885         case "$endprotoent_r_proto" in
12886         ''|0)   d_endprotoent_r=undef
12887                 endprotoent_r_proto=0
12888                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12889         * )     case "$endprotoent_r_proto" in
12890                 REENTRANT_PROTO*) ;;
12891                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12892                 esac
12893                 echo "Prototype: $try" ;;
12894         esac
12895         ;;
12896         *)      case "$usethreads" in
12897                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12898                 esac
12899                 d_endprotoent_r=undef
12900                 endprotoent_r_proto=0
12901                 ;;
12902         esac
12903         ;;
12904 *)      endprotoent_r_proto=0
12905         ;;
12906 esac
12907
12908 : see if endpwent exists
12909 set endpwent d_endpwent
12910 eval $inlibc
12911
12912 : see if this is a pwd.h system
12913 set pwd.h i_pwd
12914 eval $inhdr
12915
12916 case "$i_pwd" in
12917 $define)
12918         xxx=`./findhdr pwd.h`
12919         $cppstdin $cppflags $cppminus < $xxx >$$.h
12920
12921         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12922                 val="$define"
12923         else
12924                 val="$undef"
12925         fi
12926         set d_pwquota
12927         eval $setvar
12928
12929         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12930                 val="$define"
12931         else
12932                 val="$undef"
12933         fi
12934         set d_pwage
12935         eval $setvar
12936
12937         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12938                 val="$define"
12939         else
12940                 val="$undef"
12941         fi
12942         set d_pwchange
12943         eval $setvar
12944
12945         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12946                 val="$define"
12947         else
12948                 val="$undef"
12949         fi
12950         set d_pwclass
12951         eval $setvar
12952
12953         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12954                 val="$define"
12955         else
12956                 val="$undef"
12957         fi
12958         set d_pwexpire
12959         eval $setvar
12960
12961         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12962                 val="$define"
12963         else
12964                 val="$undef"
12965         fi
12966         set d_pwcomment
12967         eval $setvar
12968
12969         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12970                 val="$define"
12971         else
12972                 val="$undef"
12973         fi
12974         set d_pwgecos
12975         eval $setvar
12976
12977         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12978                 val="$define"
12979         else
12980                 val="$undef"
12981         fi
12982         set d_pwpasswd
12983         eval $setvar
12984
12985         $rm -f $$.h
12986         ;;
12987 *)
12988         val="$undef";
12989         set d_pwquota; eval $setvar
12990         set d_pwage; eval $setvar
12991         set d_pwchange; eval $setvar
12992         set d_pwclass; eval $setvar
12993         set d_pwexpire; eval $setvar
12994         set d_pwcomment; eval $setvar
12995         set d_pwgecos; eval $setvar
12996         set d_pwpasswd; eval $setvar
12997         ;;
12998 esac
12999
13000 : see if endpwent_r exists
13001 set endpwent_r d_endpwent_r
13002 eval $inlibc
13003 case "$d_endpwent_r" in
13004 "$define")
13005         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13006         case "$d_endpwent_r_proto:$usethreads" in
13007         ":define")      d_endpwent_r_proto=define
13008                 set d_endpwent_r_proto endpwent_r $hdrs
13009                 eval $hasproto ;;
13010         *)      ;;
13011         esac
13012         case "$d_endpwent_r_proto" in
13013         define)
13014         case "$endpwent_r_proto" in
13015         ''|0) try='int endpwent_r(FILE**);'
13016         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13017         esac
13018         case "$endpwent_r_proto" in
13019         ''|0) try='void endpwent_r(FILE**);'
13020         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13021         esac
13022         case "$endpwent_r_proto" in
13023         ''|0)   d_endpwent_r=undef
13024                 endpwent_r_proto=0
13025                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13026         * )     case "$endpwent_r_proto" in
13027                 REENTRANT_PROTO*) ;;
13028                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13029                 esac
13030                 echo "Prototype: $try" ;;
13031         esac
13032         ;;
13033         *)      case "$usethreads" in
13034                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13035                 esac
13036                 d_endpwent_r=undef
13037                 endpwent_r_proto=0
13038                 ;;
13039         esac
13040         ;;
13041 *)      endpwent_r_proto=0
13042         ;;
13043 esac
13044
13045 : see if endservent exists
13046 set endservent d_endsent
13047 eval $inlibc
13048
13049 : see if endservent_r exists
13050 set endservent_r d_endservent_r
13051 eval $inlibc
13052 case "$d_endservent_r" in
13053 "$define")
13054         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13055         case "$d_endservent_r_proto:$usethreads" in
13056         ":define")      d_endservent_r_proto=define
13057                 set d_endservent_r_proto endservent_r $hdrs
13058                 eval $hasproto ;;
13059         *)      ;;
13060         esac
13061         case "$d_endservent_r_proto" in
13062         define)
13063         case "$endservent_r_proto" in
13064         ''|0) try='int endservent_r(struct servent_data*);'
13065         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13066         esac
13067         case "$endservent_r_proto" in
13068         ''|0) try='void endservent_r(struct servent_data*);'
13069         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13070         esac
13071         case "$endservent_r_proto" in
13072         ''|0)   d_endservent_r=undef
13073                 endservent_r_proto=0
13074                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13075         * )     case "$endservent_r_proto" in
13076                 REENTRANT_PROTO*) ;;
13077                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13078                 esac
13079                 echo "Prototype: $try" ;;
13080         esac
13081         ;;
13082         *)      case "$usethreads" in
13083                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13084                 esac
13085                 d_endservent_r=undef
13086                 endservent_r_proto=0
13087                 ;;
13088         esac
13089         ;;
13090 *)      endservent_r_proto=0
13091         ;;
13092 esac
13093
13094 : Locate the flags for 'open()'
13095 echo " "
13096 $cat >try.c <<EOCP
13097 #include <sys/types.h>
13098 #ifdef I_FCNTL
13099 #include <fcntl.h>
13100 #endif
13101 #ifdef I_SYS_FILE
13102 #include <sys/file.h>
13103 #endif
13104 #$i_stdlib I_STDLIB
13105 #ifdef I_STDLIB
13106 #include <stdlib.h>
13107 #endif
13108 int main() {
13109         if(O_RDONLY);
13110 #ifdef O_TRUNC
13111         exit(0);
13112 #else
13113         exit(1);
13114 #endif
13115 }
13116 EOCP
13117 : check sys/file.h first to get FREAD on Sun
13118 if $test `./findhdr sys/file.h` && \
13119                 set try -DI_SYS_FILE && eval $compile; then
13120         h_sysfile=true;
13121         echo "<sys/file.h> defines the O_* constants..." >&4
13122         if $run ./try; then
13123                 echo "and you have the 3 argument form of open()." >&4
13124                 val="$define"
13125         else
13126                 echo "but not the 3 argument form of open().  Oh, well." >&4
13127                 val="$undef"
13128         fi
13129 elif $test `./findhdr fcntl.h` && \
13130                 set try -DI_FCNTL && eval $compile; then
13131         h_fcntl=true;
13132         echo "<fcntl.h> defines the O_* constants..." >&4
13133         if $run ./try; then
13134                 echo "and you have the 3 argument form of open()." >&4
13135                 val="$define"
13136         else
13137                 echo "but not the 3 argument form of open().  Oh, well." >&4
13138                 val="$undef"
13139         fi
13140 else
13141         val="$undef"
13142         echo "I can't find the O_* constant definitions!  You got problems." >&4
13143 fi
13144 set d_open3
13145 eval $setvar
13146 $rm_try
13147
13148 : see if this is a sys/file.h system
13149 val=''
13150 set sys/file.h val
13151 eval $inhdr
13152
13153 : do we need to include sys/file.h ?
13154 case "$val" in
13155 "$define")
13156         echo " "
13157         if $h_sysfile; then
13158                 val="$define"
13159                 echo "We'll be including <sys/file.h>." >&4
13160         else
13161                 val="$undef"
13162                 echo "We won't be including <sys/file.h>." >&4
13163         fi
13164         ;;
13165 *)
13166         h_sysfile=false
13167         ;;
13168 esac
13169 set i_sysfile
13170 eval $setvar
13171
13172 : see if fcntl.h is there
13173 val=''
13174 set fcntl.h val
13175 eval $inhdr
13176
13177 : see if we can include fcntl.h
13178 case "$val" in
13179 "$define")
13180         echo " "
13181         if $h_fcntl; then
13182                 val="$define"
13183                 echo "We'll be including <fcntl.h>." >&4
13184         else
13185                 val="$undef"
13186                 if $h_sysfile; then
13187         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13188                 else
13189                         echo "We won't be including <fcntl.h>." >&4
13190                 fi
13191         fi
13192         ;;
13193 *)
13194         h_fcntl=false
13195         val="$undef"
13196         ;;
13197 esac
13198 set i_fcntl
13199 eval $setvar
13200
13201 : see if fork exists
13202 set fork d_fork
13203 eval $inlibc
13204
13205 : see if pipe exists
13206 set pipe d_pipe
13207 eval $inlibc
13208
13209 : check for non-blocking I/O stuff
13210 case "$h_sysfile" in
13211 true) echo "#include <sys/file.h>" > head.c;;
13212 *)
13213        case "$h_fcntl" in
13214        true) echo "#include <fcntl.h>" > head.c;;
13215        *) echo "#include <sys/fcntl.h>" > head.c;;
13216        esac
13217        ;;
13218 esac
13219 echo " "
13220 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13221 case "$o_nonblock" in
13222 '')
13223         $cat head.c > try.c
13224         $cat >>try.c <<EOCP
13225 #include <stdio.h>
13226 #$i_stdlib I_STDLIB
13227 #ifdef I_STDLIB
13228 #include <stdlib.h>
13229 #endif
13230 #$i_fcntl I_FCNTL
13231 #ifdef I_FCNTL
13232 #include <fcntl.h>
13233 #endif
13234 int main() {
13235 #ifdef O_NONBLOCK
13236         printf("O_NONBLOCK\n");
13237         exit(0);
13238 #endif
13239 #ifdef O_NDELAY
13240         printf("O_NDELAY\n");
13241         exit(0);
13242 #endif
13243 #ifdef FNDELAY
13244         printf("FNDELAY\n");
13245         exit(0);
13246 #endif
13247         exit(0);
13248 }
13249 EOCP
13250         set try
13251         if eval $compile_ok; then
13252                 o_nonblock=`$run ./try`
13253                 case "$o_nonblock" in
13254                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13255                 *) echo "Seems like we can use $o_nonblock.";;
13256                 esac
13257         else
13258                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13259         fi
13260         ;;
13261 *) echo "Using $hint value $o_nonblock.";;
13262 esac
13263 $rm_try
13264
13265 echo " "
13266 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13267 case "$eagain" in
13268 '')
13269         case "$d_fork:$d_pipe:$d_alarm" in
13270         define:define:define)
13271         $cat head.c > try.c
13272         $cat >>try.c <<EOCP
13273 #include <errno.h>
13274 #include <sys/types.h>
13275 #include <signal.h>
13276 #include <stdio.h>
13277 #$i_stdlib I_STDLIB
13278 #ifdef I_STDLIB
13279 #include <stdlib.h>
13280 #endif
13281 #$i_fcntl I_FCNTL
13282 #ifdef I_FCNTL
13283 #include <fcntl.h>
13284 #endif
13285 #define MY_O_NONBLOCK $o_nonblock
13286 #ifndef errno  /* XXX need better Configure test */
13287 extern int errno;
13288 #endif
13289 #$i_unistd I_UNISTD
13290 #ifdef I_UNISTD
13291 #include <unistd.h>
13292 #endif
13293 #include <string.h>
13294 $signal_t blech(int x) { exit(3); }
13295 EOCP
13296         $cat >> try.c <<'EOCP'
13297 int main()
13298 {
13299         int pd[2];
13300         int pu[2];
13301         char buf[1];
13302         char string[100];
13303         int ret;
13304
13305         ret = pipe(pd); /* Down: child -> parent */
13306         if (ret != 0)
13307                 exit(3);
13308         ret = pipe(pu); /* Up: parent -> child */
13309         if (ret != 0)
13310                 exit(3);
13311         if (0 != fork()) {
13312                 close(pd[1]);   /* Parent reads from pd[0] */
13313                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13314 #ifdef F_SETFL
13315                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13316                         exit(1);
13317 #else
13318                 exit(4);
13319 #endif
13320                 signal(SIGALRM, blech);
13321                 alarm(5);
13322                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13323                         exit(2);
13324                 sprintf(string, "%d\n", ret);
13325                 ret = write(2, string, strlen(string));
13326                 if (ret != strlen(string))
13327                         exit(3);
13328                 alarm(0);
13329 #ifdef EAGAIN
13330                 if (errno == EAGAIN) {
13331                         printf("EAGAIN\n");
13332                         goto ok;
13333                 }
13334 #endif
13335 #ifdef EWOULDBLOCK
13336                 if (errno == EWOULDBLOCK)
13337                         printf("EWOULDBLOCK\n");
13338 #endif
13339         ok:
13340                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13341                 if (ret != 1)
13342                         exit(3);
13343                 sleep(2);                               /* Give it time to close our pipe */
13344                 alarm(5);
13345                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13346                 alarm(0);
13347                 sprintf(string, "%d\n", ret);
13348                 ret = write(4, string, strlen(string));
13349                 if (ret != strlen(string))
13350                         exit(3);
13351                 exit(0);
13352         }
13353
13354         close(pd[0]);                   /* We write to pd[1] */
13355         close(pu[1]);                   /* We read from pu[0] */
13356         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13357         if (ret != 1)
13358                 exit(3);
13359         close(pd[1]);                   /* Pipe pd is now fully closed! */
13360         exit(0);                                /* Bye bye, thank you for playing! */
13361 }
13362 EOCP
13363         set try
13364         if eval $compile_ok; then
13365                 echo "$startsh" >mtry
13366                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13367                 chmod +x mtry
13368                 $run ./mtry >/dev/null 2>&1
13369                 case $? in
13370                 0) eagain=`$cat try.out`;;
13371                 1) echo "Could not perform non-blocking setting!";;
13372                 2) echo "I did a successful read() for something that was not there!";;
13373                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13374                 4) echo "Could not find F_SETFL!";;
13375                 *) echo "Something terribly wrong happened during testing.";;
13376                 esac
13377                 rd_nodata=`$cat try.ret`
13378                 echo "A read() system call with no data present returns $rd_nodata."
13379                 case "$rd_nodata" in
13380                 0|-1) ;;
13381                 *)
13382                         echo "(That's peculiar, fixing that to be -1.)"
13383                         rd_nodata=-1
13384                         ;;
13385                 esac
13386                 case "$eagain" in
13387                 '')
13388                         echo "Forcing errno EAGAIN on read() with no data available."
13389                         eagain=EAGAIN
13390                         ;;
13391                 *)
13392                         echo "Your read() sets errno to $eagain when no data is available."
13393                         ;;
13394                 esac
13395                 status=`$cat try.err`
13396                 case "$status" in
13397                 0) echo "And it correctly returns 0 to signal EOF.";;
13398                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13399                 *) echo "However, your read() returns '$status' on EOF??";;
13400                 esac
13401                 val="$define"
13402                 if test "$status" = "$rd_nodata"; then
13403                         echo "WARNING: you can't distinguish between EOF and no data!"
13404                         val="$undef"
13405                 fi
13406         else
13407                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13408                 eagain=EAGAIN
13409         fi
13410         ;;
13411         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13412                 eagain=EAGAIN
13413                 val="$define"
13414                 ;;
13415         esac
13416         set d_eofnblk
13417         eval $setvar
13418         ;;
13419 *)
13420         echo "Using $hint value $eagain."
13421         echo "Your read() returns $rd_nodata when no data is present."
13422         case "$d_eofnblk" in
13423         "$define") echo "And you can see EOF because read() returns 0.";;
13424         "$undef") echo "But you can't see EOF status from read() returned value.";;
13425         *)
13426                 echo "(Assuming you can't see EOF status from read anyway.)"
13427                 d_eofnblk=$undef
13428                 ;;
13429         esac
13430         ;;
13431 esac
13432 $rm_try head.c mtry
13433
13434 : see if erf exists
13435 set erf d_erf
13436 eval $inlibc
13437
13438 : see if erfc exists
13439 set erfc d_erfc
13440 eval $inlibc
13441
13442 : see if exp2 exists
13443 set exp2 d_exp2
13444 eval $inlibc
13445
13446 : see if expm1 exists
13447 set expm1 d_expm1
13448 eval $inlibc
13449
13450 : see if _ptr and _cnt from stdio act std
13451 echo " "
13452
13453 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13454         echo "(Looks like you have stdio.h from BSD.)"
13455         case "$stdio_ptr" in
13456         '') stdio_ptr='((fp)->_p)'
13457                 ptr_lval=$define
13458                 ;;
13459         *)      ptr_lval=$d_stdio_ptr_lval;;
13460         esac
13461         case "$stdio_cnt" in
13462         '') stdio_cnt='((fp)->_r)'
13463                 cnt_lval=$define
13464                 ;;
13465         *)      cnt_lval=$d_stdio_cnt_lval;;
13466         esac
13467         case "$stdio_base" in
13468         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13469         esac
13470         case "$stdio_bufsiz" in
13471         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13472         esac
13473 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13474         echo "(Looks like you have stdio.h from Linux.)"
13475         case "$stdio_ptr" in
13476         '') stdio_ptr='((fp)->_IO_read_ptr)'
13477                 ptr_lval=$define
13478                 ;;
13479         *)      ptr_lval=$d_stdio_ptr_lval;;
13480         esac
13481         case "$stdio_cnt" in
13482         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13483                 cnt_lval=$undef
13484                 ;;
13485         *)      cnt_lval=$d_stdio_cnt_lval;;
13486         esac
13487         case "$stdio_base" in
13488         '') stdio_base='((fp)->_IO_read_base)';;
13489         esac
13490         case "$stdio_bufsiz" in
13491         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13492         esac
13493 else
13494         case "$stdio_ptr" in
13495         '') stdio_ptr='((fp)->_ptr)'
13496                 ptr_lval=$define
13497                 ;;
13498         *)      ptr_lval=$d_stdio_ptr_lval;;
13499         esac
13500         case "$stdio_cnt" in
13501         '') stdio_cnt='((fp)->_cnt)'
13502                 cnt_lval=$define
13503                 ;;
13504         *)      cnt_lval=$d_stdio_cnt_lval;;
13505         esac
13506         case "$stdio_base" in
13507         '') stdio_base='((fp)->_base)';;
13508         esac
13509         case "$stdio_bufsiz" in
13510         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13511         esac
13512 fi
13513
13514 : test whether _ptr and _cnt really work
13515 echo "Checking how std your stdio is..." >&4
13516 $cat >try.c <<EOP
13517 #include <stdio.h>
13518 #$i_stdlib I_STDLIB
13519 #ifdef I_STDLIB
13520 #include <stdlib.h>
13521 #endif
13522 #define FILE_ptr(fp)    $stdio_ptr
13523 #define FILE_cnt(fp)    $stdio_cnt
13524 int main() {
13525         FILE *fp = fopen("try.c", "r");
13526         char c = getc(fp);
13527         if (
13528                 18 <= FILE_cnt(fp) &&
13529                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13530         )
13531                 exit(0);
13532         exit(1);
13533 }
13534 EOP
13535 val="$undef"
13536 set try
13537 if eval $compile && $to try.c; then
13538         if $run ./try; then
13539                 echo "Your stdio acts pretty std."
13540                 val="$define"
13541         else
13542                 echo "Your stdio isn't very std."
13543         fi
13544 else
13545         echo "Your stdio doesn't appear very std."
13546 fi
13547 $rm_try
13548
13549 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13550 # direct buffer manipulation no longer works.  The Configure tests
13551 # should be changed to correctly detect this, but until then,
13552 # the following check should at least let perl compile and run.
13553 # (This quick fix should be updated before 5.8.1.)
13554 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13555 # A. Dougherty, June 3, 2002.
13556 case "$d_gnulibc" in
13557 $define)
13558         case "$gnulibc_version" in
13559         2.[01]*)  ;;
13560         2.2) ;;
13561         2.2.[0-9]) ;;
13562         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13563                 val="$undef"
13564                 ;;
13565         esac
13566         ;;
13567 esac
13568 set d_stdstdio
13569 eval $setvar
13570
13571 : Can _ptr be used as an lvalue?
13572 case "$d_stdstdio$ptr_lval" in
13573 $define$define) val=$define ;;
13574 *) val=$undef ;;
13575 esac
13576 set d_stdio_ptr_lval
13577 eval $setvar
13578
13579 : Can _cnt be used as an lvalue?
13580 case "$d_stdstdio$cnt_lval" in
13581 $define$define) val=$define ;;
13582 *) val=$undef ;;
13583 esac
13584 set d_stdio_cnt_lval
13585 eval $setvar
13586
13587
13588 : test whether setting _ptr sets _cnt as a side effect
13589 d_stdio_ptr_lval_sets_cnt="$undef"
13590 d_stdio_ptr_lval_nochange_cnt="$undef"
13591 case "$d_stdio_ptr_lval$d_stdstdio" in
13592 $define$define)
13593         echo "Checking to see what happens if we set the stdio ptr..." >&4
13594 $cat >try.c <<EOP
13595 #include <stdio.h>
13596 /* Can we scream? */
13597 /* Eat dust sed :-) */
13598 /* In the buffer space, no one can hear you scream. */
13599 #$i_stdlib I_STDLIB
13600 #ifdef I_STDLIB
13601 #include <stdlib.h>
13602 #endif
13603 #define FILE_ptr(fp)    $stdio_ptr
13604 #define FILE_cnt(fp)    $stdio_cnt
13605 #include <sys/types.h>
13606 int main() {
13607         FILE *fp = fopen("try.c", "r");
13608         int c;
13609         char *ptr;
13610         size_t cnt;
13611         if (!fp) {
13612             puts("Fail even to read");
13613             exit(1);
13614         }
13615         c = getc(fp); /* Read away the first # */
13616         if (c == EOF) {
13617             puts("Fail even to read");
13618             exit(1);
13619         }
13620         if (!(
13621                 18 <= FILE_cnt(fp) &&
13622                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13623         )) {
13624                 puts("Fail even to read");
13625                 exit (1);
13626         }
13627         ptr = (char*) FILE_ptr(fp);
13628         cnt = (size_t)FILE_cnt(fp);
13629
13630         FILE_ptr(fp) += 42;
13631
13632         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13633                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13634                 exit (1);
13635         }
13636         if (FILE_cnt(fp) <= 20) {
13637                 printf ("Fail (<20 chars to test)");
13638                 exit (1);
13639         }
13640         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13641                 puts("Fail compare");
13642                 exit (1);
13643         }
13644         if (cnt == FILE_cnt(fp)) {
13645                 puts("Pass_unchanged");
13646                 exit (0);
13647         }
13648         if (FILE_cnt(fp) == (cnt - 42)) {
13649                 puts("Pass_changed");
13650                 exit (0);
13651         }
13652         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13653         return 1;
13654
13655 }
13656 EOP
13657         set try
13658         if eval $compile && $to try.c; then
13659                 case `$run ./try` in
13660                 Pass_changed)
13661                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13662                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13663                 Pass_unchanged)
13664                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13665                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13666                 Fail*)
13667                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13668                 *)
13669                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13670         esac
13671         else
13672                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13673         fi
13674         $rm_try
13675         ;;
13676 esac
13677
13678 : see if _base is also standard
13679 val="$undef"
13680 case "$d_stdstdio" in
13681 $define)
13682         $cat >try.c <<EOP
13683 #include <stdio.h>
13684 #$i_stdlib I_STDLIB
13685 #ifdef I_STDLIB
13686 #include <stdlib.h>
13687 #endif
13688 #define FILE_base(fp)   $stdio_base
13689 #define FILE_bufsiz(fp) $stdio_bufsiz
13690 int main() {
13691         FILE *fp = fopen("try.c", "r");
13692         char c = getc(fp);
13693         if (
13694                 19 <= FILE_bufsiz(fp) &&
13695                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13696         )
13697                 exit(0);
13698         exit(1);
13699 }
13700 EOP
13701         set try
13702         if eval $compile && $to try.c; then
13703                 if $run ./try; then
13704                         echo "And its _base field acts std."
13705                         val="$define"
13706                 else
13707                         echo "But its _base field isn't std."
13708                 fi
13709         else
13710                 echo "However, it seems to be lacking the _base field."
13711         fi
13712         $rm_try
13713         ;;
13714 esac
13715 set d_stdiobase
13716 eval $setvar
13717
13718 : see if fast_stdio exists
13719 val="$undef"
13720 case "$d_stdstdio:$d_stdio_ptr_lval" in
13721 "$define:$define")
13722         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13723         *$define*)
13724                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13725                 val="$define"
13726                 ;;
13727         esac
13728         ;;
13729 esac
13730 set d_faststdio
13731 eval $setvar
13732
13733 : see if fchdir exists
13734 set fchdir d_fchdir
13735 eval $inlibc
13736
13737 : see if fchmod exists
13738 set fchmod d_fchmod
13739 eval $inlibc
13740
13741 : check for openat, unlinkat, renameat, linkat, fchmodat
13742 set openat d_openat
13743 eval $inlibc
13744
13745 set unlinkat d_unlinkat
13746 eval $inlibc
13747
13748 set renameat d_renameat
13749 eval $inlibc
13750
13751 set linkat d_linkat
13752 eval $inlibc
13753
13754 set fchmodat d_fchmodat
13755 eval $inlibc
13756
13757 : see if fchown exists
13758 set fchown d_fchown
13759 eval $inlibc
13760
13761 : see if this is an fcntl system
13762 set fcntl d_fcntl
13763 eval $inlibc
13764
13765 : See if fcntl-based locking works.
13766 echo " "
13767 $cat >try.c <<EOCP
13768 #$i_stdlib I_STDLIB
13769 #ifdef I_STDLIB
13770 #include <stdlib.h>
13771 #endif
13772 #include <unistd.h>
13773 #include <fcntl.h>
13774 #include <signal.h>
13775 $signal_t blech(int x) { exit(3); }
13776 int main() {
13777 #if defined(F_SETLK) && defined(F_SETLKW)
13778      struct flock flock;
13779      int retval, fd;
13780      fd = open("try.c", O_RDONLY);
13781      flock.l_type = F_RDLCK;
13782      flock.l_whence = SEEK_SET;
13783      flock.l_start = flock.l_len = 0;
13784      signal(SIGALRM, blech);
13785      alarm(10);
13786      retval = fcntl(fd, F_SETLK, &flock);
13787      close(fd);
13788      (retval < 0 ? exit(2) : exit(0));
13789 #else
13790      exit(2);
13791 #endif
13792 }
13793 EOCP
13794 echo "Checking if fcntl-based file locking works... "
13795 case "$d_fcntl" in
13796 "$define")
13797         set try
13798         if eval $compile_ok; then
13799                 if $run ./try; then
13800                         echo "Yes, it seems to work."
13801                         val="$define"
13802                 else
13803                         echo "Nope, it didn't work."
13804                         val="$undef"
13805                         case "$?" in
13806                         3) $cat >&4 <<EOM
13807 ***
13808 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13809 *** This is (almost) impossible.
13810 *** If your NFS lock daemons are not feeling well, something like
13811 *** this may happen, please investigate.  Cannot continue, aborting.
13812 ***
13813 EOM
13814                                 exit 1
13815                                 ;;
13816                         esac
13817                 fi
13818         else
13819                 echo "I'm unable to compile the test program, so I'll assume not."
13820                 val="$undef"
13821         fi
13822         ;;
13823 *) val="$undef";
13824         echo "Nope, since you don't even have fcntl()."
13825         ;;
13826 esac
13827 set d_fcntl_can_lock
13828 eval $setvar
13829 $rm_try
13830
13831 : check for fd_set items
13832 $cat <<EOM
13833
13834 Checking to see how well your C compiler handles fd_set and friends ...
13835 EOM
13836 $cat >try.c <<EOCP
13837 #$i_stdlib I_STDLIB
13838 #ifdef I_STDLIB
13839 #include <stdlib.h>
13840 #endif
13841 #$i_systime I_SYS_TIME
13842 #$i_sysselct I_SYS_SELECT
13843 #$d_socket HAS_SOCKET
13844 #include <sys/types.h>
13845 #ifdef HAS_SOCKET
13846 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13847 #endif
13848 #ifdef I_SYS_TIME
13849 #include <sys/time.h>
13850 #endif
13851 #ifdef I_SYS_SELECT
13852 #include <sys/select.h>
13853 #endif
13854 int main() {
13855         fd_set fds;
13856
13857 #ifdef TRYBITS
13858         if(fds.fds_bits);
13859 #endif
13860
13861 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13862         exit(0);
13863 #else
13864         exit(1);
13865 #endif
13866 }
13867 EOCP
13868 set try -DTRYBITS
13869 if eval $compile; then
13870         d_fds_bits="$define"
13871         d_fd_set="$define"
13872         echo "Well, your system knows about the normal fd_set typedef..." >&4
13873         if $run ./try; then
13874                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13875                 d_fd_macros="$define"
13876         else
13877                 $cat >&4 <<'EOM'
13878 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13879 EOM
13880                 d_fd_macros="$undef"
13881         fi
13882 else
13883         $cat <<'EOM'
13884 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13885 EOM
13886         set try
13887         if eval $compile; then
13888                 d_fds_bits="$undef"
13889                 d_fd_set="$define"
13890                 echo "Well, your system has some sort of fd_set available..." >&4
13891                 if $run ./try; then
13892                         echo "and you have the normal fd_set macros." >&4
13893                         d_fd_macros="$define"
13894                 else
13895                         $cat <<'EOM'
13896 but not the normal fd_set macros!  Gross!  More work for me...
13897 EOM
13898                         d_fd_macros="$undef"
13899                 fi
13900         else
13901         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13902                 d_fd_set="$undef"
13903                 d_fds_bits="$undef"
13904                 d_fd_macros="$undef"
13905         fi
13906 fi
13907 $rm_try
13908
13909 : see if fdclose exists
13910 set fdclose d_fdclose
13911 eval $inlibc
13912
13913 : see if fdim exists
13914 set fdim d_fdim
13915 eval $inlibc
13916
13917 : see if fegetround exists
13918 set fegetround d_fegetround
13919 eval $inlibc
13920
13921 : see if fgetpos exists
13922 set fgetpos d_fgetpos
13923 eval $inlibc
13924
13925 : see if finite exists
13926 set finite d_finite
13927 eval $inlibc
13928
13929 : see if finitel exists
13930 set finitel d_finitel
13931 eval $inlibc
13932
13933 : see if flock exists
13934 set flock d_flock
13935 eval $inlibc
13936
13937 : see if prototype for flock is available
13938 echo " "
13939 set d_flockproto flock $i_sysfile sys/file.h
13940 eval $hasproto
13941
13942 : see if fma exists
13943 set fma d_fma
13944 eval $inlibc
13945
13946 : see if fmax exists
13947 set fmax d_fmax
13948 eval $inlibc
13949
13950 : see if fmin exists
13951 set fmin d_fmin
13952 eval $inlibc
13953
13954 : see if fp_class exists
13955 set fp_class d_fp_class
13956 eval $inlibc
13957
13958 : check for fpclassify
13959 echo "Checking to see if you have fpclassify..." >&4
13960 $cat >try.c <<EOCP
13961 #include <math.h>
13962 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13963 EOCP
13964 set try
13965 if eval $compile; then
13966         val="$define"
13967         echo "You have fpclassify."
13968 else
13969         val="$undef"
13970         echo "You do not have fpclassify."
13971 fi
13972 $rm_try
13973 set d_fpclassify
13974 eval $setvar
13975
13976 : see if fp_classify exists
13977 set fp_classify d_fp_classify
13978 eval $inlibc
13979
13980 : see if fp_classl exists
13981 set fp_classl d_fp_classl
13982 eval $inlibc
13983
13984 : see if pathconf exists
13985 set pathconf d_pathconf
13986 eval $inlibc
13987
13988 : see if fpathconf exists
13989 set fpathconf d_fpathconf
13990 eval $inlibc
13991
13992 : see if fpclass exists
13993 set fpclass d_fpclass
13994 eval $inlibc
13995
13996 : see if fpclassl exists
13997 set fpclassl d_fpclassl
13998 eval $inlibc
13999
14000 : see if fpgetround exists
14001 set fpgetround d_fpgetround
14002 eval $inlibc
14003
14004 : check for fpos64_t
14005 echo " "
14006 echo "Checking to see if you have fpos64_t..." >&4
14007 $cat >try.c <<EOCP
14008 #include <stdio.h>
14009 int main() { fpos64_t x = 7; }
14010 EOCP
14011 set try
14012 if eval $compile; then
14013         val="$define"
14014         echo "You have fpos64_t."
14015 else
14016         val="$undef"
14017         echo "You do not have fpos64_t."
14018         case "$fpossize" in
14019         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14020         esac
14021 fi
14022 $rm_try
14023 set d_fpos64_t
14024 eval $setvar
14025
14026 : see if frexpl exists
14027 set frexpl d_frexpl
14028 eval $inlibc
14029
14030 : see if this is a sys/param system
14031 set sys/param.h i_sysparam
14032 eval $inhdr
14033
14034 : see if this is a sys/mount.h system
14035 set sys/mount.h i_sysmount
14036 eval $inhdr
14037
14038 : Check for fs_data_s
14039 echo " "
14040 echo "Checking to see if your system supports struct fs_data..." >&4
14041 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14042 eval $hasstruct
14043 case "$d_fs_data_s" in
14044 "$define")      echo "Yes, it does."   ;;
14045 *)              echo "No, it doesn't." ;;
14046 esac
14047
14048 : see if fseeko exists
14049 set fseeko d_fseeko
14050 eval $inlibc
14051 case "$longsize" in
14052 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14053 esac
14054
14055 : see if fsetpos exists
14056 set fsetpos d_fsetpos
14057 eval $inlibc
14058
14059 : see if fstatfs exists
14060 set fstatfs d_fstatfs
14061 eval $inlibc
14062
14063 : see if statvfs exists
14064 set statvfs d_statvfs
14065 eval $inlibc
14066
14067 : see if fstatvfs exists
14068 set fstatvfs d_fstatvfs
14069 eval $inlibc
14070
14071 : see if fsync exists
14072 set fsync d_fsync
14073 eval $inlibc
14074
14075 : see if ftello exists
14076 set ftello d_ftello
14077 eval $inlibc
14078 case "$longsize" in
14079 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14080 esac
14081
14082 : check for a working futimes
14083 d_futimes="$undef"
14084 echo " "
14085 echo "Checking if you have a working futimes()" >&4
14086 $cat >try.c <<EOCP
14087 #include <stdio.h>
14088 #include <stdlib.h>
14089 #include <sys/time.h>
14090 #include <errno.h>
14091 #include <fcntl.h>
14092 #include <stdlib.h>
14093
14094 int main ()
14095 {
14096     int fd, rv;
14097     fd = open ("try.c", O_RDWR);
14098     if (-1 == fd) exit (1);
14099     rv = futimes (fd, NULL);
14100     exit (rv == -1 ? errno : 0);
14101 }
14102 EOCP
14103 set try
14104 if eval $compile; then
14105     `$run ./try`
14106     rc=$?
14107     case "$rc" in
14108         0)  echo "Yes, you have" >&4
14109             d_futimes="$define"
14110             ;;
14111         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14112             ;;
14113     esac
14114 else
14115     echo "No, it does not (probably harmless)" >&4
14116 fi
14117 $rm_try
14118
14119 : look for gai_strerror
14120 echo " "
14121 $cat >try.c <<'EOCP'
14122 #include <sys/types.h>
14123 #include <sys/socket.h>
14124 #include <netdb.h>
14125 int main ()
14126 {
14127     return (gai_strerror (0) ? 0 : 1);
14128     }
14129 EOCP
14130 set try
14131 val="$undef"
14132 if eval $compile; then
14133     `$run ./try`
14134     case "$?" in
14135         0)  echo "A working gai_strerror() found." >&4
14136             val="$define" ;;
14137         *)  echo "gai_strerror() found, but it doesn't work" >&4
14138             ;;
14139         esac
14140 else
14141     echo "gai_strerror() NOT found." >&4
14142     fi
14143 set d_gai_strerror
14144 eval $setvar
14145 $rm_try
14146
14147 : see if ndbm.h is available
14148 set ndbm.h i_ndbm
14149 eval $inhdr
14150 : Compatibility location for RedHat 7.1
14151 set gdbm/ndbm.h i_gdbmndbm
14152 eval $inhdr
14153 : Compatibility location for Debian 4.0
14154 set gdbm-ndbm.h i_gdbm_ndbm
14155 eval $inhdr
14156
14157 val="$undef"
14158 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14159         : see if dbm_open exists
14160         set dbm_open d_dbm_open
14161         eval $inlibc
14162         case "$d_dbm_open" in
14163         $undef)
14164                 i_ndbm="$undef"
14165                 i_gdbmndbm="$undef"
14166                 i_gdbm_ndbm="$undef"
14167                 echo "We won't be including <ndbm.h>"
14168                 val="$undef"
14169                 ;;
14170         *) val="$define"
14171            ;;
14172         esac
14173 fi
14174 set d_ndbm
14175 eval $setvar
14176
14177 ndbm_hdr_protochk='name=$1; hdr=$2;
14178 eval "ihdr=\$""i_$name";
14179 val="$undef";
14180 if $test "$ihdr" = "$define"; then
14181         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14182         case "$d_cplusplus" in
14183         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14184         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14185         esac;
14186         case "$val" in
14187         $define) $echo "Your <$hdr> seems to have prototypes";;
14188         *) $echo "Your <$hdr> does not seem to have prototypes";;
14189         esac;
14190 fi;
14191 set "d_${name}_h_uses_prototypes";
14192 eval $setvar'
14193
14194 set ndbm ndbm.h
14195 eval $ndbm_hdr_protochk
14196 set gdbmndbm gdbm/ndbm.h
14197 eval $ndbm_hdr_protochk
14198 set gdbm_ndbm gdbm-ndbm.h
14199 eval $ndbm_hdr_protochk
14200
14201 : see if getaddrinfo exists
14202 set getaddrinfo d_getaddrinfo
14203 eval $inlibc
14204
14205 : see if getcwd exists
14206 set getcwd d_getcwd
14207 eval $inlibc
14208
14209 : see if getespwnam exists
14210 set getespwnam d_getespwnam
14211 eval $inlibc
14212
14213 : see if getfsstat exists
14214 set getfsstat d_getfsstat
14215 eval $inlibc
14216
14217 : see if getgrent exists
14218 set getgrent d_getgrent
14219 eval $inlibc
14220
14221 : see if getgrent_r exists
14222 set getgrent_r d_getgrent_r
14223 eval $inlibc
14224 case "$d_getgrent_r" in
14225 "$define")
14226         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14227         case "$d_getgrent_r_proto:$usethreads" in
14228         ":define")      d_getgrent_r_proto=define
14229                 set d_getgrent_r_proto getgrent_r $hdrs
14230                 eval $hasproto ;;
14231         *)      ;;
14232         esac
14233         case "$d_getgrent_r_proto" in
14234         define)
14235         case "$getgrent_r_proto" in
14236         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14237         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14238         esac
14239         case "$getgrent_r_proto" in
14240         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14241         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14242         esac
14243         case "$getgrent_r_proto" in
14244         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14245         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14246         esac
14247         case "$getgrent_r_proto" in
14248         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14249         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14250         esac
14251         case "$getgrent_r_proto" in
14252         ''|0) try='int getgrent_r(struct group*, char*, int);'
14253         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14254         esac
14255         case "$getgrent_r_proto" in
14256         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14257         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14258         esac
14259         case "$getgrent_r_proto" in
14260         ''|0)   d_getgrent_r=undef
14261                 getgrent_r_proto=0
14262                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14263         * )     case "$getgrent_r_proto" in
14264                 REENTRANT_PROTO*) ;;
14265                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14266                 esac
14267                 echo "Prototype: $try" ;;
14268         esac
14269         ;;
14270         *)      case "$usethreads" in
14271                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14272                 esac
14273                 d_getgrent_r=undef
14274                 getgrent_r_proto=0
14275                 ;;
14276         esac
14277         ;;
14278 *)      getgrent_r_proto=0
14279         ;;
14280 esac
14281
14282 : see if getgrgid_r exists
14283 set getgrgid_r d_getgrgid_r
14284 eval $inlibc
14285 case "$d_getgrgid_r" in
14286 "$define")
14287         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14288         case "$d_getgrgid_r_proto:$usethreads" in
14289         ":define")      d_getgrgid_r_proto=define
14290                 set d_getgrgid_r_proto getgrgid_r $hdrs
14291                 eval $hasproto ;;
14292         *)      ;;
14293         esac
14294         case "$d_getgrgid_r_proto" in
14295         define)
14296         case "$getgrgid_r_proto" in
14297         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14298         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14299         esac
14300         case "$getgrgid_r_proto" in
14301         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14302         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14303         esac
14304         case "$getgrgid_r_proto" in
14305         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14306         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14307         esac
14308         case "$getgrgid_r_proto" in
14309         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14310         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14311         esac
14312         case "$getgrgid_r_proto" in
14313         ''|0)   d_getgrgid_r=undef
14314                 getgrgid_r_proto=0
14315                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14316         * )     case "$getgrgid_r_proto" in
14317                 REENTRANT_PROTO*) ;;
14318                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14319                 esac
14320                 echo "Prototype: $try" ;;
14321         esac
14322         ;;
14323         *)      case "$usethreads" in
14324                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14325                 esac
14326                 d_getgrgid_r=undef
14327                 getgrgid_r_proto=0
14328                 ;;
14329         esac
14330         ;;
14331 *)      getgrgid_r_proto=0
14332         ;;
14333 esac
14334
14335 : see if getgrnam_r exists
14336 set getgrnam_r d_getgrnam_r
14337 eval $inlibc
14338 case "$d_getgrnam_r" in
14339 "$define")
14340         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14341         case "$d_getgrnam_r_proto:$usethreads" in
14342         ":define")      d_getgrnam_r_proto=define
14343                 set d_getgrnam_r_proto getgrnam_r $hdrs
14344                 eval $hasproto ;;
14345         *)      ;;
14346         esac
14347         case "$d_getgrnam_r_proto" in
14348         define)
14349         case "$getgrnam_r_proto" in
14350         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14351         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14352         esac
14353         case "$getgrnam_r_proto" in
14354         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14355         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14356         esac
14357         case "$getgrnam_r_proto" in
14358         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14359         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14360         esac
14361         case "$getgrnam_r_proto" in
14362         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14363         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14364         esac
14365         case "$getgrnam_r_proto" in
14366         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14367         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14368         esac
14369         case "$getgrnam_r_proto" in
14370         ''|0)   d_getgrnam_r=undef
14371                 getgrnam_r_proto=0
14372                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14373         * )     case "$getgrnam_r_proto" in
14374                 REENTRANT_PROTO*) ;;
14375                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14376                 esac
14377                 echo "Prototype: $try" ;;
14378         esac
14379         ;;
14380         *)      case "$usethreads" in
14381                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14382                 esac
14383                 d_getgrnam_r=undef
14384                 getgrnam_r_proto=0
14385                 ;;
14386         esac
14387         ;;
14388 *)      getgrnam_r_proto=0
14389         ;;
14390 esac
14391
14392 : see if gethostbyaddr exists
14393 set gethostbyaddr d_gethbyaddr
14394 eval $inlibc
14395
14396 : see if gethostbyname exists
14397 set gethostbyname d_gethbyname
14398 eval $inlibc
14399
14400 : see if gethostent exists
14401 set gethostent d_gethent
14402 eval $inlibc
14403
14404 : see how we will look up host name
14405 echo " "
14406 call=''
14407 if set gethostname val -f d_gethname; eval $csym; $val; then
14408         echo 'gethostname() found.' >&4
14409         d_gethname="$define"
14410         call=gethostname
14411 fi
14412 if set uname val -f d_uname; eval $csym; $val; then
14413         if ./xenix; then
14414                 $cat <<'EOM'
14415 uname() was found, but you're running xenix, and older versions of xenix
14416 have a broken uname(). If you don't really know whether your xenix is old
14417 enough to have a broken system call, use the default answer.
14418
14419 EOM
14420                 dflt=y
14421                 case "$d_uname" in
14422                 "$define") dflt=n;;
14423                 esac
14424                 rp='Is your uname() broken?'
14425                 . ./myread
14426                 case "$ans" in
14427                 n*) d_uname="$define"; call=uname;;
14428                 esac
14429         else
14430                 echo 'uname() found.' >&4
14431                 d_uname="$define"
14432                 case "$call" in
14433                 '') call=uname ;;
14434                 esac
14435         fi
14436 fi
14437 case "$d_gethname" in
14438 '') d_gethname="$undef";;
14439 esac
14440 case "$d_uname" in
14441 '') d_uname="$undef";;
14442 esac
14443 case "$d_uname$d_gethname" in
14444 *define*)
14445         dflt=n
14446         cat <<EOM
14447
14448 Every now and then someone has a $call() that lies about the hostname
14449 but can't be fixed for political or economic reasons.  If you wish, I can
14450 pretend $call() isn't there and maybe compute hostname at run-time
14451 thanks to the '$phostname' command.
14452
14453 EOM
14454         rp="Shall I ignore $call() from now on?"
14455         . ./myread
14456         case "$ans" in
14457         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14458         esac;;
14459 esac
14460 case "$phostname" in
14461 '') aphostname='';;
14462 *) case "$aphostname" in
14463         /*) ;;
14464         *) set X $phostname
14465                 shift
14466                 file=$1
14467                 shift
14468                 file=`./loc $file $file $pth`
14469                 aphostname=`echo $file $*`
14470                 ;;
14471         esac
14472         ;;
14473 esac
14474 case "$d_uname$d_gethname" in
14475 *define*) ;;
14476 *)
14477         case "$phostname" in
14478         '')
14479                 echo "There will be no way for $package to get your hostname." >&4;;
14480         *)
14481         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14482                 ;;
14483         esac;;
14484 esac
14485 case "$d_phostname" in
14486 '') d_phostname="$undef";;
14487 esac
14488
14489 : see if gethostbyaddr_r exists
14490 set gethostbyaddr_r d_gethostbyaddr_r
14491 eval $inlibc
14492 case "$d_gethostbyaddr_r" in
14493 "$define")
14494         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14495         case "$d_gethostbyaddr_r_proto:$usethreads" in
14496         ":define")      d_gethostbyaddr_r_proto=define
14497                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14498                 eval $hasproto ;;
14499         *)      ;;
14500         esac
14501         case "$d_gethostbyaddr_r_proto" in
14502         define)
14503         case "$gethostbyaddr_r_proto" in
14504         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14505         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14506         esac
14507         case "$gethostbyaddr_r_proto" in
14508         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14509         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14510         esac
14511         case "$gethostbyaddr_r_proto" in
14512         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14513         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14514         esac
14515         case "$gethostbyaddr_r_proto" in
14516         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14517         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14518         esac
14519         case "$gethostbyaddr_r_proto" in
14520         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14521         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14522         esac
14523         case "$gethostbyaddr_r_proto" in
14524         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14525         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14526         esac
14527         case "$gethostbyaddr_r_proto" in
14528         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14529         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14530         esac
14531         case "$gethostbyaddr_r_proto" in
14532         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14533         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14534         esac
14535         case "$gethostbyaddr_r_proto" in
14536         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14537         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14538         esac
14539         case "$gethostbyaddr_r_proto" in
14540         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14541         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14542         esac
14543         case "$gethostbyaddr_r_proto" in
14544         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14545         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14546         esac
14547         case "$gethostbyaddr_r_proto" in
14548         ''|0)   d_gethostbyaddr_r=undef
14549                 gethostbyaddr_r_proto=0
14550                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14551         * )     case "$gethostbyaddr_r_proto" in
14552                 REENTRANT_PROTO*) ;;
14553                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14554                 esac
14555                 echo "Prototype: $try" ;;
14556         esac
14557         ;;
14558         *)      case "$usethreads" in
14559                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14560                 esac
14561                 d_gethostbyaddr_r=undef
14562                 gethostbyaddr_r_proto=0
14563                 ;;
14564         esac
14565         ;;
14566 *)      gethostbyaddr_r_proto=0
14567         ;;
14568 esac
14569
14570 : see if gethostbyname_r exists
14571 set gethostbyname_r d_gethostbyname_r
14572 eval $inlibc
14573 case "$d_gethostbyname_r" in
14574 "$define")
14575         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14576         case "$d_gethostbyname_r_proto:$usethreads" in
14577         ":define")      d_gethostbyname_r_proto=define
14578                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14579                 eval $hasproto ;;
14580         *)      ;;
14581         esac
14582         case "$d_gethostbyname_r_proto" in
14583         define)
14584         case "$gethostbyname_r_proto" in
14585         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14586         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14587         esac
14588         case "$gethostbyname_r_proto" in
14589         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14590         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14591         esac
14592         case "$gethostbyname_r_proto" in
14593         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14594         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14595         esac
14596         case "$gethostbyname_r_proto" in
14597         ''|0)   d_gethostbyname_r=undef
14598                 gethostbyname_r_proto=0
14599                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14600         * )     case "$gethostbyname_r_proto" in
14601                 REENTRANT_PROTO*) ;;
14602                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14603                 esac
14604                 echo "Prototype: $try" ;;
14605         esac
14606         ;;
14607         *)      case "$usethreads" in
14608                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14609                 esac
14610                 d_gethostbyname_r=undef
14611                 gethostbyname_r_proto=0
14612                 ;;
14613         esac
14614         ;;
14615 *)      gethostbyname_r_proto=0
14616         ;;
14617 esac
14618
14619 : see if gethostent_r exists
14620 set gethostent_r d_gethostent_r
14621 eval $inlibc
14622 case "$d_gethostent_r" in
14623 "$define")
14624         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14625         case "$d_gethostent_r_proto:$usethreads" in
14626         ":define")      d_gethostent_r_proto=define
14627                 set d_gethostent_r_proto gethostent_r $hdrs
14628                 eval $hasproto ;;
14629         *)      ;;
14630         esac
14631         case "$d_gethostent_r_proto" in
14632         define)
14633         case "$gethostent_r_proto" in
14634         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14635         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14636         esac
14637         case "$gethostent_r_proto" in
14638         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14639         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14640         esac
14641         case "$gethostent_r_proto" in
14642         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14643         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14644         esac
14645         case "$gethostent_r_proto" in
14646         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14647         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14648         esac
14649         case "$gethostent_r_proto" in
14650         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14651         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14652         esac
14653         case "$gethostent_r_proto" in
14654         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14655         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14656         esac
14657         case "$gethostent_r_proto" in
14658         ''|0)   d_gethostent_r=undef
14659                 gethostent_r_proto=0
14660                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14661         * )     case "$gethostent_r_proto" in
14662                 REENTRANT_PROTO*) ;;
14663                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14664                 esac
14665                 echo "Prototype: $try" ;;
14666         esac
14667         ;;
14668         *)      case "$usethreads" in
14669                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14670                 esac
14671                 d_gethostent_r=undef
14672                 gethostent_r_proto=0
14673                 ;;
14674         esac
14675         ;;
14676 *)      gethostent_r_proto=0
14677         ;;
14678 esac
14679
14680 : see if prototypes for various gethostxxx netdb.h functions are available
14681 echo " "
14682 set d_gethostprotos gethostent $i_netdb netdb.h
14683 eval $hasproto
14684
14685 : see if getitimer exists
14686 set getitimer d_getitimer
14687 eval $inlibc
14688
14689 : see if getlogin exists
14690 set getlogin d_getlogin
14691 eval $inlibc
14692
14693 : see if getlogin_r exists
14694 set getlogin_r d_getlogin_r
14695 eval $inlibc
14696 case "$d_getlogin_r" in
14697 "$define")
14698         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14699         case "$d_getlogin_r_proto:$usethreads" in
14700         ":define")      d_getlogin_r_proto=define
14701                 set d_getlogin_r_proto getlogin_r $hdrs
14702                 eval $hasproto ;;
14703         *)      ;;
14704         esac
14705         case "$d_getlogin_r_proto" in
14706         define)
14707         case "$getlogin_r_proto" in
14708         ''|0) try='int getlogin_r(char*, size_t);'
14709         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14710         esac
14711         case "$getlogin_r_proto" in
14712         ''|0) try='int getlogin_r(char*, int);'
14713         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14714         esac
14715         case "$getlogin_r_proto" in
14716         ''|0) try='char* getlogin_r(char*, size_t);'
14717         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14718         esac
14719         case "$getlogin_r_proto" in
14720         ''|0) try='char* getlogin_r(char*, int);'
14721         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14722         esac
14723         case "$getlogin_r_proto" in
14724         ''|0)   d_getlogin_r=undef
14725                 getlogin_r_proto=0
14726                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14727         * )     case "$getlogin_r_proto" in
14728                 REENTRANT_PROTO*) ;;
14729                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14730                 esac
14731                 echo "Prototype: $try" ;;
14732         esac
14733         ;;
14734         *)      case "$usethreads" in
14735                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14736                 esac
14737                 d_getlogin_r=undef
14738                 getlogin_r_proto=0
14739                 ;;
14740         esac
14741         ;;
14742 *)      getlogin_r_proto=0
14743         ;;
14744 esac
14745
14746 : see if getmnt exists
14747 set getmnt d_getmnt
14748 eval $inlibc
14749
14750 : see if getmntent exists
14751 set getmntent d_getmntent
14752 eval $inlibc
14753
14754 : see if getnameinfo exists
14755 set getnameinfo d_getnameinfo
14756 eval $inlibc
14757
14758 : see if getnetbyaddr exists
14759 set getnetbyaddr d_getnbyaddr
14760 eval $inlibc
14761
14762 : see if getnetbyname exists
14763 set getnetbyname d_getnbyname
14764 eval $inlibc
14765
14766 : see if getnetent exists
14767 set getnetent d_getnent
14768 eval $inlibc
14769
14770 : see if getnetbyaddr_r exists
14771 set getnetbyaddr_r d_getnetbyaddr_r
14772 eval $inlibc
14773 case "$d_getnetbyaddr_r" in
14774 "$define")
14775         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14776         case "$d_getnetbyaddr_r_proto:$usethreads" in
14777         ":define")      d_getnetbyaddr_r_proto=define
14778                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14779                 eval $hasproto ;;
14780         *)      ;;
14781         esac
14782         case "$d_getnetbyaddr_r_proto" in
14783         define)
14784         case "$getnetbyaddr_r_proto" in
14785         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14786         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14787         esac
14788         case "$getnetbyaddr_r_proto" in
14789         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14790         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14791         esac
14792         case "$getnetbyaddr_r_proto" in
14793         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14794         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14795         esac
14796         case "$getnetbyaddr_r_proto" in
14797         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14798         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14799         esac
14800         case "$getnetbyaddr_r_proto" in
14801         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14802         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14803         esac
14804         case "$getnetbyaddr_r_proto" in
14805         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14806         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14807         esac
14808         case "$getnetbyaddr_r_proto" in
14809         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14810         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14811         esac
14812         case "$getnetbyaddr_r_proto" in
14813         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14814         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14815         esac
14816         case "$getnetbyaddr_r_proto" in
14817         ''|0)   d_getnetbyaddr_r=undef
14818                 getnetbyaddr_r_proto=0
14819                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14820         * )     case "$getnetbyaddr_r_proto" in
14821                 REENTRANT_PROTO*) ;;
14822                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14823                 esac
14824                 echo "Prototype: $try" ;;
14825         esac
14826         ;;
14827         *)      case "$usethreads" in
14828                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14829                 esac
14830                 d_getnetbyaddr_r=undef
14831                 getnetbyaddr_r_proto=0
14832                 ;;
14833         esac
14834         ;;
14835 *)      getnetbyaddr_r_proto=0
14836         ;;
14837 esac
14838
14839 : see if getnetbyname_r exists
14840 set getnetbyname_r d_getnetbyname_r
14841 eval $inlibc
14842 case "$d_getnetbyname_r" in
14843 "$define")
14844         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14845         case "$d_getnetbyname_r_proto:$usethreads" in
14846         ":define")      d_getnetbyname_r_proto=define
14847                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14848                 eval $hasproto ;;
14849         *)      ;;
14850         esac
14851         case "$d_getnetbyname_r_proto" in
14852         define)
14853         case "$getnetbyname_r_proto" in
14854         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14855         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14856         esac
14857         case "$getnetbyname_r_proto" in
14858         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14859         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14860         esac
14861         case "$getnetbyname_r_proto" in
14862         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14863         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14864         esac
14865         case "$getnetbyname_r_proto" in
14866         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14867         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14868         esac
14869         case "$getnetbyname_r_proto" in
14870         ''|0)   d_getnetbyname_r=undef
14871                 getnetbyname_r_proto=0
14872                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14873         * )     case "$getnetbyname_r_proto" in
14874                 REENTRANT_PROTO*) ;;
14875                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14876                 esac
14877                 echo "Prototype: $try" ;;
14878         esac
14879         ;;
14880         *)      case "$usethreads" in
14881                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14882                 esac
14883                 d_getnetbyname_r=undef
14884                 getnetbyname_r_proto=0
14885                 ;;
14886         esac
14887         ;;
14888 *)      getnetbyname_r_proto=0
14889         ;;
14890 esac
14891
14892 : see if getnetent_r exists
14893 set getnetent_r d_getnetent_r
14894 eval $inlibc
14895 case "$d_getnetent_r" in
14896 "$define")
14897         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14898         case "$d_getnetent_r_proto:$usethreads" in
14899         ":define")      d_getnetent_r_proto=define
14900                 set d_getnetent_r_proto getnetent_r $hdrs
14901                 eval $hasproto ;;
14902         *)      ;;
14903         esac
14904         case "$d_getnetent_r_proto" in
14905         define)
14906         case "$getnetent_r_proto" in
14907         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14908         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14909         esac
14910         case "$getnetent_r_proto" in
14911         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14912         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14913         esac
14914         case "$getnetent_r_proto" in
14915         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14916         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14917         esac
14918         case "$getnetent_r_proto" in
14919         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14920         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14921         esac
14922         case "$getnetent_r_proto" in
14923         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14924         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14925         esac
14926         case "$getnetent_r_proto" in
14927         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14928         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14929         esac
14930         case "$getnetent_r_proto" in
14931         ''|0)   d_getnetent_r=undef
14932                 getnetent_r_proto=0
14933                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14934         * )     case "$getnetent_r_proto" in
14935                 REENTRANT_PROTO*) ;;
14936                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14937                 esac
14938                 echo "Prototype: $try" ;;
14939         esac
14940         ;;
14941         *)      case "$usethreads" in
14942                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14943                 esac
14944                 d_getnetent_r=undef
14945                 getnetent_r_proto=0
14946                 ;;
14947         esac
14948         ;;
14949 *)      getnetent_r_proto=0
14950         ;;
14951 esac
14952
14953 : see if prototypes for various getnetxxx netdb.h functions are available
14954 echo " "
14955 set d_getnetprotos getnetent $i_netdb netdb.h
14956 eval $hasproto
14957
14958 : see if getpagesize exists
14959 set getpagesize d_getpagsz
14960 eval $inlibc
14961
14962 : Optional checks for getprotobyname and getprotobynumber
14963
14964 : see if getprotobyname exists
14965 set getprotobyname d_getpbyname
14966 eval $inlibc
14967
14968 : see if getprotobynumber exists
14969 set getprotobynumber d_getpbynumber
14970 eval $inlibc
14971
14972 : see if getprotoent exists
14973 set getprotoent d_getpent
14974 eval $inlibc
14975
14976 : see if getpgid exists
14977 set getpgid d_getpgid
14978 eval $inlibc
14979
14980 : see if getpgrp2 exists
14981 set getpgrp2 d_getpgrp2
14982 eval $inlibc
14983
14984 : see if getppid exists
14985 set getppid d_getppid
14986 eval $inlibc
14987
14988 : see if getpriority exists
14989 set getpriority d_getprior
14990 eval $inlibc
14991
14992 : see if getprotobyname_r exists
14993 set getprotobyname_r d_getprotobyname_r
14994 eval $inlibc
14995 case "$d_getprotobyname_r" in
14996 "$define")
14997         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14998         case "$d_getprotobyname_r_proto:$usethreads" in
14999         ":define")      d_getprotobyname_r_proto=define
15000                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15001                 eval $hasproto ;;
15002         *)      ;;
15003         esac
15004         case "$d_getprotobyname_r_proto" in
15005         define)
15006         case "$getprotobyname_r_proto" in
15007         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15008         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15009         esac
15010         case "$getprotobyname_r_proto" in
15011         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15012         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15013         esac
15014         case "$getprotobyname_r_proto" in
15015         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15016         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15017         esac
15018         case "$getprotobyname_r_proto" in
15019         ''|0)   d_getprotobyname_r=undef
15020                 getprotobyname_r_proto=0
15021                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15022         * )     case "$getprotobyname_r_proto" in
15023                 REENTRANT_PROTO*) ;;
15024                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15025                 esac
15026                 echo "Prototype: $try" ;;
15027         esac
15028         ;;
15029         *)      case "$usethreads" in
15030                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15031                 esac
15032                 d_getprotobyname_r=undef
15033                 getprotobyname_r_proto=0
15034                 ;;
15035         esac
15036         ;;
15037 *)      getprotobyname_r_proto=0
15038         ;;
15039 esac
15040
15041 : see if getprotobynumber_r exists
15042 set getprotobynumber_r d_getprotobynumber_r
15043 eval $inlibc
15044 case "$d_getprotobynumber_r" in
15045 "$define")
15046         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15047         case "$d_getprotobynumber_r_proto:$usethreads" in
15048         ":define")      d_getprotobynumber_r_proto=define
15049                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15050                 eval $hasproto ;;
15051         *)      ;;
15052         esac
15053         case "$d_getprotobynumber_r_proto" in
15054         define)
15055         case "$getprotobynumber_r_proto" in
15056         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15057         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15058         esac
15059         case "$getprotobynumber_r_proto" in
15060         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15061         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15062         esac
15063         case "$getprotobynumber_r_proto" in
15064         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15065         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15066         esac
15067         case "$getprotobynumber_r_proto" in
15068         ''|0)   d_getprotobynumber_r=undef
15069                 getprotobynumber_r_proto=0
15070                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15071         * )     case "$getprotobynumber_r_proto" in
15072                 REENTRANT_PROTO*) ;;
15073                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15074                 esac
15075                 echo "Prototype: $try" ;;
15076         esac
15077         ;;
15078         *)      case "$usethreads" in
15079                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15080                 esac
15081                 d_getprotobynumber_r=undef
15082                 getprotobynumber_r_proto=0
15083                 ;;
15084         esac
15085         ;;
15086 *)      getprotobynumber_r_proto=0
15087         ;;
15088 esac
15089
15090 : see if getprotoent_r exists
15091 set getprotoent_r d_getprotoent_r
15092 eval $inlibc
15093 case "$d_getprotoent_r" in
15094 "$define")
15095         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15096         case "$d_getprotoent_r_proto:$usethreads" in
15097         ":define")      d_getprotoent_r_proto=define
15098                 set d_getprotoent_r_proto getprotoent_r $hdrs
15099                 eval $hasproto ;;
15100         *)      ;;
15101         esac
15102         case "$d_getprotoent_r_proto" in
15103         define)
15104         case "$getprotoent_r_proto" in
15105         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15106         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15107         esac
15108         case "$getprotoent_r_proto" in
15109         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15110         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15111         esac
15112         case "$getprotoent_r_proto" in
15113         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15114         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15115         esac
15116         case "$getprotoent_r_proto" in
15117         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15118         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15119         esac
15120         case "$getprotoent_r_proto" in
15121         ''|0)   d_getprotoent_r=undef
15122                 getprotoent_r_proto=0
15123                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15124         * )     case "$getprotoent_r_proto" in
15125                 REENTRANT_PROTO*) ;;
15126                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15127                 esac
15128                 echo "Prototype: $try" ;;
15129         esac
15130         ;;
15131         *)      case "$usethreads" in
15132                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15133                 esac
15134                 d_getprotoent_r=undef
15135                 getprotoent_r_proto=0
15136                 ;;
15137         esac
15138         ;;
15139 *)      getprotoent_r_proto=0
15140         ;;
15141 esac
15142
15143 : see if prototypes for various getprotoxxx netdb.h functions are available
15144 echo " "
15145 set d_getprotoprotos getprotoent $i_netdb netdb.h
15146 eval $hasproto
15147
15148 : see if getprpwnam exists
15149 set getprpwnam d_getprpwnam
15150 eval $inlibc
15151
15152 : see if getpwent exists
15153 set getpwent d_getpwent
15154 eval $inlibc
15155
15156 : see if getpwent_r exists
15157 set getpwent_r d_getpwent_r
15158 eval $inlibc
15159 case "$d_getpwent_r" in
15160 "$define")
15161         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15162         case "$d_getpwent_r_proto:$usethreads" in
15163         ":define")      d_getpwent_r_proto=define
15164                 set d_getpwent_r_proto getpwent_r $hdrs
15165                 eval $hasproto ;;
15166         *)      ;;
15167         esac
15168         case "$d_getpwent_r_proto" in
15169         define)
15170         case "$getpwent_r_proto" in
15171         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15172         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15173         esac
15174         case "$getpwent_r_proto" in
15175         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15176         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15177         esac
15178         case "$getpwent_r_proto" in
15179         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15180         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15181         esac
15182         case "$getpwent_r_proto" in
15183         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15184         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15185         esac
15186         case "$getpwent_r_proto" in
15187         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15188         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15189         esac
15190         case "$getpwent_r_proto" in
15191         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15192         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15193         esac
15194         case "$getpwent_r_proto" in
15195         ''|0)   d_getpwent_r=undef
15196                 getpwent_r_proto=0
15197                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15198         * )     case "$getpwent_r_proto" in
15199                 REENTRANT_PROTO*) ;;
15200                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15201                 esac
15202                 echo "Prototype: $try" ;;
15203         esac
15204         ;;
15205         *)      case "$usethreads" in
15206                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15207                 esac
15208                 d_getpwent_r=undef
15209                 getpwent_r_proto=0
15210                 ;;
15211         esac
15212         ;;
15213 *)      getpwent_r_proto=0
15214         ;;
15215 esac
15216
15217 : see if getpwnam_r exists
15218 set getpwnam_r d_getpwnam_r
15219 eval $inlibc
15220 case "$d_getpwnam_r" in
15221 "$define")
15222         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15223         case "$d_getpwnam_r_proto:$usethreads" in
15224         ":define")      d_getpwnam_r_proto=define
15225                 set d_getpwnam_r_proto getpwnam_r $hdrs
15226                 eval $hasproto ;;
15227         *)      ;;
15228         esac
15229         case "$d_getpwnam_r_proto" in
15230         define)
15231         case "$getpwnam_r_proto" in
15232         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15233         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15234         esac
15235         case "$getpwnam_r_proto" in
15236         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15237         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15238         esac
15239         case "$getpwnam_r_proto" in
15240         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15241         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15242         esac
15243         case "$getpwnam_r_proto" in
15244         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15245         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15246         esac
15247         case "$getpwnam_r_proto" in
15248         ''|0)   d_getpwnam_r=undef
15249                 getpwnam_r_proto=0
15250                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15251         * )     case "$getpwnam_r_proto" in
15252                 REENTRANT_PROTO*) ;;
15253                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15254                 esac
15255                 echo "Prototype: $try" ;;
15256         esac
15257         ;;
15258         *)      case "$usethreads" in
15259                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15260                 esac
15261                 d_getpwnam_r=undef
15262                 getpwnam_r_proto=0
15263                 ;;
15264         esac
15265         ;;
15266 *)      getpwnam_r_proto=0
15267         ;;
15268 esac
15269
15270 : see if getpwuid_r exists
15271 set getpwuid_r d_getpwuid_r
15272 eval $inlibc
15273 case "$d_getpwuid_r" in
15274 "$define")
15275         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15276         case "$d_getpwuid_r_proto:$usethreads" in
15277         ":define")      d_getpwuid_r_proto=define
15278                 set d_getpwuid_r_proto getpwuid_r $hdrs
15279                 eval $hasproto ;;
15280         *)      ;;
15281         esac
15282         case "$d_getpwuid_r_proto" in
15283         define)
15284         case "$getpwuid_r_proto" in
15285         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15286         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15287         esac
15288         case "$getpwuid_r_proto" in
15289         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15290         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15291         esac
15292         case "$getpwuid_r_proto" in
15293         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15294         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15295         esac
15296         case "$getpwuid_r_proto" in
15297         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15298         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15299         esac
15300         case "$getpwuid_r_proto" in
15301         ''|0)   d_getpwuid_r=undef
15302                 getpwuid_r_proto=0
15303                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15304         * )     case "$getpwuid_r_proto" in
15305                 REENTRANT_PROTO*) ;;
15306                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15307                 esac
15308                 echo "Prototype: $try" ;;
15309         esac
15310         ;;
15311         *)      case "$usethreads" in
15312                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15313                 esac
15314                 d_getpwuid_r=undef
15315                 getpwuid_r_proto=0
15316                 ;;
15317         esac
15318         ;;
15319 *)      getpwuid_r_proto=0
15320         ;;
15321 esac
15322
15323 : Optional checks for getsbyname and getsbyport
15324
15325 : see if getservbyname exists
15326 set getservbyname d_getsbyname
15327 eval $inlibc
15328
15329 : see if getservbyport exists
15330 set getservbyport d_getsbyport
15331 eval $inlibc
15332
15333 : see if getservent exists
15334 set getservent d_getsent
15335 eval $inlibc
15336
15337 : see if getservbyname_r exists
15338 set getservbyname_r d_getservbyname_r
15339 eval $inlibc
15340 case "$d_getservbyname_r" in
15341 "$define")
15342         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15343         case "$d_getservbyname_r_proto:$usethreads" in
15344         ":define")      d_getservbyname_r_proto=define
15345                 set d_getservbyname_r_proto getservbyname_r $hdrs
15346                 eval $hasproto ;;
15347         *)      ;;
15348         esac
15349         case "$d_getservbyname_r_proto" in
15350         define)
15351         case "$getservbyname_r_proto" in
15352         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15353         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15354         esac
15355         case "$getservbyname_r_proto" in
15356         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15357         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15358         esac
15359         case "$getservbyname_r_proto" in
15360         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15361         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15362         esac
15363         case "$getservbyname_r_proto" in
15364         ''|0)   d_getservbyname_r=undef
15365                 getservbyname_r_proto=0
15366                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15367         * )     case "$getservbyname_r_proto" in
15368                 REENTRANT_PROTO*) ;;
15369                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15370                 esac
15371                 echo "Prototype: $try" ;;
15372         esac
15373         ;;
15374         *)      case "$usethreads" in
15375                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15376                 esac
15377                 d_getservbyname_r=undef
15378                 getservbyname_r_proto=0
15379                 ;;
15380         esac
15381         ;;
15382 *)      getservbyname_r_proto=0
15383         ;;
15384 esac
15385
15386 : see if getservbyport_r exists
15387 set getservbyport_r d_getservbyport_r
15388 eval $inlibc
15389 case "$d_getservbyport_r" in
15390 "$define")
15391         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15392         case "$d_getservbyport_r_proto:$usethreads" in
15393         ":define")      d_getservbyport_r_proto=define
15394                 set d_getservbyport_r_proto getservbyport_r $hdrs
15395                 eval $hasproto ;;
15396         *)      ;;
15397         esac
15398         case "$d_getservbyport_r_proto" in
15399         define)
15400         case "$getservbyport_r_proto" in
15401         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15402         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15403         esac
15404         case "$getservbyport_r_proto" in
15405         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15406         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15407         esac
15408         case "$getservbyport_r_proto" in
15409         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15410         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15411         esac
15412         case "$getservbyport_r_proto" in
15413         ''|0)   d_getservbyport_r=undef
15414                 getservbyport_r_proto=0
15415                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15416         * )     case "$getservbyport_r_proto" in
15417                 REENTRANT_PROTO*) ;;
15418                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15419                 esac
15420                 echo "Prototype: $try" ;;
15421         esac
15422         ;;
15423         *)      case "$usethreads" in
15424                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15425                 esac
15426                 d_getservbyport_r=undef
15427                 getservbyport_r_proto=0
15428                 ;;
15429         esac
15430         ;;
15431 *)      getservbyport_r_proto=0
15432         ;;
15433 esac
15434
15435 : see if getservent_r exists
15436 set getservent_r d_getservent_r
15437 eval $inlibc
15438 case "$d_getservent_r" in
15439 "$define")
15440         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15441         case "$d_getservent_r_proto:$usethreads" in
15442         ":define")      d_getservent_r_proto=define
15443                 set d_getservent_r_proto getservent_r $hdrs
15444                 eval $hasproto ;;
15445         *)      ;;
15446         esac
15447         case "$d_getservent_r_proto" in
15448         define)
15449         case "$getservent_r_proto" in
15450         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15451         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15452         esac
15453         case "$getservent_r_proto" in
15454         ''|0) try='int getservent_r(struct servent*, char*, int);'
15455         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15456         esac
15457         case "$getservent_r_proto" in
15458         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15459         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15460         esac
15461         case "$getservent_r_proto" in
15462         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15463         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15464         esac
15465         case "$getservent_r_proto" in
15466         ''|0)   d_getservent_r=undef
15467                 getservent_r_proto=0
15468                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15469         * )     case "$getservent_r_proto" in
15470                 REENTRANT_PROTO*) ;;
15471                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15472                 esac
15473                 echo "Prototype: $try" ;;
15474         esac
15475         ;;
15476         *)      case "$usethreads" in
15477                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15478                 esac
15479                 d_getservent_r=undef
15480                 getservent_r_proto=0
15481                 ;;
15482         esac
15483         ;;
15484 *)      getservent_r_proto=0
15485         ;;
15486 esac
15487
15488 : see if prototypes for various getservxxx netdb.h functions are available
15489 echo " "
15490 set d_getservprotos getservent $i_netdb netdb.h
15491 eval $hasproto
15492
15493 : see if getspnam exists
15494 set getspnam d_getspnam
15495 eval $inlibc
15496
15497 : see if this is a shadow.h system
15498 set shadow.h i_shadow
15499 eval $inhdr
15500
15501 : see if getspnam_r exists
15502 set getspnam_r d_getspnam_r
15503 eval $inlibc
15504 case "$d_getspnam_r" in
15505 "$define")
15506         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15507         case "$d_getspnam_r_proto:$usethreads" in
15508         ":define")      d_getspnam_r_proto=define
15509                 set d_getspnam_r_proto getspnam_r $hdrs
15510                 eval $hasproto ;;
15511         *)      ;;
15512         esac
15513         case "$d_getspnam_r_proto" in
15514         define)
15515         case "$getspnam_r_proto" in
15516         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15517         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15518         esac
15519         case "$getspnam_r_proto" in
15520         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15521         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15522         esac
15523         case "$getspnam_r_proto" in
15524         ''|0)   d_getspnam_r=undef
15525                 getspnam_r_proto=0
15526                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15527         * )     case "$getspnam_r_proto" in
15528                 REENTRANT_PROTO*) ;;
15529                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15530                 esac
15531                 echo "Prototype: $try" ;;
15532         esac
15533         ;;
15534         *)      case "$usethreads" in
15535                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15536                 esac
15537                 d_getspnam_r=undef
15538                 getspnam_r_proto=0
15539                 ;;
15540         esac
15541         ;;
15542 *)      getspnam_r_proto=0
15543         ;;
15544 esac
15545
15546 : see if gettimeofday or ftime exists
15547 set gettimeofday d_gettimeod
15548 eval $inlibc
15549 case "$d_gettimeod" in
15550 "$undef")
15551         set ftime d_ftime 
15552         eval $inlibc
15553         ;;
15554 *)
15555         val="$undef"; set d_ftime; eval $setvar
15556         ;;
15557 esac
15558 case "$d_gettimeod$d_ftime" in
15559 "$undef$undef")
15560         echo " "
15561         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15562         ;;
15563 esac
15564
15565 : see if gmtime_r exists
15566 set gmtime_r d_gmtime_r
15567 eval $inlibc
15568 case "$d_gmtime_r" in
15569 "$define")
15570         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15571         case "$d_gmtime_r_proto:$usethreads" in
15572         ":define")      d_gmtime_r_proto=define
15573                 set d_gmtime_r_proto gmtime_r $hdrs
15574                 eval $hasproto ;;
15575         *)      ;;
15576         esac
15577         case "$d_gmtime_r_proto" in
15578         define)
15579         case "$gmtime_r_proto" in
15580         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15581         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15582         esac
15583         case "$gmtime_r_proto" in
15584         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15585         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15586         esac
15587         case "$gmtime_r_proto" in
15588         ''|0)   d_gmtime_r=undef
15589                 gmtime_r_proto=0
15590                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15591         * )     case "$gmtime_r_proto" in
15592                 REENTRANT_PROTO*) ;;
15593                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15594                 esac
15595                 echo "Prototype: $try" ;;
15596         esac
15597         ;;
15598         *)      case "$usethreads" in
15599                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15600                 esac
15601                 d_gmtime_r=undef
15602                 gmtime_r_proto=0
15603                 ;;
15604         esac
15605         ;;
15606 *)      gmtime_r_proto=0
15607         ;;
15608 esac
15609
15610 : see if hasmntopt exists
15611 set hasmntopt d_hasmntopt
15612 eval $inlibc
15613
15614 : see if this is a netinet/in.h or sys/in.h system
15615 set netinet/in.h i_niin sys/in.h i_sysin
15616 eval $inhdr
15617
15618 : see if arpa/inet.h has to be included
15619 set arpa/inet.h i_arpainet
15620 eval $inhdr
15621
15622 : see if htonl --and friends-- exists
15623 val=''
15624 set htonl val
15625 eval $inlibc
15626
15627 : Maybe they are macros.
15628 case "$val" in
15629 $undef)
15630         $cat >htonl.c <<EOM
15631 #include <stdio.h>
15632 #include <sys/types.h>
15633 #$i_niin I_NETINET_IN
15634 #$i_sysin I_SYS_IN
15635 #$i_arpainet I_ARPA_INET
15636 #ifdef I_NETINET_IN
15637 #include <netinet/in.h>
15638 #endif
15639 #ifdef I_SYS_IN
15640 #include <sys/in.h>
15641 #endif
15642 #ifdef I_ARPA_INET
15643 #include <arpa/inet.h>
15644 #endif
15645 #ifdef htonl
15646 printf("Defined as a macro.");
15647 #endif
15648 EOM
15649         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15650         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15651                 val="$define"
15652                 echo "But it seems to be defined as a macro." >&4
15653         fi
15654         $rm -f htonl.?
15655         ;;
15656 esac
15657 set d_htonl
15658 eval $setvar
15659
15660 : see if hypot exists
15661 set hypot d_hypot
15662 eval $inlibc
15663
15664 : see if ilogb exists
15665 set ilogb d_ilogb
15666 eval $inlibc
15667
15668 : see if ilogbl exists
15669 set ilogbl d_ilogbl
15670 eval $inlibc
15671
15672 : check whether inet_aton exists
15673 set inet_aton d_inetaton
15674 eval $inlibc
15675
15676 : see if inet_ntop exists
15677 set inet_ntop d_inetntop
15678 eval $inlibc
15679
15680 : see if inet_pton exists
15681 set inet_pton d_inetpton
15682 eval $inlibc
15683
15684 : Look for isascii
15685 echo " "
15686 $cat >isascii.c <<EOCP
15687 #include <stdio.h>
15688 #include <ctype.h>
15689 #$i_stdlib I_STDLIB
15690 #ifdef I_STDLIB
15691 #include <stdlib.h>
15692 #endif
15693 int main() {
15694         int c = 'A';
15695         if (isascii(c))
15696                 exit(0);
15697         else
15698                 exit(1);
15699 }
15700 EOCP
15701 set isascii
15702 if eval $compile; then
15703         echo "isascii() found." >&4
15704         val="$define"
15705 else
15706         echo "isascii() NOT found." >&4
15707         val="$undef"
15708 fi
15709 set d_isascii
15710 eval $setvar
15711 $rm -f isascii*
15712
15713 : Look for isblank
15714 echo " "
15715 $cat >isblank.c <<'EOCP'
15716 #include <stdio.h>
15717 #include <ctype.h>
15718 int main() {
15719         int c = ' ';
15720         if (isblank(c))
15721                 return 0 ;
15722         else
15723                 return 1 ;
15724 }
15725 EOCP
15726 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15727         echo "isblank() found." >&4
15728         val="$define"
15729 else
15730         echo "isblank() NOT found." >&4
15731         val="$undef"
15732 fi
15733 set d_isblank
15734 eval $setvar
15735 $rm -f isblank*
15736
15737 : check for isfinite
15738 echo "Checking to see if you have isfinite..." >&4
15739 $cat >try.c <<EOCP
15740 #include <math.h>
15741 int main() { return isfinite(0.0); }
15742 EOCP
15743 set try
15744 if eval $compile; then
15745         val="$define"
15746         echo "You have isfinite."
15747 else
15748         val="$undef"
15749         echo "You do not have isfinite."
15750 fi
15751 $rm_try
15752 set d_isfinite
15753 eval $setvar
15754
15755 : see if isfinitel exists
15756 set isfinitel d_isfinitel
15757 eval $inlibc
15758
15759 : check for isinf
15760 echo "Checking to see if you have isinf..." >&4
15761 $cat >try.c <<EOCP
15762 #include <math.h>
15763 int main() { return isinf(0.0); }
15764 EOCP
15765 set try
15766 if eval $compile; then
15767         val="$define"
15768         echo "You have isinf."
15769 else
15770         val="$undef"
15771         echo "You do not have isinf."
15772 fi
15773 $rm_try
15774 set d_isinf
15775 eval $setvar
15776
15777 : see if isinfl exists
15778 set isinfl d_isinfl
15779 eval $inlibc
15780
15781 : check for isless
15782 echo "Checking to see if you have isless..." >&4
15783 $cat >try.c <<EOCP
15784 #include <math.h>
15785 int main() { return isless(2.0, 1.0); }
15786 EOCP
15787 set try
15788 if eval $compile; then
15789         val="$define"
15790         echo "You have isless."
15791 else
15792         val="$undef"
15793         echo "You do not have isless."
15794 fi
15795 $rm_try
15796 set d_isless
15797 eval $setvar
15798
15799 : check for isnan
15800 echo "Checking to see if you have isnan..." >&4
15801 $cat >try.c <<EOCP
15802 #include <math.h>
15803 int main() { return isnan(0.0); }
15804 EOCP
15805 set try
15806 if eval $compile; then
15807         val="$define"
15808         echo "You have isnan."
15809 else
15810         val="$undef"
15811         echo "You do not have isnan."
15812 fi
15813 $rm_try
15814 set d_isnan
15815 eval $setvar
15816
15817 : see if isnanl exists
15818 set isnanl d_isnanl
15819 eval $inlibc
15820
15821 : check for isnormal
15822 echo "Checking to see if you have isnormal..." >&4
15823 $cat >try.c <<EOCP
15824 #include <math.h>
15825 int main() { return isnormal(0.0); }
15826 EOCP
15827 set try
15828 if eval $compile; then
15829         val="$define"
15830         echo "You have isnormal."
15831 else
15832         val="$undef"
15833         echo "You do not have isnormal."
15834 fi
15835 $rm_try
15836 set d_isnormal
15837 eval $setvar
15838
15839 : see if j0 exists
15840 set j0 d_j0
15841 eval $inlibc
15842
15843 : see if j0l exists
15844 set j0l d_j0l
15845 eval $inlibc
15846
15847 : see if killpg exists
15848 set killpg d_killpg
15849 eval $inlibc
15850
15851 : see if localeconv exists
15852 set localeconv d_locconv
15853 eval $inlibc
15854
15855 : see if libc has the POSIX.1-2008 currency locale rules
15856 case "$d_locconv:$d_lc_monetary_2008" in
15857 $define:)
15858         $cat >try.c <<EOCP
15859 #include <locale.h>
15860 int main() {
15861         struct lconv *lc = localeconv();
15862         char int_p_cs_precedes = lc->int_p_cs_precedes;
15863         return 0;
15864 }
15865 EOCP
15866         set try
15867         if eval $compile; then
15868                 d_lc_monetary_2008="$define"
15869         else
15870                 d_lc_monetary_2008="$undef"
15871         fi;
15872         $rm_try
15873         ;;
15874 esac
15875
15876 : see if lchown exists
15877 echo " "
15878 $cat > try.c <<EOCP
15879 #include <pwd.h>
15880 #include <stdio.h>
15881 #include <stdlib.h>
15882 #$i_unistd      I_UNISTD
15883 #ifdef I_UNISTD
15884 #  include <unistd.h>
15885 #endif
15886 int main(int argc, char *argv[])
15887 {
15888    if (lchown("./try.c", -1, getgid()) == -1) {
15889        exit(EXIT_FAILURE);
15890    }
15891    exit(EXIT_SUCCESS);
15892 }
15893 EOCP
15894 set try
15895 if eval $compile && ./try; then
15896     $echo "lchown() found." >&4
15897     val="$define"
15898 else
15899     $echo "lchown() NOT found." >&4
15900     val="$undef"
15901 fi
15902 set d_lchown
15903 eval $setvar
15904 $rm_try
15905
15906 : See if number of significant digits in a double precision number is known
15907 echo " "
15908 $cat >ldbl_dig.c <<EOM
15909 #include <limits.h>
15910 #include <float.h>
15911 #ifdef LDBL_DIG
15912 printf("Contains LDBL_DIG");
15913 #endif
15914 EOM
15915 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15916 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15917         echo "LDBL_DIG found." >&4
15918         val="$define"
15919 else
15920         echo "LDBL_DIG NOT found." >&4
15921         val="$undef"
15922 fi
15923 $rm -f ldbl_dig.?
15924 set d_ldbl_dig
15925 eval $setvar
15926
15927 : see if lgamma exists
15928 set lgamma d_lgamma
15929 eval $inlibc
15930
15931 : see if lgamma_r exists
15932 set lgamma_r d_lgamma_r
15933 eval $inlibc
15934
15935 : check to see if math.h defines _LIB_VERSION
15936 d_libm_lib_version="$undef"
15937 echo " "
15938 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15939 $cat >try.c <<EOCP
15940 #include <unistd.h>
15941 #include <math.h>
15942 int main (int argc, char *argv[])
15943 {
15944     printf ("%d\n", _LIB_VERSION);
15945     return (0);
15946     } /* main */
15947 EOCP
15948 set try
15949 if eval $compile; then
15950     foo=`$run ./try`
15951     echo "Yes, it does ($foo)" >&4
15952     d_libm_lib_version="$define"
15953 else
15954     echo "No, it does not (probably harmless)" >&4
15955     fi
15956 $rm_try
15957
15958 : see if link exists
15959 set link d_link
15960 eval $inlibc
15961
15962 : see if llrint exists
15963 set llrint d_llrint
15964 eval $inlibc
15965
15966 : see if llrintl exists
15967 set llrintl d_llrintl
15968 eval $inlibc
15969
15970 : see if llround exists
15971 set llround d_llround
15972 eval $inlibc
15973
15974 : see if llroundl exists
15975 set llroundl d_llroundl
15976 eval $inlibc
15977
15978 : see if localeconv_l exists
15979 set localeconv_l d_localeconv_l
15980 eval $inlibc
15981
15982 : see if localtime_r exists
15983 set localtime_r d_localtime_r
15984 eval $inlibc
15985 case "$d_localtime_r" in
15986 "$define")
15987         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15988         case "$d_localtime_r_proto:$usethreads" in
15989         ":define")      d_localtime_r_proto=define
15990                 set d_localtime_r_proto localtime_r $hdrs
15991                 eval $hasproto ;;
15992         *)      ;;
15993         esac
15994         case "$d_localtime_r_proto" in
15995         define)
15996         case "$localtime_r_proto" in
15997         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15998         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15999         esac
16000         case "$localtime_r_proto" in
16001         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16002         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16003         esac
16004         case "$localtime_r_proto" in
16005         ''|0)   d_localtime_r=undef
16006                 localtime_r_proto=0
16007                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16008         * )     case "$localtime_r_proto" in
16009                 REENTRANT_PROTO*) ;;
16010                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16011                 esac
16012                 echo "Prototype: $try" ;;
16013         esac
16014         ;;
16015         *)      case "$usethreads" in
16016                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16017                 esac
16018                 d_localtime_r=undef
16019                 localtime_r_proto=0
16020                 ;;
16021         esac
16022         ;;
16023 *)      localtime_r_proto=0
16024         ;;
16025 esac
16026
16027 : see if localtime_r calls tzset
16028 case "$localtime_r_proto" in
16029 REENTRANT_PROTO*)
16030         $cat >try.c <<EOCP
16031 /*  Does our libc's localtime_r call tzset ?
16032  *  return 0 if so, 1 otherwise.
16033  */
16034 #$i_systypes    I_SYS_TYPES
16035 #$i_unistd      I_UNISTD
16036 #$i_time        I_TIME
16037 #$i_stdlib      I_STDLIB
16038 #$i_malloc      I_MALLOC
16039 #ifdef I_SYS_TYPES
16040 #  include <sys/types.h>
16041 #endif
16042 #ifdef I_UNISTD
16043 #  include <unistd.h>
16044 #endif
16045 #ifdef I_TIME
16046 #  include <time.h>
16047 #endif
16048 #ifdef I_STDLIB
16049 #include <stdlib.h>
16050 #endif
16051 #include <string.h>
16052 #ifdef I_MALLOC
16053 #  include <malloc.h>
16054 #endif
16055 int main()
16056 {
16057     int result = 0;
16058     time_t t = time(0L);
16059     char w_tz[]="TZ" "=GMT+5",
16060          e_tz[]="TZ" "=GMT-5",
16061         *tz_e = (char*)malloc(16),
16062         *tz_w = (char*)malloc(16);
16063     struct tm tm_e, tm_w;
16064     memset(&tm_e,'\0',sizeof(struct tm));
16065     memset(&tm_w,'\0',sizeof(struct tm));
16066     strcpy(tz_e,e_tz);
16067     strcpy(tz_w,w_tz);
16068
16069     putenv(tz_e);
16070     localtime_r(&t, &tm_e);
16071
16072     putenv(tz_w);
16073     localtime_r(&t, &tm_w);
16074
16075     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16076         result = 1;
16077
16078     free(tz_e);free(tz_w);
16079     return result;
16080 }
16081 EOCP
16082         set try
16083         if eval $compile; then
16084             if $run ./try; then
16085                 d_localtime_r_needs_tzset=undef;
16086             else
16087                 d_localtime_r_needs_tzset=define;
16088             fi;
16089         else
16090             d_localtime_r_needs_tzset=undef;
16091         fi;
16092      ;;
16093   *)
16094      d_localtime_r_needs_tzset=undef;
16095      ;;
16096 esac
16097 $rm_try
16098
16099 : see if lockf exists
16100 set lockf d_lockf
16101 eval $inlibc
16102
16103 : see if log1p exists
16104 set log1p d_log1p
16105 eval $inlibc
16106
16107 : see if log2 exists
16108 set log2 d_log2
16109 eval $inlibc
16110
16111 : see if logb exists
16112 set logb d_logb
16113 eval $inlibc
16114
16115 : see if lrint exists
16116 set lrint d_lrint
16117 eval $inlibc
16118
16119 : see if lrintl exists
16120 set lrintl d_lrintl
16121 eval $inlibc
16122
16123 : see if lround exists
16124 set lround d_lround
16125 eval $inlibc
16126
16127 : see if lroundl exists
16128 set lroundl d_lroundl
16129 eval $inlibc
16130
16131 : see if prototype for lseek is available
16132 echo " "
16133 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16134 eval $hasproto
16135
16136 : see if lstat exists
16137 set lstat d_lstat
16138 eval $inlibc
16139
16140 : see if madvise exists
16141 set madvise d_madvise
16142 eval $inlibc
16143
16144 : see if malloc_size exists
16145 set malloc_size d_malloc_size
16146 eval $inlibc
16147
16148 : see if malloc_size_good exists
16149 set malloc_good_size d_malloc_good_size
16150 eval $inlibc
16151
16152 : see if malloc_usable_size exists
16153 set malloc_usable_size d_malloc_usable_size
16154 eval $inlibc
16155
16156 : see if mblen exists
16157 set mblen d_mblen
16158 eval $inlibc
16159
16160 : see if mbrlen exists
16161 set mbrlen d_mbrlen
16162 eval $inlibc
16163
16164 : see if mbrtowc exists
16165 set mbrtowc d_mbrtowc
16166 eval $inlibc
16167
16168 : see if mbstowcs exists
16169 set mbstowcs d_mbstowcs
16170 eval $inlibc
16171
16172 : see if mbtowc exists
16173 set mbtowc d_mbtowc
16174 eval $inlibc
16175
16176 : see if memmem exists
16177 : We need both a prototype in string.h and the symbol in libc.
16178 echo " "
16179 d_memmem_proto=''
16180 xx1="#$d_gnulibc HAS_GNULIBC"
16181 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16182 xx3='#   define _GNU_SOURCE'
16183 xx4='#endif'
16184 set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16185 eval $hasproto
16186 case "$d_memmem_proto" in
16187     define) # see if memmem exists
16188         set memmem d_memmem
16189         eval $inlibc
16190         ;;
16191     *)  val=$undef
16192         set d_memmem
16193         eval $setvar
16194         ;;
16195 esac
16196
16197 : see if memrchr exists
16198 : We need both a prototype in string.h and the symbol in libc.
16199 echo " "
16200 d_memrchr_proto=''
16201 xx1="#$d_gnulibc HAS_GNULIBC"
16202 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
16203 xx3='#   define _GNU_SOURCE'
16204 xx4='#endif'
16205 set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
16206 eval $hasproto
16207 case "$d_memrchr_proto" in
16208     define) # see if memrchr exists
16209         set memrchr d_memrchr
16210         eval $inlibc
16211         ;;
16212     *)  val=$undef
16213         set d_memrchr
16214         eval $setvar
16215         ;;
16216 esac
16217
16218 : see if mkdir exists
16219 set mkdir d_mkdir
16220 eval $inlibc
16221
16222 : see if mkdtemp exists
16223 set mkdtemp d_mkdtemp
16224 eval $inlibc
16225
16226 : see if mkfifo exists
16227 set mkfifo d_mkfifo
16228 eval $inlibc
16229
16230 : see if mkostemp exists
16231 set mkostemp d_mkostemp
16232 eval $inlibc
16233
16234 : see if mkstemp exists
16235 set mkstemp d_mkstemp
16236 eval $inlibc
16237
16238 : see if mkstemps exists
16239 set mkstemps d_mkstemps
16240 eval $inlibc
16241
16242 : see if mktime exists
16243 set mktime d_mktime
16244 eval $inlibc
16245
16246 : see if sys/mman.h has to be included
16247 set sys/mman.h i_sysmman
16248 eval $inhdr
16249
16250 : see if mmap exists
16251 set mmap d_mmap
16252 eval $inlibc
16253 : see what shmat returns
16254 : default to something harmless
16255 mmaptype='void *'
16256 case "$i_sysmman$d_mmap" in
16257 "$define$define")
16258         $cat >mmap.c <<'END'
16259 #include <sys/mman.h>
16260 void *mmap();
16261 END
16262         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16263                 mmaptype='void *'
16264         else
16265                 mmaptype='caddr_t'
16266         fi
16267         echo "and it returns ($mmaptype)." >&4
16268         ;;
16269 esac
16270
16271 : see if sqrtl exists
16272 set sqrtl d_sqrtl
16273 eval $inlibc
16274
16275 : see if scalbnl exists
16276 set scalbnl d_scalbnl
16277 eval $inlibc
16278
16279 : see if truncl exists
16280 set truncl d_truncl
16281 eval $inlibc
16282
16283 : see if modfl exists
16284 set modfl d_modfl
16285 eval $inlibc
16286
16287 : see if prototype for modfl is available
16288 echo " "
16289 set d_modflproto modfl define math.h
16290 eval $hasproto
16291
16292 if $test "$uselongdouble" = "$define"; then
16293     message=""
16294     if $test "$d_sqrtl" != "$define"; then
16295         message="$message sqrtl"
16296     fi
16297     if $test "$d_modfl" != "$define"; then
16298         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16299             echo "You have both truncl and copysignl, so I can emulate modfl."
16300         else
16301             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16302                 echo "You have both aintl and copysignl, so I can emulate modfl."
16303             else
16304                 message="$message modfl"
16305             fi
16306         fi
16307     fi
16308     if $test "$d_frexpl" != "$define"; then
16309         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16310             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16311         else
16312             message="$message frexpl"
16313         fi
16314     fi
16315     if $test "$d_ldexpl" != "$define"; then
16316         message="$message ldexpl"
16317     fi
16318
16319     if $test "$message" != ""; then
16320         $cat <<EOM >&4
16321
16322 *** You requested the use of long doubles but you do not seem to have
16323 *** the following mathematical functions needed for long double support:
16324 ***    $message
16325 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16326 *** Cannot continue, aborting.
16327
16328 EOM
16329
16330         exit 1
16331     fi
16332 fi
16333
16334 : see if mprotect exists
16335 set mprotect d_mprotect
16336 eval $inlibc
16337
16338 : see if msgctl exists
16339 set msgctl d_msgctl
16340 eval $inlibc
16341
16342 : see if msgget exists
16343 set msgget d_msgget
16344 eval $inlibc
16345
16346 : see if msgsnd exists
16347 set msgsnd d_msgsnd
16348 eval $inlibc
16349
16350 : see if msgrcv exists
16351 set msgrcv d_msgrcv
16352 eval $inlibc
16353
16354 : see how much of the 'msg*(2)' library is present.
16355 h_msg=true
16356 echo " "
16357 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16358 *"$undef"*) h_msg=false;;
16359 esac
16360 case "$osname" in
16361 freebsd)
16362     case "`ipcs 2>&1`" in
16363     "SVID messages"*"not configured"*)
16364         echo "Your $osname does not have the msg*(2) configured." >&4
16365         h_msg=false
16366         val="$undef"
16367         set msgctl d_msgctl
16368         eval $setvar
16369         set msgget d_msgget
16370         eval $setvar
16371         set msgsnd d_msgsnd
16372         eval $setvar
16373         set msgrcv d_msgrcv
16374         eval $setvar
16375         ;;
16376     esac
16377     ;;
16378 esac
16379 : we could also check for sys/ipc.h ...
16380 if $h_msg && $test `./findhdr sys/msg.h`; then
16381         echo "You have the full msg*(2) library." >&4
16382         val="$define"
16383 else
16384         echo "You don't have the full msg*(2) library." >&4
16385         val="$undef"
16386 fi
16387 set d_msg
16388 eval $setvar
16389
16390 : Check for msghdr_s
16391 echo " "
16392 echo "Checking to see if your system supports struct msghdr..." >&4
16393 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16394 eval $hasstruct
16395 case "$d_msghdr_s" in
16396 "$define")      echo "Yes, it does."   ;;
16397 *)              echo "No, it doesn't." ;;
16398 esac
16399
16400 : see if msync exists
16401 set msync d_msync
16402 eval $inlibc
16403
16404 : see if munmap exists
16405 set munmap d_munmap
16406 eval $inlibc
16407
16408 : see if nan exists
16409 set nan d_nan
16410 eval $inlibc
16411
16412 : see if nanosleep exists
16413 set nanosleep d_nanosleep
16414 eval $inlibc
16415
16416 : see if nearbyint exists
16417 set nearbyint d_nearbyint
16418 eval $inlibc
16419
16420 : see if nextafter exists
16421 set nextafter d_nextafter
16422 eval $inlibc
16423
16424 : see if nexttoward exists
16425 set nexttoward d_nexttoward
16426 eval $inlibc
16427
16428 : see if nice exists
16429 set nice d_nice
16430 eval $inlibc
16431
16432 : see if this is a langinfo.h system
16433 set langinfo.h i_langinfo
16434 eval $inhdr
16435
16436 : see if nl_langinfo exists
16437 set nl_langinfo d_nl_langinfo
16438 eval $inlibc
16439
16440 : see if this is a quadmath.h system
16441 set quadmath.h i_quadmath
16442 eval $inhdr
16443
16444 : Check basic sizes
16445 echo " "
16446 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16447
16448 case "$use64bitint:$d_quad:$quadtype" in
16449 define:define:?*)
16450         ivtype="$quadtype"
16451         uvtype="$uquadtype"
16452         ivsize=8
16453         uvsize=8
16454         ;;
16455 *)      ivtype="long"
16456         uvtype="unsigned long"
16457         ivsize=$longsize
16458         uvsize=$longsize
16459         ;;
16460 esac
16461
16462 case "$uselongdouble:$d_longdbl" in
16463 define:define)
16464         nvtype="long double"
16465         nvsize=$longdblsize
16466         ;;
16467 *)      nvtype=double
16468         nvsize=$doublesize
16469         ;;
16470 esac
16471
16472 case "$usequadmath:$i_quadmath" in
16473 define:define)
16474   nvtype="__float128"
16475   nvsize=16
16476   case "$libs" in
16477   *quadmath*) ;;
16478   *) $cat <<EOM >&4
16479
16480 *** You requested the use of the quadmath library, but you
16481 *** do not seem to have the quadmath library installed.
16482 *** Cannot continue, aborting.
16483 EOM
16484     exit 1
16485     ;;
16486   esac
16487   ;;
16488 define:*) $cat <<EOM >&4
16489
16490 *** You requested the use of the quadmath library, but you
16491 *** do not seem to have the required header, <quadmath.h>.
16492 EOM
16493   case "$gccversion" in
16494   [23].*|4.[0-5]*)
16495    $cat <<EOM >&4
16496 *** Your gcc looks a bit old:
16497 *** $gccversion
16498 EOM
16499     ;;
16500   '')
16501    $cat <<EOM >&4
16502 *** You are not running a gcc.
16503 EOM
16504     ;;
16505   esac
16506   $cat <<EOM >&4
16507 *** For the quadmath library you need at least gcc 4.6.
16508 *** Cannot continue, aborting.
16509 EOM
16510   exit 1
16511   ;;
16512 esac
16513
16514 $echo "(IV will be "$ivtype", $ivsize bytes)"
16515 $echo "(UV will be "$uvtype", $uvsize bytes)"
16516 $echo "(NV will be "$nvtype", $nvsize bytes)"
16517
16518 $cat >try.c <<EOCP
16519 #$i_inttypes I_INTTYPES
16520 #ifdef I_INTTYPES
16521 #include <inttypes.h>
16522 #endif
16523 #include <stdio.h>
16524 int main() {
16525 #ifdef INT8
16526    int8_t i =  INT8_MAX;
16527   uint8_t u = UINT8_MAX;
16528   printf("int8_t\n");
16529 #endif
16530 #ifdef INT16
16531    int16_t i =  INT16_MAX;
16532   uint16_t u = UINT16_MAX;
16533   printf("int16_t\n");
16534 #endif
16535 #ifdef INT32
16536    int32_t i =  INT32_MAX;
16537   uint32_t u = UINT32_MAX;
16538   printf("int32_t\n");
16539 #endif
16540 }
16541 EOCP
16542
16543 i8type="signed char"
16544 u8type="unsigned char"
16545 i8size=1
16546 u8size=1
16547
16548 case "$i16type" in
16549 '')     case "$shortsize" in
16550         2)      i16type=short
16551                 u16type="unsigned short"
16552                 i16size=$shortsize
16553                 u16size=$shortsize
16554                 ;;
16555         esac
16556         ;;
16557 esac
16558 case "$i16type" in
16559 '')     set try -DINT16
16560         if eval $compile; then
16561                 case "`$run ./try`" in
16562                 int16_t)
16563                         i16type=int16_t
16564                         u16type=uint16_t
16565                         i16size=2
16566                         u16size=2
16567                         ;;
16568                 esac
16569         fi
16570         ;;
16571 esac
16572 case "$i16type" in
16573 '')     if $test $shortsize -ge 2; then
16574                 i16type=short
16575                 u16type="unsigned short"
16576                 i16size=$shortsize
16577                 u16size=$shortsize
16578         fi
16579         ;;
16580 esac
16581
16582 case "$i32type" in
16583 '')     case "$longsize" in
16584         4)      i32type=long
16585                 u32type="unsigned long"
16586                 i32size=$longsize
16587                 u32size=$longsize
16588                 ;;
16589         *)      case "$intsize" in
16590                 4)      i32type=int
16591                         u32type="unsigned int"
16592                         i32size=$intsize
16593                         u32size=$intsize
16594                         ;;
16595                 esac
16596                 ;;
16597         esac
16598         ;;
16599 esac
16600 case "$i32type" in
16601 '')     set try -DINT32
16602         if eval $compile; then
16603                 case "`$run ./try`" in
16604                 int32_t)
16605                         i32type=int32_t
16606                         u32type=uint32_t
16607                         i32size=4
16608                         u32size=4
16609                         ;;
16610                 esac
16611         fi
16612         ;;
16613 esac
16614 case "$i32type" in
16615 '')     if $test $intsize -ge 4; then
16616                 i32type=int
16617                 u32type="unsigned int"
16618                 i32size=$intsize
16619                 u32size=$intsize
16620         fi
16621         ;;
16622 esac
16623
16624 case "$i64type" in
16625 '')     case "$d_quad:$quadtype" in
16626         define:?*)
16627                 i64type="$quadtype"
16628                 u64type="$uquadtype"
16629                 i64size=8
16630                 u64size=8
16631                 ;;
16632         esac
16633         ;;
16634 esac
16635
16636 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16637 $cat <<EOP >try.c
16638 #include <stdio.h>
16639 #$i_stdlib I_STDLIB
16640 #ifdef I_STDLIB
16641 #include <stdlib.h>
16642 #endif
16643 #include <sys/types.h>
16644 #include <signal.h>
16645 #ifdef SIGFPE
16646 /* volatile so that the compiler has to store it out to memory */
16647 volatile int bletched = 0;
16648 $signal_t blech(int s) { bletched = 1; }
16649 #endif
16650 int main() {
16651     $uvtype u = 0;
16652     $nvtype d;
16653     int     n = 8 * $uvsize;
16654     int     i;
16655 #ifdef SIGFPE
16656     signal(SIGFPE, blech);
16657 #endif
16658
16659     for (i = 0; i < n; i++) {
16660       u = u << 1 | ($uvtype)1;
16661       d = ($nvtype)u;
16662       if (($uvtype)d != u)
16663         break;
16664       if (d <= 0)
16665         break;
16666       d = ($nvtype)(u - 1);
16667       if (($uvtype)d != (u - 1))
16668         break;
16669 #ifdef SIGFPE
16670       if (bletched)
16671         break;
16672 #endif
16673     }
16674     printf("%d\n", ((i == n) ? -n : i));
16675     exit(0);
16676 }
16677 EOP
16678 set try
16679
16680 d_nv_preserves_uv="$undef"
16681 if eval $compile; then
16682         nv_preserves_uv_bits="`$run ./try`"
16683 fi
16684 case "$nv_preserves_uv_bits" in
16685 \-[1-9]*)
16686         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16687         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16688         d_nv_preserves_uv="$define"
16689         ;;
16690 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16691         d_nv_preserves_uv="$undef" ;;
16692 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16693         nv_preserves_uv_bits="0" ;;
16694 esac
16695 $rm_try
16696
16697 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16698 $cat <<EOP >try.c
16699 #include <stdio.h>
16700
16701 typedef $nvtype NV;
16702
16703 int
16704 main() {
16705   NV value = 2;
16706   int count = 1;
16707
16708   while(count < 256) {
16709     /* volatile so that the compiler has to store it out to memory */
16710     volatile NV up = value + 1.0;
16711     volatile NV negated = -value;
16712     volatile NV down = negated - 1.0;
16713     volatile NV got_up = up - value;
16714     int up_good = got_up == 1.0;
16715     int got_down = down - negated;
16716     int down_good = got_down == -1.0;
16717
16718     if (down_good != up_good) {
16719       fprintf(stderr,
16720               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16721               up_good, (double) got_up, down_good, (double) got_down,
16722               count, (double) value);
16723       return 1;
16724     }
16725     if (!up_good) {
16726       while (1) {
16727         if (count > 8) {
16728           count -= 8;
16729           fputs("256.0", stdout);
16730         } else {
16731           count--;
16732           fputs("2.0", stdout);
16733         }
16734         if (!count) {
16735           puts("");
16736           return 0;
16737         }
16738         fputs("*", stdout);
16739       }
16740     }
16741     value *= 2;
16742     ++count;
16743   }
16744   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16745           count, (double) value);
16746   return 1;
16747 }
16748 EOP
16749 set try
16750
16751 nv_overflows_integers_at='0'
16752 if eval $compile; then
16753     xxx="`$run ./try`"
16754     case "$?" in
16755         0)
16756             case "$xxx" in
16757                 2*)  cat >&4 <<EOM
16758 The largest integer your NVs can preserve is equal to $xxx
16759 EOM
16760                     nv_overflows_integers_at="$xxx"
16761                     ;;
16762                 *)  cat >&4 <<EOM
16763 Cannot determine the largest integer value your NVs can hold, unexpected output
16764 '$xxx'
16765 EOM
16766                     ;;
16767             esac
16768             ;;
16769         *)  cat >&4 <<EOM
16770 Cannot determine the largest integer value your NVs can hold
16771 EOM
16772             ;;
16773     esac
16774 fi
16775 $rm_try
16776
16777 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16778 $cat <<EOP >try.c
16779 #include <stdio.h>
16780 #$i_stdlib I_STDLIB
16781 #ifdef I_STDLIB
16782 #include <stdlib.h>
16783 #endif
16784 #include <string.h>
16785 #include <sys/types.h>
16786 #include <signal.h>
16787 #ifdef SIGFPE
16788 /* volatile so that the compiler has to store it out to memory */
16789 volatile int bletched = 0;
16790 $signal_t blech(int s) { bletched = 1; }
16791 #endif
16792
16793 int checkit($nvtype d, const char *where) {
16794     void *v = &d;
16795     unsigned char *p = (unsigned char *)v;
16796     unsigned char *end = p + sizeof(d);
16797     int fail = 0;
16798
16799     while (p < end)
16800         fail += *p++;
16801
16802     if (!fail)
16803         return 0;
16804
16805     p = (unsigned char *)v;
16806     printf("No - %s: 0x", where);
16807     while (p < end)
16808         printf ("%02X", *p++);
16809     printf("\n");
16810     return 1;
16811 }
16812
16813 int main(int argc, char **argv) {
16814     $nvtype d = 0.0;
16815     int fail = 0;
16816     fail += checkit(d, "0.0");
16817
16818     /* The compiler shouldn't be assuming that bletched is 0  */
16819     d = bletched;
16820
16821     fail += checkit(d, "bleched");
16822
16823 #ifdef SIGFPE
16824     signal(SIGFPE, blech);
16825 #endif
16826
16827     /* Paranoia - the compiler should have no way of knowing that ANSI says
16828        that argv[argc] will always be NULL.  Actually, if it did assume this it
16829        would be buggy, as this is C and main() can be called from elsewhere in
16830        the program.  */
16831     d = argv[argc] ? 1 : 0;
16832
16833     if (d) {
16834         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16835     }
16836
16837     fail += checkit(d, "ternary");
16838
16839     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16840
16841     if (d != 0.0) {
16842         printf("No - memset doesn't give 0.0\n");
16843         /* This might just blow up:  */
16844         printf("(gives %g)\n", d);
16845         return 1;
16846     }
16847
16848 #ifdef SIGFPE
16849     if (bletched) {
16850         printf("No - something bleched\n");
16851         return 1;
16852     }
16853 #endif
16854     if (fail) {
16855       printf("No - %d fail(s)\n", fail);
16856       return 1;
16857     }
16858     printf("Yes\n");
16859     return 0;
16860 }
16861 EOP
16862 set try
16863
16864 d_nv_zero_is_allbits_zero="$undef"
16865 if eval $compile; then
16866     xxx="`$run ./try`"
16867     case "$?" in
16868         0)
16869             case "$xxx" in
16870                 Yes)  cat >&4 <<EOM
16871 0.0 is represented as all bits zero in memory
16872 EOM
16873                     d_nv_zero_is_allbits_zero="$define"
16874                     ;;
16875                 *)  cat >&4 <<EOM
16876 0.0 is not represented as all bits zero in memory
16877 EOM
16878                     d_nv_zero_is_allbits_zero="$undef"
16879                     ;;
16880             esac
16881             ;;
16882         *)  cat >&4 <<EOM
16883 0.0 is not represented as all bits zero in memory
16884 EOM
16885             d_nv_zero_is_allbits_zero="$undef"
16886             ;;
16887     esac
16888 fi
16889 $rm_try
16890
16891 : check for off64_t
16892 echo " "
16893 echo "Checking to see if you have off64_t..." >&4
16894 $cat >try.c <<EOCP
16895 #include <sys/types.h>
16896 #include <unistd.h>
16897 int main() { off64_t x = 7; }
16898 EOCP
16899 set try
16900 if eval $compile; then
16901         val="$define"
16902         echo "You have off64_t."
16903 else
16904         val="$undef"
16905         echo "You do not have off64_t."
16906         case "$lseeksize" in
16907         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16908         esac
16909 fi
16910 $rm_try
16911 set d_off64_t
16912 eval $setvar
16913
16914 : how to create joinable pthreads
16915 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16916         echo " "
16917         echo "Checking what constant to use for creating joinable pthreads..." >&4
16918         $cat >try.c <<'EOCP'
16919 #include <pthread.h>
16920 int main() {
16921     int detachstate = JOINABLE;
16922 }
16923 EOCP
16924         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16925         if eval $compile; then
16926                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16927                 val="$undef" # Yes, undef.
16928                 set d_old_pthread_create_joinable
16929                 eval $setvar
16930                 val=""
16931                 set old_pthread_create_joinable
16932                 eval $setvar
16933         else
16934                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16935                 if eval $compile; then
16936                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16937                         val="$define"
16938                         set d_old_pthread_create_joinable
16939                         eval $setvar
16940                         val=PTHREAD_CREATE_UNDETACHED
16941                         set old_pthread_create_joinable
16942                         eval $setvar
16943                 else
16944                         set try -DJOINABLE=__UNDETACHED
16945                         if eval $compile; then
16946                                 echo "You seem to use __UNDETACHED." >&4
16947                                 val="$define"
16948                                 set d_old_pthread_create_joinable
16949                                 eval $setvar
16950                                 val=__UNDETACHED
16951                                 set old_pthread_create_joinable
16952                                 eval $setvar
16953                         else
16954                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16955                                 val="$define"
16956                                 set d_old_pthread_create_joinable
16957                                 eval $setvar
16958                                 val=0
16959                                 set old_pthread_create_joinable
16960                                 eval $setvar
16961                         fi
16962                 fi
16963         fi
16964         $rm_try
16965 else
16966     d_old_pthread_create_joinable="$undef"
16967     old_pthread_create_joinable=""
16968 fi
16969
16970 : see if pause exists
16971 set pause d_pause
16972 eval $inlibc
16973
16974 : see if pipe2 exists
16975 set pipe2 d_pipe2
16976 eval $inlibc
16977
16978 : see if poll exists
16979 set poll d_poll
16980 eval $inlibc
16981
16982 : see if prctl exists
16983 set prctl d_prctl
16984 eval $inlibc
16985
16986 : see if prctl supports PR_SET_NAME
16987 d_prctl_set_name=$undef
16988 case $d_prctl in
16989     $define)
16990         $cat >try.c <<EOM
16991 #ifdef __ANDROID__
16992 #include <unistd.h>
16993 #endif
16994 #include <sys/prctl.h>
16995
16996 int main (int argc, char *argv[])
16997 {
16998     return (prctl (PR_SET_NAME, "Test"));
16999     } /* main */
17000 EOM
17001         set try
17002         if eval $compile_ok && $run ./try; then
17003             echo "Your prctl (PR_SET_NAME, ...) works"
17004             d_prctl_set_name=$define
17005             fi
17006         $rm_try
17007         ;;
17008     esac
17009
17010 : see if readlink exists
17011 set readlink d_readlink
17012 eval $inlibc
17013
17014 : Check if there is a /proc symlink to the abs path of
17015 : the executing program.  We will honor hints of d_procselfexe=$undef
17016 : or procselfexe being non-empty, otherwise will try to determine both
17017 : if we have readlink.
17018 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
17019 : referenced, and AmigaOS does not have a proc filesystem anyway.
17020 echo " "
17021 val="$undef"
17022 if $test "X$d_procselfexe" = Xundef; then
17023         procselfexe=''
17024 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
17025         val="$define"
17026 elif $test "X$d_readlink" = Xdefine; then
17027         : NetBSD first as /proc/self is a symlink to /proc/curproc,
17028         : and it feels more tidy to avoid an extra level of symlink
17029         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17030         while test $# -gt 0; do
17031             type=$1; try=$2
17032             shift; shift
17033             if $issymlink $try; then
17034                 $ls -l $try > reflect
17035                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17036                     echo "You have $type-like $try."
17037                     procselfexe='"'$try'"'
17038                     val="$define"
17039                     : This will break out of the loop
17040                     set X; shift
17041                 fi
17042             fi
17043         done
17044 fi
17045 $rm -f reflect
17046 set d_procselfexe
17047 eval $setvar
17048
17049 : backward compatibility for d_hvfork
17050 if test X$d_hvfork != X; then
17051         d_vfork="$d_hvfork"
17052         d_hvfork=''
17053 fi
17054 : see if there is a vfork
17055 val=''
17056 set vfork val
17057 eval $inlibc
17058
17059 d_pseudofork=$undef
17060
17061 : Ok, but do we want to use it. vfork is reportedly unreliable in
17062 : perl on Solaris 2.x, and probably elsewhere.
17063 case "$val" in
17064 $define)
17065         echo " "
17066         case "$usevfork" in
17067         false) dflt='n';;
17068         *) dflt='y';;
17069         esac
17070         cat <<'EOM'
17071
17072 Perl can only use a vfork() that doesn't suffer from strict
17073 restrictions on calling functions or modifying global data in
17074 the child.  For example, glibc-2.1 contains such a vfork()
17075 that is unsuitable.  If your system provides a proper fork()
17076 call, chances are that you do NOT want perl to use vfork().
17077
17078 EOM
17079         rp="Do you still want to use vfork()?"
17080         . ./myread
17081         case "$ans" in
17082         y|Y) ;;
17083         *)
17084                 echo "Ok, we won't use vfork()."
17085                 val="$undef"
17086                 ;;
17087         esac
17088         ;;
17089 esac
17090 set d_vfork
17091 eval $setvar
17092 case "$d_vfork" in
17093 $define) usevfork='true';;
17094 *) usevfork='false';;
17095 esac
17096
17097 : see whether the pthread_atfork exists
17098 $cat >try.c <<EOP
17099 #include <pthread.h>
17100 #include <stdio.h>
17101 int main() {
17102 #ifdef  PTHREAD_ATFORK
17103         pthread_atfork(NULL,NULL,NULL);
17104 #endif
17105 }
17106 EOP
17107
17108 : see if pthread_atfork exists
17109 set try -DPTHREAD_ATFORK
17110 if eval $compile; then
17111     val="$define"
17112 else
17113     val="$undef"
17114 fi
17115 case "$usethreads" in
17116 $define)
17117         case "$val" in
17118         $define) echo 'pthread_atfork found.' >&4        ;;
17119         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17120         esac
17121 esac
17122 set d_pthread_atfork
17123 eval $setvar
17124
17125 : see if pthread_attr_setscope exists
17126 set pthread_attr_setscope d_pthread_attr_setscope
17127 eval $inlibc
17128
17129 : see whether the various POSIXish _yields exist
17130 $cat >try.c <<EOP
17131 #include <pthread.h>
17132 #include <stdio.h>
17133 int main() {
17134 #ifdef SCHED_YIELD
17135         sched_yield();
17136 #else
17137 #ifdef PTHREAD_YIELD
17138         pthread_yield();
17139 #else
17140 #ifdef PTHREAD_YIELD_NULL
17141         pthread_yield(NULL);
17142 #endif
17143 #endif
17144 #endif
17145 }
17146 EOP
17147 : see if sched_yield exists
17148 set try -DSCHED_YIELD
17149 if eval $compile; then
17150     val="$define"
17151     sched_yield='sched_yield()'
17152 else
17153     val="$undef"
17154 fi
17155 case "$usethreads" in
17156 $define)
17157         case "$val" in
17158         $define) echo 'sched_yield() found.' >&4        ;;
17159         *)       echo 'sched_yield() NOT found.' >&4    ;;
17160         esac
17161 esac
17162 set d_sched_yield
17163 eval $setvar
17164
17165 : see if pthread_yield exists
17166 set try -DPTHREAD_YIELD
17167 if eval $compile; then
17168     val="$define"
17169     case "$sched_yield" in
17170     '') sched_yield='pthread_yield()' ;;
17171     esac
17172 else
17173     set try -DPTHREAD_YIELD_NULL
17174     if eval $compile; then
17175         val="$define"
17176         case "$sched_yield" in
17177         '') sched_yield='pthread_yield(NULL)' ;;
17178         esac
17179     else
17180         val="$undef"
17181     fi
17182 fi
17183 case "$usethreads" in
17184 $define)
17185         case "$val" in
17186         $define) echo 'pthread_yield() found.' >&4      ;;
17187         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17188         esac
17189         ;;
17190 esac
17191 set d_pthread_yield
17192 eval $setvar
17193 case "$sched_yield" in
17194 '') sched_yield=undef ;;
17195 esac
17196 $rm_try
17197
17198 : check for ptrdiff_t
17199 echo " "
17200 echo "Checking to see if you have ptrdiff_t..." >&4
17201 $cat >try.c <<EOCP
17202 #include <stddef.h>
17203 int main() { ptrdiff_t x = 7; }
17204 EOCP
17205 set try
17206 if eval $compile; then
17207         val="$define"
17208         echo "You have ptrdiff_t."
17209 else
17210         val="$undef"
17211         echo "You do not have ptrdiff_t."
17212 fi
17213 $rm_try
17214 set d_ptrdiff_t
17215 eval $setvar
17216
17217 : see if random_r exists
17218 set random_r d_random_r
17219 eval $inlibc
17220 case "$d_random_r" in
17221 "$define")
17222         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17223         case "$d_random_r_proto:$usethreads" in
17224         ":define")      d_random_r_proto=define
17225                 set d_random_r_proto random_r $hdrs
17226                 eval $hasproto ;;
17227         *)      ;;
17228         esac
17229         case "$d_random_r_proto" in
17230         define)
17231         case "$random_r_proto" in
17232         ''|0) try='int random_r(int*, struct random_data*);'
17233         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17234         esac
17235         case "$random_r_proto" in
17236         ''|0) try='int random_r(long*, struct random_data*);'
17237         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17238         esac
17239         case "$random_r_proto" in
17240         ''|0) try='int random_r(struct random_data*, int32_t*);'
17241         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17242         esac
17243         case "$random_r_proto" in
17244         ''|0)   d_random_r=undef
17245                 random_r_proto=0
17246                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17247         * )     case "$random_r_proto" in
17248                 REENTRANT_PROTO*) ;;
17249                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17250                 esac
17251                 echo "Prototype: $try" ;;
17252         esac
17253         ;;
17254         *)      case "$usethreads" in
17255                 define) echo "random_r has no prototype, not using it." >&4 ;;
17256                 esac
17257                 d_random_r=undef
17258                 random_r_proto=0
17259                 ;;
17260         esac
17261         ;;
17262 *)      random_r_proto=0
17263         ;;
17264 esac
17265
17266 : see if readdir and friends exist
17267 set readdir d_readdir
17268 eval $inlibc
17269 set seekdir d_seekdir
17270 eval $inlibc
17271 set telldir d_telldir
17272 eval $inlibc
17273 set rewinddir d_rewinddir
17274 eval $inlibc
17275
17276 : see if readdir64_r exists
17277 set readdir64_r d_readdir64_r
17278 eval $inlibc
17279 case "$d_readdir64_r" in
17280 "$define")
17281         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17282         case "$d_readdir64_r_proto:$usethreads" in
17283         ":define")      d_readdir64_r_proto=define
17284                 set d_readdir64_r_proto readdir64_r $hdrs
17285                 eval $hasproto ;;
17286         *)      ;;
17287         esac
17288         case "$d_readdir64_r_proto" in
17289         define)
17290         case "$readdir64_r_proto" in
17291         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17292         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17293         esac
17294         case "$readdir64_r_proto" in
17295         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17296         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17297         esac
17298         case "$readdir64_r_proto" in
17299         ''|0)   d_readdir64_r=undef
17300                 readdir64_r_proto=0
17301                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17302         * )     case "$readdir64_r_proto" in
17303                 REENTRANT_PROTO*) ;;
17304                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17305                 esac
17306                 echo "Prototype: $try" ;;
17307         esac
17308         ;;
17309         *)      case "$usethreads" in
17310                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17311                 esac
17312                 d_readdir64_r=undef
17313                 readdir64_r_proto=0
17314                 ;;
17315         esac
17316         ;;
17317 *)      readdir64_r_proto=0
17318         ;;
17319 esac
17320
17321 : see if readdir_r exists
17322 set readdir_r d_readdir_r
17323 eval $inlibc
17324 case "$d_readdir_r" in
17325 "$define")
17326         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17327         case "$d_readdir_r_proto:$usethreads" in
17328         ":define")      d_readdir_r_proto=define
17329                 set d_readdir_r_proto readdir_r $hdrs
17330                 eval $hasproto ;;
17331         *)      ;;
17332         esac
17333         case "$d_readdir_r_proto" in
17334         define)
17335         case "$readdir_r_proto" in
17336         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17337         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17338         esac
17339         case "$readdir_r_proto" in
17340         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17341         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17342         esac
17343         case "$readdir_r_proto" in
17344         ''|0)   d_readdir_r=undef
17345                 readdir_r_proto=0
17346                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17347         * )     case "$readdir_r_proto" in
17348                 REENTRANT_PROTO*) ;;
17349                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17350                 esac
17351                 echo "Prototype: $try" ;;
17352         esac
17353         ;;
17354         *)      case "$usethreads" in
17355                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17356                 esac
17357                 d_readdir_r=undef
17358                 readdir_r_proto=0
17359                 ;;
17360         esac
17361         ;;
17362 *)      readdir_r_proto=0
17363         ;;
17364 esac
17365
17366 : see if readv exists
17367 set readv d_readv
17368 eval $inlibc
17369
17370 : see if recvmsg exists
17371 set recvmsg d_recvmsg
17372 eval $inlibc
17373
17374 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17375 echo " "
17376 if set regcomp val -f d_regcomp; eval $csym; $val; then
17377         echo 'regcomp() found.' >&4
17378         d_regcomp="$define"
17379         d_regcmp="$undef"
17380         d_re_comp="$undef"
17381 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17382         echo 'regcmp() found.' >&4
17383         d_regcmp="$define"
17384         d_regcomp="$undef"
17385         d_re_comp="$undef"
17386 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17387         echo 're_comp() found, assuming re_exec() also exists.' >&4
17388         d_re_comp="$define"
17389         d_regcomp="$undef"
17390         d_regcmp="$undef"
17391 else
17392         $cat >&4 <<EOM
17393 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17394 EOM
17395         d_regcmp="$undef"
17396         d_re_comp="$undef"
17397         d_regcomp="$undef"
17398 fi
17399
17400 : see if remainder exists
17401 set remainder d_remainder
17402 eval $inlibc
17403
17404 : see if remquo exists
17405 set remquo d_remquo
17406 eval $inlibc
17407
17408 : see if rename exists
17409 set rename d_rename
17410 eval $inlibc
17411
17412 : see if rint exists
17413 set rint d_rint
17414 eval $inlibc
17415
17416 : see if rmdir exists
17417 set rmdir d_rmdir
17418 eval $inlibc
17419
17420 : see if round exists
17421 set round d_round
17422 eval $inlibc
17423
17424 : see if prototype for sbrk is available
17425 echo " "
17426 set d_sbrkproto sbrk $i_unistd unistd.h
17427 eval $hasproto
17428
17429 : see if scalbn exists
17430 set scalbn d_scalbn
17431 eval $inlibc
17432
17433 : see if select exists
17434 set select d_select
17435 eval $inlibc
17436
17437 : see if semctl exists
17438 set semctl d_semctl
17439 eval $inlibc
17440
17441 : see if semget exists
17442 set semget d_semget
17443 eval $inlibc
17444
17445 : see if semop exists
17446 set semop d_semop
17447 eval $inlibc
17448
17449 : see how much of the 'sem*(2)' library is present.
17450 h_sem=true
17451 echo " "
17452 case "$d_semctl$d_semget$d_semop" in
17453 *"$undef"*) h_sem=false;;
17454 esac
17455 case "$osname" in
17456 freebsd)
17457     case "`ipcs 2>&1`" in
17458     "SVID messages"*"not configured"*)
17459         echo "Your $osname does not have the sem*(2) configured." >&4
17460         h_sem=false
17461         val="$undef"
17462         set semctl d_semctl
17463         eval $setvar
17464         set semget d_semget
17465         eval $setvar
17466         set semop d_semop
17467         eval $setvar
17468         ;;
17469     esac
17470     ;;
17471 esac
17472 : we could also check for sys/ipc.h ...
17473 if $h_sem && $test `./findhdr sys/sem.h`; then
17474         echo "You have the full sem*(2) library." >&4
17475         val="$define"
17476 else
17477         echo "You don't have the full sem*(2) library." >&4
17478         val="$undef"
17479 fi
17480 set d_sem
17481 eval $setvar
17482
17483 : see whether sys/sem.h defines union semun
17484 echo " "
17485 $cat > try.c <<'END'
17486 #include <sys/types.h>
17487 #include <sys/ipc.h>
17488 #include <sys/sem.h>
17489 int main () { union semun semun; semun.buf = 0; }
17490 END
17491 set try
17492 if eval $compile; then
17493     echo "You have union semun in <sys/sem.h>." >&4
17494     val="$define"
17495 else
17496     echo "You do not have union semun in <sys/sem.h>." >&4
17497     val="$undef"
17498 fi
17499 $rm_try
17500 set d_union_semun
17501 eval $setvar
17502
17503 : see how to do semctl IPC_STAT
17504 case "$d_sem" in
17505 $define)
17506     echo " "
17507     $cat > tryh.h <<END
17508 #ifndef S_IRUSR
17509 #   ifdef S_IREAD
17510 #       define S_IRUSR S_IREAD
17511 #       define S_IWUSR S_IWRITE
17512 #       define S_IXUSR S_IEXEC
17513 #   else
17514 #       define S_IRUSR 0400
17515 #       define S_IWUSR 0200
17516 #       define S_IXUSR 0100
17517 #   endif
17518 #   define S_IRGRP (S_IRUSR>>3)
17519 #   define S_IWGRP (S_IWUSR>>3)
17520 #   define S_IXGRP (S_IXUSR>>3)
17521 #   define S_IROTH (S_IRUSR>>6)
17522 #   define S_IWOTH (S_IWUSR>>6)
17523 #   define S_IXOTH (S_IXUSR>>6)
17524 #endif
17525 #ifndef S_IRWXU
17526 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17527 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17528 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17529 #endif
17530 END
17531     : see whether semctl IPC_STAT can use union semun
17532     case "$d_semctl_semun" in
17533     '')
17534       val="$undef"
17535       $cat > try.c <<END
17536 #include <sys/types.h>
17537 #include <sys/ipc.h>
17538 #include <sys/sem.h>
17539 #include <sys/stat.h>
17540 #include <stdio.h>
17541 #include <errno.h>
17542 #include "tryh.h"
17543 #ifndef errno
17544 extern int errno;
17545 #endif
17546 #$d_union_semun HAS_UNION_SEMUN
17547 int main() {
17548     union semun
17549 #ifndef HAS_UNION_SEMUN
17550     {
17551         int val;
17552         struct semid_ds *buf;
17553         unsigned short *array;
17554     }
17555 #endif
17556     arg;
17557     int sem, st;
17558
17559 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17560     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17561     if (sem > -1) {
17562         struct semid_ds argbuf;
17563         arg.buf = &argbuf;
17564 #       ifdef IPC_STAT
17565         st = semctl(sem, 0, IPC_STAT, arg);
17566         if (st == 0)
17567             printf("semun\n");
17568         else
17569 #       endif /* IPC_STAT */
17570             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17571 #       ifdef IPC_RMID
17572         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17573 #       endif /* IPC_RMID */
17574             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17575     } else
17576 #endif /* IPC_PRIVATE && ... */
17577         printf("semget failed: errno = %d\n", errno);
17578   return 0;
17579 }
17580 END
17581       set try
17582       if eval $compile; then
17583           xxx=`$run ./try`
17584           case "$xxx" in
17585           semun) val="$define" ;;
17586           esac
17587       fi
17588       $rm_try
17589       set d_semctl_semun
17590       eval $setvar
17591       ;;
17592     esac
17593     case "$d_semctl_semun" in
17594     $define)
17595         echo "You can use union semun for semctl IPC_STAT." >&4
17596         also='also'
17597         ;;
17598     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17599         also=''
17600         ;;
17601     esac
17602
17603     : see whether semctl IPC_STAT can use struct semid_ds pointer
17604     case "$d_semctl_semid_ds" in
17605     '')
17606       val="$undef"
17607       $cat > try.c <<'END'
17608 #include <sys/types.h>
17609 #include <sys/ipc.h>
17610 #include <sys/sem.h>
17611 #include <sys/stat.h>
17612 #include "tryh.h"
17613 #include <stdio.h>
17614 #include <errno.h>
17615 #ifndef errno
17616 extern int errno;
17617 #endif
17618 int main() {
17619     union semun
17620 #ifndef HAS_UNION_SEMUN
17621     {
17622         int val;
17623         struct semid_ds *buf;
17624         unsigned short *array;
17625     }
17626 #endif
17627     arg;
17628     struct semid_ds argbuf;
17629     int sem, st;
17630
17631 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17632     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17633     if (sem > -1) {
17634         arg.buf = &argbuf;
17635 #       ifdef IPC_STAT
17636         st = semctl(sem, 0, IPC_STAT, arg);
17637         if (st == 0)
17638             printf("semid_ds\n");
17639         else
17640 #       endif /* IPC_STAT */
17641             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17642 #       ifdef IPC_RMID
17643         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17644 #       endif /* IPC_RMID */
17645             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17646     } else
17647 #endif /* IPC_PRIVATE && ... */
17648         printf("semget failed: errno = %d\n", errno);
17649
17650     return 0;
17651 }
17652 END
17653       set try
17654       if eval $compile; then
17655           xxx=`$run ./try`
17656           case "$xxx" in
17657           semid_ds) val="$define" ;;
17658           esac
17659       fi
17660       $rm_try
17661       set d_semctl_semid_ds
17662       eval $setvar
17663       ;;
17664     esac
17665     case "$d_semctl_semid_ds" in
17666     $define)
17667         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17668         ;;
17669     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17670         ;;
17671     esac
17672     ;;
17673 *)  val="$undef"
17674
17675     # We do not have the full sem*(2) library, so assume we can not
17676     # use either.
17677
17678     set d_semctl_semun
17679     eval $setvar
17680
17681     set d_semctl_semid_ds
17682     eval $setvar
17683     ;;
17684 esac
17685 $rm_try tryh.h
17686
17687 : see if sendmsg exists
17688 set sendmsg d_sendmsg
17689 eval $inlibc
17690
17691 : see if setegid exists
17692 set setegid d_setegid
17693 eval $inlibc
17694
17695 : see if seteuid exists
17696 set seteuid d_seteuid
17697 eval $inlibc
17698
17699 : see if setgrent exists
17700 set setgrent d_setgrent
17701 eval $inlibc
17702
17703 : see if setgrent_r exists
17704 set setgrent_r d_setgrent_r
17705 eval $inlibc
17706 case "$d_setgrent_r" in
17707 "$define")
17708         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17709         case "$d_setgrent_r_proto:$usethreads" in
17710         ":define")      d_setgrent_r_proto=define
17711                 set d_setgrent_r_proto setgrent_r $hdrs
17712                 eval $hasproto ;;
17713         *)      ;;
17714         esac
17715         case "$d_setgrent_r_proto" in
17716         define)
17717         case "$setgrent_r_proto" in
17718         ''|0) try='int setgrent_r(FILE**);'
17719         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17720         esac
17721         case "$setgrent_r_proto" in
17722         ''|0) try='void setgrent_r(FILE**);'
17723         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17724         esac
17725         case "$setgrent_r_proto" in
17726         ''|0)   d_setgrent_r=undef
17727                 setgrent_r_proto=0
17728                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17729         * )     case "$setgrent_r_proto" in
17730                 REENTRANT_PROTO*) ;;
17731                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17732                 esac
17733                 echo "Prototype: $try" ;;
17734         esac
17735         ;;
17736         *)      case "$usethreads" in
17737                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17738                 esac
17739                 d_setgrent_r=undef
17740                 setgrent_r_proto=0
17741                 ;;
17742         esac
17743         ;;
17744 *)      setgrent_r_proto=0
17745         ;;
17746 esac
17747
17748 : see if sethostent exists
17749 set sethostent d_sethent
17750 eval $inlibc
17751
17752 : see if sethostent_r exists
17753 set sethostent_r d_sethostent_r
17754 eval $inlibc
17755 case "$d_sethostent_r" in
17756 "$define")
17757         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17758         case "$d_sethostent_r_proto:$usethreads" in
17759         ":define")      d_sethostent_r_proto=define
17760                 set d_sethostent_r_proto sethostent_r $hdrs
17761                 eval $hasproto ;;
17762         *)      ;;
17763         esac
17764         case "$d_sethostent_r_proto" in
17765         define)
17766         case "$sethostent_r_proto" in
17767         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17768         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17769         esac
17770         case "$sethostent_r_proto" in
17771         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17772         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17773         esac
17774         case "$sethostent_r_proto" in
17775         ''|0)   d_sethostent_r=undef
17776                 sethostent_r_proto=0
17777                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17778         * )     case "$sethostent_r_proto" in
17779                 REENTRANT_PROTO*) ;;
17780                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17781                 esac
17782                 echo "Prototype: $try" ;;
17783         esac
17784         ;;
17785         *)      case "$usethreads" in
17786                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17787                 esac
17788                 d_sethostent_r=undef
17789                 sethostent_r_proto=0
17790                 ;;
17791         esac
17792         ;;
17793 *)      sethostent_r_proto=0
17794         ;;
17795 esac
17796
17797 : see if setitimer exists
17798 set setitimer d_setitimer
17799 eval $inlibc
17800
17801 : see if setlinebuf exists
17802 set setlinebuf d_setlinebuf
17803 eval $inlibc
17804
17805 : see if locale.h is available
17806 set locale.h i_locale
17807 eval $inhdr
17808
17809 : see if this system has wctype.h
17810 set wctype.h i_wctype
17811 eval $inhdr
17812
17813 : see if towupper exists
17814 set towupper d_towupper
17815 eval $inlibc
17816
17817 : check for setlocale function and behavior
17818 case "$d_setlocale" in
17819 '')
17820 $cat >&4 <<EOM
17821
17822 Checking to see if you have setlocale() and its behavior
17823 EOM
17824 $cat >try.c <<EOCP
17825 #include <stdlib.h>
17826 #include <string.h>
17827 #$i_locale I_LOCALE
17828 #ifdef I_LOCALE
17829 #  include <locale.h>
17830 #endif
17831 #$i_wctype I_WCTYPE
17832 #ifdef I_WCTYPE
17833 #  include <wctype.h>
17834 #endif
17835
17836 int main() {
17837     const char * invalid_name = "\a";   /* This is really invalid! */
17838     int accepts_any_locale_name = 0;
17839     int has_C_UTF8 = 0;
17840     unsigned char bad_setlocale = 255;
17841
17842     /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
17843      * disabled.  It's hard to imagine an instance where meaningful locale
17844      * handling could be done without LC_CTYPE */
17845     const char *  name = setlocale(LC_CTYPE, "C");
17846
17847     if (name == NULL || strcmp(name, "C") != 0) {
17848         exit(bad_setlocale);
17849     }
17850
17851     name = setlocale(LC_CTYPE, invalid_name);
17852     if (name != NULL) {
17853
17854         /* Let it pass if it accepts the name but gives back one of the C
17855          * locales */
17856         if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
17857             accepts_any_locale_name = 1;
17858         }
17859     }
17860
17861     name = setlocale(LC_CTYPE, "C.UTF-8");
17862     if (name != NULL) {
17863         unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
17864
17865 #$d_towupper HAS_TOWUPPER
17866 #ifdef HAS_TOWUPPER
17867
17868         /* We assume that if the machine doesn't have the C99 towupper, it
17869          * doesn't have C.UTF-8, even if we successfully changed locales to
17870          * include it.  This seems safer even on platforms that didn't accept
17871          * the really invalid name */
17872
17873         if (towupper(y_with_diaeresis) == 0x178) {
17874             has_C_UTF8 = 1;
17875         }
17876
17877 #endif
17878
17879     }
17880
17881 #if 0
17882
17883     /* Currently unused code to determine if LC_ALL with disparate values uses
17884      * category = value pairs or positional, and to determine the separator
17885      * between the categories.  We could add code so that if the separator were
17886      * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
17887      * every possible ASCII separator would fit in the 5 bits available in the
17888      * exit code.  This would not be true in EBCDIC.  And then if LC_ALL is
17889      * positional, we probably would want to know the order of the categories.
17890      * Using a file between the C program and the shell script would really be
17891      * require to do that */
17892 #ifdef LC_ALL
17893
17894     unsigned char min_separator = ' ' - 1;
17895     unsigned char separator = min_separator;
17896     int uses_name_value_pair_names = 0;
17897
17898     name = setlocale(LC_ALL, "C");
17899     if (name == NULL || strcmp(name, "C") != 0) {
17900         exit(bad_setlocale);
17901     }
17902
17903     if (has_C_UTF8) {
17904         char * pos;
17905
17906         name = setlocale(LC_CTYPE, "C.UTF-8");
17907         if (name == NULL) {
17908             exit(bad_setlocale);
17909         }
17910         name = setlocale(LC_ALL, NULL);
17911         if (name == NULL) {
17912             exit(bad_setlocale);
17913         }
17914
17915         pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
17916         if (pos != NULL) {
17917             uses_name_value_pair_names = 1;
17918             if (pos == name) {
17919                 separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
17920             }
17921             else {
17922                 separator = *(pos - 1);
17923             }
17924         }
17925         else {
17926             pos = strstr(name, "C.UTF-8");
17927             if (pos == NULL) {
17928                 /* bad */
17929             }
17930             else if (pos == name) {
17931                 separator = name[sizeof("C.UTF-8") - 1];
17932             }
17933             else {
17934                 separator = *(pos - 1);
17935             }
17936         }
17937     }
17938
17939 #endif
17940 #endif
17941
17942     exit( 0 /* (separator - min_separator) << 3
17943         | uses_name_value_pair_names      << 2
17944           */
17945         | has_C_UTF8                      << 1
17946         | accepts_any_locale_name);
17947
17948 }
17949 EOCP
17950 val=
17951 set d_setlocale
17952 eval $setvar
17953 case $d_setlocale in
17954     $undef) d_setlocale_accepts_any_locale_name="$undef"
17955             d_has_C_UTF8="false"
17956             ;;
17957     *) set try
17958        if eval $compile; then
17959            echo "Your system has setlocale()..." >&4
17960            $run ./try
17961            case $? in
17962                0) echo "and it seems sane; you don't have a C.UTF8 locale" >&4
17963                   d_setlocale="$define"
17964                   d_setlocale_accepts_any_locale_name="$undef"
17965                   d_has_C_UTF8="false"
17966                   ;;
17967                1) echo "and it seems sane, but accepts any locale name as valid" >&4
17968                   d_setlocale="$define"
17969                   d_setlocale_accepts_any_locale_name="$define"
17970                   d_has_C_UTF8="false"
17971                   ;;
17972                2) echo "and it seems sane; you have a C.UTF8 locale" >&4
17973                   d_setlocale="$define"
17974                   d_setlocale_accepts_any_locale_name="$undef"
17975                   d_has_C_UTF8="true"
17976                   ;;
17977                3) echo "and it seems sane, but accepts any locale name as valid" >&4
17978                   d_setlocale="$define"
17979                   d_setlocale_accepts_any_locale_name="$define"
17980                   d_has_C_UTF8="true"
17981                   ;;
17982                *) echo "but it doesn't seem to work, so we won't use it." >&4
17983                   d_setlocale="$undef"
17984                   d_setlocale_accepts_any_locale_name="$undef"
17985                   d_has_C_UTF8="false"
17986                   ;;
17987            esac
17988        else
17989            echo "your system does not have setlocale()" >&4
17990            d_setlocale="$undef"
17991            d_setlocale_accepts_any_locale_name="$undef"
17992            d_has_C_UTF8="false"
17993        fi
17994 esac
17995 $rm_try
17996 ;;
17997 *) val="$d_setlocale"
17998     set d_setlocale
17999     eval $setvar
18000     case "$d_setlocale" in
18001         $undef) echo "There may be other ways to set the locale on your system, so we need to ask:" >&4
18002         ;;
18003     esac
18004     rp="Does your system have the C.UTF8 locale?"
18005     dflt=n
18006     . ./myread
18007     case "$ans" in
18008         [Yy]*) d_has_C_UTF8="true"
18009                c_utf8_locale=" or C.UTF8"
18010                ;;
18011         *)     d_has_C_UTF8="false"
18012                c_utf8_locale=""
18013                ;;
18014     esac
18015     case "$d_setlocale" in
18016         $define)
18017             rp="When you set your locale to something besides C$c_utf8_locale, does it do so, or just pretend to?" >&4
18018             dflt=n
18019             . ./myread
18020             case "$ans" in
18021                 true|[Yy]*)
18022                    d_setlocale_accepts_any_locale_name="$undef"
18023                    ;;
18024                 *) d_setlocale_accepts_any_locale_name="$define"
18025                    ;;
18026             esac
18027             ;;
18028         *) d_setlocale_accepts_any_locale_name="$undef"
18029            ;;
18030     esac
18031 esac
18032
18033 : see if setlocale_r exists
18034 set setlocale_r d_setlocale_r
18035 eval $inlibc
18036 case "$d_setlocale_r" in
18037 "$define")
18038         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18039         case "$d_setlocale_r_proto:$usethreads" in
18040         ":define")      d_setlocale_r_proto=define
18041                 set d_setlocale_r_proto setlocale_r $hdrs
18042                 eval $hasproto ;;
18043         *)      ;;
18044         esac
18045         case "$d_setlocale_r_proto" in
18046         define)
18047         case "$setlocale_r_proto" in
18048         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18049         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18050         esac
18051         case "$setlocale_r_proto" in
18052         ''|0)   d_setlocale_r=undef
18053                 setlocale_r_proto=0
18054                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18055         * )     case "$setlocale_r_proto" in
18056                 REENTRANT_PROTO*) ;;
18057                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18058                 esac
18059                 echo "Prototype: $try" ;;
18060         esac
18061         ;;
18062         *)      case "$usethreads" in
18063                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18064                 esac
18065                 d_setlocale_r=undef
18066                 setlocale_r_proto=0
18067                 ;;
18068         esac
18069         ;;
18070 *)      setlocale_r_proto=0
18071         ;;
18072 esac
18073
18074 : see if setnetent exists
18075 set setnetent d_setnent
18076 eval $inlibc
18077
18078 : see if setnetent_r exists
18079 set setnetent_r d_setnetent_r
18080 eval $inlibc
18081 case "$d_setnetent_r" in
18082 "$define")
18083         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18084         case "$d_setnetent_r_proto:$usethreads" in
18085         ":define")      d_setnetent_r_proto=define
18086                 set d_setnetent_r_proto setnetent_r $hdrs
18087                 eval $hasproto ;;
18088         *)      ;;
18089         esac
18090         case "$d_setnetent_r_proto" in
18091         define)
18092         case "$setnetent_r_proto" in
18093         ''|0) try='int setnetent_r(int, struct netent_data*);'
18094         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18095         esac
18096         case "$setnetent_r_proto" in
18097         ''|0) try='void setnetent_r(int, struct netent_data*);'
18098         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18099         esac
18100         case "$setnetent_r_proto" in
18101         ''|0)   d_setnetent_r=undef
18102                 setnetent_r_proto=0
18103                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18104         * )     case "$setnetent_r_proto" in
18105                 REENTRANT_PROTO*) ;;
18106                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18107                 esac
18108                 echo "Prototype: $try" ;;
18109         esac
18110         ;;
18111         *)      case "$usethreads" in
18112                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18113                 esac
18114                 d_setnetent_r=undef
18115                 setnetent_r_proto=0
18116                 ;;
18117         esac
18118         ;;
18119 *)      setnetent_r_proto=0
18120         ;;
18121 esac
18122
18123 : see if setprotoent exists
18124 set setprotoent d_setpent
18125 eval $inlibc
18126
18127 : see if setpgid exists
18128 set setpgid d_setpgid
18129 eval $inlibc
18130
18131 : see if setpgrp2 exists
18132 set setpgrp2 d_setpgrp2
18133 eval $inlibc
18134
18135 : see if setpriority exists
18136 set setpriority d_setprior
18137 eval $inlibc
18138
18139 : see if setproctitle exists
18140 set setproctitle d_setproctitle
18141 eval $inlibc
18142
18143 : see if setprotoent_r exists
18144 set setprotoent_r d_setprotoent_r
18145 eval $inlibc
18146 case "$d_setprotoent_r" in
18147 "$define")
18148         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18149         case "$d_setprotoent_r_proto:$usethreads" in
18150         ":define")      d_setprotoent_r_proto=define
18151                 set d_setprotoent_r_proto setprotoent_r $hdrs
18152                 eval $hasproto ;;
18153         *)      ;;
18154         esac
18155         case "$d_setprotoent_r_proto" in
18156         define)
18157         case "$setprotoent_r_proto" in
18158         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18159         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18160         esac
18161         case "$setprotoent_r_proto" in
18162         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18163         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18164         esac
18165         case "$setprotoent_r_proto" in
18166         ''|0)   d_setprotoent_r=undef
18167                 setprotoent_r_proto=0
18168                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18169         * )     case "$setprotoent_r_proto" in
18170                 REENTRANT_PROTO*) ;;
18171                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18172                 esac
18173                 echo "Prototype: $try" ;;
18174         esac
18175         ;;
18176         *)      case "$usethreads" in
18177                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18178                 esac
18179                 d_setprotoent_r=undef
18180                 setprotoent_r_proto=0
18181                 ;;
18182         esac
18183         ;;
18184 *)      setprotoent_r_proto=0
18185         ;;
18186 esac
18187
18188 : see if setpwent exists
18189 set setpwent d_setpwent
18190 eval $inlibc
18191
18192 : see if setpwent_r exists
18193 set setpwent_r d_setpwent_r
18194 eval $inlibc
18195 case "$d_setpwent_r" in
18196 "$define")
18197         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18198         case "$d_setpwent_r_proto:$usethreads" in
18199         ":define")      d_setpwent_r_proto=define
18200                 set d_setpwent_r_proto setpwent_r $hdrs
18201                 eval $hasproto ;;
18202         *)      ;;
18203         esac
18204         case "$d_setpwent_r_proto" in
18205         define)
18206         case "$setpwent_r_proto" in
18207         ''|0) try='int setpwent_r(FILE**);'
18208         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18209         esac
18210         case "$setpwent_r_proto" in
18211         ''|0) try='void setpwent_r(FILE**);'
18212         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18213         esac
18214         case "$setpwent_r_proto" in
18215         ''|0)   d_setpwent_r=undef
18216                 setpwent_r_proto=0
18217                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18218         * )     case "$setpwent_r_proto" in
18219                 REENTRANT_PROTO*) ;;
18220                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18221                 esac
18222                 echo "Prototype: $try" ;;
18223         esac
18224         ;;
18225         *)      case "$usethreads" in
18226                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18227                 esac
18228                 d_setpwent_r=undef
18229                 setpwent_r_proto=0
18230                 ;;
18231         esac
18232         ;;
18233 *)      setpwent_r_proto=0
18234         ;;
18235 esac
18236
18237 : see if setregid exists
18238 set setregid d_setregid
18239 eval $inlibc
18240 set setresgid d_setresgid
18241 eval $inlibc
18242
18243 : see if setreuid exists
18244 set setreuid d_setreuid
18245 eval $inlibc
18246 set setresuid d_setresuid
18247 eval $inlibc
18248
18249 : see if setrgid exists
18250 set setrgid d_setrgid
18251 eval $inlibc
18252
18253 : see if setruid exists
18254 set setruid d_setruid
18255 eval $inlibc
18256
18257 : see if setservent exists
18258 set setservent d_setsent
18259 eval $inlibc
18260
18261 : see if setservent_r exists
18262 set setservent_r d_setservent_r
18263 eval $inlibc
18264 case "$d_setservent_r" in
18265 "$define")
18266         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18267         case "$d_setservent_r_proto:$usethreads" in
18268         ":define")      d_setservent_r_proto=define
18269                 set d_setservent_r_proto setservent_r $hdrs
18270                 eval $hasproto ;;
18271         *)      ;;
18272         esac
18273         case "$d_setservent_r_proto" in
18274         define)
18275         case "$setservent_r_proto" in
18276         ''|0) try='int setservent_r(int, struct servent_data*);'
18277         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18278         esac
18279         case "$setservent_r_proto" in
18280         ''|0) try='void setservent_r(int, struct servent_data*);'
18281         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18282         esac
18283         case "$setservent_r_proto" in
18284         ''|0)   d_setservent_r=undef
18285                 setservent_r_proto=0
18286                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18287         * )     case "$setservent_r_proto" in
18288                 REENTRANT_PROTO*) ;;
18289                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18290                 esac
18291                 echo "Prototype: $try" ;;
18292         esac
18293         ;;
18294         *)      case "$usethreads" in
18295                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18296                 esac
18297                 d_setservent_r=undef
18298                 setservent_r_proto=0
18299                 ;;
18300         esac
18301         ;;
18302 *)      setservent_r_proto=0
18303         ;;
18304 esac
18305
18306 : see if setsid exists
18307 set setsid d_setsid
18308 eval $inlibc
18309
18310 : see if setvbuf exists
18311 set setvbuf d_setvbuf
18312 eval $inlibc
18313
18314 : see if shmctl exists
18315 set shmctl d_shmctl
18316 eval $inlibc
18317
18318 : see if shmget exists
18319 set shmget d_shmget
18320 eval $inlibc
18321
18322 : see if shmat exists
18323 set shmat d_shmat
18324 eval $inlibc
18325 : see what shmat returns
18326 case "$d_shmat" in
18327 "$define")
18328         $cat >shmat.c <<'END'
18329 #include <sys/shm.h>
18330 void *shmat();
18331 END
18332         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18333                 shmattype='void *'
18334         else
18335                 shmattype='char *'
18336         fi
18337         echo "and it returns ($shmattype)." >&4
18338         : see if a prototype for shmat is available
18339         xxx=`./findhdr sys/shm.h`
18340         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18341         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18342                 val="$define"
18343         else
18344                 val="$undef"
18345         fi
18346         $rm -f shmat.[co]
18347         ;;
18348 *)
18349         val="$undef"
18350         ;;
18351 esac
18352 set d_shmatprototype
18353 eval $setvar
18354
18355 : see if shmdt exists
18356 set shmdt d_shmdt
18357 eval $inlibc
18358
18359 : see how much of the 'shm*(2)' library is present.
18360 h_shm=true
18361 echo " "
18362 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18363 *"$undef"*) h_shm=false;;
18364 esac
18365 case "$osname" in
18366 freebsd)
18367     case "`ipcs 2>&1`" in
18368     "SVID shared memory"*"not configured"*)
18369         echo "Your $osname does not have the shm*(2) configured." >&4
18370         h_shm=false
18371         val="$undef"
18372         set shmctl d_shmctl
18373         eval $setvar
18374         set shmget d_shmget
18375         eval $setvar
18376         set shmat d_shmat
18377         eval $setvar
18378         set shmdt d_shmdt
18379         eval $setvar
18380         ;;
18381     esac
18382     ;;
18383 esac
18384 : we could also check for sys/ipc.h ...
18385 if $h_shm && $test `./findhdr sys/shm.h`; then
18386         echo "You have the full shm*(2) library." >&4
18387         val="$define"
18388 else
18389         echo "You don't have the full shm*(2) library." >&4
18390         val="$undef"
18391 fi
18392 set d_shm
18393 eval $setvar
18394
18395 : see if we have sigaction
18396 echo " "
18397 if set sigaction val -f d_sigaction; eval $csym; $val; then
18398         echo 'sigaction() found.' >&4
18399         $cat > try.c <<EOP
18400 #include <stdio.h>
18401 #include <sys/types.h>
18402 #include <signal.h>
18403 #$i_stdlib I_STDLIB
18404 #ifdef I_STDLIB
18405 #include <stdlib.h>
18406 #endif
18407 int main()
18408 {
18409     struct sigaction act, oact;
18410     act.sa_flags = 0;
18411     oact.sa_handler = 0;
18412     /* so that act and oact are used */
18413     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18414 }
18415 EOP
18416         set try
18417         if eval $compile_ok; then
18418                 val="$define"
18419         else
18420                 echo "But you don't seem to have a usable struct sigaction." >&4
18421                 val="$undef"
18422         fi
18423 else
18424         echo 'sigaction NOT found.' >&4
18425         val="$undef"
18426 fi
18427 set d_sigaction; eval $setvar
18428 $rm_try
18429
18430 : see what type pids are declared as in the kernel
18431 rp="What is the type of process ids on this system?"
18432 set pid_t pidtype int stdio.h sys/types.h
18433 eval $typedef_ask
18434
18435 : see what type uids are declared as in the kernel
18436 echo " "
18437 echo "Looking for the type for user ids returned by getuid()."
18438 set uid_t uidtype xxx stdio.h sys/types.h
18439 eval $typedef
18440 case "$uidtype" in
18441 xxx)
18442         xxx=`./findhdr sys/user.h`
18443         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18444         case $1 in
18445         unsigned) dflt="$1 $2" ;;
18446         *) dflt="$1" ;;
18447         esac
18448         ;;
18449 *) dflt="$uidtype";;
18450 esac
18451 case "$uidtype" in
18452 uid_t)  echo "uid_t found." ;;
18453 *)      rp="What is the type for user ids returned by getuid()?"
18454         . ./myread
18455         uidtype="$ans"
18456         ;;
18457 esac
18458
18459 : Define hasfield_t macro for Configure internal use
18460 hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
18461 while $test $# -ge 2; do
18462     case "$1" in
18463         $define) echo "#include <$2>";;
18464     esac ;
18465     shift 2;
18466 done > try.c;
18467 echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
18468 set try;
18469 if eval $compile; then
18470         val="$define";
18471 else
18472         val="$undef";
18473 fi;
18474 set $varname;
18475 eval $setvar;
18476 $rm_try'
18477
18478 : see what siginfo fields we have
18479 case "$d_sigaction" in
18480 "$define")
18481         echo "Checking if your siginfo_t has si_errno field...">&4
18482         set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h
18483         eval $hasfield_t;
18484
18485         echo "Checking if your siginfo_t has si_pid field...">&4
18486         set d_siginfo_si_pid siginfo_t $pidtype si_pid $d_sigaction signal.h
18487         eval $hasfield_t;
18488
18489         echo "Checking if your siginfo_t has si_uid field...">&4
18490         set d_siginfo_si_uid siginfo_t $uidtype si_uid $d_sigaction signal.h
18491         eval $hasfield_t;
18492
18493         echo "Checking if your siginfo_t has si_addr field...">&4
18494         set d_siginfo_si_addr siginfo_t "void *" si_addr $d_sigaction signal.h
18495         eval $hasfield_t;
18496
18497         echo "Checking if your siginfo_t has si_status field...">&4
18498         set d_siginfo_si_status siginfo_t int si_status $d_sigaction signal.h
18499         eval $hasfield_t;
18500
18501         echo "Checking if your siginfo_t has si_band field...">&4
18502         set d_siginfo_si_band siginfo_t long si_band $d_sigaction signal.h
18503         eval $hasfield_t;
18504
18505         echo "Checking if your siginfo_t has si_value field...">&4
18506         set d_siginfo_si_value siginfo_t "union sigval" si_value $d_sigaction signal.h
18507         eval $hasfield_t;
18508
18509         echo "Checking if your siginfo_t has si_fd field...">&4
18510         set d_siginfo_si_fd siginfo_t int si_fd $d_sigaction signal.h
18511         eval $hasfield_t;
18512
18513         ;;
18514 *)
18515         d_siginfo_si_errno="$undef"
18516         d_siginfo_si_pid="$undef"
18517         d_siginfo_si_uid="$undef"
18518         d_siginfo_si_addr="$undef"
18519         d_siginfo_si_status="$undef"
18520         d_siginfo_si_band="$undef"
18521         d_siginfo_si_value="$undef"
18522         d_siginfo_si_fd="$undef"
18523         ;;
18524 esac
18525
18526 : see if this is a sunmath.h system
18527 set sunmath.h i_sunmath
18528 eval $inhdr
18529
18530 : see if signbit exists
18531 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18532 $cat >try.c <<EOCP
18533 #$i_sunmath I_SUNMATH
18534 #include <math.h>
18535 #ifdef I_SUNMATH  /* Solaris special math library */
18536 #  include <sunmath.h>
18537 #endif
18538 #define NV $nvtype
18539 int main(int argc, char **argv)
18540 {
18541     NV x = 0.0;
18542     NV y = -1.0;
18543     if ((signbit(x) == 0) && (signbit(y) != 0))
18544         return 0;
18545     else
18546         return 1;
18547 }
18548 EOCP
18549 val="$undef"
18550 set try
18551 if eval $compile; then
18552     if $run ./try; then
18553         $echo "Yes." >&4
18554         val="$define"
18555     else
18556         $echo "Signbit seems to be available, but doesn't work as I expected."
18557         $echo "I won't use it." >&4
18558         val="$undef"
18559     fi
18560 else
18561     $echo "Nope." >&4
18562     dflt="$undef"
18563 fi
18564 set d_signbit
18565 eval $setvar
18566 $rm_try
18567
18568 : see if sigprocmask exists
18569 set sigprocmask d_sigprocmask
18570 eval $inlibc
18571
18572 : see if sigsetjmp exists
18573 echo " "
18574 case "$d_sigsetjmp" in
18575 '')
18576         $cat >try.c <<EOP
18577 #include <setjmp.h>
18578 #$i_stdlib I_STDLIB
18579 #ifdef I_STDLIB
18580 #include <stdlib.h>
18581 #endif
18582 sigjmp_buf env;
18583 int set = 1;
18584 int main()
18585 {
18586         if (sigsetjmp(env,1))
18587                 exit(set);
18588         set = 0;
18589         siglongjmp(env, 1);
18590         exit(1);
18591 }
18592 EOP
18593         set try
18594         if eval $compile; then
18595                 if $run ./try >/dev/null 2>&1; then
18596                         echo "POSIX sigsetjmp found." >&4
18597                         val="$define"
18598                 else
18599                         $cat >&4 <<EOM
18600 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18601 I'll ignore them.
18602 EOM
18603                         val="$undef"
18604                 fi
18605         else
18606                 echo "sigsetjmp not found." >&4
18607                 val="$undef"
18608         fi
18609         ;;
18610 *) val="$d_sigsetjmp"
18611         case "$d_sigsetjmp" in
18612         $define) echo "POSIX sigsetjmp found." >&4;;
18613         $undef) echo "sigsetjmp not found." >&4;;
18614         esac
18615         ;;
18616 esac
18617 set d_sigsetjmp
18618 eval $setvar
18619 $rm_try
18620
18621 : see if snprintf exists
18622 set snprintf d_snprintf
18623 eval $inlibc
18624
18625 : see if vsnprintf exists
18626 set vsnprintf d_vsnprintf
18627 eval $inlibc
18628
18629 case "$d_snprintf-$d_vsnprintf" in
18630 "$define-$define")
18631     $cat <<EOM
18632 Checking whether your snprintf() and vsnprintf() work okay...
18633 EOM
18634     $cat >try.c <<'EOCP'
18635 /* v?snprintf testing logic courtesy of Russ Allbery.
18636  * According to C99:
18637  * - if the buffer is too short it still must be \0-terminated
18638  * - if the buffer is too short the potentially required length
18639  *   must be returned and not -1
18640  * - if the buffer is NULL the potentially required length
18641  *   must be returned and not -1 or core dump
18642  */
18643 #include <stdio.h>
18644 #include <stdarg.h>
18645
18646 char buf[2];
18647
18648 int test (char *format, ...)
18649 {
18650     va_list args;
18651     int count;
18652
18653     va_start (args, format);
18654     count = vsnprintf (buf, sizeof buf, format, args);
18655     va_end (args);
18656     return count;
18657 }
18658
18659 int main ()
18660 {
18661     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18662              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18663 }
18664 EOCP
18665     set try
18666     if eval $compile; then
18667         `$run ./try`
18668         case "$?" in
18669         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18670         *) cat <<EOM >&4
18671 Your snprintf() and snprintf() don't seem to be working okay.
18672 EOM
18673            d_snprintf="$undef"
18674            d_vsnprintf="$undef"
18675            ;;
18676         esac
18677     else
18678         echo "(I can't seem to compile the test program--assuming they don't)"
18679         d_snprintf="$undef"
18680         d_vsnprintf="$undef"
18681     fi
18682     $rm_try
18683     ;;
18684 esac
18685
18686 : see if sockatmark exists
18687 set sockatmark d_sockatmark
18688 eval $inlibc
18689
18690 : see if prototype for sockatmark is available
18691 echo " "
18692 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18693 eval $hasproto
18694
18695 : see if socks5_init exists
18696 set socks5_init d_socks5_init
18697 eval $inlibc
18698
18699 : see if srand48_r exists
18700 set srand48_r d_srand48_r
18701 eval $inlibc
18702 case "$d_srand48_r" in
18703 "$define")
18704         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18705         case "$d_srand48_r_proto:$usethreads" in
18706         ":define")      d_srand48_r_proto=define
18707                 set d_srand48_r_proto srand48_r $hdrs
18708                 eval $hasproto ;;
18709         *)      ;;
18710         esac
18711         case "$d_srand48_r_proto" in
18712         define)
18713         case "$srand48_r_proto" in
18714         ''|0) try='int srand48_r(long, struct drand48_data*);'
18715         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18716         esac
18717         case "$srand48_r_proto" in
18718         ''|0)   d_srand48_r=undef
18719                 srand48_r_proto=0
18720                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18721         * )     case "$srand48_r_proto" in
18722                 REENTRANT_PROTO*) ;;
18723                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18724                 esac
18725                 echo "Prototype: $try" ;;
18726         esac
18727         ;;
18728         *)      case "$usethreads" in
18729                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18730                 esac
18731                 d_srand48_r=undef
18732                 srand48_r_proto=0
18733                 ;;
18734         esac
18735         ;;
18736 *)      srand48_r_proto=0
18737         ;;
18738 esac
18739
18740 : see if srandom_r exists
18741 set srandom_r d_srandom_r
18742 eval $inlibc
18743 case "$d_srandom_r" in
18744 "$define")
18745         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18746         case "$d_srandom_r_proto:$usethreads" in
18747         ":define")      d_srandom_r_proto=define
18748                 set d_srandom_r_proto srandom_r $hdrs
18749                 eval $hasproto ;;
18750         *)      ;;
18751         esac
18752         case "$d_srandom_r_proto" in
18753         define)
18754         case "$srandom_r_proto" in
18755         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18756         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18757         esac
18758         case "$srandom_r_proto" in
18759         ''|0)   d_srandom_r=undef
18760                 srandom_r_proto=0
18761                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18762         * )     case "$srandom_r_proto" in
18763                 REENTRANT_PROTO*) ;;
18764                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18765                 esac
18766                 echo "Prototype: $try" ;;
18767         esac
18768         ;;
18769         *)      case "$usethreads" in
18770                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18771                 esac
18772                 d_srandom_r=undef
18773                 srandom_r_proto=0
18774                 ;;
18775         esac
18776         ;;
18777 *)      srandom_r_proto=0
18778         ;;
18779 esac
18780
18781 : see if prototype for setresgid is available
18782 echo " "
18783 set d_sresgproto setresgid $i_unistd unistd.h
18784 eval $hasproto
18785
18786 : see if prototype for setresuid is available
18787 echo " "
18788 set d_sresuproto setresuid $i_unistd unistd.h
18789 eval $hasproto
18790
18791 : see if stat exists
18792 set stat d_stat
18793 eval $inlibc
18794
18795 : see if sys/stat.h is available
18796 set sys/stat.h i_sysstat
18797 eval $inhdr
18798
18799 : see if stat knows about block sizes
18800 echo " "
18801 echo "Checking to see if your struct stat has st_blocks field..." >&4
18802 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18803 eval $hasfield
18804
18805 : see if this is a sys/vfs.h system
18806 set sys/vfs.h i_sysvfs
18807 eval $inhdr
18808
18809 : see if this is a sys/statfs.h system
18810 set sys/statfs.h i_sysstatfs
18811 eval $inhdr
18812
18813 : Check for statfs_s
18814 echo " "
18815 echo "Checking to see if your system supports struct statfs..." >&4
18816 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
18817 eval $hasstruct
18818 case "$d_statfs_s" in
18819 "$define")      echo "Yes, it does."   ;;
18820 *)              echo "No, it doesn't." ;;
18821 esac
18822
18823 : see if struct statfs knows about f_flags
18824 case "$d_statfs_s" in
18825 define)
18826         echo " "
18827         echo "Checking to see if your struct statfs has f_flags field..." >&4
18828         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
18829         eval $hasfield
18830         ;;
18831 *)      val="$undef"
18832         set d_statfs_f_flags
18833         eval $setvar
18834         ;;
18835 esac
18836 case "$d_statfs_f_flags" in
18837 "$define")      echo "Yes, it does."   ;;
18838 *)              echo "No, it doesn't." ;;
18839 esac
18840
18841 : see what flavor, if any, of static inline is supported
18842 echo " "
18843 echo "Checking to see if your system supports static inline..."
18844 $cat > try.c <<'EOCP'
18845 #include <stdlib.h>
18846 extern int f_via_a(int x);
18847 extern int f_via_b(int x);
18848 int main(int argc, char **argv)
18849 {
18850     int y;
18851
18852     y = f_via_a(0);
18853 #ifdef USE_B
18854     y = f_via_b(0);
18855 #endif
18856     if (y == 42) {
18857         return EXIT_SUCCESS;
18858     }
18859     else {
18860         return EXIT_FAILURE;
18861     }
18862 }
18863 EOCP
18864 $cat > a.c <<'EOCP'
18865 static INLINE int f(int x) {
18866     int y;
18867     y = x + 42;
18868     return y;
18869 }
18870
18871 int f_via_a(int x)
18872 {
18873     return f(x);
18874 }
18875 EOCP
18876 $cat > b.c <<'EOCP'
18877 extern int f(int x);
18878
18879 int f_via_b(int x)
18880 {
18881     return f(x);
18882 }
18883 EOCP
18884
18885 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18886 case "$perl_static_inline" in
18887 '')     # Check the various possibilities, and break out on success.
18888         # For gcc, prefer __inline__, which will still permit
18889         # cflags.SH to add in -ansi.
18890         case "$gccversion" in
18891                 '') xxx="inline __inline__ __inline _inline";;
18892                 *)  xxx="__inline__ inline __inline _inline";;
18893         esac
18894         for inline in $xxx; do
18895                 set try -DINLINE=$inline a.c
18896                 if eval $compile && $run ./try; then
18897                         # Now make sure there is no external linkage of static
18898                         # functions
18899                         set try -DINLINE=$inline -DUSE_B a.c b.c
18900                         if eval $compile && $run ./try; then
18901                                 $echo "Your compiler supports static $inline, " >&4
18902                                 $echo "but it also creates an external definition," >&4
18903                                 $echo "so I won't use it." >&4
18904                                 val=$undef
18905                         else
18906                                 $echo "Your compiler supports static $inline." >&4
18907                                 val=$define
18908                                 perl_static_inline="static $inline";
18909                                 break;
18910                         fi
18911                 else
18912                         $echo "Your compiler does NOT support static $inline." >&4
18913                         val="$undef"
18914                 fi
18915         done
18916         ;;
18917 *inline*) # Some variant of inline exists.
18918         echo "Keeping your $hint value of $perl_static_inline."
18919         val=$define
18920         ;;
18921 static)  # No inline capabilities
18922         echo "Keeping your $hint value of $perl_static_inline."
18923         val=$undef
18924         ;;
18925 *)  # Unrecognized previous value -- blindly trust the supplied
18926         # value and hope it makes sense.  Use old value for
18927         # d_static_inline, if there is one.
18928         echo "Keeping your $hint value of $perl_static_inline."
18929         case "$d_static_inline" in
18930                 '') val=$define ;;
18931                 *)  val=$d_static_inline ;;
18932         esac
18933         ;;
18934 esac
18935 # Fallback to plain 'static' if nothing worked.
18936 case "$perl_static_inline" in
18937 '')
18938         perl_static_inline="static"
18939         val=$undef
18940         ;;
18941 esac
18942 set d_static_inline
18943 eval $setvar
18944 $rm -f a.[co] b.[co]
18945 $rm_try
18946
18947 : Check stream access
18948 $cat >&4 <<EOM
18949 Checking how to access stdio streams by file descriptor number...
18950 EOM
18951 case "$stdio_stream_array" in
18952 '')     $cat >try.c <<EOCP
18953 #include <stdio.h>
18954 int main() {
18955   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18956     printf("yes\n");
18957 }
18958 EOCP
18959         for s in _iob __iob __sF
18960         do
18961                 set try -DSTDIO_STREAM_ARRAY=$s
18962                 if eval $compile; then
18963                         case "`$run ./try`" in
18964                         yes)    stdio_stream_array=$s; break ;;
18965                         esac
18966                 fi
18967         done
18968         $rm_try
18969 esac
18970 case "$stdio_stream_array" in
18971 '')     $cat >&4 <<EOM
18972 I can't figure out how to access stdio streams by file descriptor number.
18973 EOM
18974         d_stdio_stream_array="$undef"
18975         ;;
18976 *)      $cat >&4 <<EOM
18977 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18978 EOM
18979         d_stdio_stream_array="$define"
18980         ;;
18981 esac
18982
18983 : see if strcoll exists
18984 set strcoll d_strcoll
18985 eval $inlibc
18986
18987 : see if strerror_l exists
18988 set strerror_l d_strerror_l
18989 eval $inlibc
18990
18991 : see if strerror_r exists
18992 set strerror_r d_strerror_r
18993 eval $inlibc
18994 case "$d_strerror_r" in
18995 "$define")
18996         hdrs="$i_systypes sys/types.h define stdio.h define string.h"
18997         case "$d_strerror_r_proto:$usethreads" in
18998         ":define")      d_strerror_r_proto=define
18999                 set d_strerror_r_proto strerror_r $hdrs
19000                 eval $hasproto ;;
19001         *)      ;;
19002         esac
19003         case "$d_strerror_r_proto" in
19004         define)
19005         case "$strerror_r_proto" in
19006         ''|0) try='int strerror_r(int, char*, size_t);'
19007         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19008         esac
19009         case "$strerror_r_proto" in
19010         ''|0) try='int strerror_r(int, char*, int);'
19011         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19012         esac
19013         case "$strerror_r_proto" in
19014         ''|0) try='char* strerror_r(int, char*, size_t);'
19015         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19016         esac
19017         case "$strerror_r_proto" in
19018         ''|0)   d_strerror_r=undef
19019                 strerror_r_proto=0
19020                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19021         * )     case "$strerror_r_proto" in
19022                 REENTRANT_PROTO*) ;;
19023                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19024                 esac
19025                 echo "Prototype: $try" ;;
19026         esac
19027         ;;
19028         *)      case "$usethreads" in
19029                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19030                 esac
19031                 d_strerror_r=undef
19032                 strerror_r_proto=0
19033                 ;;
19034         esac
19035         ;;
19036 *)      strerror_r_proto=0
19037         ;;
19038 esac
19039
19040 : see if strftime exists
19041 set strftime d_strftime
19042 eval $inlibc
19043
19044 : see if strlcat exists
19045 : We need both a prototype in string.h and the symbol in libc.
19046 echo " "
19047 d_strlcat_proto=''
19048 xx1="#$d_gnulibc HAS_GNULIBC"
19049 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19050 xx3='#   define _GNU_SOURCE'
19051 xx4='#endif'
19052 set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19053 eval $hasproto
19054 case "$d_strlcat_proto" in
19055     define) # see if strlcat exists
19056         set strlcat d_strlcat
19057         eval $inlibc
19058         ;;
19059     *)  val=$undef
19060         set d_strlcat
19061         eval $setvar
19062         ;;
19063 esac
19064
19065 : see if strlcpy exists
19066 : We need both a prototype in string.h and the symbol in libc.
19067 echo " "
19068 d_strlcpy_proto=''
19069 xx1="#$d_gnulibc HAS_GNULIBC"
19070 xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
19071 xx3='#   define _GNU_SOURCE'
19072 xx4='#endif'
19073 set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
19074 eval $hasproto
19075 case "$d_strlcpy_proto" in
19076     define) # see if strlcpy exists
19077         set strlcpy d_strlcpy
19078         eval $inlibc
19079         ;;
19080     *)  val=$undef
19081         set d_strlcpy
19082         eval $setvar
19083         ;;
19084 esac
19085
19086 : see if strnlen exists
19087 set strnlen d_strnlen
19088 eval $inlibc
19089
19090 : see if strtod exists
19091 set strtod d_strtod
19092 eval $inlibc
19093
19094 : see if strtod_l exists
19095 set strtod_l d_strtod_l
19096 eval $inlibc
19097
19098 : see if strtol exists
19099 set strtol d_strtol
19100 eval $inlibc
19101
19102 : see if strtold exists
19103 set strtold d_strtold
19104 eval $inlibc
19105
19106 : see if strtold_l exists
19107 set strtold_l d_strtold_l
19108 eval $inlibc
19109
19110 : see if strtoll exists
19111 set strtoll d_strtoll
19112 eval $inlibc
19113
19114 case "$d_longlong-$d_strtoll" in
19115 "$define-$define")
19116         $cat <<EOM
19117 Checking whether your strtoll() works okay...
19118 EOM
19119         $cat >try.c <<'EOCP'
19120 #include <errno.h>
19121 #ifdef __hpux
19122 #define strtoll __strtoll
19123 #endif
19124 #ifdef __EMX__
19125 #define strtoll _strtoll
19126 #endif
19127 #include <stdio.h>
19128 #include <stdlib.h>
19129 static int bad = 0;
19130 void check(const char *s, long long ell, int een) {
19131         long long gll;
19132         errno = 0;
19133         gll = strtoll(s, 0, 10);
19134         if (!((gll == ell) && (errno == een)))
19135                 bad++;
19136 }
19137 int main() {
19138         check(" 1",                                      1LL, 0);
19139         check(" 0",                                      0LL, 0);
19140         check("-1",                                     -1LL, 0);
19141         check("-9223372036854775808", -9223372036854775808LL, 0);
19142         check("-9223372036854775808", -9223372036854775808LL, 0);
19143         check(" 9223372036854775807",  9223372036854775807LL, 0);
19144         check("-9223372036854775808", -9223372036854775808LL, 0);
19145         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19146         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19147         if (!bad)
19148                 printf("ok\n");
19149 }
19150 EOCP
19151         set try
19152         if eval $compile; then
19153                 yyy=`$run ./try`
19154                 case "$yyy" in
19155                 ok) echo "Your strtoll() seems to be working okay." ;;
19156                 *) cat <<EOM >&4
19157 Your strtoll() doesn't seem to be working okay.
19158 EOM
19159                    d_strtoll="$undef"
19160                    ;;
19161                 esac
19162         else
19163                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19164                 d_strtoll="$undef"
19165         fi
19166         ;;
19167 esac
19168
19169 : see if strtoq exists
19170 set strtoq d_strtoq
19171 eval $inlibc
19172
19173 : see if strtoul exists
19174 set strtoul d_strtoul
19175 eval $inlibc
19176
19177 case "$d_strtoul" in
19178 "$define")
19179         $cat <<EOM
19180 Checking whether your strtoul() works okay...
19181 EOM
19182         $cat >try.c <<'EOCP'
19183 #include <stdlib.h>
19184 #include <errno.h>
19185 #include <stdio.h>
19186 static int bad = 0;
19187 void check(const char *s, unsigned long eul, int een) {
19188         unsigned long gul;
19189         errno = 0;
19190         gul = strtoul(s, 0, 10);
19191         if (!((gul == eul) && (errno == een)))
19192                 bad++;
19193 }
19194 int main() {
19195         check(" 1", 1L, 0);
19196         check(" 0", 0L, 0);
19197 EOCP
19198         case "$longsize" in
19199         8)
19200             $cat >>try.c <<'EOCP'
19201         check("18446744073709551615", 18446744073709551615UL, 0);
19202         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19203 #if 0 /* strtoul() for /^-/ strings is undefined. */
19204         check("-1", 18446744073709551615UL, 0);
19205         check("-18446744073709551614", 2, 0);
19206         check("-18446744073709551615", 1, 0);
19207         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19208         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19209 #endif
19210 EOCP
19211                 ;;
19212         4)
19213                     $cat >>try.c <<'EOCP'
19214         check("4294967295", 4294967295UL, 0);
19215         check("4294967296", 4294967295UL, ERANGE);
19216 #if 0 /* strtoul() for /^-/ strings is undefined. */
19217         check("-1", 4294967295UL, 0);
19218         check("-4294967294", 2, 0);
19219         check("-4294967295", 1, 0);
19220         check("-4294967296", 4294967295UL, ERANGE);
19221         check("-4294967297", 4294967295UL, ERANGE);
19222 #endif
19223 EOCP
19224                 ;;
19225         *)
19226 : Should we write these tests to be more portable by sprintf-ing
19227 : ~0 and then manipulating that char string as input for strtol?
19228                 ;;
19229         esac
19230         $cat >>try.c <<'EOCP'
19231         if (!bad)
19232                 printf("ok\n");
19233         return 0;
19234 }
19235 EOCP
19236         set try
19237         if eval $compile; then
19238                 case "`$run ./try`" in
19239                 ok) echo "Your strtoul() seems to be working okay." ;;
19240                 *) cat <<EOM >&4
19241 Your strtoul() doesn't seem to be working okay.
19242 EOM
19243                    d_strtoul="$undef"
19244                    ;;
19245                 esac
19246         else
19247                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19248                 d_strtoul="$undef"
19249         fi
19250         ;;
19251 esac
19252
19253 : see if strtoull exists
19254 set strtoull d_strtoull
19255 eval $inlibc
19256
19257 case "$d_longlong-$d_strtoull" in
19258 "$define-$define")
19259         $cat <<EOM
19260 Checking whether your strtoull() works okay...
19261 EOM
19262         $cat >try.c <<'EOCP'
19263 #include <stdlib.h>
19264 #include <errno.h>
19265 #ifdef __hpux
19266 #define strtoull __strtoull
19267 #endif
19268 #include <stdio.h>
19269 static int bad = 0;
19270 void check(const char *s, long long eull, int een) {
19271         long long gull;
19272         errno = 0;
19273         gull = strtoull(s, 0, 10);
19274         if (!((gull == eull) && (errno == een)))
19275                 bad++;
19276 }
19277 int main() {
19278         check(" 1",                                        1LL, 0);
19279         check(" 0",                                        0LL, 0);
19280         check("18446744073709551615",  18446744073709551615ULL, 0);
19281         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19282 #if 0 /* strtoull() for /^-/ strings is undefined. */
19283         check("-1",                    18446744073709551615ULL, 0);
19284         check("-18446744073709551614",                     2LL, 0);
19285         check("-18446744073709551615",                     1LL, 0);
19286         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19287         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19288 #endif
19289         if (!bad)
19290                 printf("ok\n");
19291 }
19292 EOCP
19293         set try
19294         if eval $compile; then
19295                 case "`$run ./try`" in
19296                 ok) echo "Your strtoull() seems to be working okay." ;;
19297                 *) cat <<EOM >&4
19298 Your strtoull() doesn't seem to be working okay.
19299 EOM
19300                    d_strtoull="$undef"
19301                    ;;
19302                 esac
19303         else
19304                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19305                 d_strtoull="$undef"
19306         fi
19307         ;;
19308 esac
19309
19310 : see if strtouq exists
19311 set strtouq d_strtouq
19312 eval $inlibc
19313
19314 case "$d_strtouq" in
19315 "$define")
19316         $cat <<EOM
19317 Checking whether your strtouq() works okay...
19318 EOM
19319         $cat >try.c <<'EOCP'
19320 #include <stdlib.h>
19321 #include <errno.h>
19322 #include <stdio.h>
19323 static int bad = 0;
19324 void check(const char *s, unsigned long long eull, int een) {
19325         unsigned long long gull;
19326         errno = 0;
19327         gull = strtouq(s, 0, 10);
19328         if (!((gull == eull) && (errno == een)))
19329                 bad++;
19330 }
19331 int main() {
19332         check(" 1",                                        1LL, 0);
19333         check(" 0",                                        0LL, 0);
19334         check("18446744073709551615",  18446744073709551615ULL, 0);
19335         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19336 #if 0 /* strtouq() for /^-/ strings is undefined. */
19337         check("-1",                    18446744073709551615ULL, 0);
19338         check("-18446744073709551614",                     2LL, 0);
19339         check("-18446744073709551615",                     1LL, 0);
19340         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19341         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19342 #endif
19343         if (!bad)
19344                 printf("ok\n");
19345         return 0;
19346 }
19347 EOCP
19348         set try
19349         if eval $compile; then
19350                 case "`$run ./try`" in
19351                 ok) echo "Your strtouq() seems to be working okay." ;;
19352                 *) cat <<EOM >&4
19353 Your strtouq() doesn't seem to be working okay.
19354 EOM
19355                    d_strtouq="$undef"
19356                    ;;
19357                 esac
19358         else
19359                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19360                 d_strtouq="$undef"
19361         fi
19362         ;;
19363 esac
19364
19365 : see if strxfrm exists
19366 set strxfrm d_strxfrm
19367 eval $inlibc
19368
19369 : see if symlink exists
19370 set symlink d_symlink
19371 eval $inlibc
19372
19373 : see if syscall exists
19374 set syscall d_syscall
19375 eval $inlibc
19376
19377 : see if prototype for syscall is available
19378 echo " "
19379 set d_syscallproto syscall $i_unistd unistd.h
19380 eval $hasproto
19381
19382 : see if sysconf exists
19383 set sysconf d_sysconf
19384 eval $inlibc
19385
19386 : see if sys_errlist[] exists
19387 echo " "
19388 if test "X$d_syserrlst" = X; then
19389         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19390                 echo "You have sys_errlist[], so we could roll our own strerror."
19391                 d_syserrlst="$define"
19392         else
19393                 echo "You don't have sys_errlist[], so strerror() is welcome."
19394                 d_syserrlst="$undef"
19395         fi
19396 fi
19397
19398 : see if system exists
19399 set system d_system
19400 eval $inlibc
19401
19402 : see if tcgetpgrp exists
19403 set tcgetpgrp d_tcgetpgrp
19404 eval $inlibc
19405
19406 : see if tcsetpgrp exists
19407 set tcsetpgrp d_tcsetpgrp
19408 eval $inlibc
19409
19410 : see if prototype for telldir is available
19411 echo " "
19412 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19413 eval $hasproto
19414
19415 : see if tgamma exists
19416 set tgamma d_tgamma
19417 eval $inlibc
19418
19419 : check for thread_safe_nl_langinfo_l item
19420 $cat <<EOM
19421
19422 Checking to see if you have nl_langinfo_l() and that it is thread-safe
19423 EOM
19424 $cat >try.c <<EOCP
19425 #$i_stdlib I_STDLIB
19426 #ifdef I_STDLIB
19427 #  include <stdlib.h>
19428 #endif
19429 #include <string.h>
19430 #$i_langinfo I_LANGINFO
19431 #ifdef I_LANGINFO
19432 #  include <langinfo.h>
19433 #endif
19434 #$i_pthread I_PTHREAD
19435 #ifdef I_PTHREAD
19436 #  include <pthread.h>
19437 #endif
19438 #$i_locale I_LOCALE
19439 #ifdef I_LOCALE
19440 #  include <locale.h>
19441 #endif
19442
19443 void *
19444 thread_start(void * arg)
19445 {
19446     nl_langinfo(RADIXCHAR);
19447 }
19448
19449 int main() {
19450     char * main_buffer;
19451     char save_main_buffer[1000];
19452     pthread_t subthread;
19453     pthread_attr_t attr;
19454
19455     main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0));
19456
19457     /* If too large for our generous allowance, just assume we don't have
19458      * it. */
19459     if (strlen(main_buffer) >= sizeof(save_main_buffer)) {
19460         exit(1);
19461     }
19462
19463     strcpy(save_main_buffer, main_buffer);
19464
19465     if (pthread_attr_init(&attr) != 0) {
19466         exit(1);
19467     }
19468
19469     if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) {
19470         exit(1);
19471     }
19472
19473     if (pthread_join(subthread, NULL) != 0) {
19474         exit(1);
19475     }
19476
19477     exit(! (strcmp(main_buffer, save_main_buffer) == 0));
19478 }
19479 EOCP
19480 case "$usethreads" in
19481     define)
19482         set try
19483         if eval $compile; then
19484             echo "Your system has nl_langinfo_l()..." >&4
19485             if $run ./try; then
19486                 echo "and it is thread-safe (just as I'd hoped)." >&4
19487                 d_thread_safe_nl_langinfo_l="$define"
19488                 echo "$d_thread_safe_nl_langinfo_l" >&4
19489             else
19490                 echo "but it isn't thread-safe, so we won't use it." >&4
19491             fi
19492         else
19493             echo "your system does not have nl_langinfo_l()" >&4
19494         fi
19495         ;;
19496     *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4
19497 esac
19498 if test X"$d_thread_safe_nl_langinfo_l" = X; then
19499         d_thread_safe_nl_langinfo_l="$undef"
19500 fi
19501 $rm_try
19502
19503 : see if time exists
19504 echo " "
19505 if test "X$d_time" = X -o X"$timetype" = X; then
19506     if set time val -f d_time; eval $csym; $val; then
19507                 echo 'time() found.' >&4
19508                 val="$define"
19509                 rp="What is the type returned by time() on this system?"
19510                 set time_t timetype long stdio.h sys/types.h
19511                 eval $typedef_ask
19512     else
19513                 echo 'time() not found, hope that will do.' >&4
19514                 val="$undef"
19515                 timetype='int';
19516     fi
19517     set d_time
19518     eval $setvar
19519 fi
19520
19521 : see if timegm exists
19522 set timegm d_timegm
19523 eval $inlibc
19524
19525 : see if this is a sys/times.h system
19526 set sys/times.h i_systimes
19527 eval $inhdr
19528
19529 : see if times exists
19530 echo " "
19531 if set times val -f d_times; eval $csym; $val; then
19532         echo 'times() found.' >&4
19533         d_times="$define"
19534         inc=''
19535         case "$i_systimes" in
19536         "$define") inc='sys/times.h';;
19537         esac
19538         rp="What is the type returned by times() on this system?"
19539         set clock_t clocktype long stdio.h sys/types.h $inc
19540         eval $typedef_ask
19541 else
19542         echo 'times() NOT found, hope that will do.' >&4
19543         d_times="$undef"
19544         clocktype='int'
19545 fi
19546
19547 : see if tmpnam_r exists
19548 set tmpnam_r d_tmpnam_r
19549 eval $inlibc
19550 case "$d_tmpnam_r" in
19551 "$define")
19552         hdrs="$i_systypes sys/types.h define stdio.h "
19553         case "$d_tmpnam_r_proto:$usethreads" in
19554         ":define")      d_tmpnam_r_proto=define
19555                 set d_tmpnam_r_proto tmpnam_r $hdrs
19556                 eval $hasproto ;;
19557         *)      ;;
19558         esac
19559         case "$d_tmpnam_r_proto" in
19560         define)
19561         case "$tmpnam_r_proto" in
19562         ''|0) try='char* tmpnam_r(char*);'
19563         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19564         esac
19565         case "$tmpnam_r_proto" in
19566         ''|0)   d_tmpnam_r=undef
19567                 tmpnam_r_proto=0
19568                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19569         * )     case "$tmpnam_r_proto" in
19570                 REENTRANT_PROTO*) ;;
19571                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19572                 esac
19573                 echo "Prototype: $try" ;;
19574         esac
19575         ;;
19576         *)      case "$usethreads" in
19577                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19578                 esac
19579                 d_tmpnam_r=undef
19580                 tmpnam_r_proto=0
19581                 ;;
19582         esac
19583         ;;
19584 *)      tmpnam_r_proto=0
19585         ;;
19586 esac
19587
19588 : see if towlower exists
19589 set towlower d_towlower
19590 eval $inlibc
19591
19592 : see if trunc exists
19593 set trunc d_trunc
19594 eval $inlibc
19595
19596 : see if truncate exists
19597 set truncate d_truncate
19598 eval $inlibc
19599
19600 : see if ttyname_r exists
19601 set ttyname_r d_ttyname_r
19602 eval $inlibc
19603 case "$d_ttyname_r" in
19604 "$define")
19605         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19606         case "$d_ttyname_r_proto:$usethreads" in
19607         ":define")      d_ttyname_r_proto=define
19608                 set d_ttyname_r_proto ttyname_r $hdrs
19609                 eval $hasproto ;;
19610         *)      ;;
19611         esac
19612         case "$d_ttyname_r_proto" in
19613         define)
19614         case "$ttyname_r_proto" in
19615         ''|0) try='int ttyname_r(int, char*, size_t);'
19616         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19617         esac
19618         case "$ttyname_r_proto" in
19619         ''|0) try='int ttyname_r(int, char*, int);'
19620         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19621         esac
19622         case "$ttyname_r_proto" in
19623         ''|0) try='char* ttyname_r(int, char*, int);'
19624         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19625         esac
19626         case "$ttyname_r_proto" in
19627         ''|0)   d_ttyname_r=undef
19628                 ttyname_r_proto=0
19629                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19630         * )     case "$ttyname_r_proto" in
19631                 REENTRANT_PROTO*) ;;
19632                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19633                 esac
19634                 echo "Prototype: $try" ;;
19635         esac
19636         ;;
19637         *)      case "$usethreads" in
19638                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19639                 esac
19640                 d_ttyname_r=undef
19641                 ttyname_r_proto=0
19642                 ;;
19643         esac
19644         ;;
19645 *)      ttyname_r_proto=0
19646         ;;
19647 esac
19648
19649 : see if tzname[] exists
19650 echo " "
19651 if set tzname val -a d_tzname; eval $csym; $val; then
19652         val="$define"
19653         echo 'tzname[] found.' >&4
19654 else
19655         val="$undef"
19656         echo 'tzname[] NOT found.' >&4
19657 fi
19658 set d_tzname
19659 eval $setvar
19660
19661 : Check if is a multiplatform env
19662 case "$osname" in
19663 darwin) multiarch="$define" ;;
19664 esac
19665 case "$multiarch" in
19666 ''|[nN]*) multiarch="$undef" ;;
19667 esac
19668
19669 : check for ordering of bytes in a UV
19670 echo " "
19671 case "$multiarch" in
19672 *$define*)
19673         $cat <<EOM
19674 You seem to be doing a multiarchitecture build,
19675 skipping the byteorder check.
19676
19677 EOM
19678         byteorder='ffff'
19679         ;;
19680 *)
19681         case "$byteorder" in
19682         '')
19683                 $cat <<'EOM'
19684 In the following, larger digits indicate more significance.  A big-endian
19685 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19686 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19687 machines may have weird orders like 3412.  A Cray will report 87654321,
19688 an Alpha will report 12345678. If the test program works the default is
19689 probably right.
19690 I'm now running the test program...
19691 EOM
19692                 $cat >try.c <<EOCP
19693 #include <stdio.h>
19694 #$i_stdlib I_STDLIB
19695 #ifdef I_STDLIB
19696 #include <stdlib.h>
19697 #endif
19698 #include <sys/types.h>
19699 typedef $uvtype UV;
19700 int main()
19701 {
19702         int i;
19703         union {
19704                 UV l;
19705                 char c[$uvsize];
19706         } u;
19707
19708         if ($uvsize > 4)
19709                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19710         else
19711                 u.l = (UV)0x04030201;
19712         for (i = 0; i < $uvsize; i++)
19713                 printf("%c", u.c[i]+'0');
19714         printf("\n");
19715         exit(0);
19716 }
19717 EOCP
19718                 xxx_prompt=y
19719                 set try
19720                 if eval $compile && $run ./try > /dev/null; then
19721                         dflt=`$run ./try`
19722                         case "$dflt" in
19723                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19724                                 echo "(The test program ran ok.)"
19725                                 echo "byteorder=$dflt"
19726                                 xxx_prompt=n
19727                         ;;
19728                         ????|????????) echo "(The test program ran ok.)" ;;
19729                         *) echo "(The test program didn't run right for some reason.)" ;;
19730                         esac
19731                 else
19732                         dflt='4321'
19733                         cat <<'EOM'
19734 (I can't seem to compile the test program.  Guessing big-endian...)
19735 EOM
19736                 fi
19737                 case "$xxx_prompt" in
19738                 y)
19739                         rp="What is the order of bytes in $uvtype?"
19740                         . ./myread
19741                         byteorder="$ans"
19742                         ;;
19743                 *)      byteorder=$dflt
19744                         ;;
19745                 esac
19746                 ;;
19747         esac
19748         $rm_try
19749         ;;
19750 esac
19751
19752 : Checking 32bit alignedness
19753 $cat <<EOM
19754
19755 Checking to see whether you can access character data unalignedly...
19756 EOM
19757 case "$d_u32align" in
19758 '')   $cat >try.c <<EOCP
19759 #include <stdio.h>
19760 #$i_stdlib I_STDLIB
19761 #ifdef I_STDLIB
19762 #include <stdlib.h>
19763 #endif
19764 #define U32 $u32type
19765 #define BYTEORDER 0x$byteorder
19766 #define U8 $u8type
19767 #include <signal.h>
19768 #ifdef SIGBUS
19769 $signal_t bletch(int s) { exit(4); }
19770 #endif
19771 int main() {
19772 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19773     volatile U8 buf[8];
19774     volatile U32 *up;
19775     int i;
19776
19777     if (sizeof(U32) != 4) {
19778         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19779         exit(1);
19780     }
19781
19782     fflush(stdout);
19783
19784 #ifdef SIGBUS
19785     signal(SIGBUS, bletch);
19786 #endif
19787
19788     buf[0] = 0;
19789     buf[1] = 0;
19790     buf[2] = 0;
19791     buf[3] = 1;
19792     buf[4] = 0;
19793     buf[5] = 0;
19794     buf[6] = 0;
19795     buf[7] = 1;
19796
19797     for (i = 0; i < 4; i++) {
19798         up = (U32*)(buf + i);
19799         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19800                (*up == 1 << (8*(3-i)))  /* little-endian */
19801               )
19802            )
19803         {
19804             printf("read failed (%x)\n", *up);
19805             exit(2);
19806         }
19807     }
19808
19809     /* write test */
19810     for (i = 0; i < 4; i++) {
19811         up = (U32*)(buf + i);
19812         *up = 0xBeef;
19813         if (*up != 0xBeef) {
19814             printf("write failed (%x)\n", *up);
19815             exit(3);
19816         }
19817     }
19818
19819     exit(0);
19820 #else
19821     printf("1\n");
19822     exit(1);
19823 #endif
19824     return 0;
19825 }
19826 EOCP
19827 set try
19828 if eval $compile_ok; then
19829         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19830         $run ./try 2>&1 >/dev/null
19831         case "$?" in
19832         0)      cat >&4 <<EOM
19833 You can access character data pretty unalignedly.
19834 EOM
19835                 d_u32align="$undef"
19836                 ;;
19837         *)      cat >&4 <<EOM
19838 It seems that you must access character data in an aligned manner.
19839 EOM
19840                 d_u32align="$define"
19841                 ;;
19842         esac
19843 else
19844         rp='Can you access character data at unaligned addresses?'
19845         dflt='n'
19846         . ./myread
19847         case "$ans" in
19848         [yY]*)  d_u32align="$undef"  ;;
19849         *)      d_u32align="$define" ;;
19850         esac
19851 fi
19852 $rm_try
19853 ;;
19854 esac
19855
19856 : see if ualarm exists
19857 set ualarm d_ualarm
19858 eval $inlibc
19859
19860 : see if umask exists
19861 set umask d_umask
19862 eval $inlibc
19863
19864 : see if unordered exists
19865 set unordered d_unordered
19866 eval $inlibc
19867
19868 : see if unsetenv exists
19869 set unsetenv d_unsetenv
19870 eval $inlibc
19871
19872 : see if usleep exists
19873 set usleep d_usleep
19874 eval $inlibc
19875
19876 : see if prototype for usleep is available
19877 echo " "
19878 set d_usleepproto usleep $i_unistd unistd.h
19879 eval $hasproto
19880
19881 : see if ustat exists
19882 set ustat d_ustat
19883 eval $inlibc
19884
19885 : see if closedir exists
19886 set closedir d_closedir
19887 eval $inlibc
19888
19889 case "$d_closedir" in
19890 "$define")
19891         echo " "
19892         echo "Checking whether closedir() returns a status..." >&4
19893         cat > try.c <<EOM
19894 #$i_dirent I_DIRENT             /**/
19895 #$i_sysdir I_SYS_DIR            /**/
19896 #$i_sysndir I_SYS_NDIR          /**/
19897 #$i_systypes I_SYS_TYPES        /**/
19898
19899 #if defined(I_SYS_TYPES)
19900 #include <sys/types.h>
19901 #endif
19902 #if defined(I_DIRENT)
19903 #include <dirent.h>
19904 #else
19905 #ifdef I_SYS_NDIR
19906 #include <sys/ndir.h>
19907 #else
19908 #ifdef I_SYS_DIR
19909 #include <sys/dir.h>
19910 #endif
19911 #endif
19912 #endif
19913 int main() { return closedir(opendir(".")); }
19914 EOM
19915         set try
19916         if eval $compile_ok; then
19917                 if $run ./try > /dev/null 2>&1 ; then
19918                         echo "Yes, it does."
19919                         val="$undef"
19920                 else
19921                         echo "No, it doesn't."
19922                         val="$define"
19923                 fi
19924         else
19925                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19926                 val="$define"
19927         fi
19928         ;;
19929 *)
19930         val="$undef";
19931         ;;
19932 esac
19933 set d_void_closedir
19934 eval $setvar
19935 $rm_try
19936
19937 : see if there is a wait4
19938 set wait4 d_wait4
19939 eval $inlibc
19940
19941 : see if waitpid exists
19942 set waitpid d_waitpid
19943 eval $inlibc
19944
19945 : see if wcrtomb exists
19946 set wcrtomb d_wcrtomb
19947 eval $inlibc
19948
19949 : look for wcscmp
19950 echo " "
19951 $cat >try.c <<'EOCP'
19952 #include <stdio.h>
19953 #include <wchar.h>
19954 int main ()
19955 {
19956     wchar_t *s = L" ";
19957     return (wcscmp (s, s) ? 1 : 0);
19958     }
19959 EOCP
19960 set try
19961 val="$undef"
19962 if eval $compile; then
19963     `$run ./try`
19964     case "$?" in
19965         0)  echo "A working wcscmp() found." >&4
19966             val="$define" ;;
19967         *)  echo "wcscmp() found, but it doesn't work" >&4
19968             ;;
19969         esac
19970 else
19971     echo "wcscmp() NOT found." >&4
19972     fi
19973 set d_wcscmp
19974 eval $setvar
19975 $rm_try
19976
19977 : see if wcstombs exists
19978 set wcstombs d_wcstombs
19979 eval $inlibc
19980
19981 : look for wcsxfrm
19982 echo " "
19983 $cat >try.c <<'EOCP'
19984 #include <errno.h>
19985 #include <wchar.h>
19986 int main ()
19987 {
19988     wchar_t dst[4], *src = L" ";
19989     errno = 0;
19990     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19991     }
19992 EOCP
19993 set try
19994 val="$undef"
19995 if eval $compile; then
19996     `$run ./try`
19997     case "$?" in
19998         0)  echo "A working wcsxfrm() found." >&4
19999             val="$define" ;;
20000         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20001             ;;
20002         esac
20003 else
20004     echo "wcsxfrm() NOT found." >&4
20005     fi
20006 set d_wcsxfrm
20007 eval $setvar
20008 $rm_try
20009
20010 : see if wctomb exists
20011 set wctomb d_wctomb
20012 eval $inlibc
20013
20014 : see if writev exists
20015 set writev d_writev
20016 eval $inlibc
20017
20018 : check for alignment requirements
20019 echo " "
20020 case "$alignbytes" in
20021     '') echo "Checking alignment constraints..." >&4
20022         $cat >try.c <<EOCP
20023 #include <stdio.h>
20024 struct foobar {
20025     char foo;
20026     $nvtype bar;
20027 } try_algn;
20028 int main()
20029 {
20030     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20031     return(0);
20032 }
20033 EOCP
20034         set try
20035         if eval $compile_ok; then
20036             dflt=`$run ./try`
20037         else
20038             dflt='8'
20039             echo "(I can't seem to compile the test program...)"
20040         fi
20041         case "$multiarch" in
20042             *$define*)
20043                 : The usual safe value is 8, but Darwin with -Duselongdouble
20044                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20045                 : Configure to pick a larger value if needed.
20046                 if $test "$dflt" -lt 8; then
20047                     dflt='8'
20048                     echo "Setting alignment to 8 for multiarch support.">&4
20049                 fi
20050                 ;;
20051         esac
20052         ;;
20053     *) dflt="$alignbytes"
20054         ;;
20055 esac
20056 rp="Doubles must be aligned on a how-many-byte boundary?"
20057 . ./myread
20058 alignbytes="$ans"
20059 $rm_try
20060
20061 : set the base revision
20062 baserev=5.0
20063
20064 : length of character in bytes. Is always 1, otherwise it is not C
20065 : This used to be a test using sizeof
20066 charsize=1
20067
20068 : Check for the number of bits in a character
20069 case "$charbits" in
20070 '')     echo "Checking how long a character is (in bits)..." >&4
20071         $cat >try.c <<EOCP
20072 #include <stdio.h>
20073 int main ()
20074 {
20075     int n;
20076     unsigned char c;
20077     for (c = 1, n = 0; c; c <<= 1, n++) ;
20078     printf ("%d\n", n);
20079     return (0);
20080     }
20081 EOCP
20082         set try
20083         if eval $compile_ok; then
20084                 dflt=`$run ./try`
20085         else
20086                 dflt='8'
20087                 echo "(I can't seem to compile the test program.  Guessing...)"
20088         fi
20089         ;;
20090 *)
20091         dflt="$charbits"
20092         ;;
20093 esac
20094 rp="What is the length of a character (in bits)?"
20095 . ./myread
20096 charbits="$ans"
20097 $rm_try
20098 case "$charbits" in
20099 8)      ;;
20100 *)      cat >&4 << EOM
20101 Your system has an unsigned character size of $charbits bits, which
20102 is rather unusual (normally it is 8 bits).  Perl likely will not work
20103 correctly on your system, with subtle bugs in various places.
20104 EOM
20105         rp='Do you really want to continue?'
20106         dflt='n'
20107         . ./myread
20108         case "$ans" in
20109                 [yY])   echo >&4 "Okay, continuing."    ;;
20110                 *)      exit 1                          ;;
20111         esac
20112 esac
20113
20114 : how do we concatenate cpp tokens here?
20115 echo " "
20116 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20117 $cat >cpp_stuff.c <<'EOCP'
20118 #define RCAT(a,b)a/**/b
20119 #define ACAT(a,b)a ## b
20120 RCAT(Rei,ser)
20121 ACAT(Cir,cus)
20122 EOCP
20123 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20124 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20125         echo "Oh!  Smells like ANSI's been here." >&4
20126         echo "We can catify or stringify, separately or together!"
20127         cpp_stuff=42
20128 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20129         echo "Ah, yes!  The good old days!" >&4
20130         echo "However, in the good old days we don't know how to stringify and"
20131         echo "catify at the same time."
20132         cpp_stuff=1
20133 else
20134         $cat >&4 <<EOM
20135 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20136 You're going to have to edit the values of CAT[2-5] in config.h...
20137 EOM
20138         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20139 fi
20140 $rm -f cpp_stuff.*
20141
20142 : see if this is a db.h system
20143 set db.h i_db
20144 eval $inhdr
20145
20146 case "$i_db" in
20147 $define)
20148         : Check db version.
20149         echo " "
20150         echo "Checking Berkeley DB version ..." >&4
20151         $cat >try.c <<EOCP
20152 #include <sys/types.h>
20153 #include <stdio.h>
20154 #$i_stdlib I_STDLIB
20155 #ifdef I_STDLIB
20156 #include <stdlib.h>
20157 #endif
20158 #include <db.h>
20159 int main(int argc, char *argv[])
20160 {
20161 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20162     int Major, Minor, Patch ;
20163     unsigned long Version ;
20164     (void)db_version(&Major, &Minor, &Patch) ;
20165     if (argc == 2) {
20166         printf("%d %d %d %d %d %d\n",
20167                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20168                Major, Minor, Patch);
20169         exit(0);
20170     }
20171     printf("You have Berkeley DB Version 2 or greater.\n");
20172
20173     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20174                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20175     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20176                 Major, Minor, Patch) ;
20177
20178     /* check that db.h & libdb are compatible */
20179     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20180         printf("db.h and libdb are incompatible.\n") ;
20181         exit(3);
20182     }
20183
20184     printf("db.h and libdb are compatible.\n") ;
20185
20186     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20187                 + DB_VERSION_PATCH ;
20188
20189     /* needs to be >= 2.3.4 */
20190     if (Version < 2003004) {
20191     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20192         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20193         exit(2);
20194     }
20195
20196     exit(0);
20197 #else
20198 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20199     if (argc == 2) {
20200         printf("1 0 0\n");
20201         exit(0);
20202     }
20203     printf("You have Berkeley DB Version 1.\n");
20204     exit(0);    /* DB version < 2: the coast is clear. */
20205 #else
20206     exit(1);    /* <db.h> not Berkeley DB? */
20207 #endif
20208 #endif
20209 }
20210 EOCP
20211         set try
20212         if eval $compile_ok && $run ./try; then
20213                 echo 'Looks OK.' >&4
20214                 set `$run ./try 1`
20215                 db_version_major=$1
20216                 db_version_minor=$2
20217                 db_version_patch=$3
20218         else
20219                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20220                 i_db=$undef
20221                 case " $libs " in
20222                 *"-ldb "*)
20223                         : Remove db from list of libraries to use
20224                         echo "Removing unusable -ldb from library list" >&4
20225                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20226                         shift
20227                         libs="$*"
20228                         echo "libs = $libs" >&4
20229                         ;;
20230                 esac
20231         fi
20232         $rm_try
20233         ;;
20234 esac
20235
20236 case "$i_db" in
20237 define)
20238         : Check the return type needed for hash
20239         echo " "
20240         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20241         $cat >try.c <<EOCP
20242 #include <sys/types.h>
20243 #include <db.h>
20244
20245 #ifndef DB_VERSION_MAJOR
20246 u_int32_t hash_cb (const void* ptr, size_t size)
20247 {
20248         return 0;
20249 }
20250 HASHINFO info;
20251 int main()
20252 {
20253         info.hash = hash_cb;
20254 }
20255 #endif
20256 EOCP
20257         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20258                 if $compiler_warning try.out >>/dev/null 2>&1 ; then
20259                         db_hashtype='int'
20260                 else
20261                         db_hashtype='u_int32_t'
20262                 fi
20263         else
20264                 : XXX Maybe we should just give up here.
20265                 db_hashtype=u_int32_t
20266                 $cat try.out >&4
20267                 echo "Help:  I can't seem to compile the db test program." >&4
20268                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20269         fi
20270         $rm_try
20271         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20272         ;;
20273 *)      db_hashtype=u_int32_t
20274         ;;
20275 esac
20276 case "$i_db" in
20277 define)
20278         : Check the return type needed for prefix
20279         echo " "
20280         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20281         cat >try.c <<EOCP
20282 #include <sys/types.h>
20283 #include <db.h>
20284
20285 #ifndef DB_VERSION_MAJOR
20286 size_t prefix_cb (const DBT *key1, const DBT *key2)
20287 {
20288         return 0;
20289 }
20290 BTREEINFO info;
20291 int main()
20292 {
20293         info.prefix = prefix_cb;
20294 }
20295 #endif
20296 EOCP
20297         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20298                 if $compiler_warning try.out >>/dev/null 2>&1 ; then
20299                         db_prefixtype='int'
20300                 else
20301                         db_prefixtype='size_t'
20302                 fi
20303         else
20304                 db_prefixtype='size_t'
20305                 : XXX Maybe we should just give up here.
20306                 $cat try.out >&4
20307                 echo "Help:  I can't seem to compile the db test program." >&4
20308                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20309         fi
20310         $rm_try
20311         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20312         ;;
20313 *)      db_prefixtype='size_t'
20314         ;;
20315 esac
20316
20317 : Include . in @INC
20318 $cat <<EOM
20319
20320 Historically Perl has provided a final fallback of the current working
20321 directory '.' when searching for a library. This, however, can lead to
20322 problems when a Perl program which loads optional modules is called from
20323 a shared directory. This can lead to executing unexpected code.
20324
20325 EOM
20326
20327 # When changing to exclude by default:
20328 case "$default_inc_excludes_dot" in
20329     $undef|false|[nN]*) dflt="n" ;;
20330     *)                  dflt="y" ;;
20331 esac
20332 # To turn exclude off by default:
20333 #case "$default_inc_excludes_dot" in
20334 #    $define|true|[yY]*) dflt="y" ;;
20335 #    *)                  dflt="n" ;;
20336 #esac
20337
20338 rp='Exclude '.' from @INC by default? '
20339 . ./myread
20340 case "$ans" in
20341     [nN]|undef) default_inc_excludes_dot="$undef"  ;;
20342     *)          default_inc_excludes_dot="$define" ;;
20343 esac
20344
20345 : Check what kind of inf/nan your system has
20346 $echo "Checking the kind of infinities and nans you have..." >&4
20347 $echo "(The following tests may crash.  That's okay.)" >&4
20348 $cat >try.c <<EOP
20349 #define DOUBLESIZE $doublesize
20350 #$d_longdbl HAS_LONG_DOUBLE
20351 #ifdef HAS_LONG_DOUBLE
20352 #define LONG_DOUBLESIZE $longdblsize
20353 #define LONG_DOUBLEKIND $longdblkind
20354 #endif
20355 #include <math.h>
20356 #include <string.h>
20357 #include <stdio.h>
20358 /* Note that whether the sign bit is on or off
20359  * for NaN depends on the CPU/FPU, and possibly
20360  * can be affected by the build toolchain.
20361  *
20362  * For example for older MIPS and HP-PA 2.0 the quiet NaN is:
20363  * 0x7f, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
20364  * 0x7f, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20365  * (respectively) as opposed to the more usual
20366  * 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
20367  *
20368  * Pre-IEEE-754 floating point format do not even have inf/nan support
20369  * at all.  They might have a "max" value (DBL_MAX), which may be deadly
20370  * to even mention, causing immediate SIGFPE or equivalent: this is
20371  * the case with VAX floating point, for example.
20372  */
20373 static void bytes(void *v, unsigned int n) {
20374   unsigned char *p = (unsigned char *)v;
20375   int i;
20376   for (i = 0; i < n; i++) {
20377     printf("0x%02x%s", p[i], i < n - 1 ? ", " : "\n");
20378   }
20379 }
20380 int main(int argc, char *argv[]) {
20381    /* We cannot use 1.0/0.0 and 0.0/0.0 (with L suffixes for long double)
20382     * because some compilers are 'smart' and not only warn but refuse to
20383     * compile such 'illegal' values. */
20384    double dinf = exp(1e9);
20385    double dnan = sqrt(-1.0);
20386 #ifdef HAS_LONG_DOUBLE
20387    long double ldinf = (long double)exp(1e9);
20388    long double ldnan = (long double)sqrt(-1.0);
20389 # if LONG_DOUBLEKIND == 3 || LONG_DOUBLEKIND == 4
20390 /* the 80-bit long doubles might have garbage in their excess bytes */
20391     memset((char *)&ldinf + 10, '\0', LONG_DOUBLESIZE - 10);
20392     memset((char *)&ldnan + 10, '\0', LONG_DOUBLESIZE - 10);
20393 # endif
20394   if (argc == 2) {
20395     switch (argv[1][0]) {
20396     case '1': bytes(&dinf, sizeof(dinf)); break;
20397     case '2': bytes(&dnan, sizeof(dnan)); break;
20398     case '3': bytes(&ldinf, sizeof(ldinf)); break;
20399     case '4': bytes(&ldnan, sizeof(ldnan)); break;
20400 #endif
20401     }
20402   }
20403   return 0;
20404 }
20405 EOP
20406 set try
20407 if eval $compile; then
20408     doubleinfbytes=`$run ./try 1`
20409     doublenanbytes=`$run ./try 2`
20410     case "$d_longdbl" in
20411     $define)
20412       longdblinfbytes=`$run ./try 3`
20413       longdblnanbytes=`$run ./try 4`
20414       ;;
20415     esac
20416 else
20417     # Defaults in case the above test program failed.
20418     case "$doublekind" in
20419     1) # IEEE 754 32-bit LE
20420        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f'
20421        doublenanbytes='0x00, 0x00, 0xf8, 0x7f'
20422        ;;
20423     2) # IEEE 754 32-bit BE
20424        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00'
20425        doublenanbytes='0x7f, 0xf8, 0x00, 0x00'
20426        ;;
20427     3) # IEEE 754 64-bit LE
20428        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20429        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20430        ;;
20431     4) # IEEE 754 64-bit BE
20432        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20433        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20434        ;;
20435     5) # IEEE 754 128-bit LE
20436        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20437        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20438        ;;
20439     6) # IEEE 754 128-bit BE
20440        doubleinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20441        doublenanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20442        ;;
20443     7) # IEEE 754 64-bit mixed: 32-bit LEs in BE
20444        doubleinfbytes='0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00'
20445        doublenanbytes='0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00'
20446        ;;
20447     8) # IEEE 754 64-bit mixed: 32-bit BEs in LE
20448        doubleinfbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00'
20449        doublenanbytes='0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00'
20450        ;;
20451     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20452        doubleinfbytes=$undef
20453        doublenanbytes=$undef
20454        ;;
20455     *) # No idea.
20456        doubleinfbytes=$undef
20457        doublenanbytes=$undef
20458        ;;
20459     esac
20460     case "$longdblkind" in
20461     1) # IEEE 754 128-bit LE
20462        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f'
20463        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f'
20464        ;;
20465     2) # IEEE 754 128-bit BE
20466        longdblinfbytes='0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20467        longdblnanbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20468        ;;
20469     3) # IEEE 754 80-bit LE, 12 or 16 bytes (x86)
20470        case "$longdblsize" in
20471        12) # x86 32-bit (96 bits, or 4 x 32, or 12 x 8)
20472            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00'
20473            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00'
20474            ;;
20475        16) # x86_64
20476            longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20477            longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20478            ;;
20479        *)  # No idea.
20480            longdblinfbytes=$undef
20481            longdblnanbytes=$undef
20482        ;;
20483        esac
20484        ;;
20485     4) # IEEE 754 80-bit BE, 12 or 16 bytes
20486        case "$longdblsize" in
20487        12) # 32-bit system
20488            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20489            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20490            ;;
20491        16) # 64-bit system
20492            longdblinfbytes='0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20493            longdblnanbytes='0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20494            ;;
20495        *)  # No idea.
20496            longdblinfbytes=$undef
20497            longdblnanbytes=$undef
20498        ;;
20499        esac
20500        ;;
20501     5) # 128-bit LE-LE "double double"
20502        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f'
20503        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f'
20504        ;;
20505     6) # 128-bit BE-BE "double double"
20506        longdblinfbytes='0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20507        longdblnanbytes='0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20508        ;;
20509     7) # 128-bit LE-BE "double double"
20510        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20511        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20512        ;;
20513     8) # 128-bit BE-LE "double double"
20514        longdblinfbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20515        longdblnanbytes='0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00'
20516        ;;
20517     9|10|11|12|13|14) # VAX/Cray/IBM floating point formats, no inf/nan.
20518        longdblinfbytes=$undef
20519        longdblnanbytes=$undef
20520        ;;
20521     *) # No idea.
20522        longdblinfbytes=$undef
20523        longdblnanbytes=$undef
20524        ;;
20525     esac
20526 fi
20527 # In case the program crashed the values are empty, turn them undef.
20528 case "$doubleinfbytes" in
20529 '') doubleinfbytes=$undef ;;
20530 esac
20531 case "$doublenanbytes" in
20532 '') doublenanbytes=$undef ;;
20533 esac
20534 case "$longdblinfbytes" in
20535 '') longdblinfbytes=$undef ;;
20536 esac
20537 case "$longdblnanbytes" in
20538 '') longdblnanbytes=$undef ;;
20539 esac
20540 $rm_try
20541
20542 : Check the length of the double mantissa
20543 $echo "Checking how many mantissa bits your doubles have..." >&4
20544 $cat >try.c <<EOP
20545 #$i_sunmath I_SUNMATH
20546 #include <float.h>
20547 #ifdef I_SUNMATH
20548 # include <sunmath.h>
20549 #endif
20550 #ifdef DBL_MANT_DIG
20551 # define BITS (DBL_MANT_DIG - 1) /* the implicit bit does not count */
20552 #endif
20553 #include <stdio.h>
20554 int main(int argc, char *argv[]) {
20555 #ifdef BITS
20556   printf("%d\n", BITS);
20557 #endif
20558   return 0;
20559 }
20560 EOP
20561 set try
20562 if eval $compile; then
20563     doublemantbits=`$run ./try`
20564 else
20565     doublemantbits="$undef"
20566 fi
20567 $rm_try
20568
20569 : Check the length of the longdouble mantissa
20570 $echo "Checking how many mantissa bits your long doubles have..." >&4
20571 $cat >try.c <<EOP
20572 #$i_sunmath I_SUNMATH
20573 #include <float.h>
20574 #ifdef I_SUNMATH
20575 # include <sunmath.h>
20576 #endif
20577 #$d_longdbl HAS_LONG_DOUBLE
20578 #if defined(HAS_LONG_DOUBLE) && defined(LDBL_MANT_DIG)
20579 # if ($longdblkind == 3) || ($longdblkind == 4) /* 80-bit extended precision */
20580 /* This format has no implicit bit.  Beware, however, that for
20581  * this format the bare LDBL_MANT_DIG is misleading for inf/nan:
20582  * the top three bits are used for inf (100) / qnan (11x) / snan (101),
20583  * and the top bit must have been one since 387, zero is plain invalid.
20584  * For normal fp values, the LDBL_MANT_DIG is fine, though. */
20585 #  define BITS LDBL_MANT_DIG
20586 # elif ($longdblkind == 5 || $longdblkind == 6 || $longdblkind == 7 || $longdblkind == 8) /* double double */
20587 /* LDBL_MANT_DIG of 106 (twice 53) would be logical, but for some
20588  * reason e.g. Irix thinks 107.  But in any case, we want only
20589  * the number of real bits, the implicit bits are of no interest.  */
20590 #  define BITS 2 * (DBL_MANT_DIG - 1)
20591 # else
20592 #  define BITS (LDBL_MANT_DIG - 1) /* the implicit bit does not count */
20593 # endif
20594 #endif
20595 #include <stdio.h>
20596 int main(int argc, char *argv[]) {
20597 #ifdef BITS
20598   printf("%d\n", BITS);
20599 #endif
20600   return 0;
20601 }
20602 EOP
20603 set try
20604 if eval $compile; then
20605     longdblmantbits=`$run ./try`
20606 else
20607     longdblmantbits="$undef"
20608 fi
20609 $rm_try
20610
20611 : Check the length of the NV mantissa
20612 $echo "Checking how many mantissa bits your NVs have..." >&4
20613 if test "X$usequadmath" = "X$define"; then
20614   nvmantbits=112 # 128-1-15
20615 else
20616   if test "X$nvsize" = "X$doublesize"; then
20617     nvmantbits="$doublemantbits"
20618   else
20619      if test "X$nvsize" = "X$longdblsize"; then
20620        nvmantbits="$longdblmantbits"
20621      else
20622        nvmantbits="$undef"
20623      fi
20624   fi
20625 fi
20626
20627 : How can we generate normalized random numbers ?
20628 echo " "
20629 echo "Using our internal random number implementation..." >&4
20630
20631 case "$ccflags" in
20632 *-Dmy_rand=*|*-Dmy_srand=*)
20633         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20634         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20635         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20636         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20637         ;;
20638 esac
20639
20640 randfunc=Perl_drand48
20641 drand01="Perl_drand48()"
20642 seedfunc="Perl_drand48_init"
20643 randbits=48
20644 randseedtype=U32
20645
20646 : Probe whether dtrace builds an object, as newer Illumos requires an input
20647 : object file that uses at least one of the probes defined in the .d file
20648 case "$usedtrace" in
20649 $define)
20650     case "$dtracexnolibs" in
20651     $define|true|[yY]*)
20652         dtracexnolibs=$define
20653         $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h
20654         ;;
20655     ' '|'')
20656         if $dtrace -h -xnolibs -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20657              dtracexnolibs=$define
20658              echo "Your dtrace accepts -xnolibs"
20659         elif $dtrace -h -s ../perldtrace.d -o perldtrace.h 2>&1 ; then
20660              dtracexnolibs=$undef
20661              echo "Your dtrace doesn't accept -xnolibs"
20662         else
20663              echo "Your dtrace doesn't work at all, try building without dtrace support" >&4
20664              exit 1
20665         fi
20666         ;;
20667     *)
20668         dtracexnolibs=$undef
20669         $dtrace -h -s ../perldtrace.d -o perldtrace.h
20670         ;;
20671     esac
20672     case $dtracexnolibs in
20673     $define) xnolibs=-xnolibs ;;
20674     *) xnolibs= ;;
20675     esac
20676
20677     case "$dtraceobject" in
20678     $define|true|[yY]*)
20679         dtraceobject=$define
20680         ;;
20681     ' '|'')
20682         $cat >try.c <<EOM
20683 #include "perldtrace.h"
20684 int main(void) {
20685     PERL_LOADED_FILE("dummy");
20686     return 0;
20687 }
20688 EOM
20689         dtraceobject=$undef
20690         if $cc -c -o try.o $optimize $ccflags try.c \
20691                     && $dtrace -G $xnolibs -s ../perldtrace.d try.o >/dev/null 2>&1; then
20692                 dtraceobject=$define
20693             echo "Your dtrace builds an object file"
20694         fi
20695         ;;
20696     *) dtraceobject=$undef ;;
20697     esac
20698     $rm_try perldtrace.o perldtrace.h
20699 esac
20700
20701 : Determine if this is an EBCDIC system
20702 echo " "
20703 echo "Determining whether or not we are on an EBCDIC system..." >&4
20704 $cat >try.c <<'EOM'
20705 int main()
20706 {
20707   if ('M'==0xd4) return 0;
20708   return 1;
20709 }
20710 EOM
20711
20712 val=$undef
20713 set try
20714 if eval $compile_ok; then
20715         if $run ./try; then
20716                 echo "You seem to speak EBCDIC." >&4
20717                 val="$define"
20718         else
20719                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20720         fi
20721 else
20722         echo "I'm unable to compile the test program." >&4
20723         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20724 fi
20725 $rm_try
20726 set ebcdic
20727 eval $setvar
20728
20729 : Check how to flush
20730 echo " "
20731 $cat >&4 <<EOM
20732 Checking how to flush all pending stdio output...
20733 EOM
20734 # I only know how to find the first 32 possibly open files on SunOS.
20735 # See also hints/sunos_4_1.sh and util.c  --AD
20736 case "$osname" in
20737 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20738 esac
20739 $cat >>try.c <<EOCP
20740 #include <stdio.h>
20741 #$i_stdlib I_STDLIB
20742 #ifdef I_STDLIB
20743 #include <stdlib.h>
20744 #endif
20745 #$i_unistd I_UNISTD
20746 #ifdef I_UNISTD
20747 # include <unistd.h>
20748 #endif
20749 #$d_sysconf HAS_SYSCONF
20750 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20751 #ifdef HAS_STDIO_STREAM_ARRAY
20752 # define STDIO_STREAM_ARRAY $stdio_stream_array
20753 #endif
20754 int main() {
20755   FILE* p;
20756   unlink("try.out");
20757   p = fopen("try.out", "w");
20758 #ifdef TRY_FPUTC
20759   fputc('x', p);
20760 #else
20761 # ifdef TRY_FPRINTF
20762   fprintf(p, "x");
20763 # endif
20764 #endif
20765 #ifdef TRY_FFLUSH_NULL
20766   fflush(NULL);
20767 #endif
20768 #ifdef TRY_FFLUSH_ALL
20769   {
20770     long open_max = -1;
20771 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20772     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20773 # else
20774 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20775     open_max = sysconf(_SC_OPEN_MAX);
20776 #  else
20777 #   ifdef FOPEN_MAX
20778     open_max = FOPEN_MAX;
20779 #   else
20780 #    ifdef OPEN_MAX
20781     open_max = OPEN_MAX;
20782 #    else
20783 #     ifdef _NFILE
20784     open_max = _NFILE;
20785 #     endif
20786 #    endif
20787 #   endif
20788 #  endif
20789 # endif
20790 # ifdef HAS_STDIO_STREAM_ARRAY
20791     if (open_max > 0) {
20792       long i;
20793       for (i = 0; i < open_max; i++)
20794             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20795                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20796                 STDIO_STREAM_ARRAY[i]._flag)
20797                 fflush(&STDIO_STREAM_ARRAY[i]);
20798     }
20799   }
20800 # endif
20801 #endif
20802   _exit(42);
20803 }
20804 EOCP
20805 : first we have to find out how _not_ to flush
20806 $to try.c
20807 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20808     output=''
20809     set try -DTRY_FPUTC
20810     if eval $compile; then
20811             $run ./try 2>/dev/null
20812             code="$?"
20813             $from try.out
20814             if $test ! -s try.out -a "X$code" = X42; then
20815                 output=-DTRY_FPUTC
20816             fi
20817     fi
20818     case "$output" in
20819     '')
20820             set try -DTRY_FPRINTF
20821             if eval $compile; then
20822                     $run ./try 2>/dev/null
20823                     code="$?"
20824                     $from try.out
20825                     if $test ! -s try.out -a "X$code" = X42; then
20826                         output=-DTRY_FPRINTF
20827                     fi
20828             fi
20829         ;;
20830     esac
20831 fi
20832 : check for fflush NULL behavior
20833 case "$fflushNULL" in
20834 '')     set try -DTRY_FFLUSH_NULL $output
20835         if eval $compile; then
20836                 $run ./try 2>/dev/null
20837                 code="$?"
20838                 $from try.out
20839                 if $test -s try.out -a "X$code" = X42; then
20840                         fflushNULL="`$cat try.out`"
20841                 else
20842                         if $test "X$code" != X42; then
20843                                 $cat >&4 <<EOM
20844 (If this test failed, don't worry, we'll try another method shortly.)
20845 EOM
20846                         fi
20847                 fi
20848         fi
20849         $rm -f core try.core core.try.*
20850         case "$fflushNULL" in
20851         x)      $cat >&4 <<EOM
20852 Your fflush(NULL) works okay for output streams.
20853 Let's see if it clobbers input pipes...
20854 EOM
20855 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20856 # bug that improperly flushes the input end of pipes.  So we avoid the
20857 # autoflush on fork/system/exec support for now. :-(
20858 $cat >tryp.c <<EOCP
20859 #include <stdio.h>
20860 int
20861 main(int argc, char **argv)
20862 {
20863     char buf[1024];
20864     int i;
20865     char *bp = buf;
20866     while (1) {
20867         while ((i = getc(stdin)) != -1
20868                && (*bp++ = i) != '\n'
20869                && bp < &buf[1024])
20870         /* DO NOTHING */ ;
20871         *bp = '\0';
20872         fprintf(stdout, "%s", buf);
20873         fflush(NULL);
20874         if (i == -1)
20875             return 0;
20876         bp = buf;
20877     }
20878 }
20879 EOCP
20880                 fflushNULL="$define"
20881                 set tryp
20882                 if eval $compile; then
20883                     $rm -f tryp.out
20884                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20885                     if $test "X$targethost" != X; then
20886                         $to tryp.c
20887                         $to tryp
20888                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20889                     else
20890                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20891                     fi
20892                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20893                        $cat >&4 <<EOM
20894 fflush(NULL) seems to behave okay with input streams.
20895 EOM
20896                         fflushNULL="$define"
20897                     else
20898                         $cat >&4 <<EOM
20899 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20900 EOM
20901                         fflushNULL="$undef"
20902                     fi
20903                 fi
20904                 $rm -f core tryp.c tryp.core core.tryp.*
20905                 ;;
20906         '')     $cat >&4 <<EOM
20907 Your fflush(NULL) isn't working (contrary to ANSI C).
20908 EOM
20909                 fflushNULL="$undef"
20910                 ;;
20911         *)      $cat >&4 <<EOM
20912 Cannot figure out whether your fflush(NULL) works or not.
20913 I'm assuming it doesn't (contrary to ANSI C).
20914 EOM
20915                 fflushNULL="$undef"
20916                 ;;
20917         esac
20918         ;;
20919 $define|true|[yY]*)
20920         fflushNULL="$define"
20921         ;;
20922 *)
20923         fflushNULL="$undef"
20924         ;;
20925 esac
20926 : check explicit looping only if NULL did not work, and if the pipe
20927 : bug does not show up on an explicit flush too
20928 case "$fflushNULL" in
20929 "$undef")
20930         $cat >tryp.c <<EOCP
20931 #include <stdio.h>
20932 int
20933 main(int argc, char **argv)
20934 {
20935     char buf[1024];
20936     int i;
20937     char *bp = buf;
20938     while (1) {
20939         while ((i = getc(stdin)) != -1
20940                && (*bp++ = i) != '\n'
20941                && bp < &buf[1024])
20942         /* DO NOTHING */ ;
20943         *bp = '\0';
20944         fprintf(stdout, "%s", buf);
20945         fflush(stdin);
20946         if (i == -1)
20947             return 0;
20948         bp = buf;
20949     }
20950 }
20951 EOCP
20952         set tryp
20953         if eval $compile; then
20954             $rm -f tryp.out
20955             if $test "X$targethost" != X; then
20956                 $to tryp.c
20957                 $to tryp
20958                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20959             else
20960                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20961             fi
20962             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20963                $cat >&4 <<EOM
20964 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20965 EOM
20966                 : now check for fflushall behaviour
20967                 case "$fflushall" in
20968                 '')     set try -DTRY_FFLUSH_ALL $output
20969                         if eval $compile; then
20970                                 $cat >&4 <<EOM
20971 (Now testing the other method--but note that this also may fail.)
20972 EOM
20973                                 $run ./try 2>/dev/null
20974                                 code=$?
20975                                 $from try.out
20976                                 if $test -s try.out -a "X$code" = X42; then
20977                                         fflushall="`$cat try.out`"
20978                                 fi
20979                         fi
20980                         $rm_try
20981                         case "$fflushall" in
20982                         x)      $cat >&4 <<EOM
20983 Whew. Flushing explicitly all the stdio streams works.
20984 EOM
20985                                 fflushall="$define"
20986                                 ;;
20987                         '')     $cat >&4 <<EOM
20988 Sigh. Flushing explicitly all the stdio streams doesn't work.
20989 EOM
20990                                 fflushall="$undef"
20991                                 ;;
20992                         *)      $cat >&4 <<EOM
20993 Cannot figure out whether flushing stdio streams explicitly works or not.
20994 I'm assuming it doesn't.
20995 EOM
20996                                 fflushall="$undef"
20997                                 ;;
20998                         esac
20999                         ;;
21000                 "$define"|true|[yY]*)
21001                         fflushall="$define"
21002                         ;;
21003                 *)
21004                         fflushall="$undef"
21005                         ;;
21006                 esac
21007             else
21008                 $cat >&4 <<EOM
21009 All is futile.  Even fflush(stdin) clobbers input pipes!
21010 EOM
21011                 fflushall="$undef"
21012             fi
21013         else
21014             fflushall="$undef"
21015         fi
21016         $rm -f core tryp.c tryp.core core.tryp.*
21017         ;;
21018 *)      fflushall="$undef"
21019         ;;
21020 esac
21021
21022 case "$fflushNULL$fflushall" in
21023 undefundef)
21024         $cat <<EOM
21025 OK, I give up.  I cannot figure out how to flush pending stdio output.
21026 We won't be flushing handles at all before fork/exec/popen.
21027 EOM
21028         ;;
21029 esac
21030 $rm_try tryp
21031
21032 : Store the full pathname to the ar program for use in the C program
21033 : Respect a hint or command line value for full_ar.
21034 case "$full_ar" in
21035 '') full_ar=$ar ;;
21036 esac
21037
21038 : Store the full pathname to the sed program for use in the C program
21039 full_sed=$sed
21040
21041 : see what type gids are declared as in the kernel
21042 echo " "
21043 echo "Looking for the type for group ids returned by getgid()."
21044 set gid_t gidtype xxx stdio.h sys/types.h
21045 eval $typedef
21046 case "$gidtype" in
21047 xxx)
21048         xxx=`./findhdr sys/user.h`
21049         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
21050         case $1 in
21051         unsigned) dflt="$1 $2" ;;
21052         *) dflt="$1" ;;
21053         esac
21054         ;;
21055 *) dflt="$gidtype";;
21056 esac
21057 case "$gidtype" in
21058 gid_t) echo "gid_t found." ;;
21059 *)      rp="What is the type for group ids returned by getgid()?"
21060         . ./myread
21061         gidtype="$ans"
21062         ;;
21063 esac
21064
21065 : Check the size of GID
21066 echo " "
21067 case "$gidtype" in
21068 *_t) zzz="$gidtype"     ;;
21069 *)   zzz="gid"          ;;
21070 esac
21071 echo "Checking the size of $zzz..." >&4
21072 cat > try.c <<EOCP
21073 #include <sys/types.h>
21074 #include <stdio.h>
21075 #$i_stdlib I_STDLIB
21076 #ifdef I_STDLIB
21077 #include <stdlib.h>
21078 #endif
21079 int main() {
21080     printf("%d\n", (int)sizeof($gidtype));
21081     exit(0);
21082 }
21083 EOCP
21084 set try
21085 if eval $compile_ok; then
21086         yyy=`$run ./try`
21087         case "$yyy" in
21088         '')     gidsize=4
21089                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
21090                 ;;
21091         *)      gidsize=$yyy
21092                 echo "Your $zzz is $gidsize bytes long."
21093                 ;;
21094         esac
21095 else
21096         gidsize=4
21097         echo "(I can't compile the test program--guessing $gidsize.)" >&4
21098 fi
21099
21100 : Check if GID is signed
21101 echo " "
21102 case "$gidtype" in
21103 *_t) zzz="$gidtype"     ;;
21104 *)   zzz="gid"          ;;
21105 esac
21106 echo "Checking the sign of $zzz..." >&4
21107 cat > try.c <<EOCP
21108 #include <sys/types.h>
21109 #include <stdio.h>
21110 int main() {
21111         $gidtype foo = -1;
21112         if (foo < 0)
21113                 printf("-1\n");
21114         else
21115                 printf("1\n");
21116 }
21117 EOCP
21118 set try
21119 if eval $compile; then
21120         yyy=`$run ./try`
21121         case "$yyy" in
21122         '')     gidsign=1
21123                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21124                 ;;
21125         *)      gidsign=$yyy
21126                 case "$gidsign" in
21127                  1) echo "Your $zzz is unsigned." ;;
21128                 -1) echo "Your $zzz is signed."   ;;
21129                 esac
21130                 ;;
21131         esac
21132 else
21133         gidsign=1
21134         echo "(I can't compile the test program--guessing unsigned.)" >&4
21135 fi
21136
21137 : Check 64bit sizes
21138 echo " "
21139
21140 if $test X"$quadtype" != X; then
21141
21142 echo "Checking how to print 64-bit integers..." >&4
21143
21144 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
21145         $cat >try.c <<'EOCP'
21146 #include <sys/types.h>
21147 #include <stdio.h>
21148 int main() {
21149   int q = 12345678901;
21150   printf("%ld\n", q);
21151 }
21152 EOCP
21153         set try
21154         if eval $compile; then
21155                 yyy=`$run ./try`
21156                 case "$yyy" in
21157                 12345678901)
21158                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
21159                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
21160                         echo "We will use %d."
21161                         ;;
21162                 esac
21163         fi
21164 fi
21165
21166 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
21167         $cat >try.c <<'EOCP'
21168 #include <sys/types.h>
21169 #include <stdio.h>
21170 int main() {
21171   long q = 12345678901;
21172   printf("%ld\n", q);
21173 }
21174 EOCP
21175         set try
21176         if eval $compile; then
21177                 yyy=`$run ./try`
21178                 case "$yyy" in
21179                 12345678901)
21180                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
21181                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
21182                         echo "We will use %ld."
21183                         ;;
21184                 esac
21185         fi
21186 fi
21187
21188 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
21189         $cat >try.c <<'EOCP'
21190 #include <sys/types.h>
21191 #include <inttypes.h>
21192 #include <stdio.h>
21193 int main() {
21194   int64_t q = 12345678901;
21195   printf("%" PRId64 "\n", q);
21196 }
21197 EOCP
21198         set try
21199         if eval $compile; then
21200                 yyy=`$run ./try`
21201                 case "$yyy" in
21202                 12345678901)
21203                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
21204                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
21205                         echo "We will use the C9X style."
21206                         ;;
21207                 esac
21208         fi
21209 fi
21210
21211 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21212         $cat >try.c <<EOCP
21213 #include <sys/types.h>
21214 #include <stdio.h>
21215 int main() {
21216   $quadtype q = 12345678901;
21217   printf("%Ld\n", q);
21218 }
21219 EOCP
21220         set try
21221         if eval $compile; then
21222                 yyy=`$run ./try`
21223                 case "$yyy" in
21224                 12345678901)
21225                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
21226                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
21227                         echo "We will use %Ld."
21228                         ;;
21229                 esac
21230         fi
21231 fi
21232
21233 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
21234         $cat >try.c <<'EOCP'
21235 #include <sys/types.h>
21236 #include <stdio.h>
21237 int main() {
21238   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
21239   printf("%lld\n", q);
21240 }
21241 EOCP
21242         set try
21243         if eval $compile; then
21244                 yyy=`$run ./try`
21245                 case "$yyy" in
21246                 12345678901)
21247                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
21248                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
21249                         echo "We will use the %lld style."
21250                         ;;
21251                 esac
21252         fi
21253 fi
21254
21255 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
21256         $cat >try.c <<EOCP
21257 #include <sys/types.h>
21258 #include <stdio.h>
21259 int main() {
21260   $quadtype q = 12345678901;
21261   printf("%qd\n", q);
21262 }
21263 EOCP
21264         set try
21265         if eval $compile; then
21266                 yyy=`$run ./try`
21267                 case "$yyy" in
21268                 12345678901)
21269                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
21270                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
21271                         echo "We will use %qd."
21272                         ;;
21273                 esac
21274         fi
21275 fi
21276
21277 if $test X"$sPRId64" = X; then
21278         echo "Cannot figure out how to print 64-bit integers." >&4
21279 fi
21280 $rm_try
21281
21282 fi
21283
21284 case "$sPRId64" in
21285 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
21286         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
21287         ;;
21288 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
21289         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
21290         ;;
21291 esac
21292
21293 : Check format strings for internal types
21294 echo " "
21295 $echo "Checking the format strings to be used for Perl's internal types..." >&4
21296
21297 if $test X"$ivsize" = X8; then
21298         ivdformat="$sPRId64"
21299         uvuformat="$sPRIu64"
21300         uvoformat="$sPRIo64"
21301         uvxformat="$sPRIx64"
21302         uvXUformat="$sPRIXU64"
21303 else
21304         if $test X"$ivsize" = X"$longsize"; then
21305                 ivdformat='"ld"'
21306                 uvuformat='"lu"'
21307                 uvoformat='"lo"'
21308                 uvxformat='"lx"'
21309                 uvXUformat='"lX"'
21310         else
21311                 if $test X"$ivsize" = X"$intsize"; then
21312                         ivdformat='"d"'
21313                         uvuformat='"u"'
21314                         uvoformat='"o"'
21315                         uvxformat='"x"'
21316                         uvXUformat='"X"'
21317                 else
21318                         : far out
21319                         if $test X"$ivsize" = X"$shortsize"; then
21320                                 ivdformat='"hd"'
21321                                 uvuformat='"hu"'
21322                                 uvoformat='"ho"'
21323                                 uvxformat='"hx"'
21324                                 uvXUformat='"hX"'
21325                         fi
21326                 fi
21327         fi
21328 fi
21329
21330 if $test X"$usequadmath" = X"$define"; then
21331     nveformat='"Qe"'
21332     nvfformat='"Qf"'
21333     nvgformat='"Qg"'
21334     nvEUformat='"QE"'
21335     nvFUformat='"QF"'
21336     nvGUformat='"QG"'
21337 else
21338     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21339         nveformat="$sPRIeldbl"
21340         nvfformat="$sPRIfldbl"
21341         nvgformat="$sPRIgldbl"
21342         nvEUformat="$sPRIEUldbl"
21343         nvFUformat="$sPRIFUldbl"
21344         nvGUformat="$sPRIGUldbl"
21345     else
21346         nveformat='"e"'
21347         nvfformat='"f"'
21348         nvgformat='"g"'
21349         nvEUformat='"E"'
21350         nvFUformat='"F"'
21351         nvGUformat='"G"'
21352     fi
21353 fi
21354
21355 case "$ivdformat" in
21356 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21357     exit 1
21358     ;;
21359 esac
21360
21361 : Check format string for GID
21362
21363 echo " "
21364 $echo "Checking the format string to be used for gids..." >&4
21365
21366 case "$gidsign" in
21367 -1)     if $test X"$gidsize" = X"$ivsize"; then
21368                 gidformat="$ivdformat"
21369         else
21370                 if $test X"$gidsize" = X"$longsize"; then
21371                         gidformat='"ld"'
21372                 else
21373                         if $test X"$gidsize" = X"$intsize"; then
21374                                 gidformat='"d"'
21375                         else
21376                                 if $test X"$gidsize" = X"$shortsize"; then
21377                                         gidformat='"hd"'
21378                                 fi
21379                         fi
21380                 fi
21381         fi
21382         ;;
21383 *)      if $test X"$gidsize" = X"$uvsize"; then
21384                 gidformat="$uvuformat"
21385         else
21386                 if $test X"$gidsize" = X"$longsize"; then
21387                         gidformat='"lu"'
21388                 else
21389                         if $test X"$gidsize" = X"$intsize"; then
21390                                 gidformat='"u"'
21391                         else
21392                                 if $test X"$gidsize" = X"$shortsize"; then
21393                                         gidformat='"hu"'
21394                                 fi
21395                         fi
21396                 fi
21397         fi
21398         ;;
21399 esac
21400
21401 : see if getgroups exists
21402 set getgroups d_getgrps
21403 eval $inlibc
21404
21405 : see if setgroups exists
21406 set setgroups d_setgrps
21407 eval $inlibc
21408
21409 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21410 echo " "
21411 case "$d_getgrps$d_setgrps" in
21412 *define*)
21413         case "$groupstype" in
21414         '') dflt="$gidtype" ;;
21415         *)  dflt="$groupstype" ;;
21416         esac
21417         $cat <<EOM
21418 What type of pointer is the second argument to getgroups() and setgroups()?
21419 Usually this is the same as group ids, $gidtype, but not always.
21420
21421 EOM
21422         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21423         . ./myread
21424         groupstype="$ans"
21425         ;;
21426 *)  groupstype="$gidtype";;
21427 esac
21428
21429 : check whether make sets MAKE
21430 echo " "
21431 echo "Checking if your $make program sets \$(MAKE)..." >&4
21432 case "$make_set_make" in
21433 '')
21434         $sed 's/^X //' > testmake.mak << 'EOF'
21435 Xall:
21436 X       @echo 'maketemp="$(MAKE)"'
21437 EOF
21438         case "`$make -f testmake.mak 2>/dev/null`" in
21439         *maketemp=*) make_set_make='#' ;;
21440         *)      make_set_make="MAKE=$make" ;;
21441         esac
21442         $rm -f testmake.mak
21443         ;;
21444 esac
21445 case "$make_set_make" in
21446 '#') echo "Yup, it does.";;
21447 *) echo "Nope, it doesn't.";;
21448 esac
21449
21450 : see what type is used for mode_t
21451 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21452 set mode_t modetype int stdio.h sys/types.h
21453 eval $typedef_ask
21454
21455 : see if we need va_copy
21456 echo " "
21457 $cat >try.c <<EOCP
21458 #include <stdarg.h>
21459 #include <stdio.h>
21460 #include <stdlib.h>
21461 #include <signal.h>
21462
21463 int
21464 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21465 {
21466   return vfprintf(f, fmt, *valp);
21467 }
21468
21469 int
21470 myvfprintf(FILE *f, const  char *fmt, va_list val)
21471 {
21472   return ivfprintf(f, fmt, &val);
21473 }
21474
21475 int
21476 myprintf(char *fmt, ...)
21477 {
21478   va_list val;
21479   va_start(val, fmt);
21480   return myvfprintf(stdout, fmt, val);
21481 }
21482
21483 int
21484 main(int ac, char **av)
21485 {
21486   signal(SIGSEGV, exit);
21487 #ifdef SIGBUS
21488   signal(SIGBUS,  exit);
21489 #endif
21490
21491   myprintf("%s%cs all right, then\n", "that", '\'');
21492   exit(0);
21493 }
21494 EOCP
21495 set try
21496 if eval $compile && $run ./try 2>&1 >/dev/null; then
21497         case "`$run ./try`" in
21498         "that's all right, then")
21499                 okay=yes
21500                 ;;
21501         esac
21502 fi
21503 case "$okay" in
21504 yes)    echo "It seems that you don't need va_copy()." >&4
21505         need_va_copy="$undef"
21506         ;;
21507 *)      echo "It seems that va_copy() or similar will be needed." >&4
21508         need_va_copy="$define"
21509         ;;
21510 esac
21511 $rm_try
21512
21513 : see what type is used for size_t
21514 rp="What is the type used for the length parameter for string functions?"
21515 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21516 eval $typedef_ask
21517
21518 : check for type of arguments to gethostbyaddr.
21519 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21520         case "$d_gethbyaddr" in
21521         $define)
21522                 $cat <<EOM
21523
21524 Checking to see what type of arguments are accepted by gethostbyaddr().
21525 EOM
21526                 hdrs="$define sys/types.h
21527                         $d_socket sys/socket.h
21528                         $i_niin netinet/in.h
21529                         $i_netdb netdb.h
21530                         $i_unistd unistd.h"
21531                 : The first arg can 'char *' or 'void *'
21532                 : The second arg is some of integral type
21533                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21534                         for yyy in size_t long int; do
21535                                 case "$netdb_host_type" in
21536                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21537                                         if ./protochk "$try" $hdrs; then
21538                                                 echo "Your system accepts $xxx for the first arg."
21539                                                 echo "...and $yyy for the second arg."
21540                                                 netdb_host_type="$xxx"
21541                                                 netdb_hlen_type="$yyy"
21542                                         fi
21543                                         ;;
21544                                 esac
21545                         done
21546                 done
21547                 : In case none of those worked, prompt the user.
21548                 case "$netdb_host_type" in
21549                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21550                         dflt='char *'
21551                         . ./myread
21552                         netdb_host_type=$ans
21553                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21554                         dflt="$sizetype"
21555                         . ./myread
21556                         netdb_hlen_type=$ans
21557                         ;;
21558                 esac
21559                 ;;
21560         *)      : no gethostbyaddr, so pick harmless defaults
21561                 netdb_host_type='char *'
21562                 netdb_hlen_type="$sizetype"
21563                 ;;
21564         esac
21565         # Remove the "const" if needed. -- but then we'll have a
21566         # prototype clash!
21567         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21568 fi
21569
21570 : check for type of argument to gethostbyname.
21571 if test "X$netdb_name_type" = X ; then
21572         case "$d_gethbyname" in
21573         $define)
21574                 $cat <<EOM
21575
21576 Checking to see what type of argument is accepted by gethostbyname().
21577 EOM
21578                 hdrs="$define sys/types.h
21579                         $d_socket sys/socket.h
21580                         $i_niin netinet/in.h
21581                         $i_netdb netdb.h
21582                         $i_unistd unistd.h"
21583                 for xxx in "const char *" "char *"; do
21584                         case "$netdb_name_type" in
21585                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21586                                 if ./protochk "$try" $hdrs; then
21587                                         echo "Your system accepts $xxx."
21588                                         netdb_name_type="$xxx"
21589                                 fi
21590                                 ;;
21591                         esac
21592                 done
21593                 : In case none of those worked, prompt the user.
21594                 case "$netdb_name_type" in
21595                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21596                         dflt='char *'
21597                         . ./myread
21598                         netdb_name_type=$ans
21599                         ;;
21600                 esac
21601                 ;;
21602         *)      : no gethostbyname, so pick harmless default
21603                 netdb_name_type='char *'
21604                 ;;
21605         esac
21606 fi
21607
21608 : check for type of 1st argument to getnetbyaddr.
21609 if test "X$netdb_net_type" = X ; then
21610         case "$d_getnbyaddr" in
21611         $define)
21612                 $cat <<EOM
21613
21614 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21615 EOM
21616                 hdrs="$define sys/types.h
21617                         $d_socket sys/socket.h
21618                         $i_niin netinet/in.h
21619                         $i_netdb netdb.h
21620                         $i_unistd unistd.h"
21621                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21622                         case "$netdb_net_type" in
21623                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21624                                 if ./protochk "$try" $hdrs; then
21625                                         echo "Your system accepts $xxx."
21626                                         netdb_net_type="$xxx"
21627                                 fi
21628                                 ;;
21629                         esac
21630                 done
21631                 : In case none of those worked, prompt the user.
21632                 case "$netdb_net_type" in
21633                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21634                         dflt='long'
21635                         . ./myread
21636                         netdb_net_type=$ans
21637                         ;;
21638                 esac
21639                 ;;
21640         *)      : no getnetbyaddr, so pick harmless default
21641                 netdb_net_type='long'
21642                 ;;
21643         esac
21644 fi
21645 : locate the preferred pager for this system
21646 fn=f/
21647 case "$pager" in
21648 '')
21649         dflt=''
21650         case "$pg" in
21651         /*) dflt=$pg;;
21652         [a-zA-Z]:/*) dflt=$pg;;
21653         esac
21654         case "$more" in
21655         /*) dflt=$more;;
21656         [a-zA-Z]:/*) dflt=$more;;
21657         esac
21658         case "$less" in
21659         /*) dflt=$less;;
21660         [a-zA-Z]:/*) dflt=$less;;
21661         esac
21662         case "$dflt" in
21663         '') dflt=/usr/ucb/more;;
21664         esac
21665         ;;
21666 *)      dflt="$pager"
21667         ;;
21668 esac
21669 fn="f/($dflt)"
21670 echo " "
21671 rp='What pager is used on your system?'
21672 . ./getfile
21673 pager="$ans"
21674
21675 : see if ar generates random libraries by itself
21676 echo " "
21677 echo "Checking how to generate random libraries on your machine..." >&4
21678 echo 'int bar1() { return bar2(); }' > bar1.c
21679 echo 'int bar2() { return 2; }' > bar2.c
21680 $cat > foo.c <<EOP
21681 #$i_stdlib I_STDLIB
21682 #ifdef I_STDLIB
21683 #include <stdlib.h>
21684 #endif
21685 int main() { printf("%d\n", bar1()); exit(0); }
21686 EOP
21687 $cc $ccflags -c bar1.c >/dev/null 2>&1
21688 $cc $ccflags -c bar2.c >/dev/null 2>&1
21689 $cc $ccflags -c foo.c >/dev/null 2>&1
21690 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21691 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21692         $run ./foobar >/dev/null 2>&1; then
21693         echo "$ar appears to generate random libraries itself."
21694         orderlib=false
21695         if [ "X$ranlib" = "X" ]; then
21696             ranlib=":"
21697         fi
21698 elif $ar s bar$_a >/dev/null 2>&1 &&
21699         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21700         $run ./foobar >/dev/null 2>&1; then
21701                 echo "a table of contents needs to be added with '$ar s'."
21702                 orderlib=false
21703                 ranlib="$ar s"
21704 elif $ar ts bar$_a >/dev/null 2>&1 &&
21705         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21706         $run ./foobar >/dev/null 2>&1; then
21707                 echo "a table of contents needs to be added with '$ar ts'."
21708                 orderlib=false
21709                 ranlib="$ar ts"
21710 else
21711         case "$ranlib" in
21712         :) ranlib='';;
21713         '')
21714                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21715                 $test -f $ranlib || ranlib=''
21716                 ;;
21717         esac
21718         if $test -n "$ranlib"; then
21719                 echo "your system has '$ranlib'; we'll use that."
21720                 orderlib=false
21721         else
21722                 echo "your system doesn't seem to support random libraries"
21723                 echo "so we'll use lorder and tsort to order the libraries."
21724                 orderlib=true
21725                 ranlib=":"
21726         fi
21727 fi
21728 $rm -f foo* bar*
21729
21730 : Check the max offset that gmtime and localtime accept
21731 echo "Checking max offsets that gmtime () accepts"
21732
21733 case "$sGMTIME_min/$sGMTIME_max" in
21734     0/0|/)
21735         $cat >try.c <<EOCP
21736 #include <sys/types.h>
21737 #include <stdio.h>
21738 #include <time.h>
21739
21740 int i;
21741 struct tm *tmp;
21742 time_t pt;
21743
21744 void gm_check (time_t t, int min_year, int max_year)
21745 {
21746     tmp = gmtime (&t);
21747     if ( tmp == NULL ||
21748         /* Check tm_year overflow */
21749          tmp->tm_year < min_year || tmp->tm_year > max_year)
21750         tmp = NULL;
21751     else
21752         pt = t;
21753     } /* gm_check */
21754
21755 int check_max ()
21756 {
21757     tmp = NULL;
21758     pt  = 0;
21759 #ifdef MAXLONG
21760     gm_check (MAXLONG, 69, 0x7fffffff);
21761 #endif
21762     if (tmp == NULL || tmp->tm_year < 0) {
21763         for (i = 63; i >= 0; i--) {
21764             time_t x = pt | ((time_t)1 << i);
21765             if (x < 0 || x < pt) continue;
21766             gm_check (x, 69, 0x7fffffff);
21767             }
21768         }
21769     printf ("sGMTIME_max=%ld\n", pt);
21770     return (0);
21771     } /* check_max */
21772
21773 int check_min ()
21774 {
21775     tmp = NULL;
21776     pt  = 0;
21777 #ifdef MINLONG
21778     gm_check (MINLONG, -1900, 70);
21779 #endif
21780     if (tmp == NULL) {
21781         for (i = 36; i >= 0; i--) {
21782             time_t x = pt - ((time_t)1 << i);
21783             if (x > 0) continue;
21784             gm_check (x, -1900, 70);
21785             }
21786         }
21787     printf ("sGMTIME_min=%ld\n", pt);
21788     return (0);
21789     } /* check_min */
21790
21791 int main (int argc, char *argv[])
21792 {
21793     /* fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); */
21794     check_max ();
21795     check_min ();
21796     return (0);
21797     } /* main */
21798 EOCP
21799         set try
21800         if eval $compile; then
21801             eval `$run ./try 2>/dev/null`
21802         else
21803             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21804             fi
21805         $rm_try
21806         ;;
21807     esac
21808
21809 echo "Checking max offsets that localtime () accepts"
21810
21811 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21812     0/0|/)
21813         $cat >try.c <<EOCP
21814 #include <sys/types.h>
21815 #include <stdio.h>
21816 #include <time.h>
21817
21818 int i;
21819 struct tm *tmp;
21820 time_t pt;
21821
21822 void local_check (time_t t, int min_year, int max_year)
21823 {
21824     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21825         tmp = NULL;
21826     else
21827         tmp = localtime (&t);
21828     if ( tmp == NULL ||
21829         /* Check tm_year overflow */
21830          tmp->tm_year < min_year || tmp->tm_year > max_year)
21831         tmp = NULL;
21832     else
21833         pt = t;
21834     } /* local_check */
21835
21836 int check_max ()
21837 {
21838     tmp = NULL;
21839     pt  = 0;
21840 #ifdef MAXLONG
21841     local_check (MAXLONG, 69, 0x7fffffff);
21842 #endif
21843     if (tmp == NULL || tmp->tm_year < 0) {
21844         for (i = 63; i >= 0; i--) {
21845             time_t x = pt | ((time_t)1 << i);
21846             if (x < 0 || x < pt) continue;
21847             local_check (x, 69, 0x7fffffff);
21848             }
21849         }
21850     printf ("sLOCALTIME_max=%ld\n", pt);
21851     return (0);
21852    } /* check_max */
21853
21854 int check_min ()
21855 {
21856     tmp = NULL;
21857     pt  = 0;
21858 #ifdef MINLONG
21859     local_check (MINLONG, -1900, 70);
21860 #endif
21861     if (tmp == NULL) {
21862         for (i = 36; i >= 0; i--) {
21863             time_t x = pt - ((time_t)1 << i);
21864             if (x > 0) continue;
21865             local_check (x, -1900, 70);
21866             }
21867         }
21868     printf ("sLOCALTIME_min=%ld\n", pt);
21869     return (0);
21870     } /* check_min */
21871
21872 int main (int argc, char *argv[])
21873 {
21874     check_max ();
21875     check_min ();
21876     return (0);
21877     } /* main */
21878 EOCP
21879         set try
21880         if eval $compile; then
21881             eval `$run ./try 2>/dev/null`
21882         else
21883             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21884             fi
21885         $rm_try
21886         ;;
21887     esac
21888
21889 : check for type of arguments to select.
21890 case "$selecttype" in
21891 '') case "$d_select" in
21892         $define)
21893                 echo " "
21894                 $cat <<EOM
21895 Checking to see what type of arguments are accepted by select().
21896 EOM
21897                 hdrs="$define sys/types.h
21898                         $i_systime sys/time.h
21899                         $i_sysselct sys/select.h
21900                         $d_socket sys/socket.h"
21901                 : The first arg can be int, unsigned, or size_t
21902                 : The last arg may or may not be 'const'
21903                 val=''
21904                 : void pointer has been seen but using that
21905                 : breaks the selectminbits test
21906                 for xxx in 'fd_set *' 'int *'; do
21907                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21908                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21909                                         case "$val" in
21910                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21911                                                 if ./protochk "$try" $hdrs; then
21912                                                         echo "Your system accepts $xxx."
21913                                                         val="$xxx"
21914                                                 fi
21915                                                 ;;
21916                                         esac
21917                                 done
21918                         done
21919                 done
21920                 case "$val" in
21921                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21922                         case "$d_fd_set" in
21923                                 $define) dflt="fd_set *" ;;
21924                                 *)              dflt="int *" ;;
21925                         esac
21926                         . ./myread
21927                         val=$ans
21928                         ;;
21929                 esac
21930                 selecttype="$val"
21931                 ;;
21932         *)      : no select, so pick a harmless default
21933                 selecttype='int *'
21934                 ;;
21935         esac
21936         ;;
21937 esac
21938
21939 : check for the select 'width'
21940 case "$selectminbits" in
21941 '') safebits=`expr $ptrsize \* 8`
21942     case "$d_select" in
21943         $define)
21944                 $cat <<EOM
21945
21946 Checking to see on how many bits at a time your select() operates...
21947 EOM
21948                 $cat >try.c <<EOCP
21949 #include <sys/types.h>
21950 #$i_time I_TIME
21951 #$i_systime I_SYS_TIME
21952 #$i_systimek I_SYS_TIME_KERNEL
21953 #ifdef I_TIME
21954 #   include <time.h>
21955 #endif
21956 #ifdef I_SYS_TIME
21957 #   ifdef I_SYS_TIME_KERNEL
21958 #       define KERNEL
21959 #   endif
21960 #   include <sys/time.h>
21961 #   ifdef I_SYS_TIME_KERNEL
21962 #       undef KERNEL
21963 #   endif
21964 #endif
21965 #$i_sysselct I_SYS_SELECT
21966 #ifdef I_SYS_SELECT
21967 #include <sys/select.h>
21968 #endif
21969 #$d_socket HAS_SOCKET
21970 #ifdef HAS_SOCKET
21971 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21972 #endif
21973 #include <stdio.h>
21974 #$i_stdlib I_STDLIB
21975 #ifdef I_STDLIB
21976 #include <stdlib.h>
21977 #endif
21978 $selecttype b;
21979 #define S sizeof(*(b))
21980 #define MINBITS 64
21981 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21982 #define NBITS  (NBYTES * 8)
21983 int main() {
21984     char *s = (char *)malloc(NBYTES);
21985     struct timeval t;
21986     int i;
21987     FILE* fp;
21988     int fd;
21989
21990     if (!s)
21991         exit(1);
21992     fclose(stdin);
21993     fp = fopen("try.c", "r");
21994     if (fp == 0)
21995       exit(2);
21996     fd = fileno(fp);
21997     if (fd < 0)
21998       exit(3);
21999     b = ($selecttype)s;
22000     for (i = 0; i < NBITS; i++)
22001         FD_SET(i, b);
22002     t.tv_sec  = 0;
22003     t.tv_usec = 0;
22004     select(fd + 1, b, 0, 0, &t);
22005     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
22006     free(s);
22007     printf("%d\n", i + 1);
22008     return 0;
22009 }
22010 EOCP
22011                 set try
22012                 if eval $compile_ok; then
22013                         selectminbits=`$run ./try 2>/dev/null`
22014                         case "$selectminbits" in
22015                         '')     cat >&4 <<EOM
22016 Cannot figure out on how many bits at a time your select() operates.
22017 I'll play safe and guess it is $safebits bits.
22018 EOM
22019                                 selectminbits=$safebits
22020                                 bits="$safebits bits"
22021                                 ;;
22022                         1)      bits="1 bit" ;;
22023                         *)      bits="$selectminbits bits" ;;
22024                         esac
22025                         echo "Your select() operates on $bits at a time." >&4
22026                 else
22027                         rp='What is the minimum number of bits your select() operates on?'
22028                         case "$byteorder" in
22029                         12345678)       dflt=64 ;;
22030                         1234)           dflt=32 ;;
22031                         *)              dflt=1  ;;
22032                         esac
22033                         . ./myread
22034                         val=$ans
22035                         selectminbits="$val"
22036                 fi
22037                 $rm_try
22038                 ;;
22039         *)      : no select, so pick a harmless default
22040                 selectminbits=$safebits
22041                 ;;
22042         esac
22043         ;;
22044 esac
22045
22046 : Trace out the files included by signal.h, then look for SIGxxx names.
22047 case "$sig_num_init" in
22048 '')
22049 if [ "X$fieldn" = X ]; then
22050         : Just make some guesses.  We check them later.
22051         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
22052 else
22053         xxx=`echo '#include <signal.h>' |
22054         $cppstdin $cppminus $cppflags 2>/dev/null |
22055         $grep '^[       ]*#.*include' |
22056         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
22057                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
22058 fi
22059 xxxfiles=''
22060 for xx in $xxx /dev/null ; do
22061         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
22062 done
22063 case "$xxxfiles" in
22064 '')     xxxfiles=`./findhdr signal.h` ;;
22065 esac
22066 xxx=`awk '
22067 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
22068         print substr($2, 4, 20)
22069 }
22070 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
22071         print substr($3, 4, 20)
22072 }' $xxxfiles`
22073 : Append some common names just in case the awk scan failed.
22074 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
22075 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
22076 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
22077 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
22078 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
22079
22080 : generate a few handy files for later
22081 $cat > signal.c <<EOCP
22082 #include <sys/types.h>
22083 #include <signal.h>
22084 #$i_stdlib I_STDLIB
22085 #ifdef I_STDLIB
22086 #include <stdlib.h>
22087 #endif
22088 #include <stdio.h>
22089 int main() {
22090
22091 /* Strange style to avoid deeply-nested #if/#else/#endif */
22092 #ifndef NSIG
22093 #  ifdef _NSIG
22094 #    define NSIG (_NSIG)
22095 #  endif
22096 #endif
22097
22098 #ifndef NSIG
22099 #  ifdef SIGMAX
22100 #    define NSIG (SIGMAX+1)
22101 #  endif
22102 #endif
22103
22104 #ifndef NSIG
22105 #  ifdef SIG_MAX
22106 #    define NSIG (SIG_MAX+1)
22107 #  endif
22108 #endif
22109
22110 #ifndef NSIG
22111 #  ifdef _SIG_MAX
22112 #    define NSIG (_SIG_MAX+1)
22113 #  endif
22114 #endif
22115
22116 #ifndef NSIG
22117 #  ifdef MAXSIG
22118 #    define NSIG (MAXSIG+1)
22119 #  endif
22120 #endif
22121
22122 #ifndef NSIG
22123 #  ifdef MAX_SIG
22124 #    define NSIG (MAX_SIG+1)
22125 #  endif
22126 #endif
22127
22128 #ifndef NSIG
22129 #  ifdef SIGARRAYSIZE
22130 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
22131 #  endif
22132 #endif
22133
22134 #ifndef NSIG
22135 #  ifdef _sys_nsig
22136 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
22137 #  endif
22138 #endif
22139
22140 /* Default to some arbitrary number that's big enough to get most
22141    of the common signals.
22142 */
22143 #ifndef NSIG
22144 #    define NSIG 50
22145 #endif
22146
22147 printf("NSIG %d\n", NSIG);
22148
22149 #ifndef JUST_NSIG
22150
22151 EOCP
22152
22153 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
22154 {
22155         printf "#ifdef SIG"; printf $1; printf "\n"
22156         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
22157         printf $1; printf ");\n"
22158         printf "#endif\n"
22159 }
22160 END {
22161         printf "#endif /* JUST_NSIG */\n";
22162         printf "exit(0);\n}\n";
22163 }
22164 ' >>signal.c
22165 $cat >signal.awk <<'EOP'
22166 BEGIN { ndups = 0 }
22167 $1 ~ /^NSIG$/ { nsig = $2 }
22168 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
22169     if ($2 > maxsig) { maxsig = $2 }
22170     if (sig_name[$2]) {
22171         dup_name[ndups] = $1
22172         dup_num[ndups] = $2
22173         ndups++
22174     }
22175     else {
22176         sig_name[$2] = $1
22177         sig_num[$2] = $2
22178     }
22179 }
22180 END {
22181     if (nsig == 0) {
22182         nsig = maxsig + 1
22183     }
22184     printf("NSIG %d\n", nsig);
22185     for (n = 1; n < nsig; n++) {
22186         if (sig_name[n]) {
22187             printf("%s %d\n", sig_name[n], sig_num[n])
22188         }
22189         else {
22190             printf("NUM%d %d\n", n, n)
22191         }
22192     }
22193     for (n = 0; n < ndups; n++) {
22194         printf("%s %d\n", dup_name[n], dup_num[n])
22195     }
22196 }
22197 EOP
22198 $cat >signal_cmd <<EOS
22199 $startsh
22200 if $test -s signal.lst; then
22201     echo "Using your existing signal.lst file"
22202         exit 0
22203 fi
22204 xxx="$xxx"
22205 EOS
22206 $cat >>signal_cmd <<'EOS'
22207
22208 set signal
22209 if eval $compile_ok; then
22210         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
22211                 $uniq | $awk -f signal.awk >signal.lst
22212 else
22213         echo "(I can't seem be able to compile the whole test program)" >&4
22214         echo "(I'll try it in little pieces.)" >&4
22215         set signal -DJUST_NSIG
22216         if eval $compile_ok; then
22217                 $run ./signal$_exe > signal.nsg
22218                 $cat signal.nsg
22219         else
22220                 echo "I can't seem to figure out how many signals you have." >&4
22221                 echo "Guessing 50." >&4
22222                 echo 'NSIG 50' > signal.nsg
22223         fi
22224         : Now look at all the signal names, one at a time.
22225         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
22226                 $cat > signal.c <<EOCP
22227 #include <sys/types.h>
22228 #include <signal.h>
22229 #include <stdio.h>
22230 int main() {
22231 printf("$xx %d\n", SIG${xx});
22232 return 0;
22233 }
22234 EOCP
22235                 set signal
22236                 if eval $compile; then
22237                         echo "SIG${xx} found."
22238                         $run ./signal$_exe  >> signal.ls1
22239                 else
22240                         echo "SIG${xx} NOT found."
22241                 fi
22242         done
22243         if $test -s signal.ls1; then
22244                 $cat signal.nsg signal.ls1 |
22245                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
22246         fi
22247
22248 fi
22249 if $test -s signal.lst; then
22250         :
22251 else
22252         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
22253         echo 'kill -l' >signal
22254         set X `csh -f <signal`
22255         $rm -f signal
22256         shift
22257         case $# in
22258         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
22259         esac
22260         echo $@ | $tr ' ' $trnl | \
22261             $awk '{ printf "%s %d\n", $1, ++s; }
22262                   END { printf "NSIG %d\n", ++s }' >signal.lst
22263 fi
22264 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
22265 EOS
22266 chmod a+x signal_cmd
22267 $eunicefix signal_cmd
22268 ;;
22269 esac
22270
22271 : generate list of signal names
22272 case "$sig_num_init" in
22273 '')
22274 echo " "
22275 case "$sig_name_init" in
22276 '') doinit=yes ;;
22277 *)  case "$sig_num_init" in
22278     ''|*,*) doinit=yes ;;
22279     esac ;;
22280 esac
22281 case "$doinit" in
22282 yes)
22283         echo "Generating a list of signal names and numbers..." >&4
22284         . ./signal_cmd
22285         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22286         sig_name=`$awk 'BEGIN { printf "ZERO " }
22287                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22288         sig_num=`$awk  'BEGIN { printf "0 " }
22289                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22290         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22291                              !/^NSIG/   { printf "\"%s\", ", $1 }
22292                              END        { printf "0\n" }' signal.lst`
22293         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22294                              !/^NSIG/   { printf "%d, ", $2}
22295                              END        { printf "0\n"}' signal.lst`
22296         ;;
22297 esac
22298 echo "The following $sig_count signals are available:"
22299 echo " "
22300 echo $sig_name | $awk \
22301 'BEGIN { linelen = 0 }
22302 {
22303         for (i = 1; i <= NF; i++) {
22304                 name = "SIG" $i " "
22305                 linelen = linelen + length(name)
22306                 if (linelen > 70) {
22307                         printf "\n"
22308                         linelen = length(name)
22309                 }
22310                 printf "%s", name
22311         }
22312         printf "\n"
22313 }'
22314 sig_size=`echo $sig_name | awk '{print NF}'`
22315 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22316 ;;
22317 esac
22318
22319 : Check size of size
22320 echo " "
22321 case "$sizetype" in
22322 *_t) zzz="$sizetype"    ;;
22323 *)   zzz="filesize"     ;;
22324 esac
22325 echo "Checking the size of $zzz..." >&4
22326 cat > try.c <<EOCP
22327 #include <sys/types.h>
22328 #include <stdio.h>
22329 #$i_stdlib I_STDLIB
22330 #ifdef I_STDLIB
22331 #include <stdlib.h>
22332 #endif
22333 int main() {
22334     printf("%d\n", (int)sizeof($sizetype));
22335     exit(0);
22336 }
22337 EOCP
22338 set try
22339 if eval $compile_ok; then
22340         yyy=`$run ./try`
22341         case "$yyy" in
22342         '')     sizesize=4
22343                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22344                 ;;
22345         *)      sizesize=$yyy
22346                 echo "Your $zzz size is $sizesize bytes."
22347                 ;;
22348         esac
22349 else
22350         sizesize=4
22351         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22352 fi
22353
22354 : check for socklen_t
22355 echo " "
22356 echo "Checking to see if you have socklen_t..." >&4
22357 $cat >try.c <<EOCP
22358 #include <sys/types.h>
22359 #$d_socket HAS_SOCKET
22360 #ifdef HAS_SOCKET
22361 #include <sys/socket.h>
22362 #endif
22363 int main() { socklen_t x = 16; }
22364 EOCP
22365 set try
22366 if eval $compile; then
22367         val="$define"
22368         echo "You have socklen_t."
22369 else
22370         val="$undef"
22371         echo "You do not have socklen_t."
22372         case "$sizetype" in
22373         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22374         esac
22375 fi
22376 $rm_try
22377 set d_socklen_t
22378 eval $setvar
22379
22380 : see if this is a socks.h system
22381 set socks.h i_socks
22382 eval $inhdr
22383
22384 : check for type of the size argument to socket calls
22385 case "$d_socket" in
22386 "$define")
22387         $cat <<EOM
22388
22389 Checking to see what type is the last argument of accept().
22390 EOM
22391         yyy=''
22392         case "$d_socklen_t" in
22393         "$define") yyy="$yyy socklen_t"
22394         esac
22395         yyy="$yyy $sizetype int long unsigned"
22396         for xxx in $yyy; do
22397                 case "$socksizetype" in
22398                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22399                         case "$usesocks" in
22400                         "$define")
22401                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22402                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22403                                         socksizetype="$xxx"
22404                                 fi
22405                                 ;;
22406                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22407                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22408                                         socksizetype="$xxx"
22409                                 fi
22410                                 ;;
22411                         esac
22412                         ;;
22413                 esac
22414         done
22415 : In case none of those worked, prompt the user.
22416         case "$socksizetype" in
22417         '')     rp='What is the type for socket address structure sizes?'
22418                 dflt='int'
22419                 . ./myread
22420                 socksizetype=$ans
22421                 ;;
22422         esac
22423         ;;
22424 *)      : no sockets, so pick relatively harmless default
22425         socksizetype='int'
22426         ;;
22427 esac
22428
22429 : see what type is used for signed size_t
22430 set ssize_t ssizetype int stdio.h sys/types.h
22431 eval $typedef
22432 dflt="$ssizetype"
22433 $cat > try.c <<EOM
22434 #include <stdio.h>
22435 #$i_stdlib I_STDLIB
22436 #ifdef I_STDLIB
22437 #include <stdlib.h>
22438 #endif
22439 #include <sys/types.h>
22440 #define Size_t $sizetype
22441 #define SSize_t $dflt
22442 int main()
22443 {
22444         if (sizeof(Size_t) == sizeof(SSize_t))
22445                 printf("$dflt\n");
22446         else if (sizeof(Size_t) == sizeof(int))
22447                 printf("int\n");
22448         else
22449                 printf("long\n");
22450         exit(0);
22451 }
22452 EOM
22453 echo " "
22454 set try
22455 if eval $compile_ok && $run ./try > /dev/null; then
22456         ssizetype=`$run ./try`
22457         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22458 else
22459         $cat >&4 <<EOM
22460 Help! I can't compile and run the ssize_t test program: please enlighten me!
22461 (This is probably a misconfiguration in your system or libraries, and
22462 you really ought to fix it.  Still, I'll try anyway.)
22463
22464 I need a type that is the same size as $sizetype, but is guaranteed to
22465 be signed.  Common values are ssize_t, int and long.
22466
22467 EOM
22468         rp="What signed type is the same size as $sizetype?"
22469         . ./myread
22470         ssizetype="$ans"
22471 fi
22472 $rm_try
22473
22474 : Check the size of st_ino
22475 $echo " "
22476 $echo "Checking the size of st_ino..." >&4
22477 $cat > try.c <<EOCP
22478 #include <sys/stat.h>
22479 #include <stdio.h>
22480 #$i_stdlib I_STDLIB
22481 #ifdef I_STDLIB
22482 #include <stdlib.h>
22483 #endif
22484 int main() {
22485     struct stat st;
22486     printf("%d\n", (int)sizeof(st.st_ino));
22487     exit(0);
22488 }
22489 EOCP
22490 set try
22491 if eval $compile_ok; then
22492         val=`$run ./try`
22493         case "$val" in
22494         '')     st_ino_size=4
22495                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22496                 ;;
22497         *)      st_ino_size=$val
22498                 $echo "Your st_ino is $st_ino_size bytes long."
22499                 ;;
22500         esac
22501 else
22502         st_ino_size=4
22503         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22504 fi
22505 $rm_try
22506
22507 : Check if st_ino is signed
22508 $echo " "
22509 $echo "Checking the sign of st_ino..." >&4
22510 $cat > try.c <<EOCP
22511 #include <sys/stat.h>
22512 #include <stdio.h>
22513 int main() {
22514         struct stat foo;
22515         foo.st_ino = -1;
22516         if (foo.st_ino < 0)
22517                 printf("-1\n");
22518         else
22519                 printf("1\n");
22520 }
22521 EOCP
22522 set try
22523 if eval $compile; then
22524         val=`$run ./try`
22525         case "$val" in
22526         '')     st_ino_sign=1
22527                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22528                 ;;
22529         *)      st_ino_sign=$val
22530                 case "$st_ino_sign" in
22531                  1) $echo "Your st_ino is unsigned." ;;
22532                 -1) $echo "Your st_ino is signed."   ;;
22533                 esac
22534                 ;;
22535         esac
22536 else
22537         st_ino_sign=1
22538         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22539 fi
22540 $rm_try
22541
22542 : see what type of char stdio uses.
22543 echo " "
22544 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22545 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22546         echo "Your stdio uses unsigned chars." >&4
22547         stdchar="unsigned char"
22548 else
22549         echo "Your stdio uses signed chars." >&4
22550         stdchar="char"
22551 fi
22552 $rm -f stdioh
22553
22554 : Check size of UID
22555 echo " "
22556 case "$uidtype" in
22557 *_t) zzz="$uidtype"     ;;
22558 *)   zzz="uid"          ;;
22559 esac
22560 echo "Checking the size of $zzz..." >&4
22561 cat > try.c <<EOCP
22562 #include <sys/types.h>
22563 #include <stdio.h>
22564 #$i_stdlib I_STDLIB
22565 #ifdef I_STDLIB
22566 #include <stdlib.h>
22567 #endif
22568 int main() {
22569     printf("%d\n", (int)sizeof($uidtype));
22570     exit(0);
22571 }
22572 EOCP
22573 set try
22574 if eval $compile_ok; then
22575         yyy=`$run ./try`
22576         case "$yyy" in
22577         '')     uidsize=4
22578                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22579                 ;;
22580         *)      uidsize=$yyy
22581                 echo "Your $zzz is $uidsize bytes long."
22582                 ;;
22583         esac
22584 else
22585         uidsize=4
22586         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22587 fi
22588
22589 : Check if UID is signed
22590 echo " "
22591 case "$uidtype" in
22592 *_t) zzz="$uidtype"     ;;
22593 *)   zzz="uid"          ;;
22594 esac
22595 echo "Checking the sign of $zzz..." >&4
22596 cat > try.c <<EOCP
22597 #include <sys/types.h>
22598 #include <stdio.h>
22599 int main() {
22600         $uidtype foo = -1;
22601         if (foo < 0)
22602                 printf("-1\n");
22603         else
22604                 printf("1\n");
22605 }
22606 EOCP
22607 set try
22608 if eval $compile; then
22609         yyy=`$run ./try`
22610         case "$yyy" in
22611         '')     uidsign=1
22612                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22613                 ;;
22614         *)      uidsign=$yyy
22615                 case "$uidsign" in
22616                  1) echo "Your $zzz is unsigned." ;;
22617                 -1) echo "Your $zzz is signed."   ;;
22618                 esac
22619                 ;;
22620         esac
22621 else
22622         uidsign=1
22623         echo "(I can't compile the test program--guessing unsigned.)" >&4
22624 fi
22625
22626 : Check format string for UID
22627 echo " "
22628 $echo "Checking the format string to be used for uids..." >&4
22629
22630 case "$uidsign" in
22631 -1)     if $test X"$uidsize" = X"$ivsize"; then
22632                 uidformat="$ivdformat"
22633         else
22634                 if $test X"$uidsize" = X"$longsize"; then
22635                         uidformat='"ld"'
22636                 else
22637                         if $test X"$uidsize" = X"$intsize"; then
22638                                 uidformat='"d"'
22639                         else
22640                                 if $test X"$uidsize" = X"$shortsize"; then
22641                                         uidformat='"hd"'
22642                                 fi
22643                         fi
22644                 fi
22645         fi
22646         ;;
22647 *)      if $test X"$uidsize" = X"$uvsize"; then
22648                 uidformat="$uvuformat"
22649         else
22650                 if $test X"$uidsize" = X"$longsize"; then
22651                         uidformat='"lu"'
22652                 else
22653                         if $test X"$uidsize" = X"$intsize"; then
22654                                 uidformat='"u"'
22655                         else
22656                                 if $test X"$uidsize" = X"$shortsize"; then
22657                                         uidformat='"hu"'
22658                                 fi
22659                         fi
22660                 fi
22661         fi
22662         ;;
22663 esac
22664
22665 : Ask about strict by default.
22666 case "$usedefaultstrict" in
22667     $define|true|[Yy]*)
22668        dflt="y"
22669        ;;
22670     *)
22671        dflt="n"
22672        ;;
22673     esac
22674
22675 cat <<EOM
22676
22677 EXPERIMENTAL: Perl can now be built with strict on by default when not
22678 invoked with -e or -E. This is a diagnostic tool for development.
22679
22680 Unless you are familiar with this feature, you should probably answer 'no'.
22681
22682 EOM
22683
22684 rp='Would you like to build perl with strict enabled by default?'
22685 . ./myread
22686 case "$ans" in
22687 y|Y) val="$define" ;;
22688 *)   val="$undef"  ;;
22689 esac
22690 set usedefaultstrict
22691 eval $setvar
22692
22693 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22694 echo " "
22695 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22696 $cat >try.c <<'EOM'
22697 /* Intentionally a long probe as I'd like to sanity check that the exact
22698    approach is going to work, as thinking it will work, but only having it
22699    part working at runtime is worse than not having it.  */
22700
22701 #include <sys/types.h>
22702 #include <sys/sysctl.h>
22703 #include <sys/param.h>
22704 #include <stdio.h>
22705 #include <string.h>
22706 #include <stdlib.h>
22707 #include <unistd.h>
22708
22709 int
22710 main(int argc, char **argv) {
22711     char *buffer;
22712     char *argv_leaf = strrchr(argv[0], '/');
22713     char *buffer_leaf;
22714     size_t size = 0;
22715     int mib[4];
22716
22717     mib[0] = CTL_KERN;
22718     mib[1] = KERN_PROC;
22719     mib[2] = KERN_PROC_PATHNAME;
22720     mib[3] = -1;
22721
22722     if (!argv_leaf) {
22723         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22724         return 1;
22725     }
22726
22727     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22728         perror("sysctl");
22729         return 2;
22730     }
22731
22732     if (size < strlen(argv_leaf) + 1) {
22733         fprintf(stderr, "size %lu is too short for a path\n",
22734                 (unsigned long) size);
22735         return 3;
22736     }
22737
22738     if (size > MAXPATHLEN * MAXPATHLEN) {
22739         fprintf(stderr, "size %lu is too long for a path\n",
22740                 (unsigned long) size);
22741         return 4;
22742     }
22743
22744     buffer = (char *)malloc(size);
22745     if (!buffer) {
22746         perror("malloc");
22747         return 5;
22748     }
22749
22750     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22751         perror("sysctl");
22752         return 6;
22753     }
22754
22755     if (strlen(buffer) + 1 != size) {
22756         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22757                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22758         return 7;
22759     }
22760
22761
22762     if (*buffer != '/') {
22763         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22764         return 8;
22765     }
22766
22767     if (strstr(buffer, "/./")) {
22768         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22769         return 9;
22770     }
22771
22772     if (strstr(buffer, "/../")) {
22773         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22774         return 10;
22775     }
22776
22777     buffer_leaf = strrchr(buffer, '/');
22778     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22779         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22780         return 11;
22781     }
22782
22783     free(buffer);
22784
22785     return 0;
22786 }
22787 EOM
22788
22789 val=$undef
22790 set try
22791 if eval $compile; then
22792         if $run ./try; then
22793                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22794                 val="$define"
22795         else
22796                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22797                 val="$undef"
22798         fi
22799 else
22800         echo "I'm unable to compile the test program." >&4
22801         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22802         val="$undef"
22803 fi
22804 $rm_try
22805 set usekernprocpathname
22806 eval $setvar
22807
22808 : Determine if we can use _NSGetExecutablePath to find executing program
22809 echo " "
22810 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22811 $cat >try.c <<'EOM'
22812 /* Intentionally a long probe as I'd like to sanity check that the exact
22813    approach is going to work, as thinking it will work, but only having it
22814    part working at runtime is worse than not having it.  */
22815 #include <mach-o/dyld.h>
22816 #include <stdio.h>
22817 #include <stdlib.h>
22818 #include <sys/param.h>
22819 #include <string.h>
22820
22821 int
22822 main(int argc, char **argv) {
22823     char buf[1];
22824     uint32_t size = sizeof(buf);
22825     int result;
22826     char *buffer;
22827     char *tidied;
22828     char *argv_leaf = strrchr(argv[0], '/');
22829     char *tidied_leaf;
22830
22831     if (!argv_leaf) {
22832         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22833         return 1;
22834     }
22835
22836     _NSGetExecutablePath(buf, &size);
22837     if (size > MAXPATHLEN * MAXPATHLEN) {
22838         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22839                 (unsigned int) size);
22840         return 2;
22841     }
22842
22843     buffer = (char *)malloc(size);
22844     if (!buffer) {
22845         perror("malloc");
22846         return 3;
22847     }
22848
22849     result = _NSGetExecutablePath(buffer, &size);
22850     if (result != 0) {
22851         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22852                 result, (unsigned int) size);
22853         return 4;
22854     }
22855
22856     tidied = realpath(buffer, NULL);
22857     if (!tidied) {
22858         perror("realpath");
22859         return 5;
22860     }
22861
22862     free(buffer);
22863
22864     if (*tidied != '/') {
22865         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22866         return 6;
22867     }
22868
22869     if (strstr(tidied, "/./")) {
22870         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22871         return 7;
22872     }
22873
22874     if (strstr(tidied, "/../")) {
22875         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22876         return 8;
22877     }
22878
22879     tidied_leaf = strrchr(tidied, '/');
22880     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22881         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22882         return 9;
22883     }
22884
22885     free(tidied);
22886
22887     return 0;
22888 }
22889 EOM
22890
22891 val=$undef
22892 set try
22893 if eval $compile; then
22894         if $run ./try; then
22895                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22896                 val="$define"
22897         else
22898                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22899         fi
22900 else
22901         echo "I'm unable to compile the test program." >&4
22902         echo "I'll assume no _NSGetExecutablePath here." >&4
22903 fi
22904 $rm_try
22905 set usensgetexecutablepath
22906 eval $setvar
22907
22908 : Check if site customization support was requested
22909 case "$usesitecustomize" in
22910     $define|true|[Yy]*)
22911         usesitecustomize="$define"
22912         ;;
22913     *)
22914         usesitecustomize="$undef"
22915         ;;
22916     esac
22917
22918 : determine compiler compiler
22919 case "$yacc" in
22920 '')
22921         dflt=yacc;;
22922 *)
22923         dflt="$yacc";;
22924 esac
22925 echo " "
22926 comp='yacc'
22927 if $test -f "$byacc$_exe"; then
22928         dflt="$byacc"
22929         comp="byacc or $comp"
22930 fi
22931 if $test -f "$bison$_exe"; then
22932         comp="$comp or bison -y"
22933 fi
22934 rp="Which compiler compiler ($comp) shall I use?"
22935 . ./myread
22936 yacc="$ans"
22937 case "$yacc" in
22938 *bis*)
22939         case "$yacc" in
22940         *-y*) ;;
22941         *)
22942                 yacc="$yacc -y"
22943                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22944                 ;;
22945         esac
22946         ;;
22947 esac
22948
22949 : see if this is a bfd.h system
22950 set bfd.h i_bfd
22951 eval $inhdr
22952
22953 : see if this is an execinfo.h system
22954 set execinfo.h i_execinfo
22955 eval $inhdr
22956
22957 : see if this is a fenv.h system
22958 set fenv.h i_fenv
22959 eval $inhdr
22960
22961 : see if this is a fp.h system
22962 set fp.h i_fp
22963 eval $inhdr
22964
22965 : see if this is a fp_class.h system
22966 set fp_class.h i_fp_class
22967 eval $inhdr
22968
22969 : see if gdbm.h is available
22970 set gdbm.h t_gdbm
22971 eval $inhdr
22972 case "$t_gdbm" in
22973 $define)
22974         : see if gdbm_open exists
22975         set gdbm_open d_gdbm_open
22976         eval $inlibc
22977         case "$d_gdbm_open" in
22978         $undef)
22979                 t_gdbm="$undef"
22980                 echo "We won't be including <gdbm.h>"
22981                 ;;
22982         esac
22983         ;;
22984 esac
22985 val="$t_gdbm"
22986 set i_gdbm
22987 eval $setvar
22988
22989 : see if this is a ieeefp.h system
22990 case "$i_ieeefp" in
22991 '' ) set ieeefp.h i_ieeefp
22992      eval $inhdr
22993      ;;
22994 esac
22995
22996 : see if this is a libutil.h system
22997 set libutil.h i_libutil
22998 eval $inhdr
22999
23000 : see if mach cthreads are available
23001 if test "X$usethreads" = "X$define"; then
23002         set mach/cthreads.h i_machcthr
23003         eval $inhdr
23004 else
23005         i_machcthr="$undef"
23006 fi
23007
23008 : see if this is a mntent.h system
23009 set mntent.h i_mntent
23010 eval $inhdr
23011
23012 : see if net/errno.h is available
23013 val=''
23014 set net/errno.h val
23015 eval $inhdr
23016
23017 : Unfortunately, it causes problems on some systems.  Arrgh.
23018 case "$val" in
23019 $define)
23020         cat > try.c <<'EOM'
23021 #include <stdio.h>
23022 #include <errno.h>
23023 #include <net/errno.h>
23024 int func()
23025 {
23026         return ENOTSOCK;
23027 }
23028 EOM
23029         if $cc $ccflags -c try.c >/dev/null 2>&1; then
23030                 echo "We'll be including <net/errno.h>." >&4
23031         else
23032                 echo "We won't be including <net/errno.h>." >&4
23033                 val="$undef"
23034         fi
23035         $rm_try
23036         ;;
23037 esac
23038 set i_neterrno
23039 eval $setvar
23040
23041 : see if netinet/tcp.h is available
23042 set netinet/tcp.h i_netinettcp
23043 eval $inhdr
23044
23045 : see if this is a poll.h system
23046 set poll.h i_poll
23047 eval $inhdr
23048
23049 : see if this is a prot.h system
23050 set prot.h i_prot
23051 eval $inhdr
23052
23053 : Preprocessor symbols
23054 echo " "
23055 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
23056 $cat <<'EOSH' > Cppsym.know
23057 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
23058 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
23059 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
23060 arch_pwr ardent ARM ARM32 atarist att386 att3b
23061 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
23062 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
23063 byteorder byte_order
23064 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
23065 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
23066 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
23067 ELF encore EPI EXTENSIONS
23068 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
23069 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
23070 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
23071 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
23072 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400
23073 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
23074 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
23075 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
23076 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
23077 ksr1
23078 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
23079 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
23080 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
23081 luna88k Lynx
23082 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
23083 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
23084 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
23085 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
23086 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
23087 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
23088 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
23089 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
23090 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
23091 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
23092 ns32000 ns32016 ns32332 ns32k nsc32000
23093 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
23094 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
23095 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
23096 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
23097 QK_USER QNX
23098 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
23099 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
23100 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
23101 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
23102 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
23103 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
23104 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
23105 SYSV4 SYSV5 sysV68 sysV88
23106 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
23107 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
23108 tower32_800 tower32_850 tss
23109 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
23110 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
23111 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
23112 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
23113 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
23114 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
23115 uxpm uxps
23116 vax venix VMESA vms
23117 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
23118 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
23119 z8000 zarch
23120 EOSH
23121 # Maybe put other stuff here too.
23122 ./tr '-' '_' <<EOSH >>Cppsym.know
23123 $osname
23124 EOSH
23125 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
23126 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
23127 $cat Cppsym.know > Cppsym.c
23128 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
23129 $rm -f Cppsym.a Cppsym.b Cppsym.c
23130 cat <<EOSH > Cppsym
23131 $startsh
23132 if $test \$# -gt 0; then
23133     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
23134     if $test -s Cppsym.got; then
23135         $rm -f Cppsym.got
23136         exit 0
23137     fi
23138     $rm -f Cppsym.got
23139     exit 1
23140 else
23141     $tr " " "$trnl" | ./Cppsym.try
23142     exit 0
23143 fi
23144 EOSH
23145 chmod +x Cppsym
23146 $eunicefix Cppsym
23147 cat <<EOSH > Cppsym.try
23148 $startsh
23149 cat <<'EOCP' > try.c
23150 #include <stdio.h>
23151 #if cpp_stuff == 1
23152 #define STRINGIFY(a)    "a"
23153 #endif
23154 #if cpp_stuff == 42
23155 #define StGiFy(a)  #a
23156 #define STRINGIFY(a)    StGiFy(a)
23157 #endif
23158 #if $cpp_stuff != 1 && $cpp_stuff != 42
23159 #   include "Bletch: How does this C preprocessor stringify macros?"
23160 #endif
23161 int main() {
23162 EOCP
23163 $awk \\
23164 EOSH
23165 cat <<'EOSH' >> Cppsym.try
23166 'length($1) > 0 {
23167     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
23168     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
23169     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
23170     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
23171 }' >> try.c
23172 echo 'return 0;}' >> try.c
23173 EOSH
23174 cat <<EOSH >> Cppsym.try
23175 ccflags="$ccflags"
23176 case "$osname-$gccversion" in
23177 irix-) ccflags="\$ccflags -woff 1178" ;;
23178 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
23179 esac
23180 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs 2>/dev/null && $run ./try | $sed 's/ /\\\\ /g'
23181 EOSH
23182 chmod +x Cppsym.try
23183 $eunicefix Cppsym.try
23184 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
23185 : Add in any Linux cpp "predefined macros":
23186 case "$osname::$gccversion" in
23187   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
23188     tHdrH=_tmpHdr
23189     rm -f $tHdrH'.h' $tHdrH
23190     touch $tHdrH'.h'
23191     # Filter out macro arguments, such as Linux's __INT8_C(c)
23192     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
23193        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
23194        if [ -s $tHdrH'_cppsym.real' ]; then
23195           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
23196        fi
23197     fi
23198     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
23199   ;;
23200 esac
23201 : now check the C compiler for additional symbols
23202 postprocess_cc_v=''
23203 case "$osname" in
23204 aix) postprocess_cc_v="|$tr , ' '" ;;
23205 esac
23206 $cat >ccsym <<EOS
23207 $startsh
23208 $cat >tmp.c <<EOF
23209 extern int foo;
23210 EOF
23211 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
23212 do
23213         case "\$i" in
23214         -D*) echo "\$i" | $sed 's/^-D//';;
23215         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
23216         esac
23217 done
23218 $rm_try
23219 EOS
23220 postprocess_cc_v=''
23221 chmod +x ccsym
23222 $eunicefix ccsym
23223 ./ccsym > ccsym1.raw
23224 if $test -s ccsym1.raw; then
23225     $sort ccsym1.raw | $uniq >ccsym.raw
23226 else
23227     mv ccsym1.raw ccsym.raw
23228 fi
23229
23230 $awk '/\=/ { print $0; next }
23231         { print $0"=1" }' ccsym.raw >ccsym.list
23232 $comm -13 Cppsym.true ccsym.list >ccsym.own
23233 $comm -12 Cppsym.true ccsym.list >ccsym.com
23234 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
23235 also=''
23236 if $test -z ccsym.raw; then
23237         echo "Your C compiler doesn't seem to define any symbols!" >&4
23238         echo " "
23239         echo "However, your C preprocessor defines the following symbols:"
23240         $cat Cppsym.true
23241         ccsymbols=''
23242         cppsymbols=`$cat Cppsym.true`
23243         cppsymbols=`echo $cppsymbols`
23244         cppccsymbols="$cppsymbols"
23245 else
23246         if $test -s ccsym.com; then
23247                 echo "Your C compiler and pre-processor define these symbols:"
23248                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
23249                 also='also '
23250                 symbols='ones'
23251                 cppccsymbols=`$cat ccsym.com`
23252                 cppccsymbols=`echo $cppccsymbols`
23253                 $test "$silent" || sleep 1
23254         fi
23255         if $test -s ccsym.cpp; then
23256                 $test "$also" && echo " "
23257                 echo "Your C pre-processor ${also}defines the following symbols:"
23258                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
23259                 also='further '
23260                 cppsymbols=`$cat ccsym.cpp`
23261                 cppsymbols=`echo $cppsymbols`
23262                 $test "$silent" || sleep 1
23263         fi
23264         if $test -s ccsym.own; then
23265                 $test "$also" && echo " "
23266                 echo "Your C compiler ${also}defines the following cpp symbols:"
23267                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
23268                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
23269                 ccsymbols=`$cat ccsym.own`
23270                 ccsymbols=`echo $ccsymbols`
23271                 $test "$silent" || sleep 1
23272         fi
23273 fi
23274
23275 : add -D_FORTIFY_SOURCE if feasible and not already there
23276 case "$gccversion" in
23277 [456789].*|[1-9][0-9]*) case "$optimize$ccflags" in
23278         *-O*)   case "$ccflags$cppsymbols" in
23279                 *_FORTIFY_SOURCE=*) # Don't add it again.
23280                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23281                         ;;
23282                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23283                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23284                         ;;
23285                 esac
23286                 ;;
23287         *)      echo "You have gcc 4.* or later but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23288                 ;;
23289         esac
23290         ;;
23291 *)      echo "You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE." >&4
23292         ;;
23293 esac
23294
23295 : script used to emit important warnings
23296 cat >warn <<EOS
23297 $startsh
23298 if test \$# -gt 0; then
23299         echo "\$@" >msg
23300 else
23301         cat >msg
23302 fi
23303 echo "*** WARNING:" >&4
23304 sed -e 's/^/*** /' <msg >&4
23305 echo "*** " >&4
23306 cat msg >>config.msg
23307 echo " " >>config.msg
23308 rm -f msg
23309 EOS
23310 chmod +x warn
23311 $eunicefix warn
23312
23313 : see if this is a termio system
23314 val="$undef"
23315 val2="$undef"
23316 val3="$undef"
23317 if $test `./findhdr termios.h`; then
23318     set tcsetattr i_termios
23319     eval $inlibc
23320     val3="$i_termios"
23321 fi
23322 echo " "
23323 case "$val3" in
23324     "$define") echo "You have POSIX termios.h... good!" >&4;;
23325     *)  if ./Cppsym pyr; then
23326             case "`$run /bin/universe`" in
23327                 ucb) if $test `./findhdr sgtty.h`; then
23328                         val2="$define"
23329                         echo "<sgtty.h> found." >&4
23330                     else
23331                         echo "System is pyramid with BSD universe."
23332                         ./warn "<sgtty.h> not found--you could have problems."
23333                     fi;;
23334                 *)  if $test `./findhdr termio.h`; then
23335                         val="$define"
23336                         echo "<termio.h> found." >&4
23337                     else
23338                         echo "System is pyramid with USG universe."
23339                         ./warn "<termio.h> not found--you could have problems."
23340                     fi;;
23341             esac
23342         elif ./usg; then
23343             if $test `./findhdr termio.h`; then
23344                 echo "<termio.h> found." >&4
23345                 val="$define"
23346             elif $test `./findhdr sgtty.h`; then
23347                 echo "<sgtty.h> found." >&4
23348                 val2="$define"
23349             else
23350                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23351             fi
23352         else
23353             if $test `./findhdr sgtty.h`; then
23354                 echo "<sgtty.h> found." >&4
23355                 val2="$define"
23356             elif $test `./findhdr termio.h`; then
23357                 echo "<termio.h> found." >&4
23358                 val="$define"
23359             else
23360                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23361             fi
23362         fi;;
23363 esac
23364 set i_termio; eval $setvar
23365 val=$val2; set i_sgtty; eval $setvar
23366 val=$val3; set i_termios; eval $setvar
23367
23368 : see if stdbool is available
23369 : we want a real compile instead of Inhdr because some Solaris systems
23370 : have stdbool.h, but it can only be used if the compiler indicates it
23371 : is sufficiently c99-compliant.
23372 echo " "
23373 $cat >try.c <<EOCP
23374 #include <stdio.h>
23375 #include <stdbool.h>
23376 int func(bool x)
23377 {
23378     return x ? 1 : 0;
23379 }
23380 int main(int argc, char **argv)
23381 {
23382     return func(0);
23383 }
23384 EOCP
23385 set try
23386 if eval $compile; then
23387         echo "<stdbool.h> found." >&4
23388         val="$define"
23389 else
23390         echo "<stdbool.h> NOT found." >&4
23391         val="$undef"
23392 fi
23393 $rm_try
23394 set i_stdbool
23395 eval $setvar
23396
23397 : see if stdint is available
23398 set stdint.h i_stdint
23399 eval $inhdr
23400
23401 : see if sys/access.h is available
23402 set sys/access.h i_sysaccess
23403 eval $inhdr
23404
23405 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23406 set sys/filio.h i_sysfilio
23407 eval $inhdr
23408 echo " "
23409 if $test `./findhdr sys/ioctl.h`; then
23410         val="$define"
23411         echo '<sys/ioctl.h> found.' >&4
23412 else
23413         val="$undef"
23414         if $test $i_sysfilio = "$define"; then
23415             echo '<sys/ioctl.h> NOT found.' >&4
23416         else
23417                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23418                 $test $i_termio = "$define" && xxx="termio.h"
23419                 $test $i_termios = "$define" && xxx="termios.h"
23420 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23421         fi
23422 fi
23423 set i_sysioctl
23424 eval $setvar
23425
23426 : see if socket ioctl defs are in sys/sockio.h
23427 echo " "
23428 xxx=`./findhdr sys/sockio.h`
23429 if $test "$xxx"; then
23430         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23431                 val="$define"
23432                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23433         else
23434                 val="$undef"
23435                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23436         fi
23437 else
23438         val="$undef"
23439         $cat <<EOM
23440 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23441 EOM
23442 fi
23443 set i_syssockio
23444 eval $setvar
23445
23446 : see if this is a syslog.h system
23447 set syslog.h i_syslog
23448 eval $inhdr
23449
23450 : see if this is a sys/mode.h system
23451 set sys/mode.h i_sysmode
23452 eval $inhdr
23453
23454 : see if there is a sys/poll.h file
23455 set sys/poll.h i_syspoll
23456 eval $inhdr
23457
23458 : see if sys/resource.h has to be included
23459 set sys/resource.h i_sysresrc
23460 eval $inhdr
23461
23462 : see if sys/security.h is available
23463 set sys/security.h i_syssecrt
23464 eval $inhdr
23465
23466 : see if this is a sys/statvfs.h system
23467 set sys/statvfs.h i_sysstatvfs
23468 eval $inhdr
23469
23470 : see if this is a sys/un.h system
23471 set sys/un.h i_sysun
23472 eval $inhdr
23473
23474 : see if this is a sys/utsname.h system
23475 set sys/utsname.h i_sysutsname
23476 eval $inhdr
23477
23478 : see if this is a syswait system
23479 set sys/wait.h i_syswait
23480 eval $inhdr
23481
23482 : see if this is a ustat.h system
23483 set ustat.h i_ustat
23484 eval $inhdr
23485
23486 : see if this is an utime system
23487 set utime.h i_utime
23488 eval $inhdr
23489
23490 : see if this is a vfork system
23491 case "$d_vfork" in
23492 "$define")
23493         set vfork.h i_vfork
23494         eval $inhdr
23495         ;;
23496 *)
23497         i_vfork="$undef"
23498         ;;
23499 esac
23500
23501 : see if wchar.h is present
23502 set wchar.h i_wchar
23503 eval $inhdr
23504
23505 : Check extensions
23506 echo " "
23507 echo "Looking for extensions..." >&4
23508 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23509 : contain old or inaccurate or duplicate values.
23510 nonxs_extensions=''
23511 xs_extensions=''
23512 : We do not use find because it might not be available.
23513 : We do not just use MANIFEST because the user may have dropped
23514 : some additional extensions into the source tree and expect them
23515 : to be built.
23516
23517 : Function to recursively find available extensions, ignoring DynaLoader
23518 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23519 : In 5.10.1 and later, extensions are stored in directories
23520 : like File-Glob instead of the older File/Glob/.
23521 find_extensions='
23522     for xxx in *; do
23523         case "$xxx" in
23524             DynaLoader|dynaload) ;;
23525             *)
23526             this_ext=`echo "$xxx" | $sed -e s/-/\\\//g`;
23527             case "$this_ext" in
23528                 Scalar/List/Utils) this_ext="List/Util" ;;
23529                 PathTools)         this_ext="Cwd"       ;;
23530             esac;
23531             echo " $xs_extensions $nonxs_extensions" > "$tdir/$$.tmp";
23532             if $contains " $this_ext " "$tdir/$$.tmp"; then
23533                 echo >&4;
23534                 echo "Duplicate directories detected for extension $xxx" >&4;
23535                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23536                 case "$knowitall" in
23537                 "") dflt=y;;
23538                 *) dflt=n;;
23539                 esac;
23540                 . ../UU/myread;
23541                 case "$ans" in
23542                 n*|N*) ;;
23543                 *) echo >&4;
23544                     echo "Ok.  Stopping Configure." >&4;
23545                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23546                     exit 1;;
23547                 esac;
23548                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23549             fi;
23550             $ls -1 "$xxx" > "$tdir/$$.tmp";
23551             if   $contains "\.xs$" "$tdir/$$.tmp" > /dev/null 2>&1; then
23552                 xs_extensions="$xs_extensions $this_ext";
23553             elif $contains "\.c$"  "$tdir/$$.tmp" > /dev/null 2>&1; then
23554                 xs_extensions="$xs_extensions $this_ext";
23555             elif $test -d "$xxx"; then
23556                 nonxs_extensions="$nonxs_extensions $this_ext";
23557             fi;
23558             $rm -f "$tdir/$$.tmp";
23559             ;;
23560         esac;
23561     done'
23562 tdir=`pwd`
23563 cd "$rsrc/cpan"
23564 set X
23565 shift
23566 eval $find_extensions
23567 cd "$rsrc/dist"
23568 set X
23569 shift
23570 eval $find_extensions
23571 cd "$rsrc/ext"
23572 set X
23573 shift
23574 eval $find_extensions
23575 set X $xs_extensions
23576 shift
23577 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23578 set X $nonxs_extensions
23579 shift
23580 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23581 cd "$tdir"
23582 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23583
23584 : Now see which are supported on this system.
23585 avail_ext=''
23586 for xxx in $xs_extensions ; do
23587         case "$xxx" in
23588         Amiga*)
23589                 case "$osname" in
23590                 amigaos) avail_ext="$avail_ext $xxx" ;;
23591                 esac
23592                 ;;
23593         DB_File|db_file)
23594                 case "$i_db" in
23595                 $define) avail_ext="$avail_ext $xxx" ;;
23596                 esac
23597                 ;;
23598         GDBM_File|gdbm_fil)
23599                 case "$i_gdbm" in
23600                 $define) avail_ext="$avail_ext $xxx" ;;
23601                 esac
23602                 ;;
23603         IPC/SysV|ipc/sysv)
23604                 : XXX Do we need a useipcsysv variable here
23605                 case "${d_msg}${d_sem}${d_shm}" in
23606                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23607                 esac
23608                 ;;
23609         NDBM_File|ndbm_fil)
23610                 case "$d_ndbm" in
23611                 $define)
23612                     case "$osname-$use64bitint" in
23613                     hpux-define)
23614                         case "$libs" in
23615                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23616                         esac
23617                         ;;
23618                     *) avail_ext="$avail_ext $xxx" ;;
23619                     esac
23620                     ;;
23621                 esac
23622                 ;;
23623         ODBM_File|odbm_fil)
23624                 case "${i_dbm}${i_rpcsvcdbm}" in
23625                 *"${define}"*)
23626                     case "$d_cplusplus" in
23627                     define) ;; # delete as a function name will not work
23628                     *)  case "$osname-$use64bitint" in
23629                         hpux-define)
23630                             case "$libs" in
23631                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23632                             esac
23633                             ;;
23634                         *) avail_ext="$avail_ext $xxx" ;;
23635                         esac
23636                         ;;
23637                     esac
23638                     ;;
23639                 esac
23640                 ;;
23641         Opcode|opcode)
23642                 case "$useopcode" in
23643                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23644                 esac
23645                 ;;
23646         POSIX|posix)
23647                 case "$useposix" in
23648                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23649                 esac
23650                 ;;
23651         Socket|socket)
23652                 case "$d_socket" in
23653                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23654                 esac
23655                 ;;
23656         I18N/Langinfo|langinfo)
23657                 case "$uselanginfo" in
23658                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23659                 esac
23660                 ;;
23661         Sys/Syslog|sys/syslog)
23662                 case $osname in
23663                         amigaos) ;; # not really very useful on AmigaOS
23664                         *)
23665                         : XXX syslog requires socket
23666                         case "$d_socket" in
23667                         true|$define|y) avail_ext="$avail_ext $xxx" ;;
23668                         esac
23669                         ;;
23670                 esac
23671                 ;;
23672         threads|threads/shared)
23673                 # threads and threads::shared are special cases.
23674                 # To stop people from asking "Perl 5.8.0 was supposed
23675                 # to have this new fancy threads implementation but my
23676                 # perl doesn't have it" and from people trying to
23677                 # (re)install the threads module using CPAN.pm and
23678                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23679                 # the threads.pm and threads/shared.pm will always be
23680                 # there, croaking informatively ("you need to rebuild
23681                 # all of Perl with threads, sorry") when threads haven't
23682                 # been compiled in.
23683                 # --jhi
23684                 avail_ext="$avail_ext $xxx"
23685                 ;;
23686         VMS*)
23687                 ;;
23688         Win32*)
23689                 case "$osname" in
23690                 cygwin) avail_ext="$avail_ext $xxx" ;;
23691                 esac
23692                 ;;
23693         XS/APItest|xs/apitest)
23694                 # This is just for testing.  Skip it unless we have dynamic loading.
23695
23696                 case "$usedl" in
23697                 $define) avail_ext="$avail_ext $xxx" ;;
23698                 esac
23699                 ;;
23700         XS/Typemap|xs/typemap)
23701                 # This is just for testing.  Skip it unless we have dynamic loading.
23702                 case "$usedl" in
23703                 $define) avail_ext="$avail_ext $xxx" ;;
23704                 esac
23705                 ;;
23706         *)      avail_ext="$avail_ext $xxx"
23707                 ;;
23708         esac
23709 done
23710
23711 set X $avail_ext
23712 shift
23713 avail_ext="$*"
23714
23715 case "$onlyextensions" in
23716 '') ;;
23717 *)  keepextensions=''
23718     echo "You have requested that only certain extensions be included..." >&4
23719     for i in $onlyextensions; do
23720         case " $avail_ext " in
23721         *" $i "*)
23722             echo "Keeping extension $i."
23723             keepextensions="$keepextensions $i"
23724             ;;
23725         *) echo "Ignoring extension $i." ;;
23726         esac
23727     done
23728     avail_ext="$keepextensions"
23729     ;;
23730 esac
23731
23732 case "$noextensions" in
23733 '') ;;
23734 *)  keepextensions=''
23735     echo "You have requested that certain extensions be ignored..." >&4
23736     for i in $avail_ext; do
23737         case " $noextensions " in
23738         *" $i "*) echo "Ignoring extension $i." ;;
23739         *) echo "Keeping extension $i.";
23740            keepextensions="$keepextensions $i"
23741            ;;
23742         esac
23743     done
23744     avail_ext="$keepextensions"
23745     ;;
23746 esac
23747
23748 : Now see which nonxs extensions are supported on this system.
23749 : For now assume all are.
23750 nonxs_ext=''
23751 for xxx in $nonxs_extensions ; do
23752         case "$xxx" in
23753         VMS*)
23754                 ;;
23755         *)      nonxs_ext="$nonxs_ext $xxx"
23756                 ;;
23757         esac
23758 done
23759
23760 set X $nonxs_ext
23761 shift
23762 nonxs_ext="$*"
23763
23764 case $usedl in
23765 $define)
23766         $cat <<EOM
23767 A number of extensions are supplied with $package.  You may choose to
23768 compile these extensions for dynamic loading (the default), compile
23769 them into the $package executable (static loading), or not include
23770 them at all.  Answer "none" to include no extensions.
23771 Note that DynaLoader is always built and need not be mentioned here.
23772
23773 EOM
23774         case "$dynamic_ext" in
23775         '')
23776                 : Exclude those listed in static_ext
23777                 dflt=''
23778                 for xxx in $avail_ext; do
23779                         case " $static_ext " in
23780                         *" $xxx "*) ;;
23781                         *) dflt="$dflt $xxx" ;;
23782                         esac
23783                 done
23784                 set X $dflt
23785                 shift
23786                 dflt="$*"
23787                 ;;
23788         *)      dflt="$dynamic_ext"
23789                 # Perhaps we are reusing an old out-of-date config.sh.
23790                 case "$hint" in
23791                 previous)
23792                         if test X"$dynamic_ext" != X"$avail_ext"; then
23793                                 $cat <<EOM
23794 NOTICE:  Your previous config.sh list may be incorrect.
23795 The extensions now available to you are
23796         ${avail_ext}
23797 but the default list from your previous config.sh is
23798         ${dynamic_ext}
23799
23800 EOM
23801                         fi
23802                         ;;
23803                 esac
23804                 ;;
23805         esac
23806         case "$dflt" in
23807         '')     dflt=none;;
23808         esac
23809         rp="What extensions do you wish to load dynamically?"
23810         . ./myread
23811         case "$ans" in
23812         none) dynamic_ext=' ' ;;
23813         *) dynamic_ext="$ans" ;;
23814         esac
23815
23816         case "$static_ext" in
23817         '')
23818                 : Exclude those already listed in dynamic linking
23819                 dflt=''
23820                 for xxx in $avail_ext; do
23821                         case " $dynamic_ext " in
23822                         *" $xxx "*) ;;
23823                         *) dflt="$dflt $xxx" ;;
23824                         esac
23825                 done
23826                 set X $dflt
23827                 shift
23828                 dflt="$*"
23829                 ;;
23830         *)  dflt="$static_ext"
23831                 ;;
23832         esac
23833
23834         case "$dflt" in
23835         '')     dflt=none;;
23836         esac
23837         rp="What extensions do you wish to load statically?"
23838         . ./myread
23839         case "$ans" in
23840         none) static_ext=' ' ;;
23841         *) static_ext="$ans" ;;
23842         esac
23843         ;;
23844 *)
23845         $cat <<EOM
23846 A number of extensions are supplied with $package.  Answer "none"
23847 to include no extensions.
23848 Note that DynaLoader is always built and need not be mentioned here.
23849
23850 EOM
23851         case "$static_ext" in
23852         '') dflt="$avail_ext" ;;
23853         *)      dflt="$static_ext"
23854                 # Perhaps we are reusing an old out-of-date config.sh.
23855                 case "$hint" in
23856                 previous)
23857                         if test X"$static_ext" != X"$avail_ext"; then
23858                                 $cat <<EOM
23859 NOTICE:  Your previous config.sh list may be incorrect.
23860 The extensions now available to you are
23861         ${avail_ext}
23862 but the default list from your previous config.sh is
23863         ${static_ext}
23864
23865 EOM
23866                         fi
23867                         ;;
23868                 esac
23869                 ;;
23870         esac
23871         : Exclude those that are not xs extensions
23872         case "$dflt" in
23873         '')     dflt=none;;
23874         esac
23875         rp="What extensions do you wish to include?"
23876         . ./myread
23877         case "$ans" in
23878         none) static_ext=' ' ;;
23879         *) static_ext="$ans" ;;
23880         esac
23881         ;;
23882 esac
23883 #
23884 # Encode is a special case.  If we are building Encode as a static
23885 # extension, we need to explicitly list its subextensions as well.
23886 # For other nested extensions, this is handled automatically by
23887 # the appropriate Makefile.PL.
23888 case " $static_ext " in
23889         *" Encode "*) # Add the subextensions of Encode
23890         cd "$rsrc/cpan"
23891         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23892                 static_ext="$static_ext Encode/$xxx"
23893                 known_extensions="$known_extensions Encode/$xxx"
23894         done
23895         cd "$tdir"
23896         ;;
23897 esac
23898
23899 set X $dynamic_ext $static_ext $nonxs_ext
23900 shift
23901 extensions="$*"
23902
23903 # Sanity check:  We require an extension suitable for use with
23904 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23905 # should show up as failures in the test suite, but it's helpful to
23906 # catch them now.) The 'extensions' list is normally sorted
23907 # alphabetically, so we need to accept either
23908 #    DB_File ... Fcntl ... IO  ....
23909 # or something like
23910 #    Fcntl ... NDBM_File ... IO  ....
23911 case " $extensions"  in
23912 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23913 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23914 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23915 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23916    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23917    ;;
23918 esac
23919
23920 : Remove libraries needed only for extensions
23921 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23922 : The exception is SunOS 4.x, which needs them.
23923 case "${osname}X${osvers}" in
23924 sunos*X4*)
23925     perllibs="$libs"
23926     ;;
23927 *) case "$usedl" in
23928     $define|true|[yY]*)
23929             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23930             shift
23931             perllibs="$*"
23932             ;;
23933     *)  perllibs="$libs"
23934             ;;
23935     esac
23936     ;;
23937 esac
23938
23939 : Remove build directory name from cppstdin so it can be used from
23940 : either the present location or the final installed location.
23941 echo " "
23942 : Get out of the UU directory to get correct path name.
23943 cd ..
23944 case "$cppstdin" in
23945 `pwd`/cppstdin)
23946         echo "Stripping down cppstdin path name"
23947         cppstdin=cppstdin
23948         ;;
23949 esac
23950 cd UU
23951
23952 : end of configuration questions
23953 echo " "
23954 echo "End of configuration questions."
23955 echo " "
23956
23957 : back to where it started
23958 if test -d ../UU; then
23959         cd ..
23960 fi
23961
23962 : configuration may be unconditionally patched via a 'config.arch' file
23963 if $test -f config.arch; then
23964         echo "I see a config.arch file, loading it." >&4
23965         . ./config.arch
23966 fi
23967
23968 : configuration may be patched via a 'config.over' file
23969 if $test -f config.over; then
23970         echo " "
23971         dflt=y
23972         rp='I see a config.over file.  Do you wish to load it?'
23973         . UU/myread
23974         case "$ans" in
23975         n*) echo "OK, I'll ignore it.";;
23976         *)      . ./config.over
23977                 echo "Configuration override changes have been loaded."
23978                 ;;
23979         esac
23980 fi
23981
23982 : in case they want portability, strip down executable paths
23983 case "$d_portable" in
23984 "$define")
23985         echo " "
23986         echo "Stripping down executable paths..." >&4
23987         for file in $loclist $trylist; do
23988                 eval temp=\$$file
23989                 eval $file=`basename $temp`
23990         done
23991         ;;
23992 esac
23993
23994 : create config.sh file
23995 echo " "
23996 echo "Creating config.sh..." >&4
23997 $spitshell <<EOT >config.sh
23998 $startsh
23999 #
24000 # This file was produced by running the Configure script. It holds all the
24001 # definitions figured out by Configure. Should you modify one of these values,
24002 # do not forget to propagate your changes by running "Configure -der". You may
24003 # instead choose to run each of the .SH files by yourself, or "Configure -S".
24004 #
24005
24006 # Package name      : $package
24007 # Source directory  : $src
24008 # Configuration time: $cf_time
24009 # Configured by     : $cf_by
24010 # Target system     : $myuname
24011
24012 EOT
24013 : Add in command line options if available
24014 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
24015
24016 $spitshell <<EOT >>config.sh
24017
24018 Author='$Author'
24019 Date='$Date'
24020 Header='$Header'
24021 Id='$Id'
24022 Locker='$Locker'
24023 Log='$Log'
24024 RCSfile='$RCSfile'
24025 Revision='$Revision'
24026 Source='$Source'
24027 State='$State'
24028 _a='$_a'
24029 _exe='$_exe'
24030 _o='$_o'
24031 afs='$afs'
24032 afsroot='$afsroot'
24033 alignbytes='$alignbytes'
24034 aphostname='$aphostname'
24035 api_revision='$api_revision'
24036 api_subversion='$api_subversion'
24037 api_version='$api_version'
24038 api_versionstring='$api_versionstring'
24039 ar='$ar'
24040 archlib='$archlib'
24041 archlibexp='$archlibexp'
24042 archname64='$archname64'
24043 archname='$archname'
24044 archobjs='$archobjs'
24045 asctime_r_proto='$asctime_r_proto'
24046 awk='$awk'
24047 baserev='$baserev'
24048 bash='$bash'
24049 bin='$bin'
24050 bin_ELF='$bin_ELF'
24051 binexp='$binexp'
24052 bison='$bison'
24053 byacc='$byacc'
24054 byteorder='$byteorder'
24055 c='$c'
24056 castflags='$castflags'
24057 cat='$cat'
24058 cc='$cc'
24059 cccdlflags='$cccdlflags'
24060 ccdlflags='$ccdlflags'
24061 ccflags='$ccflags'
24062 ccflags_uselargefiles='$ccflags_uselargefiles'
24063 ccname='$ccname'
24064 ccsymbols='$ccsymbols'
24065 ccversion='$ccversion'
24066 cf_by='$cf_by'
24067 cf_email='$cf_email'
24068 cf_time='$cf_time'
24069 charbits='$charbits'
24070 charsize='$charsize'
24071 chgrp='$chgrp'
24072 chmod='$chmod'
24073 chown='$chown'
24074 clocktype='$clocktype'
24075 comm='$comm'
24076 compiler_warning='$compiler_warning'
24077 compress='$compress'
24078 contains='$contains'
24079 cp='$cp'
24080 cpio='$cpio'
24081 cpp='$cpp'
24082 cpp_stuff='$cpp_stuff'
24083 cppccsymbols='$cppccsymbols'
24084 cppflags='$cppflags'
24085 cpplast='$cpplast'
24086 cppminus='$cppminus'
24087 cpprun='$cpprun'
24088 cppstdin='$cppstdin'
24089 cppsymbols='$cppsymbols'
24090 crypt_r_proto='$crypt_r_proto'
24091 cryptlib='$cryptlib'
24092 csh='$csh'
24093 ctermid_r_proto='$ctermid_r_proto'
24094 ctime_r_proto='$ctime_r_proto'
24095 d_Gconvert='$d_Gconvert'
24096 d_PRIEUldbl='$d_PRIEUldbl'
24097 d_PRIFUldbl='$d_PRIFUldbl'
24098 d_PRIGUldbl='$d_PRIGUldbl'
24099 d_PRIXU64='$d_PRIXU64'
24100 d_PRId64='$d_PRId64'
24101 d_PRIeldbl='$d_PRIeldbl'
24102 d_PRIfldbl='$d_PRIfldbl'
24103 d_PRIgldbl='$d_PRIgldbl'
24104 d_PRIi64='$d_PRIi64'
24105 d_PRIo64='$d_PRIo64'
24106 d_PRIu64='$d_PRIu64'
24107 d_PRIx64='$d_PRIx64'
24108 d_SCNfldbl='$d_SCNfldbl'
24109 d__fwalk='$d__fwalk'
24110 d_accept4='$d_accept4'
24111 d_access='$d_access'
24112 d_accessx='$d_accessx'
24113 d_acosh='$d_acosh'
24114 d_aintl='$d_aintl'
24115 d_alarm='$d_alarm'
24116 d_archlib='$d_archlib'
24117 d_asctime64='$d_asctime64'
24118 d_asctime_r='$d_asctime_r'
24119 d_asinh='$d_asinh'
24120 d_atanh='$d_atanh'
24121 d_atolf='$d_atolf'
24122 d_atoll='$d_atoll'
24123 d_attribute_always_inline='$d_attribute_always_inline'
24124 d_attribute_deprecated='$d_attribute_deprecated'
24125 d_attribute_format='$d_attribute_format'
24126 d_attribute_malloc='$d_attribute_malloc'
24127 d_attribute_nonnull='$d_attribute_nonnull'
24128 d_attribute_noreturn='$d_attribute_noreturn'
24129 d_attribute_pure='$d_attribute_pure'
24130 d_attribute_unused='$d_attribute_unused'
24131 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
24132 d_backtrace='$d_backtrace'
24133 d_bsd='$d_bsd'
24134 d_bsdgetpgrp='$d_bsdgetpgrp'
24135 d_bsdsetpgrp='$d_bsdsetpgrp'
24136 d_builtin_add_overflow='$d_builtin_add_overflow'
24137 d_builtin_choose_expr='$d_builtin_choose_expr'
24138 d_builtin_expect='$d_builtin_expect'
24139 d_builtin_mul_overflow='$d_builtin_mul_overflow'
24140 d_builtin_sub_overflow='$d_builtin_sub_overflow'
24141 d_c99_variadic_macros='$d_c99_variadic_macros'
24142 d_casti32='$d_casti32'
24143 d_castneg='$d_castneg'
24144 d_cbrt='$d_cbrt'
24145 d_chown='$d_chown'
24146 d_chroot='$d_chroot'
24147 d_chsize='$d_chsize'
24148 d_class='$d_class'
24149 d_clearenv='$d_clearenv'
24150 d_closedir='$d_closedir'
24151 d_cmsghdr_s='$d_cmsghdr_s'
24152 d_copysign='$d_copysign'
24153 d_copysignl='$d_copysignl'
24154 d_cplusplus='$d_cplusplus'
24155 d_crypt='$d_crypt'
24156 d_crypt_r='$d_crypt_r'
24157 d_csh='$d_csh'
24158 d_ctermid='$d_ctermid'
24159 d_ctermid_r='$d_ctermid_r'
24160 d_ctime64='$d_ctime64'
24161 d_ctime_r='$d_ctime_r'
24162 d_cuserid='$d_cuserid'
24163 d_dbminitproto='$d_dbminitproto'
24164 d_difftime64='$d_difftime64'
24165 d_difftime='$d_difftime'
24166 d_dir_dd_fd='$d_dir_dd_fd'
24167 d_dirfd='$d_dirfd'
24168 d_dirnamlen='$d_dirnamlen'
24169 d_dladdr='$d_dladdr'
24170 d_dlerror='$d_dlerror'
24171 d_dlopen='$d_dlopen'
24172 d_dlsymun='$d_dlsymun'
24173 d_dosuid='$d_dosuid'
24174 d_double_has_inf='$d_double_has_inf'
24175 d_double_has_nan='$d_double_has_nan'
24176 d_double_has_negative_zero='$d_double_has_negative_zero'
24177 d_double_has_subnormals='$d_double_has_subnormals'
24178 d_double_style_cray='$d_double_style_cray'
24179 d_double_style_ibm='$d_double_style_ibm'
24180 d_double_style_ieee='$d_double_style_ieee'
24181 d_double_style_vax='$d_double_style_vax'
24182 d_drand48_r='$d_drand48_r'
24183 d_drand48proto='$d_drand48proto'
24184 d_dup2='$d_dup2'
24185 d_dup3='$d_dup3'
24186 d_duplocale='$d_duplocale'
24187 d_eaccess='$d_eaccess'
24188 d_endgrent='$d_endgrent'
24189 d_endgrent_r='$d_endgrent_r'
24190 d_endhent='$d_endhent'
24191 d_endhostent_r='$d_endhostent_r'
24192 d_endnent='$d_endnent'
24193 d_endnetent_r='$d_endnetent_r'
24194 d_endpent='$d_endpent'
24195 d_endprotoent_r='$d_endprotoent_r'
24196 d_endpwent='$d_endpwent'
24197 d_endpwent_r='$d_endpwent_r'
24198 d_endsent='$d_endsent'
24199 d_endservent_r='$d_endservent_r'
24200 d_eofnblk='$d_eofnblk'
24201 d_erf='$d_erf'
24202 d_erfc='$d_erfc'
24203 d_eunice='$d_eunice'
24204 d_exp2='$d_exp2'
24205 d_expm1='$d_expm1'
24206 d_faststdio='$d_faststdio'
24207 d_fchdir='$d_fchdir'
24208 d_fchmod='$d_fchmod'
24209 d_fchmodat='$d_fchmodat'
24210 d_fchown='$d_fchown'
24211 d_fcntl='$d_fcntl'
24212 d_fcntl_can_lock='$d_fcntl_can_lock'
24213 d_fd_macros='$d_fd_macros'
24214 d_fd_set='$d_fd_set'
24215 d_fdclose='$d_fdclose'
24216 d_fdim='$d_fdim'
24217 d_fds_bits='$d_fds_bits'
24218 d_fegetround='$d_fegetround'
24219 d_fgetpos='$d_fgetpos'
24220 d_finite='$d_finite'
24221 d_finitel='$d_finitel'
24222 d_flexfnam='$d_flexfnam'
24223 d_flock='$d_flock'
24224 d_flockproto='$d_flockproto'
24225 d_fma='$d_fma'
24226 d_fmax='$d_fmax'
24227 d_fmin='$d_fmin'
24228 d_fork='$d_fork'
24229 d_fp_class='$d_fp_class'
24230 d_fp_classify='$d_fp_classify'
24231 d_fp_classl='$d_fp_classl'
24232 d_fpathconf='$d_fpathconf'
24233 d_fpclass='$d_fpclass'
24234 d_fpclassify='$d_fpclassify'
24235 d_fpclassl='$d_fpclassl'
24236 d_fpgetround='$d_fpgetround'
24237 d_fpos64_t='$d_fpos64_t'
24238 d_freelocale='$d_freelocale'
24239 d_frexpl='$d_frexpl'
24240 d_fs_data_s='$d_fs_data_s'
24241 d_fseeko='$d_fseeko'
24242 d_fsetpos='$d_fsetpos'
24243 d_fstatfs='$d_fstatfs'
24244 d_fstatvfs='$d_fstatvfs'
24245 d_fsync='$d_fsync'
24246 d_ftello='$d_ftello'
24247 d_ftime='$d_ftime'
24248 d_futimes='$d_futimes'
24249 d_gai_strerror='$d_gai_strerror'
24250 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
24251 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
24252 d_getaddrinfo='$d_getaddrinfo'
24253 d_getcwd='$d_getcwd'
24254 d_getespwnam='$d_getespwnam'
24255 d_getfsstat='$d_getfsstat'
24256 d_getgrent='$d_getgrent'
24257 d_getgrent_r='$d_getgrent_r'
24258 d_getgrgid_r='$d_getgrgid_r'
24259 d_getgrnam_r='$d_getgrnam_r'
24260 d_getgrps='$d_getgrps'
24261 d_gethbyaddr='$d_gethbyaddr'
24262 d_gethbyname='$d_gethbyname'
24263 d_gethent='$d_gethent'
24264 d_gethname='$d_gethname'
24265 d_gethostbyaddr_r='$d_gethostbyaddr_r'
24266 d_gethostbyname_r='$d_gethostbyname_r'
24267 d_gethostent_r='$d_gethostent_r'
24268 d_gethostprotos='$d_gethostprotos'
24269 d_getitimer='$d_getitimer'
24270 d_getlogin='$d_getlogin'
24271 d_getlogin_r='$d_getlogin_r'
24272 d_getmnt='$d_getmnt'
24273 d_getmntent='$d_getmntent'
24274 d_getnameinfo='$d_getnameinfo'
24275 d_getnbyaddr='$d_getnbyaddr'
24276 d_getnbyname='$d_getnbyname'
24277 d_getnent='$d_getnent'
24278 d_getnetbyaddr_r='$d_getnetbyaddr_r'
24279 d_getnetbyname_r='$d_getnetbyname_r'
24280 d_getnetent_r='$d_getnetent_r'
24281 d_getnetprotos='$d_getnetprotos'
24282 d_getpagsz='$d_getpagsz'
24283 d_getpbyname='$d_getpbyname'
24284 d_getpbynumber='$d_getpbynumber'
24285 d_getpent='$d_getpent'
24286 d_getpgid='$d_getpgid'
24287 d_getpgrp2='$d_getpgrp2'
24288 d_getpgrp='$d_getpgrp'
24289 d_getppid='$d_getppid'
24290 d_getprior='$d_getprior'
24291 d_getprotobyname_r='$d_getprotobyname_r'
24292 d_getprotobynumber_r='$d_getprotobynumber_r'
24293 d_getprotoent_r='$d_getprotoent_r'
24294 d_getprotoprotos='$d_getprotoprotos'
24295 d_getprpwnam='$d_getprpwnam'
24296 d_getpwent='$d_getpwent'
24297 d_getpwent_r='$d_getpwent_r'
24298 d_getpwnam_r='$d_getpwnam_r'
24299 d_getpwuid_r='$d_getpwuid_r'
24300 d_getsbyname='$d_getsbyname'
24301 d_getsbyport='$d_getsbyport'
24302 d_getsent='$d_getsent'
24303 d_getservbyname_r='$d_getservbyname_r'
24304 d_getservbyport_r='$d_getservbyport_r'
24305 d_getservent_r='$d_getservent_r'
24306 d_getservprotos='$d_getservprotos'
24307 d_getspnam='$d_getspnam'
24308 d_getspnam_r='$d_getspnam_r'
24309 d_gettimeod='$d_gettimeod'
24310 d_gmtime64='$d_gmtime64'
24311 d_gmtime_r='$d_gmtime_r'
24312 d_gnulibc='$d_gnulibc'
24313 d_grpasswd='$d_grpasswd'
24314 d_has_C_UTF8='$d_has_C_UTF8'
24315 d_hasmntopt='$d_hasmntopt'
24316 d_htonl='$d_htonl'
24317 d_hypot='$d_hypot'
24318 d_ilogb='$d_ilogb'
24319 d_ilogbl='$d_ilogbl'
24320 d_inc_version_list='$d_inc_version_list'
24321 d_inetaton='$d_inetaton'
24322 d_inetntop='$d_inetntop'
24323 d_inetpton='$d_inetpton'
24324 d_int64_t='$d_int64_t'
24325 d_ip_mreq='$d_ip_mreq'
24326 d_ip_mreq_source='$d_ip_mreq_source'
24327 d_ipv6_mreq='$d_ipv6_mreq'
24328 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24329 d_isascii='$d_isascii'
24330 d_isblank='$d_isblank'
24331 d_isfinite='$d_isfinite'
24332 d_isfinitel='$d_isfinitel'
24333 d_isinf='$d_isinf'
24334 d_isinfl='$d_isinfl'
24335 d_isless='$d_isless'
24336 d_isnan='$d_isnan'
24337 d_isnanl='$d_isnanl'
24338 d_isnormal='$d_isnormal'
24339 d_j0='$d_j0'
24340 d_j0l='$d_j0l'
24341 d_killpg='$d_killpg'
24342 d_lc_monetary_2008='$d_lc_monetary_2008'
24343 d_lchown='$d_lchown'
24344 d_ldbl_dig='$d_ldbl_dig'
24345 d_ldexpl='$d_ldexpl'
24346 d_lgamma='$d_lgamma'
24347 d_lgamma_r='$d_lgamma_r'
24348 d_libm_lib_version='$d_libm_lib_version'
24349 d_libname_unique='$d_libname_unique'
24350 d_link='$d_link'
24351 d_linkat='$d_linkat'
24352 d_llrint='$d_llrint'
24353 d_llrintl='$d_llrintl'
24354 d_llround='$d_llround'
24355 d_llroundl='$d_llroundl'
24356 d_localeconv_l='$d_localeconv_l'
24357 d_localtime64='$d_localtime64'
24358 d_localtime_r='$d_localtime_r'
24359 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24360 d_locconv='$d_locconv'
24361 d_lockf='$d_lockf'
24362 d_log1p='$d_log1p'
24363 d_log2='$d_log2'
24364 d_logb='$d_logb'
24365 d_long_double_style_ieee='$d_long_double_style_ieee'
24366 d_long_double_style_ieee_doubledouble='$d_long_double_style_ieee_doubledouble'
24367 d_long_double_style_ieee_extended='$d_long_double_style_ieee_extended'
24368 d_long_double_style_ieee_std='$d_long_double_style_ieee_std'
24369 d_long_double_style_vax='$d_long_double_style_vax'
24370 d_longdbl='$d_longdbl'
24371 d_longlong='$d_longlong'
24372 d_lrint='$d_lrint'
24373 d_lrintl='$d_lrintl'
24374 d_lround='$d_lround'
24375 d_lroundl='$d_lroundl'
24376 d_lseekproto='$d_lseekproto'
24377 d_lstat='$d_lstat'
24378 d_madvise='$d_madvise'
24379 d_malloc_good_size='$d_malloc_good_size'
24380 d_malloc_size='$d_malloc_size'
24381 d_malloc_usable_size='$d_malloc_usable_size'
24382 d_mblen='$d_mblen'
24383 d_mbrlen='$d_mbrlen'
24384 d_mbrtowc='$d_mbrtowc'
24385 d_mbstowcs='$d_mbstowcs'
24386 d_mbtowc='$d_mbtowc'
24387 d_memmem='$d_memmem'
24388 d_memrchr='$d_memrchr'
24389 d_mkdir='$d_mkdir'
24390 d_mkdtemp='$d_mkdtemp'
24391 d_mkfifo='$d_mkfifo'
24392 d_mkostemp='$d_mkostemp'
24393 d_mkstemp='$d_mkstemp'
24394 d_mkstemps='$d_mkstemps'
24395 d_mktime64='$d_mktime64'
24396 d_mktime='$d_mktime'
24397 d_mmap='$d_mmap'
24398 d_modfl='$d_modfl'
24399 d_modflproto='$d_modflproto'
24400 d_mprotect='$d_mprotect'
24401 d_msg='$d_msg'
24402 d_msg_ctrunc='$d_msg_ctrunc'
24403 d_msg_dontroute='$d_msg_dontroute'
24404 d_msg_oob='$d_msg_oob'
24405 d_msg_peek='$d_msg_peek'
24406 d_msg_proxy='$d_msg_proxy'
24407 d_msgctl='$d_msgctl'
24408 d_msgget='$d_msgget'
24409 d_msghdr_s='$d_msghdr_s'
24410 d_msgrcv='$d_msgrcv'
24411 d_msgsnd='$d_msgsnd'
24412 d_msync='$d_msync'
24413 d_munmap='$d_munmap'
24414 d_mymalloc='$d_mymalloc'
24415 d_nan='$d_nan'
24416 d_nanosleep='$d_nanosleep'
24417 d_ndbm='$d_ndbm'
24418 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24419 d_nearbyint='$d_nearbyint'
24420 d_newlocale='$d_newlocale'
24421 d_nextafter='$d_nextafter'
24422 d_nexttoward='$d_nexttoward'
24423 d_nice='$d_nice'
24424 d_nl_langinfo='$d_nl_langinfo'
24425 d_nv_preserves_uv='$d_nv_preserves_uv'
24426 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24427 d_off64_t='$d_off64_t'
24428 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24429 d_oldpthreads='$d_oldpthreads'
24430 d_oldsock='$d_oldsock'
24431 d_open3='$d_open3'
24432 d_openat='$d_openat'
24433 d_pathconf='$d_pathconf'
24434 d_pause='$d_pause'
24435 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24436 d_phostname='$d_phostname'
24437 d_pipe2='$d_pipe2'
24438 d_pipe='$d_pipe'
24439 d_poll='$d_poll'
24440 d_portable='$d_portable'
24441 d_prctl='$d_prctl'
24442 d_prctl_set_name='$d_prctl_set_name'
24443 d_printf_format_null='$d_printf_format_null'
24444 d_procselfexe='$d_procselfexe'
24445 d_pseudofork='$d_pseudofork'
24446 d_pthread_atfork='$d_pthread_atfork'
24447 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24448 d_pthread_yield='$d_pthread_yield'
24449 d_ptrdiff_t='$d_ptrdiff_t'
24450 d_pwage='$d_pwage'
24451 d_pwchange='$d_pwchange'
24452 d_pwclass='$d_pwclass'
24453 d_pwcomment='$d_pwcomment'
24454 d_pwexpire='$d_pwexpire'
24455 d_pwgecos='$d_pwgecos'
24456 d_pwpasswd='$d_pwpasswd'
24457 d_pwquota='$d_pwquota'
24458 d_qgcvt='$d_qgcvt'
24459 d_quad='$d_quad'
24460 d_querylocale='$d_querylocale'
24461 d_random_r='$d_random_r'
24462 d_re_comp='$d_re_comp'
24463 d_readdir64_r='$d_readdir64_r'
24464 d_readdir='$d_readdir'
24465 d_readdir_r='$d_readdir_r'
24466 d_readlink='$d_readlink'
24467 d_readv='$d_readv'
24468 d_recvmsg='$d_recvmsg'
24469 d_regcmp='$d_regcmp'
24470 d_regcomp='$d_regcomp'
24471 d_remainder='$d_remainder'
24472 d_remquo='$d_remquo'
24473 d_rename='$d_rename'
24474 d_renameat='$d_renameat'
24475 d_rewinddir='$d_rewinddir'
24476 d_rint='$d_rint'
24477 d_rmdir='$d_rmdir'
24478 d_round='$d_round'
24479 d_sbrkproto='$d_sbrkproto'
24480 d_scalbn='$d_scalbn'
24481 d_scalbnl='$d_scalbnl'
24482 d_sched_yield='$d_sched_yield'
24483 d_scm_rights='$d_scm_rights'
24484 d_seekdir='$d_seekdir'
24485 d_select='$d_select'
24486 d_sem='$d_sem'
24487 d_semctl='$d_semctl'
24488 d_semctl_semid_ds='$d_semctl_semid_ds'
24489 d_semctl_semun='$d_semctl_semun'
24490 d_semget='$d_semget'
24491 d_semop='$d_semop'
24492 d_sendmsg='$d_sendmsg'
24493 d_setegid='$d_setegid'
24494 d_seteuid='$d_seteuid'
24495 d_setgrent='$d_setgrent'
24496 d_setgrent_r='$d_setgrent_r'
24497 d_setgrps='$d_setgrps'
24498 d_sethent='$d_sethent'
24499 d_sethostent_r='$d_sethostent_r'
24500 d_setitimer='$d_setitimer'
24501 d_setlinebuf='$d_setlinebuf'
24502 d_setlocale='$d_setlocale'
24503 d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
24504 d_setlocale_r='$d_setlocale_r'
24505 d_setnent='$d_setnent'
24506 d_setnetent_r='$d_setnetent_r'
24507 d_setpent='$d_setpent'
24508 d_setpgid='$d_setpgid'
24509 d_setpgrp2='$d_setpgrp2'
24510 d_setpgrp='$d_setpgrp'
24511 d_setprior='$d_setprior'
24512 d_setproctitle='$d_setproctitle'
24513 d_setprotoent_r='$d_setprotoent_r'
24514 d_setpwent='$d_setpwent'
24515 d_setpwent_r='$d_setpwent_r'
24516 d_setregid='$d_setregid'
24517 d_setresgid='$d_setresgid'
24518 d_setresuid='$d_setresuid'
24519 d_setreuid='$d_setreuid'
24520 d_setrgid='$d_setrgid'
24521 d_setruid='$d_setruid'
24522 d_setsent='$d_setsent'
24523 d_setservent_r='$d_setservent_r'
24524 d_setsid='$d_setsid'
24525 d_setvbuf='$d_setvbuf'
24526 d_shm='$d_shm'
24527 d_shmat='$d_shmat'
24528 d_shmatprototype='$d_shmatprototype'
24529 d_shmctl='$d_shmctl'
24530 d_shmdt='$d_shmdt'
24531 d_shmget='$d_shmget'
24532 d_sigaction='$d_sigaction'
24533 d_siginfo_si_addr='$d_siginfo_si_addr'
24534 d_siginfo_si_band='$d_siginfo_si_band'
24535 d_siginfo_si_errno='$d_siginfo_si_errno'
24536 d_siginfo_si_fd='$d_siginfo_si_fd'
24537 d_siginfo_si_pid='$d_siginfo_si_pid'
24538 d_siginfo_si_status='$d_siginfo_si_status'
24539 d_siginfo_si_uid='$d_siginfo_si_uid'
24540 d_siginfo_si_value='$d_siginfo_si_value'
24541 d_signbit='$d_signbit'
24542 d_sigprocmask='$d_sigprocmask'
24543 d_sigsetjmp='$d_sigsetjmp'
24544 d_sin6_scope_id='$d_sin6_scope_id'
24545 d_sitearch='$d_sitearch'
24546 d_snprintf='$d_snprintf'
24547 d_sockaddr_in6='$d_sockaddr_in6'
24548 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24549 d_sockaddr_storage='$d_sockaddr_storage'
24550 d_sockatmark='$d_sockatmark'
24551 d_sockatmarkproto='$d_sockatmarkproto'
24552 d_socket='$d_socket'
24553 d_socklen_t='$d_socklen_t'
24554 d_sockpair='$d_sockpair'
24555 d_socks5_init='$d_socks5_init'
24556 d_sqrtl='$d_sqrtl'
24557 d_srand48_r='$d_srand48_r'
24558 d_srandom_r='$d_srandom_r'
24559 d_sresgproto='$d_sresgproto'
24560 d_sresuproto='$d_sresuproto'
24561 d_stat='$d_stat'
24562 d_statblks='$d_statblks'
24563 d_statfs_f_flags='$d_statfs_f_flags'
24564 d_statfs_s='$d_statfs_s'
24565 d_static_inline='$d_static_inline'
24566 d_statvfs='$d_statvfs'
24567 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24568 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24569 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24570 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24571 d_stdio_stream_array='$d_stdio_stream_array'
24572 d_stdiobase='$d_stdiobase'
24573 d_stdstdio='$d_stdstdio'
24574 d_strcoll='$d_strcoll'
24575 d_strerror_l='$d_strerror_l'
24576 d_strerror_r='$d_strerror_r'
24577 d_strftime='$d_strftime'
24578 d_strlcat='$d_strlcat'
24579 d_strlcpy='$d_strlcpy'
24580 d_strnlen='$d_strnlen'
24581 d_strtod='$d_strtod'
24582 d_strtod_l='$d_strtod_l'
24583 d_strtol='$d_strtol'
24584 d_strtold='$d_strtold'
24585 d_strtold_l='$d_strtold_l'
24586 d_strtoll='$d_strtoll'
24587 d_strtoq='$d_strtoq'
24588 d_strtoul='$d_strtoul'
24589 d_strtoull='$d_strtoull'
24590 d_strtouq='$d_strtouq'
24591 d_strxfrm='$d_strxfrm'
24592 d_suidsafe='$d_suidsafe'
24593 d_symlink='$d_symlink'
24594 d_syscall='$d_syscall'
24595 d_syscallproto='$d_syscallproto'
24596 d_sysconf='$d_sysconf'
24597 d_sysernlst='$d_sysernlst'
24598 d_syserrlst='$d_syserrlst'
24599 d_system='$d_system'
24600 d_tcgetpgrp='$d_tcgetpgrp'
24601 d_tcsetpgrp='$d_tcsetpgrp'
24602 d_telldir='$d_telldir'
24603 d_telldirproto='$d_telldirproto'
24604 d_tgamma='$d_tgamma'
24605 d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l'
24606 d_time='$d_time'
24607 d_timegm='$d_timegm'
24608 d_times='$d_times'
24609 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24610 d_tm_tm_zone='$d_tm_tm_zone'
24611 d_tmpnam_r='$d_tmpnam_r'
24612 d_towlower='$d_towlower'
24613 d_towupper='$d_towupper'
24614 d_trunc='$d_trunc'
24615 d_truncate='$d_truncate'
24616 d_truncl='$d_truncl'
24617 d_ttyname_r='$d_ttyname_r'
24618 d_tzname='$d_tzname'
24619 d_u32align='$d_u32align'
24620 d_ualarm='$d_ualarm'
24621 d_umask='$d_umask'
24622 d_uname='$d_uname'
24623 d_union_semun='$d_union_semun'
24624 d_unlinkat='$d_unlinkat'
24625 d_unordered='$d_unordered'
24626 d_unsetenv='$d_unsetenv'
24627 d_uselocale='$d_uselocale'
24628 d_usleep='$d_usleep'
24629 d_usleepproto='$d_usleepproto'
24630 d_ustat='$d_ustat'
24631 d_vendorarch='$d_vendorarch'
24632 d_vendorbin='$d_vendorbin'
24633 d_vendorlib='$d_vendorlib'
24634 d_vendorscript='$d_vendorscript'
24635 d_vfork='$d_vfork'
24636 d_void_closedir='$d_void_closedir'
24637 d_voidsig='$d_voidsig'
24638 d_voidtty='$d_voidtty'
24639 d_vsnprintf='$d_vsnprintf'
24640 d_wait4='$d_wait4'
24641 d_waitpid='$d_waitpid'
24642 d_wcrtomb='$d_wcrtomb'
24643 d_wcscmp='$d_wcscmp'
24644 d_wcstombs='$d_wcstombs'
24645 d_wcsxfrm='$d_wcsxfrm'
24646 d_wctomb='$d_wctomb'
24647 d_writev='$d_writev'
24648 d_xenix='$d_xenix'
24649 date='$date'
24650 db_hashtype='$db_hashtype'
24651 db_prefixtype='$db_prefixtype'
24652 db_version_major='$db_version_major'
24653 db_version_minor='$db_version_minor'
24654 db_version_patch='$db_version_patch'
24655 default_inc_excludes_dot='$default_inc_excludes_dot'
24656 direntrytype='$direntrytype'
24657 dlext='$dlext'
24658 dlsrc='$dlsrc'
24659 doubleinfbytes='$doubleinfbytes'
24660 doublekind='$doublekind'
24661 doublemantbits='$doublemantbits'
24662 doublenanbytes='$doublenanbytes'
24663 doublesize='$doublesize'
24664 drand01='$drand01'
24665 drand48_r_proto='$drand48_r_proto'
24666 dtrace='$dtrace'
24667 dtraceobject='$dtraceobject'
24668 dtracexnolibs='$dtracexnolibs'
24669 dynamic_ext='$dynamic_ext'
24670 eagain='$eagain'
24671 ebcdic='$ebcdic'
24672 echo='$echo'
24673 egrep='$egrep'
24674 emacs='$emacs'
24675 endgrent_r_proto='$endgrent_r_proto'
24676 endhostent_r_proto='$endhostent_r_proto'
24677 endnetent_r_proto='$endnetent_r_proto'
24678 endprotoent_r_proto='$endprotoent_r_proto'
24679 endpwent_r_proto='$endpwent_r_proto'
24680 endservent_r_proto='$endservent_r_proto'
24681 eunicefix='$eunicefix'
24682 exe_ext='$exe_ext'
24683 expr='$expr'
24684 extensions='$extensions'
24685 extern_C='$extern_C'
24686 extras='$extras'
24687 fflushNULL='$fflushNULL'
24688 fflushall='$fflushall'
24689 find='$find'
24690 firstmakefile='$firstmakefile'
24691 flex='$flex'
24692 fpossize='$fpossize'
24693 fpostype='$fpostype'
24694 freetype='$freetype'
24695 from='$from'
24696 full_ar='$full_ar'
24697 full_csh='$full_csh'
24698 full_sed='$full_sed'
24699 gccansipedantic='$gccansipedantic'
24700 gccosandvers='$gccosandvers'
24701 gccversion='$gccversion'
24702 getgrent_r_proto='$getgrent_r_proto'
24703 getgrgid_r_proto='$getgrgid_r_proto'
24704 getgrnam_r_proto='$getgrnam_r_proto'
24705 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24706 gethostbyname_r_proto='$gethostbyname_r_proto'
24707 gethostent_r_proto='$gethostent_r_proto'
24708 getlogin_r_proto='$getlogin_r_proto'
24709 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24710 getnetbyname_r_proto='$getnetbyname_r_proto'
24711 getnetent_r_proto='$getnetent_r_proto'
24712 getprotobyname_r_proto='$getprotobyname_r_proto'
24713 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24714 getprotoent_r_proto='$getprotoent_r_proto'
24715 getpwent_r_proto='$getpwent_r_proto'
24716 getpwnam_r_proto='$getpwnam_r_proto'
24717 getpwuid_r_proto='$getpwuid_r_proto'
24718 getservbyname_r_proto='$getservbyname_r_proto'
24719 getservbyport_r_proto='$getservbyport_r_proto'
24720 getservent_r_proto='$getservent_r_proto'
24721 getspnam_r_proto='$getspnam_r_proto'
24722 gidformat='$gidformat'
24723 gidsign='$gidsign'
24724 gidsize='$gidsize'
24725 gidtype='$gidtype'
24726 glibpth='$glibpth'
24727 gmake='$gmake'
24728 gmtime_r_proto='$gmtime_r_proto'
24729 gnulibc_version='$gnulibc_version'
24730 grep='$grep'
24731 groupcat='$groupcat'
24732 groupstype='$groupstype'
24733 gzip='$gzip'
24734 h_fcntl='$h_fcntl'
24735 h_sysfile='$h_sysfile'
24736 hint='$hint'
24737 hostcat='$hostcat'
24738 hostgenerate='$hostgenerate'
24739 hostosname='$hostosname'
24740 hostperl='$hostperl'
24741 html1dir='$html1dir'
24742 html1direxp='$html1direxp'
24743 html3dir='$html3dir'
24744 html3direxp='$html3direxp'
24745 i16size='$i16size'
24746 i16type='$i16type'
24747 i32size='$i32size'
24748 i32type='$i32type'
24749 i64size='$i64size'
24750 i64type='$i64type'
24751 i8size='$i8size'
24752 i8type='$i8type'
24753 i_arpainet='$i_arpainet'
24754 i_bfd='$i_bfd'
24755 i_bsdioctl='$i_bsdioctl'
24756 i_crypt='$i_crypt'
24757 i_db='$i_db'
24758 i_dbm='$i_dbm'
24759 i_dirent='$i_dirent'
24760 i_dlfcn='$i_dlfcn'
24761 i_execinfo='$i_execinfo'
24762 i_fcntl='$i_fcntl'
24763 i_fenv='$i_fenv'
24764 i_fp='$i_fp'
24765 i_fp_class='$i_fp_class'
24766 i_gdbm='$i_gdbm'
24767 i_gdbm_ndbm='$i_gdbm_ndbm'
24768 i_gdbmndbm='$i_gdbmndbm'
24769 i_grp='$i_grp'
24770 i_ieeefp='$i_ieeefp'
24771 i_inttypes='$i_inttypes'
24772 i_langinfo='$i_langinfo'
24773 i_libutil='$i_libutil'
24774 i_locale='$i_locale'
24775 i_machcthr='$i_machcthr'
24776 i_malloc='$i_malloc'
24777 i_mallocmalloc='$i_mallocmalloc'
24778 i_mntent='$i_mntent'
24779 i_ndbm='$i_ndbm'
24780 i_netdb='$i_netdb'
24781 i_neterrno='$i_neterrno'
24782 i_netinettcp='$i_netinettcp'
24783 i_niin='$i_niin'
24784 i_poll='$i_poll'
24785 i_prot='$i_prot'
24786 i_pthread='$i_pthread'
24787 i_pwd='$i_pwd'
24788 i_quadmath='$i_quadmath'
24789 i_rpcsvcdbm='$i_rpcsvcdbm'
24790 i_sgtty='$i_sgtty'
24791 i_shadow='$i_shadow'
24792 i_socks='$i_socks'
24793 i_stdbool='$i_stdbool'
24794 i_stdint='$i_stdint'
24795 i_stdlib='$i_stdlib'
24796 i_sunmath='$i_sunmath'
24797 i_sysaccess='$i_sysaccess'
24798 i_sysdir='$i_sysdir'
24799 i_sysfile='$i_sysfile'
24800 i_sysfilio='$i_sysfilio'
24801 i_sysin='$i_sysin'
24802 i_sysioctl='$i_sysioctl'
24803 i_syslog='$i_syslog'
24804 i_sysmman='$i_sysmman'
24805 i_sysmode='$i_sysmode'
24806 i_sysmount='$i_sysmount'
24807 i_sysndir='$i_sysndir'
24808 i_sysparam='$i_sysparam'
24809 i_syspoll='$i_syspoll'
24810 i_sysresrc='$i_sysresrc'
24811 i_syssecrt='$i_syssecrt'
24812 i_sysselct='$i_sysselct'
24813 i_syssockio='$i_syssockio'
24814 i_sysstat='$i_sysstat'
24815 i_sysstatfs='$i_sysstatfs'
24816 i_sysstatvfs='$i_sysstatvfs'
24817 i_systime='$i_systime'
24818 i_systimek='$i_systimek'
24819 i_systimes='$i_systimes'
24820 i_systypes='$i_systypes'
24821 i_sysuio='$i_sysuio'
24822 i_sysun='$i_sysun'
24823 i_sysutsname='$i_sysutsname'
24824 i_sysvfs='$i_sysvfs'
24825 i_syswait='$i_syswait'
24826 i_termio='$i_termio'
24827 i_termios='$i_termios'
24828 i_time='$i_time'
24829 i_unistd='$i_unistd'
24830 i_ustat='$i_ustat'
24831 i_utime='$i_utime'
24832 i_vfork='$i_vfork'
24833 i_wchar='$i_wchar'
24834 i_wctype='$i_wctype'
24835 i_xlocale='$i_xlocale'
24836 ignore_versioned_solibs='$ignore_versioned_solibs'
24837 inc_version_list='$inc_version_list'
24838 inc_version_list_init='$inc_version_list_init'
24839 incpath='$incpath'
24840 incpth='$incpth'
24841 inews='$inews'
24842 initialinstalllocation='$initialinstalllocation'
24843 installarchlib='$installarchlib'
24844 installbin='$installbin'
24845 installhtml1dir='$installhtml1dir'
24846 installhtml3dir='$installhtml3dir'
24847 installman1dir='$installman1dir'
24848 installman3dir='$installman3dir'
24849 installprefix='$installprefix'
24850 installprefixexp='$installprefixexp'
24851 installprivlib='$installprivlib'
24852 installscript='$installscript'
24853 installsitearch='$installsitearch'
24854 installsitebin='$installsitebin'
24855 installsitehtml1dir='$installsitehtml1dir'
24856 installsitehtml3dir='$installsitehtml3dir'
24857 installsitelib='$installsitelib'
24858 installsiteman1dir='$installsiteman1dir'
24859 installsiteman3dir='$installsiteman3dir'
24860 installsitescript='$installsitescript'
24861 installstyle='$installstyle'
24862 installusrbinperl='$installusrbinperl'
24863 installvendorarch='$installvendorarch'
24864 installvendorbin='$installvendorbin'
24865 installvendorhtml1dir='$installvendorhtml1dir'
24866 installvendorhtml3dir='$installvendorhtml3dir'
24867 installvendorlib='$installvendorlib'
24868 installvendorman1dir='$installvendorman1dir'
24869 installvendorman3dir='$installvendorman3dir'
24870 installvendorscript='$installvendorscript'
24871 intsize='$intsize'
24872 issymlink='$issymlink'
24873 ivdformat='$ivdformat'
24874 ivsize='$ivsize'
24875 ivtype='$ivtype'
24876 known_extensions='$known_extensions'
24877 ksh='$ksh'
24878 ld='$ld'
24879 ld_can_script='$ld_can_script'
24880 lddlflags='$lddlflags'
24881 ldflags='$ldflags'
24882 ldflags_uselargefiles='$ldflags_uselargefiles'
24883 ldlibpthname='$ldlibpthname'
24884 less='$less'
24885 lib_ext='$lib_ext'
24886 libc='$libc'
24887 libperl='$libperl'
24888 libpth='$libpth'
24889 libs='$libs'
24890 libsdirs='$libsdirs'
24891 libsfiles='$libsfiles'
24892 libsfound='$libsfound'
24893 libspath='$libspath'
24894 libswanted='$libswanted'
24895 libswanted_uselargefiles='$libswanted_uselargefiles'
24896 line='$line'
24897 lint='$lint'
24898 lkflags='$lkflags'
24899 ln='$ln'
24900 lns='$lns'
24901 localtime_r_proto='$localtime_r_proto'
24902 locincpth='$locincpth'
24903 loclibpth='$loclibpth'
24904 longdblinfbytes='$longdblinfbytes'
24905 longdblkind='$longdblkind'
24906 longdblmantbits='$longdblmantbits'
24907 longdblnanbytes='$longdblnanbytes'
24908 longdblsize='$longdblsize'
24909 longlongsize='$longlongsize'
24910 longsize='$longsize'
24911 lp='$lp'
24912 lpr='$lpr'
24913 ls='$ls'
24914 lseeksize='$lseeksize'
24915 lseektype='$lseektype'
24916 mail='$mail'
24917 mailx='$mailx'
24918 make='$make'
24919 make_set_make='$make_set_make'
24920 mallocobj='$mallocobj'
24921 mallocsrc='$mallocsrc'
24922 malloctype='$malloctype'
24923 man1dir='$man1dir'
24924 man1direxp='$man1direxp'
24925 man1ext='$man1ext'
24926 man3dir='$man3dir'
24927 man3direxp='$man3direxp'
24928 man3ext='$man3ext'
24929 mips_type='$mips_type'
24930 mistrustnm='$mistrustnm'
24931 mkdir='$mkdir'
24932 mmaptype='$mmaptype'
24933 modetype='$modetype'
24934 more='$more'
24935 multiarch='$multiarch'
24936 mv='$mv'
24937 myarchname='$myarchname'
24938 mydomain='$mydomain'
24939 myhostname='$myhostname'
24940 myuname='$myuname'
24941 n='$n'
24942 need_va_copy='$need_va_copy'
24943 netdb_hlen_type='$netdb_hlen_type'
24944 netdb_host_type='$netdb_host_type'
24945 netdb_name_type='$netdb_name_type'
24946 netdb_net_type='$netdb_net_type'
24947 nm='$nm'
24948 nm_opt='$nm_opt'
24949 nm_so_opt='$nm_so_opt'
24950 nonxs_ext='$nonxs_ext'
24951 nroff='$nroff'
24952 nvEUformat='$nvEUformat'
24953 nvFUformat='$nvFUformat'
24954 nvGUformat='$nvGUformat'
24955 nv_overflows_integers_at='$nv_overflows_integers_at'
24956 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24957 nveformat='$nveformat'
24958 nvfformat='$nvfformat'
24959 nvgformat='$nvgformat'
24960 nvmantbits='$nvmantbits'
24961 nvsize='$nvsize'
24962 nvtype='$nvtype'
24963 o_nonblock='$o_nonblock'
24964 obj_ext='$obj_ext'
24965 old_pthread_create_joinable='$old_pthread_create_joinable'
24966 optimize='$optimize'
24967 orderlib='$orderlib'
24968 osname='$osname'
24969 osvers='$osvers'
24970 otherlibdirs='$otherlibdirs'
24971 package='$package'
24972 pager='$pager'
24973 passcat='$passcat'
24974 patchlevel='$patchlevel'
24975 path_sep='$path_sep'
24976 perl5='$perl5'
24977 perl='$perl'
24978 perl_patchlevel='$perl_patchlevel'
24979 perl_static_inline='$perl_static_inline'
24980 perladmin='$perladmin'
24981 perllibs='$perllibs'
24982 perlpath='$perlpath'
24983 pg='$pg'
24984 phostname='$phostname'
24985 pidtype='$pidtype'
24986 plibpth='$plibpth'
24987 pmake='$pmake'
24988 pr='$pr'
24989 prefix='$prefix'
24990 prefixexp='$prefixexp'
24991 privlib='$privlib'
24992 privlibexp='$privlibexp'
24993 procselfexe='$procselfexe'
24994 ptrsize='$ptrsize'
24995 quadkind='$quadkind'
24996 quadtype='$quadtype'
24997 randbits='$randbits'
24998 randfunc='$randfunc'
24999 random_r_proto='$random_r_proto'
25000 randseedtype='$randseedtype'
25001 ranlib='$ranlib'
25002 rd_nodata='$rd_nodata'
25003 readdir64_r_proto='$readdir64_r_proto'
25004 readdir_r_proto='$readdir_r_proto'
25005 revision='$revision'
25006 rm='$rm'
25007 rm_try='$rm_try'
25008 rmail='$rmail'
25009 run='$run'
25010 runnm='$runnm'
25011 sGMTIME_max='$sGMTIME_max'
25012 sGMTIME_min='$sGMTIME_min'
25013 sLOCALTIME_max='$sLOCALTIME_max'
25014 sLOCALTIME_min='$sLOCALTIME_min'
25015 sPRIEUldbl='$sPRIEUldbl'
25016 sPRIFUldbl='$sPRIFUldbl'
25017 sPRIGUldbl='$sPRIGUldbl'
25018 sPRIXU64='$sPRIXU64'
25019 sPRId64='$sPRId64'
25020 sPRIeldbl='$sPRIeldbl'
25021 sPRIfldbl='$sPRIfldbl'
25022 sPRIgldbl='$sPRIgldbl'
25023 sPRIi64='$sPRIi64'
25024 sPRIo64='$sPRIo64'
25025 sPRIu64='$sPRIu64'
25026 sPRIx64='$sPRIx64'
25027 sSCNfldbl='$sSCNfldbl'
25028 sched_yield='$sched_yield'
25029 scriptdir='$scriptdir'
25030 scriptdirexp='$scriptdirexp'
25031 sed='$sed'
25032 seedfunc='$seedfunc'
25033 selectminbits='$selectminbits'
25034 selecttype='$selecttype'
25035 sendmail='$sendmail'
25036 setgrent_r_proto='$setgrent_r_proto'
25037 sethostent_r_proto='$sethostent_r_proto'
25038 setlocale_r_proto='$setlocale_r_proto'
25039 setnetent_r_proto='$setnetent_r_proto'
25040 setprotoent_r_proto='$setprotoent_r_proto'
25041 setpwent_r_proto='$setpwent_r_proto'
25042 setservent_r_proto='$setservent_r_proto'
25043 sh='$sh'
25044 shar='$shar'
25045 sharpbang='$sharpbang'
25046 shmattype='$shmattype'
25047 shortsize='$shortsize'
25048 shrpenv='$shrpenv'
25049 shsharp='$shsharp'
25050 sig_count='$sig_count'
25051 sig_name='$sig_name'
25052 sig_name_init='$sig_name_init'
25053 sig_num='$sig_num'
25054 sig_num_init='$sig_num_init'
25055 sig_size='$sig_size'
25056 signal_t='$signal_t'
25057 sitearch='$sitearch'
25058 sitearchexp='$sitearchexp'
25059 sitebin='$sitebin'
25060 sitebinexp='$sitebinexp'
25061 sitehtml1dir='$sitehtml1dir'
25062 sitehtml1direxp='$sitehtml1direxp'
25063 sitehtml3dir='$sitehtml3dir'
25064 sitehtml3direxp='$sitehtml3direxp'
25065 sitelib='$sitelib'
25066 sitelib_stem='$sitelib_stem'
25067 sitelibexp='$sitelibexp'
25068 siteman1dir='$siteman1dir'
25069 siteman1direxp='$siteman1direxp'
25070 siteman3dir='$siteman3dir'
25071 siteman3direxp='$siteman3direxp'
25072 siteprefix='$siteprefix'
25073 siteprefixexp='$siteprefixexp'
25074 sitescript='$sitescript'
25075 sitescriptexp='$sitescriptexp'
25076 sizesize='$sizesize'
25077 sizetype='$sizetype'
25078 sleep='$sleep'
25079 smail='$smail'
25080 so='$so'
25081 sockethdr='$sockethdr'
25082 socketlib='$socketlib'
25083 socksizetype='$socksizetype'
25084 sort='$sort'
25085 spackage='$spackage'
25086 spitshell='$spitshell'
25087 srand48_r_proto='$srand48_r_proto'
25088 srandom_r_proto='$srandom_r_proto'
25089 src='$src'
25090 ssizetype='$ssizetype'
25091 st_ino_sign='$st_ino_sign'
25092 st_ino_size='$st_ino_size'
25093 startperl='$startperl'
25094 startsh='$startsh'
25095 static_ext='$static_ext'
25096 stdchar='$stdchar'
25097 stdio_base='$stdio_base'
25098 stdio_bufsiz='$stdio_bufsiz'
25099 stdio_cnt='$stdio_cnt'
25100 stdio_filbuf='$stdio_filbuf'
25101 stdio_ptr='$stdio_ptr'
25102 stdio_stream_array='$stdio_stream_array'
25103 strerror_r_proto='$strerror_r_proto'
25104 submit='$submit'
25105 subversion='$subversion'
25106 sysman='$sysman'
25107 sysroot='$sysroot'
25108 tail='$tail'
25109 tar='$tar'
25110 targetarch='$targetarch'
25111 targetdir='$targetdir'
25112 targetenv='$targetenv'
25113 targethost='$targethost'
25114 targetmkdir='$targetmkdir'
25115 targetport='$targetport'
25116 targetsh='$targetsh'
25117 tbl='$tbl'
25118 tee='$tee'
25119 test='$test'
25120 timeincl='$timeincl'
25121 timetype='$timetype'
25122 tmpnam_r_proto='$tmpnam_r_proto'
25123 to='$to'
25124 touch='$touch'
25125 tr='$tr'
25126 trnl='$trnl'
25127 troff='$troff'
25128 ttyname_r_proto='$ttyname_r_proto'
25129 u16size='$u16size'
25130 u16type='$u16type'
25131 u32size='$u32size'
25132 u32type='$u32type'
25133 u64size='$u64size'
25134 u64type='$u64type'
25135 u8size='$u8size'
25136 u8type='$u8type'
25137 uidformat='$uidformat'
25138 uidsign='$uidsign'
25139 uidsize='$uidsize'
25140 uidtype='$uidtype'
25141 uname='$uname'
25142 uniq='$uniq'
25143 uquadtype='$uquadtype'
25144 use64bitall='$use64bitall'
25145 use64bitint='$use64bitint'
25146 usecbacktrace='$usecbacktrace'
25147 usecrosscompile='$usecrosscompile'
25148 usedefaultstrict='$usedefaultstrict'
25149 usedevel='$usedevel'
25150 usedl='$usedl'
25151 usedtrace='$usedtrace'
25152 usefaststdio='$usefaststdio'
25153 useithreads='$useithreads'
25154 usekernprocpathname='$usekernprocpathname'
25155 uselanginfo='$uselanginfo'
25156 uselargefiles='$uselargefiles'
25157 uselongdouble='$uselongdouble'
25158 usemallocwrap='$usemallocwrap'
25159 usemorebits='$usemorebits'
25160 usemultiplicity='$usemultiplicity'
25161 usemymalloc='$usemymalloc'
25162 usenm='$usenm'
25163 usensgetexecutablepath='$usensgetexecutablepath'
25164 useopcode='$useopcode'
25165 useperlio='$useperlio'
25166 useposix='$useposix'
25167 usequadmath='$usequadmath'
25168 usereentrant='$usereentrant'
25169 userelocatableinc='$userelocatableinc'
25170 useshrplib='$useshrplib'
25171 usesitecustomize='$usesitecustomize'
25172 usesocks='$usesocks'
25173 usethreads='$usethreads'
25174 usevendorprefix='$usevendorprefix'
25175 useversionedarchname='$useversionedarchname'
25176 usevfork='$usevfork'
25177 usrinc='$usrinc'
25178 uuname='$uuname'
25179 uvXUformat='$uvXUformat'
25180 uvoformat='$uvoformat'
25181 uvsize='$uvsize'
25182 uvtype='$uvtype'
25183 uvuformat='$uvuformat'
25184 uvxformat='$uvxformat'
25185 vendorarch='$vendorarch'
25186 vendorarchexp='$vendorarchexp'
25187 vendorbin='$vendorbin'
25188 vendorbinexp='$vendorbinexp'
25189 vendorhtml1dir='$vendorhtml1dir'
25190 vendorhtml1direxp='$vendorhtml1direxp'
25191 vendorhtml3dir='$vendorhtml3dir'
25192 vendorhtml3direxp='$vendorhtml3direxp'
25193 vendorlib='$vendorlib'
25194 vendorlib_stem='$vendorlib_stem'
25195 vendorlibexp='$vendorlibexp'
25196 vendorman1dir='$vendorman1dir'
25197 vendorman1direxp='$vendorman1direxp'
25198 vendorman3dir='$vendorman3dir'
25199 vendorman3direxp='$vendorman3direxp'
25200 vendorprefix='$vendorprefix'
25201 vendorprefixexp='$vendorprefixexp'
25202 vendorscript='$vendorscript'
25203 vendorscriptexp='$vendorscriptexp'
25204 version='$version'
25205 version_patchlevel_string='$version_patchlevel_string'
25206 versiononly='$versiononly'
25207 vi='$vi'
25208 xlibpth='$xlibpth'
25209 yacc='$yacc'
25210 yaccflags='$yaccflags'
25211 zcat='$zcat'
25212 zip='$zip'
25213 EOT
25214
25215 : add special variables
25216 $test -f $src/patchlevel.h && \
25217 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
25218 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
25219 echo "PERL_CONFIG_SH=true" >>config.sh
25220
25221 : propagate old symbols
25222 if $test -f UU/config.sh; then
25223         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
25224         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
25225                 config.sh config.sh UU/oldconfig.sh |\
25226                 $sort | $uniq -u >UU/oldsyms
25227         set X `$cat UU/oldsyms`
25228         shift
25229         case $# in
25230         0) ;;
25231         *)
25232                 $cat <<EOM
25233 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
25234 EOM
25235                 echo ": Variables propagated from previous config.sh file." >>config.sh
25236                 for sym in `$cat UU/oldsyms`; do
25237                         echo "    Propagating $hint variable "'$'"$sym..."
25238                         eval 'tmp="$'"${sym}"'"'
25239                         echo "$tmp" | \
25240                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
25241                 done
25242                 ;;
25243         esac
25244 fi
25245
25246 : preserve RCS keywords in files with variable substitution, grrr
25247 Id='$Id'
25248
25249 : Finish up by extracting the .SH files
25250 case "$alldone" in
25251 exit)
25252         echo "Stopping at your request, leaving temporary files around."
25253         exit 0
25254         ;;
25255 cont)
25256         ;;
25257 '')
25258         dflt=''
25259         nostick=true
25260         $cat <<EOM
25261
25262 If you'd like to make any changes to the config.sh file before I begin
25263 to configure things, do it as a shell escape now (e.g. !vi config.sh).
25264
25265 EOM
25266         rp="Press return or use a shell escape to edit config.sh:"
25267         . UU/myread
25268         nostick=''
25269         case "$ans" in
25270         '') ;;
25271         *) : in case they cannot read
25272                 sh 1>&4 -c "$ans";;
25273         esac
25274         ;;
25275 esac
25276
25277 : if this fails, just run all the .SH files by hand
25278 . ./config.sh
25279
25280 echo " "
25281 exec 1>&4
25282 pwd=`pwd`
25283 . ./UU/extract
25284 cd "$pwd"
25285
25286 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
25287         dflt=y
25288         case "$silent" in
25289         true) ;;
25290         *)
25291                 $cat <<EOM
25292
25293 Now you need to generate make dependencies by running "$make depend".
25294 You might prefer to run it in background: "$make depend > makedepend.out &"
25295 It can take a while, so you might not want to run it right now.
25296
25297 EOM
25298                 ;;
25299         esac
25300         rp="Run $make depend now?"
25301         . UU/myread
25302         case "$ans" in
25303         y*)
25304                 $make depend && echo "Now you must run '$make'."
25305                 ;;
25306         *)
25307                 echo "You must run '$make depend' then '$make'."
25308                 ;;
25309         esac
25310 elif test -f [Mm]akefile; then
25311         echo " "
25312         echo "Now you must run a $make."
25313 else
25314         echo "Configure done."
25315 fi
25316
25317 if $test -f Policy.sh; then
25318     $cat <<EOM
25319
25320 If you compile $package on a different machine or from a different object
25321 directory, copy the Policy.sh file from this object directory to the
25322 new one before you run Configure -- this will help you with most of
25323 the policy defaults.
25324
25325 EOM
25326 fi
25327 if $test -f UU/config.msg; then
25328     echo "Hmm.  I also noted the following information while running:"
25329     echo " "
25330     $cat UU/config.msg >&4
25331 fi
25332 $rm -f kit*isdone ark*isdone
25333 $rm -rf UU
25334
25335 : End of Configure
25336